RO CSVI

Replacing line breaks in RO CSVI Exports

Often we get into a problem of having line breaks in export. This mostly happens in VirtueMart export and when exporting product_desc or product_s_desc field. It is possible to remove these line breaks RO CSVI multi replace plugin. This document explains on replacing line breaks in RO CSVI Exports.

At first, create a export template using the following steps.

  1. Go to Components -> CSVI Pro -> Templates
  2. Click New
  3. Give the template a name, say for example VirtueMart Product export
  4. Set Action to Export
  5. Set Component to VirtueMart
  6. Set Operation to Product
  7. Click Next: Select Destination
  8. Destination is set default to Download.
  9. Click Next: Select options
  10. The default values are OK, change if needed.
  11. Click Next: Select fields
  12. Add the fields to be exported
  13. Click Next: Finalize
  14. All done here
  15. Click Close to return to the list of templates or Edit if you want to fine-tune the template further.

 

Replacing line breaks in RO CSVI Exports - create export template

 

Add template fields for the export template, for our example we are exporting product_sku, product_name and product_desc fields.

Template fields can be added by following these steps:

  1. Go to Components -> CSVI Pro -> Templates
  2. Click on Template fields
  3. In the Search Tools select your template
  4. Click on New to add a single field or click on Quick Add to add multiple fields.

Quick Add

The Quick Add Option allows you to quickly add multiple fields to a template. It is not possible to set any settings per field here but that can be done after the fields have been added to the template.

Replacing line breaks in RO CSVI Exports - create export template fields

 Now say when you do the product export, product_desc field data is exported like below image when rule is not applied.

Replacing line breaks in RO CSVI Exports - create multi replace rule

 

Create a multi replace rule for replacing line breaks to space in Rules page and apply it on product_desc in template fields page.

  1. Go to Components -> CSVI Pro -> Templates
  2. Click on Rules
  3. Click New
  4. Give a name to the Rule
  5. Select Action as Export
  6. Select Plugin as Multireplace
  7. Click Load plugin button
  8. Save the rule before continuing further
  9. Since we are creating a find and replace for line breaks here, Select operation as Find and replace
  10. In the Filter part, in Find field set expression to be /\r\n/, Replace field should be a space or empty, Method to be Regular expression, Other fields can be left with default values.
  11. Save the rule
  12. Now go to template fields and apply the created rule on product_desc field by selecting the rule in Rules field.

Replacing line breaks in RO CSVI Exports - Add rule to template field 

Thats it. Run the export from CSVI export page and by selecting the export template. Your  product_desc or product_s_desc fields should be exported without line breaks like the image below

Replacing line breaks in RO CSVI Exports - result after export

Related Articles