rugg Posted March 4, 2010 Share Posted March 4, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
HerrZ Posted March 4, 2010 Share Posted March 4, 2010 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() 0 Quote Link to comment Share on other sites More sharing options...
rugg Posted March 4, 2010 Author Share Posted March 4, 2010 Hello, should i put this code into which page to make it work ? thank you 0 Quote Link to comment Share on other sites More sharing options...
HerrZ Posted March 4, 2010 Share Posted March 4, 2010 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. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted March 4, 2010 Share Posted March 4, 2010 You can use smarty {math equation="x + y" x=$invoice_total y=20 assign=money55555555}then use that new variable like normal{$money55555555} 0 Quote Link to comment Share on other sites More sharing options...
HerrZ Posted March 5, 2010 Share Posted March 5, 2010 Thanks sparky, I did not know yet. 0 Quote Link to comment Share on other sites More sharing options...
rugg Posted March 9, 2010 Author Share Posted March 9, 2010 You can use smartythen use that new variable like normal sparky,can i ask more details about which files i should edit ? 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.