Field mapping

Product feeds can vary significantly in structure, depending on the source or affiliate network. To ensure accurate data import, each feed must be mapped to Content Egg’s internal product fields. This process is required for every individual feed.

The simplest way to manage field mapping is by using AI Auto-Mapping. This feature automatically analyzes your feed and aligns its fields with Content Egg’s internal structure.

To enable AI Auto-Mapping:

  1. Go to Content Egg > Settings > AI, and enter your OpenAI API key.

  2. In the feed module settings, ensure the AI Auto-Mapping option is enabled.

  3. Leave all field mapping entries blank, then save the settings.

  4. Wait a few minutes, then refresh the feed status to see if products have been successfully imported.

Note: If there are errors or if the AI is unable to identify all required fields, you will need to manually complete the field mapping as described in the next section.

CSV Feeds Mapping

To begin, open your CSV feed file in a spreadsheet viewer like Excel or Google Sheets. Then, in the Content Egg interface, match each column header from your file to the appropriate plugin field.

Common CSV Field Mappings:

Plugin Field
Description

id

Required. Unique identifier for each product. Must remain consistent across imports.

affiliate link

The product's affiliate URL, including your tracking parameters.

is in stock

Stock status. Supported values: 1, true, on, yes, 0, false, off, no

availability

Text-based stock status. Supported values: in stock, out of stock

direct link

Direct (non-affiliate) URL to the original product page

gtin

Global Trade Item Number, such as EAN-13 (e.g., 3001234567892)

💡 Note: Some fields are required, such as id, while others are optional. However, including more fields improves matching, filtering, and comparison quality.

XML Feeds Mapping

If your feed is in XML format, you'll map fields using either XML node names or XPath expressions.

Example: Node Attribute Mapping

You can directly select attributes from a node. For example:

<product>
    <image url="https://example.com/image.jpg" />
</product>

You can map the image URL using:

//image/@url

Example: Using XPath for Namespaced Nodes

For more complex XML structures or namespaced elements, XPath expressions are supported:

.//*[local-name()='media:thumbnail']/@url

This XPath selects the url attribute of a <media:thumbnail> element, even if it uses a namespace.

Extract Data with Regex

You can extract specific data from a feed field using a custom syntax that incorporates a regex pattern: [regex][pattern][feed_field_name]

This allows you to define a pattern to match and extract the desired portion of the data within the specified feed field.

Example Use Case:

Consider a feed containing a "fields" field that combines multiple pieces of product data. To extract the value of a specific key, such as "from_price", you can use the following syntax:

[regex][/from_price:([\d.]+) EUR/][fields]

Explanation:

  • [regex]: This indicates you are using a regex-based extraction.

  • /from_price:([\d.]+) EUR/: The regex pattern to match.

  • [fields]: The feed field from which data will be extracted.

Use capturing groups () to define the exact portion of the match you want to extract.

Product Attributes

You can map any fields from your CSV feed as product attributes, which can then be used to import WooCommerce attributes or display attributes via shortcode.

For example, if your feed includes columns like delivery_weight and delivery_time that you want to map as attributes, add them to the "attributes" mapping settings as follows:

delivery_weight,delivery_time

These fields will then appear as product attributes:

To customize their display names, update the "attributes" mapping like this:

delivery_weight->Delivery Weight,delivery_time->Delivery Time

The result will appear as shown:

Last updated