The variables in rules

The variables in rules

Variables in the rules
In formula type fields, you can use any value from the product sheet field by indicating its name surrounded by braces {}. example {wholesale_price}, {wheigt}, {fixed_price} etc….

NB, if you want to use a "characteristic" from the product sheet, you must first check that this characteristic is correctly selected in the characteristics to be exported (see the main configuration screen of SmartPrice)

Example of mixed formula, formula and field:

We want to create a maximum price rule that would correspond to twice the price of the website excluding tax. We must therefore create a maximum price limit rule, choose the “value” method and formulate the price field multiplied by 2: {price} * 2
We also have internal variables in SmartPrice:

{rule.cost} = Result of the product purchase cost type rule applied to the offer
{rule.cost_shipping} = Result of the shipping cost type rule applied to the offer
{rule.additional_cost} = Result of the additional cost rule applied to the offer
{rule.tax_rate = Value of the TAX type rule applied to the offer in%. (will not give the result of the rule but the percentage applied. for example for a VAT rule of 20% the variable will result in 20.)
{rule.margin} = Value of the minimum margin type rule applied to the offer in%.
{rule.commission} = Value in the commission type rule applied to the offer in%.
{rule.final_price} = Target price calculated by SmartPrice, after possible deduction of the “Shipping costs” rule
Example of formula with internal SmartPrice variables:

We want to create a maximum price rule that would correspond to 2 times the price of the website including VAT. We must therefore create a maximum price limit rule, fall under the “value” method and formulate the price field in inclusive of VAT multiplied by 2. The value of the Prestashop “Price” field is generally exclusive of tax, therefore it must be converted into TTC. If we have a fixed VAT rate for all products and all distribution channels, we can then multiply the Price field by 1.20 if the VAT rate is 20% but we can also recover the VAT rate automatically according to tax rules configured and using the {rule.tax_rate} variable the formula will therefore be:

({price} * (1 + ({rule.tax_rate} / 100)) * 2)
Special formulas:

“If… then… else”

A particular formula exists to use a field from your product sheet, but if this field is empty, use another field or a value.

Examples:

For a purchase cost rule, we want to use the wholesale_price field but if this field is not filled in, use a default value of 10. We will therefore use a formula:
if {wholesale_price} then {wholesale_price} else 10.
For a purchase cost rule, we want to use the wholesale_price field but if this field is not filled in, use the website price divided by 2. We will therefore use a formula:
if {wholesale_price} then {wholesale_price} else ({price} / 2).
    • Related Articles

    • Create Shoppingfeed rules for myPricing

      Shoppingfeed rules for myPricing myPricing saves prices in product characteristics. The goal here is to create a rule on Shoppingfeed, so that shopping feed uses the value of this characteristic as price if this characteristic is not empty. Procedure ...
    • Create Iziflux rules for myPricing

      IziFlux rule for myPricing myPricing saves prices in product characteristics. The goal here is to create a rule on Iziflux, so that the flow uses the value of this characteristic as a price if this characteristic is not empty. You must create one ...
    • Quick Start - Your pricing strategy

      From the Strategy screen you will be able to define your pricing strategy by creating rules. Default rules During the integration, we create for you the rules required by the application to function correctly. This rule can obviously be modified but ...
    • Exclude products from being repriced

      Exclude poducts with rules To exclude products from repricing, go to Strategies > Rules and :  - Create a new "Include / Exclude products" rules by clicking on the "+" button - Add a condition in order to identify the product - In this example, we ...
    • Exclude products from being repriced

      Exclude poducts with rules To exclude products from repricing, go to Strategies > Rules and :  - Create a new "Include / Exclude products" rules by clicking on the "+" button - Add a condition in order to identify the product - In this example, we ...