Page 1 of 1

Attributes and categories

Posted: 28 Sep 2017, 21:43
by Bevi
Hi, is there a way to set which attributes are to be shown depending on the category ?

Re: Attributes and categories

Posted: 30 Sep 2017, 12:16
by aimeos
You mean product attributes depending on the category? Not out of the box, you would need to adapt the template and add some if-conditions.

Can you give an example what you want to use it for?

Re: Attributes and categories

Posted: 01 Oct 2017, 16:45
by Bevi
I have the following categories:

-tires
-clothes
-modeling
-electronic

The problem is that all my attributes are shown, no matter on which category I am.
So, if someone is visiting the clothes area, he will also display all the attributes that don't have anything to do with clothes.
I will try to arrange it with some if statements, which file should I modify?

Re: Attributes and categories

Posted: 01 Oct 2017, 17:11
by aimeos
Your products have nothing in common and maybe won't be sold together. Do you already thought about using different sites for each product category? That's like an own shop area for each product category in one installation

Re: Attributes and categories

Posted: 01 Oct 2017, 21:45
by Metalics
I think you want to hide attributes whose all attr-items 0.
In your example, you want to hide "Screen size" attribute when someone visiting "Clothes" category. In this case, all attr-items of "Screen size" attribute will be empty so it is annoying to display this attribute.

Add the following line at the bottom of "/client/html/templates/catalog/lists/body-default.php" file and it will help you.

<script type="text/javascript">
$('.attribute-lists fieldset').hide();
$(function(){
$(".attr-count").each(function(){
$(this).parents('.attribute-lists fieldset').show();
});
});
</script>

Re: Attributes and categories

Posted: 07 Oct 2017, 15:44
by Bevi
aimeos wrote:Your products have nothing in common and maybe won't be sold together. Do you already thought about using different sites for each product category? That's like an own shop area for each product category in one installation
Products don't have anything in common, but I want to sell them in 1 single website. I don't want to create more shops because then I will probably need to administrate them through separated backends areas, one for each site, right?

Re: Attributes and categories

Posted: 08 Oct 2017, 15:48
by aimeos
No, it would still be one backend where editors can switch between shops.
But if you want to sell tires and shirts in one order, this doesn't work. Then, we would recommend the suggestion of Metalics to hide the attributes and types with no products found via Javascript.

Re: Attributes and categories

Posted: 09 Feb 2018, 13:51
by aimeos
The next Aimeos version (2018.04) will contain the script to hide empty attribute lists by default.