Attributes and categories

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)
Spam and unrelated posts will be removed immediately!
Bevi
Posts: 33
Joined: 25 Sep 2017, 20:57

Attributes and categories

Post by Bevi » 28 Sep 2017, 21:43

Hi, is there a way to set which attributes are to be shown depending on the category ?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Attributes and categories

Post 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?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Bevi
Posts: 33
Joined: 25 Sep 2017, 20:57

Re: Attributes and categories

Post 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?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Attributes and categories

Post 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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Metalics
Advanced
Posts: 103
Joined: 13 Jul 2015, 23:59

Re: Attributes and categories

Post 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>

Bevi
Posts: 33
Joined: 25 Sep 2017, 20:57

Re: Attributes and categories

Post 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?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Attributes and categories

Post 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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Attributes and categories

Post by aimeos » 09 Feb 2018, 13:51

The next Aimeos version (2018.04) will contain the script to hide empty attribute lists by default.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply