Manage PrestaShop Data in the Process of Import via Expressions
30
9 usages left

How to Manage PrestaShop Data in the Process of Import by Means of Expression?

Very often PrestaShop users come across difficulties, when performing PrestaShop product import. In some cases the feed for import does not include necessary fields, in the other – some fields records are improper. As a result PrestaShop store owners reach a deadlock and have to edit or add data to the file before commencing on PrestaShop import from file.

To sort the matters out, Store Manager for PrestaShop gives you a possibility to use Expression rules and manage file data right in the course of product upload.

Let’s view the example, to clear the situation and trace the logic of adding necessary data in the process of PrestaShop import of file by means of Expression.

EXAMPLE 1 – Update Product Status

You have got file of 10 000 products with the following fields indicated:

  • product identifier
  • product name
  • product price
  • product quantity

You need to change product status, depending on their quantity. You want a product not to be displayed at frontend, if its quantity value is equal to 1. Thus, you have to create the rule, implementing which, status of all items, added by means of PrestaShop import of products will be automatically changed.

Expression can be added on the “Assign .csv Columns to Database Fields” step of PrestaShop import. To the left you can see the list of database fields available.

  1. Choose “Status” field and press “Editor” button, placed in front of it.

  2. Use Expressions During PrestaShop Products Import with Store Manager

    The “Expression Editor” will appear, where the rule for status changing should be added.


    It’s recommended to use prompts and hints, listed in “Auto Complete Window”, pressing the corresponding button or clicking Ctrl + Space hotkeys. Here you can find list of .csv file fields available, set of SQL commands, functions and macros, which can be used while creating Expressions.

    Expression Editor via PrestaShop Products Import with Store Manager

    You can resort to “SQL Help” option, in case you are not acquainted with all SQL functions.


  3. Let’s create the formula, using which you will automatically change product status in correspondence to its quantity, in the process of product import to database. The rule should function on the following scheme: IF (Product Quantity<=1, the product is not displayed at the site, otherwise it is available for purchase).

  4. PrestaShop Products Import Expression for Status Update with Store Manager

    According to it, IF[CSV_COL(4)]<=1 Condition, 0True , 1,False will be accomplished.

    • [CSV_COL(4)] represents the value indicated in .csv column #4 (Quantity column of .csv file)
    • 0 – the value that should be set for product status, if condition is true for quantity
    • 1 – the value that should be set for product status, if condition is not true for quantity

    To make sure, that the Expression is accurate, use “Check” button.


    Execute Expression to Check the Result in Import Wizard

    Using this rule you will change product status in the course of PrestaShop import on the fly.

     

    EXAMPLE 2 – Update PrestaShop Product Description

    You have the feed, including 10 000 products. There is reseller’s company name “ABC-company” indicated in products descriptions. You need to exclude this name from description.

    You should use SQL command “Replace”, and add the following rule in “Expression Editor” window:

    REPLACE([CSV_COL(5)]Text Column,“ABC-company”Search text,   “”  Replace text)


    Expression for PrestaShop Description Update During Products Import with Store Manager

    • [CSV_COL(5)] – number of .csv file column with product description
    • “ABC-company” – the name, which you need to remove
    • “” – means that there will be empty value instead of ABC-company

    After PrestaShop import company name won’t be shown in products description field.

    Sometimes, there is the necessity to change existing name for some other. On such condition you can use given below rule:

    REPLACE([CSV_COL(39)]TXT Column, “ABC-company”Search text, “my New DEF-company”Replace text)

    In our example “ABC-company” will be replaced by “my New DEF-company” name.

     

    EXAMPLE 3 – Update Product Price

    At time, you need to change products price indicated in the file, sent by your supplier. For example, you want to set mark-up – increase price for all the products by 5%.

    The procedure is similar to those, described above. On certain step of PrestaShop import of products you should use Expression rule to change products price.

    The following formula is being used to set 5% mark-up:

    [CSV_COL(INDEX)]Price Column*1.05Factor

    In this formula (INDEX) is the number of .csv file column in which PrestaShop products price is indicated. *1.05 value, indicated in this Expression, means, that the price of all items, listed in .csv file will be increased by 5%.


    Update Product Price Using Expression During Products Import with Store Manager

    At times, there arises a need to set mark-ups for certain group of products, listed in the file. The following formulae can be used:

    CASE

    WHEN [CSV_COL(3)] BETWEEN 0.00 AND 19.99Condition THEN [CSV_COL(3)]Product Value * 1.38Factor

    WHEN [CSV_COL(3)] BETWEEN 20.00 AND 39.99 THEN [CSV_COL(3)] * 1.27

    WHEN [CSV_COL(3)] BETWEEN 40.00 AND 59.99 THEN [CSV_COL(3)] * 1.22

    WHEN [CSV_COL(3)] BETWEEN 60.00 AND 69.99 THEN [CSV_COL(3)] * 1.18

    WHEN [CSV_COL(3)] BETWEEN 70.00 AND 79.99 THEN [CSV_COL(3)] * 1.15

    ELSE [CSV_COL(3)]

    END;


    Price Mark-up With Expression During Products Import with Store Manager

    This complex expression allows to apply different price mark-ups depending on current product price. For example, the condition in the first row will apply to products if their price varies between 20.00 and 39.99 and, as a result, price of this product will be increased by 38%. In such a way, you can set required percentage not to all products, feed contains, determining the principle of products selecting.


    Described above examples illustrate only several aspects of data managing right in the process of PrestaShop import of products. You can operate with prices, manage PrestaShop products stock, edit products description, merge .csv file columns on the fly by means of Expressions via Store Manager for PrestaShop application. It makes the process of huge spreadsheet upload more flexible and approachable and helps to avoid data administrating issues, especially, occurring when web store keeper aims at extending products range.


Upload products to PrestaShop in bulk FREE with Store Manager for PrestaShop application Upload Now



Related Articles:


Card image
Why to Use Expressions during PrestaShop Import?

Discover what import file formats are supported by PrestaShop admin and what import solutions are offered by Store Manager for PrestaShop. Read More…

Card image
Handling Products Not Listed in CSV by Suppliers

Check out what actions can be performed with the merchandise not listed in the import file in the process of upload. Read More…

Card image
Make Your PrestaShop Product Import Automated

Discover the benefits of automated product import and the way to set it up. Read More…

Card image
How to Import PrestaShop Products Into Specific Shops?

Configure settings for importing products into multiple PrestaShop stores at one stroke. Read More…


COMMENTS
Be the first to comment.