General Procedure To Add A Custom Attribute
Adding a new attribute to the feed must be done within SHOPWARE.
Step 1 - Find The Attribute
Go to Einstellungen > Freitextfeld-Verwaltung and, in the drop-down menu located at the top-right side of the listing, choose Atrikel (_articles_attributes)' to see all available attributes. Pay special attention to NAME and LABEL.
Step 2 - Design The Line that Needs To Be Added
You will have to add a new entry to the feed as an XML fragment where the tag is the label of the attribute and the content is extracted with some template code.
For instance, for the attr5
attribute, with a label of Farbe
the line to add to the feed would look like this:
<Farbe>{$sArticle.attr5|escape}</Farbe>
Step 3 - Add The Line To The Doofinder Feed
Go to Marketing > Produktexport > Doofinder Feed and click on the 'pencil' icon and then on the 'Body' tab. (see image).
Directly underneath the MPN line, add the new attribute line. E.g.
<Farbe>{$sArticle.attr5|escape}</Farbe>
If you have to add more than one attribute, it's recommended that you add one per line.
Once finished it should look like this:
Time to SAVE!
Step 4 - Indexing The New Attribute
You may need to change the caching interval for immediate update. Go to Marketing > Produktexport > Doofinder Feed and click on the 'pencil', and set the caching interval to LIVE.
With this you can go to Doofinder admin > Search Engines > Settings > Indices and click on 'Process Now'.
Once the feed is processed, it's recommended to revert the caching interval to its previous value.
How To Add The Price Per Unit To The Feed
Above the brand line, create a new empty line and add the following:
<referenz-preis>
{if $sArticle.purchaseunit}{round($sArticle.price/$sArticle.purchaseunit *$sArticle.referenceunit,2)|escape} EUR / {$sArticle.referenceunit} {$sArticle.unit}{/if}
</referenz-preis>
Save.
Shopware 6
- To find the custom attribute go to Settings > System > Custom Fields Einstellungen > System > Zusatzfelder.
- To add the attribute to the feed go to Verkaufskanale > DF feed > Template tab > Produktzeile
Remember to change the caching interval to LIVE and revert it to its previous value once the feed is indexed.