• Google+
  • VirtueMart Manager RSS
  • VirtueMart Manager YouTube
  • Follow VirtueMart Manager on Twitter
  • VirtueMart Manager on Blogger
  • VirtueMart Manager on FaceBook
1-855-814-4511
8 AM - 7 PM (GMT) / 3 AM - 2 PM (EST)
1-855-810-5797
8 AM - 7 PM (GMT) / 3 AM - 2 PM (EST)

Use Expressions and Modify Data Right in the Process of Import to VirtueMart

Expressions, implemented in the course of VirtueMart import from csv, are particularly useful in number of situations. Having created the formulae properly, you can seamlessly transfer data from the file to VirtueMart without product referred information rearranging.

What Can You Modify Using Expressions?

Manage Product Stock

Expressions can be used to modify any product related information in the process of VirtueMart import. For example, you need to change product status depending on its quantity. Let’s say, some products in the file have quantity 1 and correspondingly, you want to make them inaccessible at the website. There should be created the rule, fulfilling which, you will change product status.

To generate the rule, open Expression Editor for field Published. Expression should function by the following scheme: if product quantity equals to 1 or is less, this item will not be listed at the website, otherwise it will be available for shoppers (IF(expr1,expr2,expr3) - If expr1 is TRUE then IF() returns expr2; otherwise it returns expr3.). Thus, you should use IF command, and the formula will look like

In this statement [CSV_COL(32)] conveys the value, indicated in column №32 of csv file (In Stock), [CSV_COL(53)] - column responsible for product status.

To make sure the expression is correct and desired results will be attained after VirtueMart import from csv, check it pressing Execute Expression (F9).

Change Product Price

Oftentimes price of merchandise, provided by supplier, differs from price, web merchants would like to set. Price for abundance of products can be also modified using expressions. You can either increase or decrease product cost creating SQL statements.

Expression rule, implementing which you will modify product price, will be the following: [CSV_COL(INDEX)]*VALUE, where INDEX is the number of csv column, product price is specified in, VALUE - the value cost will be increased/decreased by.

Having applied expression as on the screenshot, you will add 15% to current product price.

Complex expressions can be applied when price of VirtueMart products, you want to modify, varies. Set of certain rules should be created, for example,

CASE

WHEN [CSV_COL(6)] BETWEEN 0.00 AND 19.99 THEN [CSV_COL(6)] * 1.38

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

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

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

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

WHEN [CSV_COL(6)] BETWEEN 80.00 AND 149.99 THEN [CSV_COL(6)] * 1.11

WHEN [CSV_COL(6)] BETWEEN 150.00 AND 249.99 THEN [CSV_COL(6)] * 1.10

ELSE [CSV_COL(6)]

END;

Modify Description For Numerous Products

Using expressions you can modify text fields as well. If you have immense number of products in the file and want to add some detail, for example “Powered by MyStore.com” phrase, you should use CONCAT command. Once this expression is implemented and import is run, this phrase will be included into product description.

One more example shows, how to add promotional text to your product names. It can be quite a workable tool for the sales season. IF and CONCAT commands should be used when creating such a statement

It follows from the rule that in case .csv column responsible for product price, contains value less than 60, above mentioned sentence will be published with product name.

Described above cases of expression usage illustrate only several aspects of data modifying right in the process of VirtueMart import. It boosts your productivity in managing product catalog and help you out when you need to modify huge data sets.

Read related article on expressions and purpose of their usage when uploading products to VirtueMart - http://virtuemart-manager.com/useful-articles/tips-tricks/expressions-and-purpose-of-their-usage-in-the-process-of-virtuemart-import


By Ira Svedovetska