Chad Posted March 11, 2017 Share Posted March 11, 2017 (edited) Hello, Trying to accomplish this conditional in the "Total Due Today" section (/cart.php?a=confproduct&i=1) Assuming the chosen monthly cycle, display a message using an if conditional with the actual date range being invoiced for. Apply this only to select product group #7. Would appreciate help on this. I'm referring to ordersummary.tpl file. Edited March 11, 2017 by Chad 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 12, 2017 Share Posted March 12, 2017 in ordersummary.tpl, you could add this... {if $producttotals.productinfo.gid eq "7"}{$smarty.now|date_format:"%d/%m/%Y"} - {"+{if $producttotals.billingcycle eq "monthly"}1 month{elseif $producttotals.billingcycle eq "quarterly"}3 months{elseif $producttotals.billingcycle eq "semiannually"}6 months{elseif $producttotals.billingcycle eq "annually"}1 year{elseif $producttotals.billingcycle eq "biennially"}2 years{elseif $producttotals.billingcycle eq "triennially"}3 years{/if} -1 day"|date_format:"%d/%m/%Y"}{/if} you may need to adjust your date format to suit your site, e.g the above is for d/m/y. if you wanted to follow this through to viewcart.tpl and display it for the product there, you could use... {if $product.productinfo.gid eq "7"}{$smarty.now|date_format:"%d/%m/%Y"} - {"+{if $product.billingcycle eq "monthly"}1 month{elseif $product.billingcycle eq "quarterly"}3 months{elseif $product.billingcycle eq "semiannually"}6 months{elseif $product.billingcycle eq "annually"}1 year{elseif $product.billingcycle eq "biennially"}2 years{elseif $product.billingcycle eq "triennially"}3 years{/if} -1 day"|date_format:"%d/%m/%Y"}{/if} and if you wanted to use it for domains, the coding becomes slightly easier on the one hand, but more complicated on the other... {$smarty.now|date_format:"%d/%m/%Y"} - {"+{$domain.regperiod} years -1 day"|date_format:"%d/%m/%Y"} the problem with standard_cart, is that the multiple years dropdown is linked to jquery... therefore, when adjusting the registration period, it won't automatically adjust the date range - unless you modified the .js to output them... but you didn't ask about domains, so let's not go down that bumpy road. 0 Quote Link to comment Share on other sites More sharing options...
Chad Posted March 15, 2017 Author Share Posted March 15, 2017 in ordersummary.tpl, you could add this... {if $producttotals.productinfo.gid eq "7"}{$smarty.now|date_format:"%d/%m/%Y"} - {"+{if $producttotals.billingcycle eq "monthly"}1 month{elseif $producttotals.billingcycle eq "quarterly"}3 months{elseif $producttotals.billingcycle eq "semiannually"}6 months{elseif $producttotals.billingcycle eq "annually"}1 year{elseif $producttotals.billingcycle eq "biennially"}2 years{elseif $producttotals.billingcycle eq "triennially"}3 years{/if} -1 day"|date_format:"%d/%m/%Y"}{/if} Thanks, but this doesn't work. It doesn't properly show the invoiced pro-rated date, which should be remainder of the month starting today, plus April for example, Instead, it shows just a full 30 days ahead. I used this code: {if $producttotals.productinfo.gid eq "7"} <br /> Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {"+{if $producttotals.billingcycle eq "monthly"}1 month{elseif $producttotals.billingcycle eq "quarterly"}3 months{elseif $producttotals.billingcycle eq "semiannually"}6 months{elseif $producttotals.billingcycle eq "annually"}1 year{elseif $producttotals.billingcycle eq "biennially"}2 years{elseif $producttotals.billingcycle eq "triennially"}3 years{/if} -1 day"|date_format:"%m/%d/%Y"} {/if} 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 15, 2017 Share Posted March 15, 2017 Thanks, but this doesn't work. It doesn't properly show the invoiced pro-rated date, which should be remainder of the month starting today, plus April for example, Instead, it shows just a full 30 days ahead. it works fine - except at no stage in your original question, did you mention about using pro-rata - my telepathic skills are not what they used to be, so you at least have to give me a small clue as to your intentions. would this work for you? {if $producttotals.productinfo.gid eq "7"}<br />Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {$producttotals.proratadate}{/if} 0 Quote Link to comment Share on other sites More sharing options...
Chad Posted March 15, 2017 Author Share Posted March 15, 2017 Thank you, that works partially I think. It shows: Initial Invoice Pro-rated: 03/15/2017 - 05/01/2017 It should be the last day of the 2nd month, in this case April 30th, 2017. Why does it show May 1st instead? Also, considering this applies to product group 7 strictly, how do I apply a slightly modified output for other product groups Would it be something like the below? Simply stack them? <span><span style="color: #ff6161; font-weight: 800; line-height: 32px">{$LANG.ordertotalduetoday}</span> {if $producttotals.productinfo.gid eq "7"}<br />Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {$producttotals.proratadate}{/if} {if $producttotals.productinfo.gid eq "2"}<br />Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {$producttotals.proratadate}{/if} {if $producttotals.productinfo.gid eq "3"}<br />Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {$producttotals.proratadate}{/if} </td> 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 15, 2017 Share Posted March 15, 2017 Thank you, that works partially I think. It shows: Initial Invoice Pro-rated: 03/15/2017 - 05/01/2017 It should be the last day of the 2nd month, in this case April 30th, 2017. Why does it show May 1st instead? perhaps because I forgot to subtract a day.... {if $producttotals.productinfo.gid eq "7"}<br />{math equation="x - y" x=$producttotals.proratadate|strtotime y=86000 assign="prorata_date"}Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {$prorata_date|date_format:"%m/%d/%Y"}{/if} Also, considering this applies to product group 7 strictly, how do I apply a slightly modified output for other product groups Would it be something like the below? Simply stack them? depends exactly what you want to change and how different each condition is going to be, but one option would be... <span><span style="color: #ff6161; font-weight: 800; line-height: 32px">{$LANG.ordertotalduetoday}</span>{math equation="x - y" x=$producttotals.proratadate|strtotime y=86000 assign="prorata_date"} {if $producttotals.productinfo.gid eq "7"}<br />Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {$prorata_date|date_format:"%m/%d/%Y"} {elseif $producttotals.productinfo.gid eq "2"}<br />Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {$prorata_date|date_format:"%m/%d/%Y"} {elseif $producttotals.productinfo.gid eq "3"}<br />Initial Invoice Pro-rated: {$smarty.now|date_format:"%m/%d/%Y"} - {$prorata_date|date_format:"%m/%d/%Y"}{/if} </td> 0 Quote Link to comment Share on other sites More sharing options...
Chad Posted March 15, 2017 Author Share Posted March 15, 2017 Perfect that works, thank you! 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.