Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleAttribute Value Condition example
// if product price is lower than 20 then use product price as the final price increased by 25% , if product price is lower than 40 and higher than 20 then use product price as the final price increased by 15%, otherwise use product price as the final price

[[({{price_final_include_tax}} < 20) ? {{price_final_include_tax}}*1.25 : ({{price_final_include_tax}} < 40) ? {{price_final_include_tax}}*1.15 : {{price_final_include_tax}}]]

...


PHP functions and conditions

You can use various JavaScript PHP math functions or String functions

Code Block
titleExample
//Export sku only if it is longer than 6 characters, otherwise export empty string
[[ strlen('{{sku}}'.length) > 6 ? '{{sku}}': '']]

Timestamp settings (Facebook channel)

...

You can do it be setting 2 conditions. 

 


Code Block
//For "g:sale_price_effective_date FROM" attribute
[[ ("{{special_from_date}}" != "")? "{{special_from_date}}T00:01-0100":"" ]]
 
//For "g:sale_price_effective_date TO" attribute
[[ ("{{special_to_date}}" != "")? "{{special_to_date}}T23:59-0100":"" ]]

...

 




Store Attributes 

You can combine various Store attributes to export required results.

...

Code Block
titleShipping cost (weight) example
// if products weight is higher than 100 then increase shipping cost by 10, else export base shipping cost
[[{{weight}} > 100) ? {{shipping_cost}} : {{shipping_cost}} + 10]]

Price rounding -

...

Ceil, Floor, Round

Code Block
titlePrice rounding
// increase price by 20% and round the result to the nearest integer
[[Math.roundceil({{price_final_include_tax}} * 1.2)]]

...


Special KAAS functions for export

we created special functions for kaas specific purpose

  1. compNotEmptyFromList( 1:N params)
    • returns first not empty parameter from list of attributes
    • example: compNotEmptyFromList( '{{tags}}', '{{name}}', 'default value')

  2. compMultiConditions( cond1, value1, cond2, value2, ..., condN, valueN, default)

    • returns first value after first TRUE condition
    • example: compMultiConditions( '{{sku}}' == 'foo', {{price}}, strpos( '{{sku}}', 'bar') !== false, {{name}}, 'default value')

  3. compConcatMultiConditions( glue, cond1, value1, cond2, value2, ..., condN, valueN, default)

    • returns all values with TRUE condition concatenated by glue
    • example: compConcatMultiConditions( ' ', '{{sku}}' == 'foo', {{price}}, strpos( '{{sku}}', 'bar') !== false, {{name}}, 'default value')