Community Forums

Discuss, share and get help from our community of friendly WHMCS users

Close
Login to Your Account
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2016
    Posts
    42

    Default How to modify the Recurring Billing Cycle text

    Hello,

    I find this post very interesting, I would like to post on the previous link but this is no longer possible in the messure or it is considered too old of 180 days.

    I wondered if it was possible to calculate the percentage reduction.

    thank you in advance

    Best regards

  2. #2
    Join Date
    Feb 2013
    Location
    UK
    Posts
    6,101

    Default Re: How to modify the Recurring Billing Cycle text

    i've done this... can't remember if i've posted previously (if so, I can't find it), so assume it was a paying client...

    the maths part is...

    PHP Code:
    {* Calculate the cycle savings *} 
    {if ((
    $pricing.minprice.cycle eq "monthly") or ($pricing.minprice.cycle  eq "1month"))} 
        {
    assign qsaving '0'}{math assign="qsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.monthly b=3  c=$pricing.rawpricing.quarterly d=100 format="%.0f"
        {
    assign ssaving '0'}{math assign="ssaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.monthly b=6  c=$pricing.rawpricing.semiannually d=100 format="%.0f"
        {
    assign asaving '0'}{math assign="asaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.monthly b=12  c=$pricing.rawpricing.annually d=100 format="%.0f"
        {
    assign bsaving '0'}{math assign="bsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.monthly b=24  c=$pricing.rawpricing.biennially d=100 format="%.0f"
        {
    assign tsaving '0'}{math assign="tsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.monthly b=36  c=$pricing.rawpricing.triennially d=100 format="%.0f"
    {elseif ((
    $pricing.minprice.cycle eq "quarterly") or  ($pricing.minprice.cycle eq "3month"))} 
        {
    assign ssaving '0'}{math assign="ssaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.quarterly b=2  c=$pricing.rawpricing.semiannually d=100 format="%.0f"
        {
    assign asaving '0'}{math assign="asaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.quarterly b=4  c=$pricing.rawpricing.annually d=100 format="%.0f"
        {
    assign bsaving '0'}{math assign="bsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.quarterly b=8  c=$pricing.rawpricing.biennially d=100 format="%.0f"
        {
    assign tsaving '0'}{math assign="tsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.quarterly b=12  c=$pricing.rawpricing.triennially d=100 format="%.0f"
    {elseif ((
    $pricing.minprice.cycle eq "semiannually") or  ($pricing.minprice.cycle eq "6month"))} 
        {
    assign asaving '0'}{math assign="asaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.semiannually b=2  c=$pricing.rawpricing.annually d=100 format="%.0f"
        {
    assign bsaving '0'}{math assign="bsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.semiannually b=4  c=$pricing.rawpricing.biennially d=100 format="%.0f"
        {
    assign tsaving '0'}{math assign="tsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.semiannually b=8  c=$pricing.rawpricing.triennially d=100 format="%.0f"
    {elseif ((
    $pricing.minprice.cycle eq "annually") or  ($pricing.minprice.cycle eq "12month"))} 
        {
    assign bsaving '0'}{math assign="bsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.annually b=2  c=$pricing.rawpricing.biennially d=100 format="%.0f"
        {
    assign tsaving '0'}{math assign="tsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.annually b=3  c=$pricing.rawpricing.triennially d=100 format="%.0f"
    {elseif ((
    $pricing.minprice.cycle eq "biennially") or  ($pricing.minprice.cycle eq "24month"))} 
        {
    assign tsaving '0'}{math assign="tsaving" equation="((((a * b) - c) /  c) * d)" a=$pricing.rawpricing.biennially b=1.5  c=$pricing.rawpricing.triennially d=100 format="%.0f"
    {/if} 
    and then the recurring pricing dropdown becomes...

    PHP Code:
                            {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.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} {if $qsaving gt 2}(-{$qsaving}%){/if}
                                                </
    option>
                                            {/if}
                                            {if 
    $pricing.semiannually}
                                                <
    option value="semiannually"{if $billingcycle eq "semiannually"selected{/if}>
                                                    {
    $pricing.semiannually} {if $ssaving gt 2}(-{$ssaving}%){/if}
                                                </
    option>
                                            {/if}
                                            {if 
    $pricing.annually}
                                                <
    option value="annually"{if $billingcycle eq "annually"selected{/if}>
                                                    {
    $pricing.annually} {if $asaving gt 2}(-{$asaving}%){/if}
                                                </
    option>
                                            {/if}
                                            {if 
    $pricing.biennially}
                                                <
    option value="biennially"{if $billingcycle eq "biennially"selected{/if}>
                                                    {
    $pricing.biennially} {if $bsaving gt 2}(-{$bsaving}%){/if}
                                                </
    option>
                                            {/if}
                                            {if 
    $pricing.triennially}
                                                <
    option value="triennially"{if $billingcycle eq "triennially"selected{/if}>
                                                    {
    $pricing.triennially} {if $tsaving gt 2}(-{$tsaving}%){/if}
                                                </
    option>
                                            {/if}
                                        </
    select>
                                    </
    div>
                                </
    div>
                            {/if} 
    I think when I did this for the client, it was for v7.1.1 and they didn't require any additional language strings adding (though you could add one for 'Save" or "Off" etc and add it to the dropdown text... but fundamentally the math part won't change with future versions, the output might.



    the client only wanted a saving shown if it was over 2% (that's what the {if x gt 2} line is for - if you don't want that, then you can remove it... also, to keep the formula simple(!), I didn't include setup fees (the client didn't use them).

Similar Threads

  1. Billing cycle text change V.7.0.1
    By jamespierre in forum Developer Corner
    Replies: 0
    Last Post: 11-30-16, 05:42 AM
  2. Tutorial: How to modify the Recurring Billing Cycle text.
    By brian! in forum Third Party Add-ons
    Replies: 24
    Last Post: 01-08-16, 02:58 PM
  3. Changing Billing Cycle text
    By hfgameservers.com in forum Service Offers & Requests
    Replies: 1
    Last Post: 11-23-13, 12:28 AM
  4. Billing Cycle Text
    By dr00t in forum Developer Corner
    Replies: 8
    Last Post: 06-30-10, 11:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •