Hide Variant Name in Product Show

  • Posts: 251
  • Thank you received: 2
13 years 1 month ago #26852

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!

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 1 month ago #26859

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

Please Log in or Create an account to join the conversation.

  • Posts: 251
  • Thank you received: 2
13 years 1 month ago #26871

Ok! It works, but if I select a variant from the dropdown list, it reappears...
what i have to modify?

Thank you so much.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 1 month ago #26880

That means that you didn't remove the span as I wrote.

Please Log in or Create an account to join the conversation.

  • Posts: 251
  • Thank you received: 2
13 years 1 month ago #26883

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

Last edit: 13 years 1 month ago by Nello.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 1 month ago #26884

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.

  • Posts: 251
  • Thank you received: 2
13 years 1 month ago #26887

Don't works!

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 1 month ago #26888

I still see the id in your span on your product page.

Please Log in or Create an account to join the conversation.

  • Posts: 251
  • Thank you received: 2
13 years 1 month ago #26891

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

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
13 years 1 month ago #26893

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>

Last edit: 13 years 1 month ago by Xavier.

Please Log in or Create an account to join the conversation.

  • Posts: 251
  • Thank you received: 2
13 years 1 month ago #26894

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!

Please Log in or Create an account to join the conversation.

Time to create page: 0.089 seconds
Powered by Kunena Forum