How to - New Tab in product page

  • Posts: 132
  • Thank you received: 3
  • Hikaserial Subscription Hikashop Business
11 years 3 weeks ago #169140

I have added new tab and it does display on the product page. But if there is an editor to edit content of the Description tab, there is no way to edit content for my new custom tub on the vendor product editing form.
Please help to make that tab field to show and to be editable on the Vendor Product setup form.
thank you
I used your instructions:

Chapter: How to add a tab in the tabular view ?
You have to edit the view "product / show_tabular" via the menu Display > Views and add an entry like:

<li id="hikashop_show_tabular_custom_li" class="hikashop_tabs_li ui-corner-top">
    <a onclick="displayTab('hikashop_show_tabular_custom');" href="javascript:void(0);">
        <?php echo JText::_('YOUR_TAB_NAME');?>
    </a>
</li>
In the < ul class="hikashop_tabs_ul"> element. Then add a div with content after the "ul" thanks to:
<div class="hikashop_tabs_content" id="hikashop_show_tabular_custom">
<!-- Your div content -->
</div>

Last edit: 11 years 3 weeks ago by Jerome. Reason: [code] is nice !

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
11 years 3 weeks ago #169152

If you want the content of the div to be different for each product, you want to create a new custom product field via the menu Display->Custom fields, and change the line:
<!-- Your div content -->
by:
<?php echo $this->element->FIELD; ?>
where FIELD is the column name of your custom field.

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

  • Posts: 75
  • Thank you received: 1
10 years 6 months ago #191407

Hello, this is nice.
Is there also a magic spell for tab content to be used in products of a certain category?

kind regards, Wilfried

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
10 years 6 months ago #191409

Hi,

You can add conditions around these pieces of code:
<?php if(!empty($this->element->FIELD)){ ?>
...
<?php } ?>

Then, in your custom fields you can restrict them per category.
That way, if the custom field is not for a product, or that the field has not been filled in the product, the tab won't display.

The following user(s) said Thank You: wilfried

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

  • Posts: 51
  • Thank you received: 1
9 years 4 months ago #238942

nicolas wrote: Hi,

You can add conditions around these pieces of code:
<?php if(!empty($this->element->FIELD)){ ?>
...
<?php } ?>

Then, in your custom fields you can restrict them per category.
That way, if the custom field is not for a product, or that the field has not been filled in the product, the tab won't display.


Hi Nicholas,

Pls i don't understand how to use this code. What i want is a situation where if nothing is filled in the product edition of this custom tab, it should be hidden.
I tried this code like this
<div class="hikashop_tabs_content" id="hikashop_show_tabular_custom2">
<?php if(!empty($this->element->property)){Display: hide;} ?>
<?php echo $this->element->property; ?>
</div>
"Property" is the column name of my product custom field. But it doesn't hide when there's no content in it. Pls where are my getting it wrong?
Expecting your reply. Thanks

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #238954

Hi,

No you have two pieces of code:

<li id="hikashop_show_tabular_custom_li" class="hikashop_tabs_li ui-corner-top">
    <a onclick="displayTab('hikashop_show_tabular_custom');" href="javascript:void(0);">
        <?php echo JText::_('YOUR_TAB_NAME');?>
    </a>
</li>
and:
<div class="hikashop_tabs_content" id="hikashop_show_tabular_custom">
<?php echo $this->element->FIELD; ?>
</div>
And you need to add the code
<?php if(!empty($this->element->FIELD)){ ?>
...
<?php } ?>
around both pieces, as I explained in my previous message.

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

Time to create page: 0.081 seconds
Powered by Kunena Forum