Jump to content

Defaulting to Annual Billing Cycle


Recommended Posts

How do I set the order configuration page to default to annual billing? I changed the order of the items in the list, but it still defaults to monthly billing.

 

Please see screenshot.

 

Thanks,

 

Brandon

 

Here is the code I changed to change the order, but it still defaults to monthly:

 

{if $pricing.type eq "recurring"}

<div class="field-container">

<div class="form-group">

<label for="inputBillingcycle">{$LANG.cartchoosecycle}</label>

<select name="billingcycle" id="inputBillingcycle" class="form-control select-inline" onchange="{if $configurableoptions}updateConfigurableOptions({$i}, this.value);{else}recalctotals();{/if}">

{if $pricing.annually}

<option value="annually"{if $billingcycle eq "annually"} selected{/if}>

{$pricing.annually}

</option>

{/if}

{if $pricing.monthly}

<option value="monthly"{if $billingcycle eq "monthly"} selected{/if}>

{$pricing.monthly}

</option>

{/if}

{if $pricing.quarterly}

<option value="quarterly"{if $billingcycle eq "quarterly"} selected{/if}>

{$pricing.quarterly}

</option>

{/if}

{if $pricing.semiannually}

<option value="semiannually"{if $billingcycle eq "semiannually"} selected{/if}>

{$pricing.semiannually}

</option>

{/if}

{if $pricing.biennially}

<option value="biennially"{if $billingcycle eq "biennially"} selected{/if}>

{$pricing.biennially}

</option>

{/if}

{if $pricing.triennially}

<option value="triennially"{if $billingcycle eq "triennially"} selected{/if}>

{$pricing.triennially}

</option>

{/if}

</select>

</div>

</div>

{/if}

Link to comment
Share on other sites

the problem you have is that I think {$billingcycle} is always set to be the lowest cycle for which there is a price - and so changing the order of the {if} statements wouldn't have any effect on that.

there are a number of ways to do what you want to achieve - including passing the cycle in the URL if you are linking directly to it.

but if you want to edit the template to do it, just add the following code towards the top(after the include) of configureproduct.tpl...

 

{if $pricing.annually}{assign 'billingcycle' 'annually'}{/if}

if you do that, then it will default to annually if there is an annual price for the product; if there isn't, it won't change $billingcycle and it will continue to use the lowest cycle. :idea:

Link to comment
Share on other sites

  • 3 months later...

you could modify pure_comparison/products.tpl and change...

 

{$product.pricing.minprice.cycleText}

to...

 

{if $product.pricing.annually}<span>{$currency.prefix}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"}{$currency.suffix}</span>/mo{else}{$product.pricing.minprice.cycleText}{/if}

if a product has an annual price, the above code should show it's monthly breakdown price (e.g annual price divided by 12) instead; if the product isn't priced annually, then WHMCS will output as normal. :idea:

Link to comment
Share on other sites

Hi Anders,

 

it's taking the information from your currency settings - some currencies use prefix (before the amount) e.g $ - some use suffix (after the amount) USD - and some use both.

 

if you want to remove the prefix (the € symbol) remove {$currency.prefix} from the code; to remove 'EUR', delete {$currency.suffix} from the code.

Link to comment
Share on other sites

Hi Brian,

 

you are correct but just to be a litltebit peti as i am using swedish and euro currency. the right way is € sign on left side and swedish on the right.

 

so if i remove right code then swedish will not show up and if i remove left then the € sign is not showing correct.

i have removed left so it showing swedish and euro ont right side and that fine for me.

 

and super thx for your help :)

 

Warm regards Anders

Link to comment
Share on other sites

checking the normal output again, it doesn't seem to use suffix by default - so you could do this...

 

{if $product.pricing.annually}<span>{if $currency.prefix eq '€'}{$currency.prefix}{/if}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"}{if $currency.suffix eq 'SEK'}{$currency.suffix}{/if}</span>/mo{else}{$product.pricing.minprice.cycleText}{/if}

that would show the Euro sign on the left for EUR Pricing, and SEK on the right for Swedish pricing - the rules could be expanded for other currencies if required. :idea:

Link to comment
Share on other sites

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