New Var As Order Total At Invoice

New php function needed for process {$order_info.total} value. cs-cart v4.2.4





at invoice, another smarty value needed. {$NewVar}





for example

other total = 2 x {$order_info.total}



order total 100 , other total 200



how can I add this php function and new vars at invoice?



could you help me for simple php function for process {$order_info.total} value.

at fn.cart php ? or anohter php file?





in fact, real function should complex. But mechanism, method needed.







My php and smarty knowledge as zero. one :)

Thanks for your help.

Hi



May I ask why do you want to do this ?

You need to make an add-on or to use my_change add-on to use some hook in the order invoice template.

You can find more details in cs-cart documentation on how to use hooks and how to write an add-on.

Add-on Development — CS-Cart 4.2.x documentation



If you just need to display a new calculated value I think the hook use in my_change add-on is enough for your project.



design/themes/YOURTHEME/mail/templates/invoice.tpl >> find the hook you want to use in this template.

Actually you just have to do come calculation to display your new value like this $new_value = $x * $order_info.total but put this in a hook even if this is better to do this in the controller.



You could use the orders:totals hook.



Have fun !

This for writing total value as text. For invoice paper printing.

for example total usd100$. New var is “hundred dollars” as string.

I have some php functions for generating this string.



my_changes add-on may suitable ? inserted php functions can process $order_info.total ?

The best way is to


  • use the My changes add-on to define your PHP function
  • use the orders:totals to add additional line to the invoice
  • your custom function can be called in the following way in the template



{$order_info.total|my_custom_php_function_name}

how can use this on html template ?

how can use this on html template ?

Please clarify your question

its work via old system on .tpl

now new method (DB templates )doesnt accept smarty tags

Thank you for the answer. In this case you should extend the list of order variables to add your custom variable

app/Tygh/Template/Document/Order/Variables/OrderVariable.php

Thank you for the answer. In this case you should extend the list of order variables to add your custom variable

app/Tygh/Template/Document/Order/Variables/OrderVariable.php

I.e. it's a royal pain in the arse to do a simple thing like add to the order_info data that is used in the new email editor....

I.e. it's a royal pain in the arse to do a simple thing like add to the order_info data that is used in the new email editor....

Agree, in my opinion the whole order_info array should be available by default

i did via this documents

http://docs.cs-cart.com/4.3.x/developer_guide/core/documents/documents.html

but its not easy way.

Agree, in my opinion the whole order_info array should be available by default

Amen.