Jump to content

Hiding some attributes in the product display


Recommended Posts

Hello,

I need a help. I searched a lot for the solution but couldn't figure it out yet. Some people have already started the topic but it definitely doesn't work for me.

I have plenty of product attributes that I don't want to show up in my product display but the fact is that I need them all  in the blocklayerd.

 

I know I need to edit the product.tpl file located in my theme folder and add some code around :

 

<fieldset class="attribute_fieldset">

                            NEW CODE HERE

                            <label class="attribute_label" for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>
                            {assign var="groupName" value="group_$id_attribute_group"}

 

For some people I believe this worked out : 

 

{if $id_attribute_group == 2}style="display: none;"{/if}

 

but it doesn't  work in my case.

 

So, I found another code :

 

{if $id_attribute_group eq 2}style="display: none;"{/if}

 

And still, doesn't work at all!

My PS version is 1.5.6.2

Please, I really need to get it done. 

Thanks

Link to comment
Share on other sites

In your product.tpl file you can find code: 

<div id="attributes">
				<div class="clear"></div>
				{foreach from=$groups key=id_attribute_group item=group}
					{if $group.attributes|@count}
						<fieldset class="attribute_fieldset">
							<label class="attribute_label" for="group_{$id_attribu
..........

Try write to it this changes(4 row in code above): 

{if $group.attributes|@count && $id_attribute_group != 2}
Edited by Maskca (see edit history)
  • Like 1
Link to comment
Share on other sites

Dear Maskca,

 

I have a little question about the code your provided me.

 

I'd like to add another attribute to hide.

 

I tried his :

{if $group.attributes|@count && $id_attribute_group != 2 OR 4}

 

But it's doesn't work at all... :( When I refresh my product display, I reach a blank page...

 

Coud you tell me how to add more attribute to hide ?

 

Please, I need to get it done. 

 

Thanks

Link to comment
Share on other sites

Hi again Maskca !

 

I've a last question about how to hide attribute properly!

 

Again, I've searched quite a lot but I haven't found the answer yet.

 

My question is :

 

How to hide attribute on the display product if there is only one choice ?

 

For exemple, in my shop, I need to add color to every single product even if there is only one color for each product. In fact, the client doesn't have choice of the color so there is no need to show up that!

 

But if there is 2 choices of color, of course, it's important to show back the attributes.

 

Do you have any idea how to do that ?

 

Thanks again for your precious help.

Link to comment
Share on other sites

  • 2 months later...

Hello

I follow this tutorial, And now i can´t find my add to cart button.
It´s just disappeared....

I use PS 1.6.0.6

{if $group.attributes|@count && $id_attribute_group != 1 && $id_attribute_group != 3 && $id_attribute_group != 4 && $id_attribute_group != 5 && $id_attribute_group != 7 && $id_attribute_group != 8 && $id_attribute_group != 9}

 

Link to comment
Share on other sites

Hi again Maskca !

 

I've a last question about how to hide attribute properly!

 

Again, I've searched quite a lot but I haven't found the answer yet.

 

My question is :

 

How to hide attribute on the display product if there is only one choice ?

 

For exemple, in my shop, I need to add color to every single product even if there is only one color for each product. In fact, the client doesn't have choice of the color so there is no need to show up that!

 

But if there is 2 choices of color, of course, it's important to show back the attributes.

 

Do you have any idea how to do that ?

 

Thanks again for your precious help.

 

Hi, sorry for long answer, find this in product.tpl: 

<div id="attributes">
				{foreach from=$groups key=id_attribute_group item=group}
					{if $group.attributes|@count}
						<fieldset class="attribute_fieldset">
							<label class="attribute_label" for="group_

And write this, instead of third row:

{if count($group.attributes) > 1}
Edited by Maskca (see edit history)
Link to comment
Share on other sites

 

Hello

 

I follow this tutorial, And now i can´t find my add to cart button.

It´s just disappeared....

 

I use PS 1.6.0.6

{if $group.attributes|@count && $id_attribute_group != 1 && $id_attribute_group != 3 && $id_attribute_group != 4 && $id_attribute_group != 5 && $id_attribute_group != 7 && $id_attribute_group != 8 && $id_attribute_group != 9}

 

Hi, in PS 1.6 try this:

<fieldset style="{if $id_attribute_group==1 || $id_attribute_group==3} display: none; {/if}" class="attribute_fieldset">
  • Like 1
Link to comment
Share on other sites

  • 9 months later...

Hello, i changed the third row as you said, but now the cart button also dissapearing, i want to hide the attribute if there is only one. I am using the latest 1.6.0.14.

 

 

Hi, sorry for long answer, find this in product.tpl: 
 

<div id="attributes">
                {foreach from=$groups key=id_attribute_group item=group}
                    {if $group.attributes|@count}
                        
<fieldset class="attribute_fieldset">
                            <label class="attribute_label" for="group_

And write this, instead of third row:

{if count($group.attributes) > 1}

 

Best Regards

Edited by wiseprt (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
  • 3 weeks later...

Hello,


 


can I hide values of attributes depending on other attributes selected?


 


scenario:


 


attribute 1: 


-  model 1 


- model 2


 


Attribute 2:


 


- 100 units


- 200 units


 


Model 1 has 100 units, but not 200 units. Therefore, when the first dropdown selects model 1, i don't want the second dropdown to show 200 units.


 


Does it make sense?


 


Thanks,


 


Guillem

Link to comment
Share on other sites

  • 9 months later...

 

Hi,

try this on 4 line: 

<fieldset {if count($group.attributes) == 1} style="display: none" {/if} class="attribute_fieldset">

 

I have used this but now the page does not load (just get a blank screen) I presume i swap the 1 for the Attribute ID (in my case 6)

If i put it between lines 4 and 5, nothing happens (page works as normal unless it is set to 1, in which case I get No Attributes)

 

Using the Multi Attribute option earlier and throwing almost random numbers into BOTH values (reduce it to one value it doesn't appear to work) I have pointed it at a deleted group (1) and the group I want to hide (6) in that order and it appears to work when added between lines 4 and 5 (not replacing 4).  Am I just going crazy?

 

using prestashop 1.6.1.1

 

Using the earlier option did hide the attribute set, but it also meant the cart button was disabled.

 

I need to have a hidden Generic colour (e.g. black, red, blue etc) and the actual colour (Ebony, Coal, Magenta, Flame, Sky Blue, Azure etc) so I can filter by the Generic colour for customers in the layered navigation.

Edited by iHairBeauty (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...