Jump to content

Custom Variables for Groups


Chad

Recommended Posts

Hello,

 

Trying to accomplish this conditional in the "Total Due Today" section (/cart.php?a=confproduct&i=1)

 

  1. Assuming the chosen monthly cycle, display a message using an if conditional with the actual date range being invoiced for.
  2. Apply this only to select product group #7.

 

Would appreciate help on this. I'm referring to ordersummary.tpl file.

Edited by Chad
Link to comment
Share on other sites

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.

tFjXBb8.png

 

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... :roll:

 

{$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. :idea:

 

AsYUmID.png

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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>

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