RO CSVI

Replace line breaks with an HTML br tag on import

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.

  1. Create VirtueMart Product import template.
    1. Set Action to Import
    2. Set Component to VirtueMart
    3. Set Operation to Product.

Remove line breaks on RO CSVI imports - Import template

  1. Add template fields to the template from RO CSVI template fields. For this example we use product_sku, product_name and product_desc fields.

 Remove line breaks on RO CSVI imports - Import template fields

 

  1. 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.

Replace line breaks with an HTML br tag on import - file tab settings

  1. From RO CSVI Rules page create a new rule for Multi replace plugin. To create the rule
    1. Go to Components -> RO CSVI -> Rules
    2. Click New
    3. Give a name to the Rule
    4. Select Action as Import
    5. Select Plugin as RO CSVI Multireplace
    6. Click Load plugin button
    7. Save the rule before continuing further
    8. Since we are creating a find and replace for line breaks here, Select operation as Find and replace
    9. 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.
    10. Save the rule.

Replace line breaks with an HTML br tag on import - Rule settings

  1. Apply the rule for product_desc field in RO CSVI Template fields page.

Replace line breaks with an HTML br tag on import - Replace rule on template fields

 

  1. 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"
  1. Run the import. Check the import preview page to see if the rule has been applied as needed.

Replace line breaks with an HTML br tag on import - Import preview

Related Articles