Jump to content

[SOLVED] how to show/hide tabs in product.tpl


ioanas

Recommended Posts

Hi,

 

I'm trying to hide tabs in product.tpl based on manufacturer id.

if manufacturer id =17 or 18 or 19 the i what the tab to be visible else i need it to be hidden

this is the code i whant to modify:

 

<ul id="more_info_tabs" class="idTabs idTabsShort clearfix">
{if $product->description}<li><a id="more_info_tab_more_info" href="#idTab1">{l s='More info'}</a></li>{/if}
{if $features}<li><a id="more_info_tab_data_sheet" href="#idTab2" class="selected">{l s='Data sheet'}</a></li>{/if}
        {if (isset($quantity_discounts) && count($quantity_discounts) > 0)}<li><a id="more_info_tab_quantity" href="#discount_tab">{l s='Quantity discount'}</a></li>{/if}
{if $attachments}<li><a id="more_info_tab_attachments" href="#idTab9">{l s='Download'}</a></li>{/if}
{if isset($product) && $product->customizable}<li><a href="#idTab10">{l s='Product customization'}</a></li>{/if}
{$HOOK_PRODUCT_TAB}
 
the tab i need to be hidden/visible based on manufacturer id is "#idTab1"

 

any help is much appreciated,

 

Best regards,

Bogdan

post-559237-0-00997400-1404136964_thumb.jpg

Link to comment
Share on other sites

hello

you can use if condition like:

 

{if $product->id_manufacturer!=19 || $product->id_manufacturer!=18 || $product->id_manufacturer!=17}

//do something

{/if}

 

code above means if product id_manufacturer is different than 19,18,16 - then display something (do something)

just paste there tabs & their contents :)

Link to comment
Share on other sites

hello

you can use if condition like:

 

{if $product->id_manufacturer!=19 || $product->id_manufacturer!=18 || $product->id_manufacturer!=17}

//do something

{/if}

 

code above means if product id_manufacturer is different than 19,18,16 - then display something (do something)

just paste there tabs & their contents :)

i cant make this work.

i'm sure i'm doing something wrong 

this is the link to my website product http://www.optiplaza.ro/rayban/2406-rayban-rb3016-w0365-51.html

 

i need to make the "INFORMATII" TAB HIDDEN when the product displayed is sunglasses, and visible when the product is contact lenses.

 

My contact lenses manufacturer id are 14, 15, 17. that's way i'm trying to use this to now when the "informatii" tab should be visible or not

<!-- description and features -->
{if (isset($product) && $product->description) || (isset($features) && $features) || (isset($accessories) && $accessories) || (isset($product) && $product->customizable) || (isset($HOOK_PRODUCT_TAB) && $HOOK_PRODUCT_TAB) || (isset($attachments) && $attachments)}
<div id="more_info_block" class="clear">
	<ul id="more_info_tabs" class="idTabs idTabsShort clearfix">
		{if $product->description}<li><a id="more_info_tab_more_info" href="#idTab1">{l s='More info'}</a></li>{/if}
		{if $features}<li><a id="more_info_tab_data_sheet" href="#idTab2">{l s='Data sheet'}</a></li>{/if}
        {if (isset($quantity_discounts) && count($quantity_discounts) > 0)}<li><a id="more_info_tab_quantity" href="#discount_tab">{l s='Quantity discount'}</a></li>{/if}
		{if $attachments}<li><a id="more_info_tab_attachments" href="#idTab9">{l s='Download'}</a></li>{/if}
		{if isset($product) && $product->customizable}<li><a href="#idTab10">{l s='Product customization'}</a></li>{/if}
		{$HOOK_PRODUCT_TAB}
	</ul>

the code above is from my website, i managed to hide the "INFORMATII" TAB but it hides from all products, sunglasses or/and contact lenses.

 

how can i make this to work?

 

Thanks

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

i manage to make it work. hope that i don't mess anything up.

i modified the code like this:

