- Posts: 251
- Thank you received: 2
Hide Variant Name in Product Show
14 years 11 months ago #26852
by Nello
Hide Variant Name in Product Show was created by Nello
Hi Nicolas,
how can I hide the variant name on the product page, without using the option or css.
Because if I set option to Not Add Variant Name, it does not also show in the cart.
You can see an example here.
www.hidesign.it/it/catalogo/product/show...3075/steelwood-chair
I want to hide ": Rosso"
Thank you!
how can I hide the variant name on the product page, without using the option or css.
Because if I set option to Not Add Variant Name, it does not also show in the cart.
You can see an example here.
www.hidesign.it/it/catalogo/product/show...3075/steelwood-chair
I want to hide ": Rosso"
Thank you!
Please Log in or Create an account to join the conversation.
14 years 11 months ago #26859
by nicolas
Replied by nicolas on topic Re: Hide Variant Name in Product Show
You can edit the file show of the view product via the menu Display->Views and change the code:
<span id="hikashop_product_name_main" class="hikashop_product_name_main">
<?php
echo $this->element->product_name;
?>
</span>
to:
<?php
echo $this->element->main->product_name;
?>
<span id="hikashop_product_name_main" class="hikashop_product_name_main">
<?php
echo $this->element->product_name;
?>
</span>
to:
<?php
echo $this->element->main->product_name;
?>
Please Log in or Create an account to join the conversation.
14 years 11 months ago #26871
by Nello
Replied by Nello on topic Re: Hide Variant Name in Product Show
Ok! It works, but if I select a variant from the dropdown list, it reappears...
what i have to modify?
Thank you so much.
what i have to modify?
Thank you so much.
Please Log in or Create an account to join the conversation.
14 years 11 months ago #26880
by nicolas
Replied by nicolas on topic Re: Hide Variant Name in Product Show
That means that you didn't remove the span as I wrote.
Please Log in or Create an account to join the conversation.
14 years 11 months ago - 14 years 11 months ago #26883
by Nello
Replied by Nello on topic Re: Hide Variant Name in Product Show
If I remove SPAN, when the product have no variants, no name is showed...
I want to hide only the name of variant, and show the name of product..
I want to hide only the name of variant, and show the name of product..
Last edit: 14 years 11 months ago by Nello.
Please Log in or Create an account to join the conversation.
14 years 11 months ago #26884
by nicolas
Replied by nicolas on topic Re: Hide Variant Name in Product Show
Then just remove the id attribute of the span: id="hikashop_product_name_main"
Please Log in or Create an account to join the conversation.
14 years 11 months ago #26887
by Nello
Replied by Nello on topic Re: Hide Variant Name in Product Show
Don't works!
Please Log in or Create an account to join the conversation.
14 years 11 months ago #26888
by nicolas
Replied by nicolas on topic Re: Hide Variant Name in Product Show
I still see the id in your span on your product page.
Please Log in or Create an account to join the conversation.
14 years 11 months ago #26891
by Nello
Replied by Nello on topic Re: Hide Variant Name in Product Show
Ok! With this code
<span class="hikashop_product_name_main">
<?php
echo $this->element->main->product_name;
?>
</span>
this are the results:
www.hidesign.it/it/catalogo/product/show...misuratore-magnetico
This is OK!
But this below have no product name, because have no variants
www.hidesign.it/it/catalogo/product/show/cid-198/divano-velvet
<span class="hikashop_product_name_main">
<?php
echo $this->element->main->product_name;
?>
</span>
this are the results:
www.hidesign.it/it/catalogo/product/show...misuratore-magnetico
This is OK!
But this below have no product name, because have no variants
www.hidesign.it/it/catalogo/product/show/cid-198/divano-velvet
Please Log in or Create an account to join the conversation.
14 years 11 months ago - 14 years 11 months ago #26893
by Xavier
Replied by Xavier on topic Re: Hide Variant Name in Product Show
Hi Nello,
Try to change your code:
<span class="hikashop_product_name_main">
<?php
echo $this->element->main->product_name;
?>
</span>
To:
<span id="hikashop_product_name_main" class="hikashop_product_name_main">
<?php
if(isset($this->element->main->product_name)) echo $this->element->main->product_name;
else echo $this->element->product_name;
?>
</span>
Try to change your code:
<span class="hikashop_product_name_main">
<?php
echo $this->element->main->product_name;
?>
</span>
To:
<span id="hikashop_product_name_main" class="hikashop_product_name_main">
<?php
if(isset($this->element->main->product_name)) echo $this->element->main->product_name;
else echo $this->element->product_name;
?>
</span>
Last edit: 14 years 11 months ago by Xavier.
Please Log in or Create an account to join the conversation.
14 years 11 months ago #26894
by Nello
Replied by Nello on topic Re: Hide Variant Name in Product Show
I tried with this code and now works well!
<span class="hikashop_product_name_main">
<?php
if(isset($this->element->main->product_name)) echo $this->element->main->product_name;
else echo $this->element->product_name;
?>
</span>
Thank you!
<span class="hikashop_product_name_main">
<?php
if(isset($this->element->main->product_name)) echo $this->element->main->product_name;
else echo $this->element->product_name;
?>
</span>
Thank you!
Please Log in or Create an account to join the conversation.
Time to create page: 0.250 seconds