0

I'm working on a digital downloads site that has free and paid downloads.

When only free items are in the cart at checkout, I want to use the ct_offline_payments gateway without cc data, but for some reason cartthrob is not loading the offline payments gateway called within the conditional, and is loading the default gateway (moneris_direct).

The transaction fails due to missing cc data.

Here is my code.

{if "{exp:cartthrob:cart_total}" > 0}

{exp:cartthrob:checkout_form id="gateway" secure_action="yes" gateway="moneris_direct" return="{template_group}/order_complete"}

{gateway_fields}

<fieldset class="promo" id="promo">
<p><label for="coupon_code">Enter Promo Code</label>
<input type="text" value="" id="coupon_code" name="coupon_code" /></p>
</fieldset>

<fieldset class="payment" id="payment">
<img id="payment_cards" src="/assets/images/payment_cards.jpg" width="171" height="22" alt="Visa, Mastercard, American Express, Diners Club" align="right" /><legend>Payment Info</legend>
  <p class="required">* All Fields Required</p>

    <p><label for="credit_card_number"><span class="required">*</span> Credit Card Number</label>
    <input type="text" name="credit_card_number" value="" id="credit_card_number" class="required" /></p>

    <img src="/assets/images/RapidSSL_SEAL-90x50.gif" width="90" height="50" alt="Secured with RapidSSL" align="right" />
    <p><label for="CVV2"><span class="required">*</span> Card Security Code</label>
    <input type="text" name="CVV2" value="" id="CVV2" /></p>

    <p><label for="expiration_month"><span class="required">*</span> Expiration Month</label>
    <select name="expiration_month" id="expiration_month">
        <option value="11">November</option>
    </select></p>

    <p><label for="expiration_year"><span class="required">*</span> Expiration Year</label>
    <select name="expiration_year" id="expiration_year">
        <option value="2014">2014</option>
    </select></p>

</fieldset>

<input type="hidden" value="{clear_coupon_codes}">
<input type="submit" value="Complete Purchase">

{/exp:cartthrob:checkout_form}

{if:else}

{exp:cartthrob:checkout_form id="gateway" gateway="ct_offline_payments" return="{template_group}/order_complete"}

{gateway_fields}

<input type="hidden" value="{clear_coupon_codes}">
<input type="submit" value="Download">

{/exp:cartthrob:checkout_form}

{/if}

I have recently upgraded cartthrob to 2.6.1 from 2.05x, so it may be a syntax issue.

I have made sure it's not a (strict) conditionals issue with EE 2.9.x.

Any thoughts, or example working code to share?

Thanks very much for reading.

0

I am working on a very similar case atm. I think I have just found the solution:

Use {if '{exp:cartthrob:cart_total prefix=""}' > 0}

instead of: {if "{exp:cartthrob:cart_total}" > 0}

Check out this reply in the CT forums for further reference.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.