Displaying customer specific products can be achieved by providing us the customer identifiers and using the current customer as a filter.
Normally filtering is done by adding an attribute to a filtertemplate and the filter will be visible in the active filter set. That means you'll see the customer identifier in the selection, which is not what you want.
To prevent that, we introduced request parameters. Using this mechanism will work the same as regular filtering, but the filter will not be part of the active filter set.
Steps to take:
- Add an attribute containing the customer identifiers that have the product in their range.
- Configure the attribute as request parameter.
- Use the parameter in your platform to show products for the current customer.
Add an attribute
Add an attribute to the product feed, containing the customer identifiers that have the product in their range.
<item>
<id>TSH0123</id>
<name>Shirt Colin</name>
<!-- omitted for brevity -->
<attributes>
<attribute>
<name>allow_customer</name>
<value>10005</value>
</attribute>
<attribute>
<name>allow_customer</name>
<value>10006</value>
</attribute>
<attribute>
<name>allow_customer</name>
<value>10018</value>
</attribute>
</attributes>
</item>This will be visible in the items module as:
Configure as request parameter
Follow the guide to Configure the attribute as request parameter.
Use the parameter
In the examples we take this as a starting point:
- Attribute name:
allow_customer - Current customer identifier:
10005
Use the parameters option to filter on the current customer:
window.addEventListener("twn.starter.ready", function () {
var api = tweakwiseListerPage({
cid: "1000",
parameters: 'allow_customer=10005'
});
});Read more about Use request parameters in Tweakwise API.
