A quick B@SE tweak for product pages or thumbs to test if a product is in a given category. It’s useful for conditionally adding/removing content on the product page for particular types of products. For example:
- Disclaimers on used items
- Promo banners like free freight or consumer finance on big-ticket products
- Warnings on discontinued categories carried only for legacy customers
[%content_path id:'[@inventory_id@]' type:'category' %]
[%param *body%]
[%if [@content_id@] eq '123' %]
...
[%/if%]
[%/param%]
[%/content_path%]
Replace “123” with the ID of your target category.
There is no way in B@SE to directly test category membership. This code works by listing all categories a product belongs to and testing each against your specified ID.
