Variable use in column value
There are a lot of variables at your disposal. All variables that exist in Orders2CSVPRO are shown in the help section, and you can also use default Magento variables. The way that you indicate a variable, is by using the format shown below in code example.
{{variable_code}} | the format |
{{order_data_status}} | example, will print the status of the order |
The variables are divided up into different types. A general section which can be used in all types ofCSV’s.
And there a variables that can only be used in different types. There are groups of variables for invoice, shipment and credit memo, which can only be used in that CSV types.
Variables related to product are found under each type, and general variables that can be used in all type under Product and Product Bundle, which include variables related to the bundle group and the single items in the bundle.
Formatting variables
There are some standard formatting options available in the Orders2CSVPRO module. These formatting can be used on all variables, whether or not they are computed or single. The last tab in help pages, is a list of all the available formatting options.
You use formatting for a single variable on the way shown below here:
{{formatting variable_code}} | the format |
{{format_price order_data_subtotal}} | example, will print the subtotal of order with the correct currency formatting |
If you have inline code the formatting of that is as follows
##formatting the_code## | the format |
## format_price {{order_data_subtotal }}-{{order_data_discount}}## | example, will print the subtotal minus the discount with the correct currency formatting |
Coding inline in value field
With Orders2CSVPRO inline code you can make the export file very specialized. You can do everything from simple math stuff to very complex PHP code. I will give a short introduction to what you can do, but there is many more options to generate custom values. The format of inline coding in Orders2CSVPRO is as follows
## the_code## | the format |
##{order_data_subtotal }}-{{order_data_discount}}## | will print the subtotal minus the discount |
The above example is very simple, here we just take one value and subtracts another.
The power of this function is very massive, because you can use different types of PHP code directly in the value field. An example could be that you to print the a text and calculate the average item price, this can be done by below code:
You have ordered {{format_integer invoice_data_total_qty}} item with an average price of ##{{format_convert_price invoice_data_subtotal_incl_tax}}/{{format_integer invoice_data_total_qty}}##
Not all PHP function can be used. Example: if expression cannot be used, instead use the conditional operator ?: - the eval function is used in Orders2CSVPRO, you can read more about it on php.net
|
Be sure that you are signed up for ext4mage newsletter, because we will be sending out tips and examples of ways to use inline coding.
See more about the magento extension Orders2CSV PRO