Jump to content

defince a variable ?


rugg

Recommended Posts

Hello,

 

on my invoice,

 

i need to get a value "{$invoice_total}+20",

 

by the way,

 

i need to define a variable like {$money55555555}={$invoice_total}+20,

 

can you please tell me how to do it ?

 

 

thank you

Link to comment
Share on other sites

i would prefer the PHP variant:

 

old output: {$invoice_total}<br />

{php}
$itotal = $this->get_template_vars('invoice_total');
$itotal = $itotal + 20; // better (int)$itotal + 20;
$this->assign('awesomenewsmartyvar', $itotal);
{/php}

new output: {$awesomenewsmartyvar}

 

this should work as long as $invoice_total is a numeric string. if not try preg_match()

Link to comment
Share on other sites

The code shows how you can change a SMARTY var technically.

 

Anyway manipulating an invoice sum is bungling!

For pre changing your invoice i recommend using the hook "UpdateInvoiceTotal" or "AfterShoppingCartCheckout.

 

For visible-only changes in cart and invoice you have to change the tpl viewcart.tpl and viewinvoice.tpl. But that is crap.

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