Jump to content

Small issue with ordersummary.tpl's variable called $cycle.


-M-

Recommended Posts

Hi guys,

 

Quick question on ordersummary.tpl there is a variable called {$cycle}.

 

Here is the part of ordersummary.tpl with this variable:

 

       {foreach from=$producttotals.pricing.recurringexcltax key=cycle item=recurring}
           <div class="clearfix">
               <span class="pull-left">{$cycle}:</span>
               <span class="pull-right">{$recurring}</span>
           </div>
       {/foreach}

 

I think this variable is linked somehow to:

 

$_LANG['orderpaymenttermannually'] = "xx";
$_LANG['orderpaymenttermbiennially'] = "xx";
$_LANG['orderpaymenttermfreeaccount'] = "xx";
$_LANG['orderpaymenttermmonthly'] = "xx";
$_LANG['orderpaymenttermonetime'] = "xx";
$_LANG['orderpaymenttermquarterly'] = "xx";
$_LANG['orderpaymenttermsemiannually'] = "xx";

 

Now the "problem" is that if I change the translation in dutch.php it will change them for all other values as well which are linked to the above.

 

Now I just want to change translation for just that page into something else, without changing it for other pages / templates as well. In other words, I want to assign the ordersummary.tpl it's own language changes for that part.

 

Something like the following (but then for ordersummary.tpl):

 

{if $product.pricing.minprice.cycle eq "monthly"}
{$LANG.orderpaymenttermmonthlyalternative}
{elseif $product.pricing.minprice.cycle eq "quarterly"}
{$LANG.orderpaymenttermquarterlyalternative}
{elseif $product.pricing.minprice.cycle eq "semiannually"}
{$LANG.orderpaymenttermsemiannuallyalternative}
{elseif $product.pricing.minprice.cycle eq "annually"}
{$LANG.orderpaymenttermannuallyalternative}
{elseif $product.pricing.minprice.cycle eq "biennially"}
{$LANG.orderpaymenttermbienniallyalternative}
{elseif $product.pricing.minprice.cycle eq "triennially"}
{$LANG.orderpaymenttermtrienniallyalternative}
{/if}

 

(please take notice of "alternative"-part)

 

Obviously, the above isn't correct, but just an example of what I am trying to achieve, so I can use different names on ordersummary.tpl in comparism to other pages.

 

Can someone give me a partial example or point me in the right direction?

 

Thank you!

Link to comment
Share on other sites

you'll need to do this in two ways... firstly, using Language Overrides to create your alternative translations.

 

http://docs.whmcs.com/Language_Overrides

 

the documentation explains what to do in more detail - but, in brief, you create a folder within the 'lang' directory, call it "overrides" - inside the folder, you create a file for each language you need to add overrides for - if your site only uses Dutch, then you only need to add 'dutch.php'; if you use other languages, you'll need to add them too.

 

btw - you never edit the original language files - they will get replaced when updating WHMCS, these new overrides will not.

 

inside dutch.php, add the following...

 

<?php
$_LANG['altpaymentcycleannually'] = "Annually (Alt)";
$_LANG['altpaymentcyclebiennially'] = "Biennially (Alt)";
$_LANG['altpaymentcycletriennially'] = "Triennially (Alt)";
$_LANG['altpaymentcyclefreeaccount'] = "Free (Alt)";
$_LANG['altpaymentcyclemonthly'] = "Monthly (Alt)";
$_LANG['altpaymentcycleonetime'] = "One-Time (Alt)";
$_LANG['altpaymentcyclequarterly'] = "Quarterly (Alt)";
$_LANG['altpaymentcyclesemi-annually'] = "Semi-Annually (Alt)";

obviously, put your dutch terms inside the quotes! :)

 

and then in ordersummary.tpl, you can do this...

 

        {foreach from=$producttotals.pricing.recurringexcltax key=cycle item=recurring}
           <div class="clearfix">
               {$altpaymentcycle = "altpaymentcycle{$cycle|strtolower}"}  
               <span class="pull-left">{$LANG.{$altpaymentcycle}}:</span>
               <span class="pull-right">{$recurring}</span>
           </div>
       {/foreach}

you could use an {if} statement for every cycle and display an alternative term for each one - but the above is a quick way to do it using existing Smarty variables. :idea:

Link to comment
Share on other sites

Thanks Brian,

 

I was already using the overrides function for Dutch (have over 240 lines atm). :oops:

 

Anyways, I added your language examples also to it and edited ordersummary.tpl.

But I don't think it's correct; the only result I am getting back, or better said, being displayed is ':'

No tranlastion or anything? Just the ':'

 

Any ideas?

 

Thanks.

Link to comment
Share on other sites

Anyways, I added your language examples also to it and edited ordersummary.tpl.

But I don't think it's correct; the only result I am getting back, or better said, being displayed is ':'

No tranlastion or anything? Just the ':'

 

Any ideas?

yes - i'm an idiot! :roll:

 

the testing on the above code was so poor and incomplete, i'm now qualified to work for WHMCS Quality Assurance Division - but i'm not even sure it has one! :lol:

 

the mistake I made was to test it in English, and assume that the $cycle values were always in English - a basic mistake! :oops:

 

so the Smarty code is correct, but it's the dutch overrides that will be wrong... e.g for Monthly and Quarterly cycles, use these...

 

$_LANG['altpaymentcyclemaandelijks'] = "Monthly (Alt)";
$_LANG['altpaymentcycleper kwartaal'] = "Quarterly (Alt)";

and then adjust your other entries and replace the English cycle term with its dutch equivalent.

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