Rewrite

In this post we will learn:

  • What is the Rewrite rule used for?
  • How does it work?
  • Examples of use
  • Summary

What is it used for?

The rule is used to modify the values of any element, e.g. product names, categories, labels and many others. Using the Rewrite rule, values can be completely overwritten, enriched, or reduced by parts.

How does the Rewrite rule work?

In this section, we will describe how the rule works, what it can do, and what to watch out for.

Basic principle

The rule targets all values of the element in the left field and completely overwrites them with the values in the right field.

Before:

<PRODUCTNAME>Phone</PRODUCTNAME>
<PRODUCT>Nokia 5800 XpressMusic</PRODUCT>

Rule:

After regeneration:

<PRODUCTNAME>Nokia 5800 XpressMusic + free shipping</PRODUCTNAME>
<PRODUCTNAME>Nokia 5800 XpressMusic</PRODUCT>

The rule applies changes line by line

Within one rule, it is possible to overwrite multiple elements, so that we do not have to create a separate rule for each element.
In such cases, the element on the 1st line is overwritten first, and only after this element is overwritten does the rule start overwriting the element on the 2nd line. And in this way the rule continues until the last line.

What else does the Delete Parameter Values rule form offer?

The rule form offers several functions that will make our work easier:

  1. The order of the rows can be changed by grabbing the arrow and then dragging it to the desired location.
     
    drag-and-drop

  2. smart insertion works in the form. If we have elements and new values listed in the table, we can simply copy them and then paste them into the form.
     
    smarte-paste

Usage examples

We will show several examples of using the Rewrite rule in the Heureka format.

Example 1: We set a fixed price - this is the PRICE_VAT element.

After regeneration, we will see the price we defined for the given products.

Example 2: We will remove the gift - this is the GIFT element.

If you do not fill in the text field on the right, the element on the left will be empty (its value will become empty).

Example 3: In the PRODUCTNAME element, we get the same thing as in the PRODUCT element, and in addition, we add “+ free shipping” as the value

Summary

  • What is it used for?
    The rule is used to modify the values of any element, e.g. product names, categories, labels and many others. Using the Overwrite rule, values can be completely overwritten, enriched, or reduced by parts.
     
  • How does the rule work?
    The rule targets all values of the element in the left field and completely overwrites them with the values in the right field.