This document explains on how to make RO CSVI replace line breaks with an HTML br tag on import using the Multi-Replace rule.
Often in imports where descriptions are imported, we would like to replace line breaks \r\n to HTML <br /> tags. One of this example is with VirtueMart Product descriptions. This document explains on how to replace line breaks wih an HTML br tag on import using the RO CSVI Multi replace plugin.
- Create VirtueMart Product import template.
- Set Action to Import
- Set Component to VirtueMart
- Set Operation to Product.
- Add template fields to the template from RO CSVI template fields. For this example we use product_sku, product_name and product_desc fields.
- In your import template settings on File tab set Use file for configuration to No. This setting will tell RO CSVI to use template fields on import and not the column headers in import file.
- From RO CSVI Rules page create a new rule for Multi replace plugin. To create the rule
- Go to Components -> RO CSVI -> Rules
- Click New
- Give a name to the Rule
- Select Action as Import
- Select Plugin as RO CSVI Multireplace
- Click Load plugin button
- Save the rule before continuing further
- Since we are creating a find and replace for line breaks here, Select operation as Find and replace
- In the Filter part, in Find field set expression to be /\r\n/, Replace field should be <br>, Method to be Regular expression, Other fields can be left with default values.
- Save the rule.
- Apply the rule for product_desc field in RO CSVI Template fields page.
- Example Import CSV content
"product_sku","product_name","product_description" "NP-R522-ET01DE","R522-Aura T6400 Edira","R522-Aura T6400 Edira Pentium Dual Core processor T6400 (2,00 GHz, 800 MHz, 2 MB) 4 GB (DDR2 / 2 GB x 2) 15,6 inches LED HD"
- Run the import. Check the import preview page to see if the rule has been applied as needed.