Add Tab to Product View

  • Posts: 72
  • Thank you received: 2
3 years 3 months ago #337099

-- url of the page with the problem -- : valentinosafeco.com.au/index.php/hikasho...ng/product/25-bond-2

I am struggling to add a tab in product view.

I have found this:
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"><?php echo JText::_('YOUR_TAB_NAME');?></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>


When I do this the content of the tab disappears and no additional tab is shown.
Where am I going wrong and can you perhaps elaborate on the above tutorial?

Many thanks in advance.

Best,

Thomas

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

  • Posts: 72
  • Thank you received: 2
3 years 3 months ago #337102

Update
I have content of description tab visible now again. 'Tab2' is created as a custom field and visible in product edit page.
Tab 2 is not visible on the front end.

Here is my edit of show_tabular.php

Please advise

<div id="hikashop_product_bottom_part" class="hikashop_product_bottom_part show_tabular">
	<div id="hikashop_tabs_div">
		<ul class="hikashop_tabs_ul">
<?php if(!empty($description) || !empty ($this->element->product_url)) {
		if(empty($selected)) $selected = 'hikashop_show_tabular_description'; ?>
			<li id="hikashop_show_tabular_description_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_DESCRIPTION');?></li>
<?php } ?>
<?php if(!empty($specif_tab_content)) {
		if(empty($selected)) $selected = 'hikashop_show_tabular_specification'; ?>
			<li id="hikashop_show_tabular_specification_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('SPECIFICATIONS');?></li>
<?php } ?>
<?php if(in_array($status_vote, array('comment', 'two', 'both'))) {
		if(empty($selected)) $selected = 'hikashop_show_tabular_comment'; ?>
			<li id="hikashop_show_tabular_comment_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_COMMENT');?></li>
			<li id="hikashop_show_tabular_new_comment_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_NEW_COMMENT');?></li>
          <li id="hikashop_show_tabular_custom_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('Details');?></li>
<?php } ?>
		</ul>
  <div class="hikashop_tabs_content" id="hikashop_show_tabular_custom">
<?php echo $this->element->Tab2;?>
</div>

Last edit: 3 years 3 months ago by nicolas.

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 3 months ago #337106

Hi,

You've added your

<li id="hikashop_show_tabular_custom_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('Details');?></li>
inside the "if" condition to display the tabs of the vote/comment mechanism. But you didn't activate the vote/comment mechanism in your HikaShop configuration, and that's why you still don't see the tab.
Instead, add it after the code:
<li id="hikashop_show_tabular_description_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_DESCRIPTION');?></li>
which displays the tab for the description.

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

  • Posts: 72
  • Thank you received: 2
3 years 3 months ago #337140

Hi Nicolas,

thanks for the correction - and it makes sense to me now to have the li in Product_Description.

The new tab 'Detail' displays, but I also get the 'Specification' tab showing.
The custom field 'Tab2" is shown in the 'Specification' tab instead of 'Detail"
I have Specifications empty in Products for this item ( I had a related product listed here in the previous edit)

If you could point me in the right direction again, please.

Best,

Thomas

Here is the URL
valentinosafeco.com.au/index.php/hikasho...ng/product/25-bond-2

My edit:
?>
<div id="hikashop_product_bottom_part" class="hikashop_product_bottom_part show_tabular">
<div id="hikashop_tabs_div">
<ul class="hikashop_tabs_ul">
<?php if(!empty($description) || !empty ($this->element->product_url)) {
if(empty($selected)) $selected = 'hikashop_show_tabular_description'; ?>
<li id="hikashop_show_tabular_description_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_DESCRIPTION');?></li>
<li id="hikashop_show_tabular_custom_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('Detail');?></li>
<?php } ?>
<?php if(!empty($specif_tab_content)) {
if(empty($selected)) $selected = 'hikashop_show_tabular_specification'; ?>
<li id="hikashop_show_tabular_specification_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('SPECIFICATIONS');?></li>
<?php } ?>
<?php if(in_array($status_vote, array('comment', 'two', 'both'))) {
if(empty($selected)) $selected = 'hikashop_show_tabular_comment'; ?>
<li id="hikashop_show_tabular_comment_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_COMMENT');?></li>
<li id="hikashop_show_tabular_new_comment_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_NEW_COMMENT');?></li>

<?php } ?>
</ul>
<div class="hikashop_tabs_content" id="hikashop_show_tabular_custom">
<?php echo $this->element->Tab2;?>
</div>

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

  • Posts: 83402
  • Thank you received: 13496
  • MODERATOR
3 years 3 months ago #337152

Hi,

You have two issues:
- you've activated the display of the custom field for the product page. You want to turn that off since you're the one doing the display with your custom code. You can do that in the settings of the custom field and that will remove the "specifications" tab.
- you aren't using the correct column name for your custom field in your code. It's probably not Tab2 but something else. I would need a screenshot of the settings of the custom field to tell you.

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

Time to create page: 0.061 seconds
Powered by Kunena Forum