<!-- description and features -->
{if (isset($id_manufacturer) && $id_manufacturer) || (isset($product) && $product->description) || (isset($features) && $features) || (isset($accessories) && $accessories) || (isset($product) && $product->customizable) || (isset($HOOK_PRODUCT_TAB) && $HOOK_PRODUCT_TAB) || (isset($attachments) && $attachments)}
<div id="more_info_block" class="clear">
	<ul id="more_info_tabs" class="idTabs idTabsShort clearfix">
		<!--{if $product->description}<li><a id="more_info_tab_more_info" href="#idTab1">{l s='More info'}</a></li>{/if} -->
		{if $product->id_manufacturer ==14 || $product->id_manufacturer ==15 || $product->id_manufacturer ==17}<li><a id="more_info_tab_more_info" href="#idTab1">{l s='More info'}</a></li>{/if}
		{if $features}<li><a id="more_info_tab_data_sheet" href="#idTab2" >{l s='Data sheet'}</a></li>{/if}
        {if (isset($quantity_discounts) && count($quantity_discounts) > 0)}<li><a id="more_info_tab_quantity" href="#discount_tab">{l s='Quantity discount'}</a></li>{/if}
		{if $attachments}<li><a id="more_info_tab_attachments" href="#idTab9">{l s='Download'}</a></li>{/if}
		{if isset($product) && $product->customizable}<li><a href="#idTab10">{l s='Product customization'}</a></li>{/if}
		{$HOOK_PRODUCT_TAB}
	</ul>
	<div id="more_info_sheets" class="sheets align_justify">
	{if $product->id_manufacturer ==14 || $product->id_manufacturer ==15 || $product->id_manufacturer ==17}
		{if isset($product) && $product->description}
		<!-- full description -->
		<div id="idTab1" class="rte">{$product->description}</div>
		{/if}
	{/if}

if this is not the right way please leave a comment.

thanks vekia for your support

Link to comment
Share on other sites

i manage to make it work. hope that i don't mess anything up.

i modified the code like this:

<!-- description and features -->
{if (isset($id_manufacturer) && $id_manufacturer) || (isset($product) && $product->description) || (isset($features) && $features) || (isset($accessories) && $accessories) || (isset($product) && $product->customizable) || (isset($HOOK_PRODUCT_TAB) && $HOOK_PRODUCT_TAB) || (isset($attachments) && $attachments)}
<div id="more_info_block" class="clear">
	<ul id="more_info_tabs" class="idTabs idTabsShort clearfix">
		<!--{if $product->description}<li><a id="more_info_tab_more_info" href="#idTab1">{l s='More info'}</a></li>{/if} -->
		{if $product->id_manufacturer ==14 || $product->id_manufacturer ==15 || $product->id_manufacturer ==17}<li><a id="more_info_tab_more_info" href="#idTab1">{l s='More info'}</a></li>{/if}
		{if $features}<li><a id="more_info_tab_data_sheet" href="#idTab2" >{l s='Data sheet'}</a></li>{/if}
        {if (isset($quantity_discounts) && count($quantity_discounts) > 0)}<li><a id="more_info_tab_quantity" href="#discount_tab">{l s='Quantity discount'}</a></li>{/if}
		{if $attachments}<li><a id="more_info_tab_attachments" href="#idTab9">{l s='Download'}</a></li>{/if}
		{if isset($product) && $product->customizable}<li><a href="#idTab10">{l s='Product customization'}</a></li>{/if}
		{$HOOK_PRODUCT_TAB}
	</ul>
	<div id="more_info_sheets" class="sheets align_justify">
	{if $product->id_manufacturer ==14 || $product->id_manufacturer ==15 || $product->id_manufacturer ==17}
		{if isset($product) && $product->description}
		<!-- full description -->
		<div id="idTab1" class="rte">{$product->description}</div>
		{/if}
	{/if}

if this is not the right way please leave a comment.

thanks vekia for your support

 

it's allright :-)

topic marked as solved :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...