Jump to content

Hide gateways when cart total is Free


Alcedema

Recommended Posts

This is an easy way of hiding the gateway list (not removing - as it is needed) when everything in the cart is Free.

 

In viewcart.tpl change (around line 362):

 

  <p class="heading2">{$LANG.orderpaymentmethod}</p>
 <p align="center">{foreach key=num item=gateway from=$gateways}
   <input type="radio" name="paymentmethod" value="{$gateway.sysname}" id="pgbtn{$num}"{if $selectedgateway eq $gateway.sysname} checked="checked"{/if} />
   <label for="pgbtn{$num}" style="margin-right: 10px;">{$gateway.name}</label>
   {/foreach}</p>

 

to:

 

{if substr($total, 2, 4) == '0.00'}<div style="display: none">{/if}
 <p class="heading2">{$LANG.orderpaymentmethod}</p>
 <p align="center">{foreach key=num item=gateway from=$gateways}
   <input type="radio" name="paymentmethod" value="{$gateway.sysname}" id="pgbtn{$num}"{if $selectedgateway eq $gateway.sysname} checked="checked"{/if} />
   <label for="pgbtn{$num}" style="margin-right: 10px;">{$gateway.name}</label>
   {/foreach}</p>
 {if substr($total, 2, 4) == '0.00'}</div>{/if}

 

This hides the list, as per WHMCS' requirement, an order has to have a payment/transaction associated with it. This way, your default gateway is used and should go straight to the order confirmation page.

Link to comment
Share on other sites

You can also use the following if statement to make your own hidden input for using only one certain gateway; ie

 

{if substr($total, 2, 4) == '0.00'}
<input type="hidden" name="paymentmethod" value="payflowpro" />
{else}
.. normal gateway selection ..
{/if}

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 months later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated