Auto-assign products
Auto-assign products is an advanced products-related capability which makes it possible to automatically place products in product groups based on e.g. attribute values or (in more advanced scenarios) query criteria.
To use this capability, first you create product assignment rules using the Auto-assign products
-tool:
To create a product assignment rule:
- Click New product assignment rule
- Provide a name and set it to be active
- Select which shop/channel this rule should be active for
- Select a rule mode
- Group rules mode assigns products to groups based on some product attributes
- Query rules mode assigns products to a group using a query with GroupFields as parameters
- If query rules mode is selected, select a query
- Save
After creating product assignment rules, you should create a scheduled task which uses the Assign products to one or more groups, depending on some rules
add-in to place products in groups based on the rules. You can read more about this add-in here.
Example 1: Group rules mode
Group rules mode is the simplest implementation, and works the following way:
- Open the group settings for each group you want to assign products to
- Scroll to the Auto product relation rules section, select up to two fields, and specify a value for each of them – e.g. Manufacturer and Trek
- Go to Settings > Areas > Products > Advanced configuration > Auto-assign products and create a product assignment rule
- Select which shop/channel this rule should apply to
- Select Group rules mode
- Go to Settings > System > Scheduled tasks and create a new scheduled task:
- Select the Assign products to one or more groups, depending on some rules add in
- Select which product assignment rules to schedule
Whenever the scheduled task is run, the products which match the criteria defined on the groups – the group rules – will be added to the groups in question. If the values used to assign a product to a group change, the product will be removed from the group again unless Don't detach products is set on the scheduled task.
Example 2: Query mode
Query mode is reserved for more advanced scenarios and works in the following manner:
- First create a repository query which finds the products you want to auto-assign groups
- Go to Settings > Areas > Products > Advanced configuration > Auto-assign products and create a product assignment rule
- Select which shop/channel this rule should apply to
- Select Query rules mode
- Under parameter mapping add a mapping between a product group field and a query parameter
- Go to System > Scheduled tasks and create a new scheduled task:
- Select the Assign products to one or more groups, depending on some rules add in
- Select which product assignment rules to schedule
Whenever the scheduled task is run, the products matched by the query will be placed in the product group(s) where the query parameter matches the value on the product group field defined in the mapping.