You can have multiple different customer user groups, all with their own assigned pricing for each product. This is often because different customers have agreed a different contract price with your organisation.
Before you start
Things you need to know:
Learn more about product recommendations in Recommendation SmartBlocks.
If you need assistance with implementing a solution for your store, contact Fresh Relevance support.
Display the correct contract price
Display the correct product price for each customer in SmartBlock Recommendations:
Product import
Each price group value is imported into its own product field, for example:
"ex.price_group_004":{"ftp_field_name":"004","field_type":"double"},
"ex.price_group_005":{"ftp_field_name":"005","field_type":"double"},
"Ex.price_group_006":{"ftp_field_name":"006","field_type":"double"},
Person import
The price group assigned to each person is set as a person extend field, for example:
"Person.extend.price_groups":{"ftp_field_name":"price_groups"}
SmartBlock layout to show the correct price
In the SmartBlock layout, the price group is taken from the person record and the appropriate field is then looked up from the product record and output:
{% if person and person.extend.price_groups %} <br/>
{% set priceGroups = person.extend.price_groups|split(',') %}<br/>
{% endif %}<br/>
<br/>
{% if product.ex and product.ex.size %}<br/>
{% set productPrice = product.uv/product.ex.size %}<br/>
{% else %}
{% set productPrice = product.uv %}
{% endif %}
{% if priceGroups %}
{% for priceGroup in priceGroups %}
{% set priceField = 'price_group_'+priceGroup %}
{% if product.ex[priceField] and product.ex[priceField] > 0 %}
{% set productPrice = product.ex[priceField] %}
{% endif %}
{% endfor %}
{% endif %}
{{ productPrice|format_currency(product.curr,2) }}
Exclude products which aren’t available to particular clients
This might happen for various reasons, for example, due to location or licensing.
The approach to implement this is similar to multiple price books:
Load one or more fields into the product database to identify which group(s) they should be available for.
Load a field into the person database to identify which group they belong to.
In product recommendation filtering, exclude products which shouldn't be available for that person.
This Recommendation SmartBlock filter extracts the above data from the person record based on the sales organisation (sitebrand) of the page itself, and uses it to exclude products containing those material group IDs:
Tag Value (Category) has none of :
{% set fieldName = 'excluded_material_groups_'+merges.sbr|lower %}{% if person.extend[fieldName] %}{% set fieldValue = person.extend[fieldName]|split('|')|join('||') %}{{ fieldValue|prefixvalues('excluded-material-group:') }}{% else %}{{ 'fakevalue' }}{% endif %}
which when the above Jinja is formatted turns into something like:
Tag Value (Category) has none of :excluded-material-group:02||excluded-material-group:03||excluded-material-group:05 etc
This then excludes products in the material groups 02,03,05.