sebsimappus Posted April 19, 2017 Share Posted April 19, 2017 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 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 20, 2017 Share Posted April 20, 2017 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... {* 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... {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). 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.