Jump to content
brandonfire

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}

Share this post


Link to post
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:

Share this post


Link to post
Share on other sites

Wow Brian you are the best :)

 

i am using six theme with pure_comparison, in the cart its showing monthly price as default. is iit possible to show the Annual monthly breakdown price as default?

 

if yes could you show me.

 

warm regards Birken

Share this post


Link to post
Share on other sites

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:

Share this post


Link to post
Share on other sites

oh my god that is fantastic fast response Brian!,

 

it works fine just one little thing if i change to Euro currency it add the prefix twice like this. € 19.00 EUR

 

any ideas why?

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines