Filtering by Product Type
Another one of many filtering options Photoslurp's widgets provide is a way to filter media by the product type or category that their associated product belongs to, commonly used on category pages. This is more convenient than our Collections feature in some situations, as it does not require you to perform any additional tagging on media during curation.
For you to be able to utilize this feature, you would need to have product categories configured in your eCommerce store and included in the product CSV file that you are sending to us. If you are using one of our modules or you've integrated using a Google product feed, this data has already been made available to us within the product_types column and the <g:product_type> tag respectively.
For more information about Product Types, check this guide.
What to include if you are using a custom CSV catalog
Include an additional column with the name 'product_types' that should include category information for each product. Category names can be comma separated (e.g. "Summer sales, Men > Swimwear", "BrandXYZ"). The angular bracket is used to depict hierarchy. (e.g. Men > Shoes > Running shoes).
More information on the requirements for CSV product feeds can be found here.
Implementing the code for Category widgets
To apply the product type filter to the widget, ensuring it only returns media from a specific category, the following additional code needs to be added to the page where the widget is to be shown:
<!-- Start Photoslurp Additional Parameters Code -->
<script>
window.photoSlurpWidgetSettings = window.photoSlurpWidgetSettings || {};
photoSlurpWidgetSettings["INSERT THE WIDGETID FOR THIS WIDGET"] = {
productType: ['men', 'shoes']
};
</script>
<!-- End Photoslurp Additional Parameters Code -->
Replacing the widgetID and the example types (men and shoes) with the name or names of the types or categories that you would like to filter by. As explained above, this can be a comma separated list or include hierarchy with angular brackets. If you add more than one category, the widget will filter by products that include both of the specified product types, in no particular order.