How to configure and adapt Aimeos based shops as developer
Forum rules: Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4656 by Bevi
28 Sep 2017, 21:43
Hi, is there a way to set which attributes are to be shown depending on the category ?
#4661 by aimeos
30 Sep 2017, 12:16
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?
#4681 by Bevi
01 Oct 2017, 16:45
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?
#4682 by aimeos
01 Oct 2017, 17:11
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
#4683 by Metalics
01 Oct 2017, 21:45
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>
#4733 by Bevi
07 Oct 2017, 15:44
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?
#4740 by aimeos
08 Oct 2017, 15:48
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.
#5664 by aimeos
09 Feb 2018, 13:51
The next Aimeos version (2018.04) will contain the script to hide empty attribute lists by default.