Assign EAN Codes From A List
This Action Map will show to assign EAN codes to products from a list of available codes, making sure all EAN codes are only used once.
This is very useful when you have a list of preapproved EAN codes for use and want to make sure that the EAN codes and only assigned once and also make sure that your products are assigned an EAN code a certain step in it life cycle.
This example is provided as inspiration only. It must be adapted to your Perfion environment to work. Perfion Support does not assist with such adaptations. Please contact your Perfion Partner or your Perfion consultant if you need assistance.
Download the Action here:
In order for this Action to work, you need a Selectable Feature that holds the available EAN Codes. For the example, we've created a Feature called EANSeries:
On this feature, you will be able to see which EAN codes are not currently used.
The Action itself consists of two parts. A parent Action and a child Action.
Parent Action
This Action will find all of the Products are currently does not have an EAN code assigned. The query in the SELECT.PERFION should find all the Products you wish to assign an EAN Codes
01 - Get Items without EAN
<Query>
<Select languages='EN'>
<Feature id='Product' />
</Select>
<From id='Product' />
<Where>
<Clause id='Brand' operator='=' value='Normal' />
<Clause id='Category' operator='HAS' />
<Clause id='BrandName' operator='HAS' />
<Clause id='EANCode' operator='NOT HAS' />
</Where>
</Query> |
Child Action
This Action takes the products from the parent Action and assigns an EAN code to each of those, one at a time. It does this by using the Perfion API Update statement. This Action is called for each of the products found in the parent Action
02 - Assign EAN
Using the '{=$variable}' notion we can use global variables in our SELECT.PERFION queries.
FInd 1 unassigned EAN code from EANSeries feature
<Query>
<Select languages='EN' maxCount='1'>
<Feature id='**' view='Config' />
</Select>
<From id='EANSeries' />
<Where>
<Clause id='Product' operator='NOT HAS' />
</Where>
</Query> |
Update the EANSeries feature with the Product currently in focus
<Query>
<Update>
<Item brand='Normal'>
<Product id='{=$ProductID}' />
</Item>
</Update>
<From id='EANSeries' />
<Where>
<Clause id='ID' operator='=' value='{=$EANID}' />
</Where>
</Query> |
Update the Product with the EAN code found above