Skip to main content

Add tab on product page

More
10 years 8 months ago #225560 by webhelpus
Replied by webhelpus on topic Add tab on product page
Yep, that did the trick. Thank you. So how do I move the last two fields (the media fields) from the Specifications tab to the new tab? I only want those two in that tab and not appearing at all in the Specifications tab.

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

More
10 years 8 months ago #225592 by Xavier
Replied by Xavier on topic Add tab on product page
Hi,

You have to edit the view "product / show_block_custom_main" and in the foreach add a PHP check in order to not display the desired fields, a check like:
Code:
// right after the foreach line if(in_array($fieldName,array('CUSTOM_FIELD1','CUSTOM_FIELD2')) continue;
That way it will not be displayed in the specification tab, and to display it in the new tab, you have to edit the view "product / show_tabular" and in the div add code like:
Code:
echo $this->element->CUSTOM_FIELD1; echo $this->element->CUSTOM_FIELD2;

Where of course "CUSTOM_FIELD1" and "CUSTOM_FIELD2" must be replaced by the custom field column name.

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

More
10 years 8 months ago #225652 by webhelpus
Replied by webhelpus on topic Add tab on product page
I put this:
Code:
if(in_array($fieldName,array('sm_preview','sm_media')) continue;
right after
Code:
foreach ($this->fields as $fieldName => $oneExtraField) {
and before (and after)
Code:
$value = '';

and it broke the website.

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

More
10 years 8 months ago #225655 by webhelpus
Replied by webhelpus on topic Add tab on product page
Also, one of those echo lines is suppose to be restricted by group. It new shows up. How do I make it only seen by certain groups?

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

More
10 years 8 months ago #225653 by Jerome
Replied by Jerome on topic Add tab on product page
Hi,

If you have PHP errors ; please take a look at your PHP error log in order to have more details about your issue.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

More
10 years 8 months ago #225760 by webhelpus
Replied by webhelpus on topic Add tab on product page
After turning on all the error reporting this is what was reported:
Code:
Parse error: syntax error, unexpected 'continue' (T_CONTINUE) in /com_hikashop/product/show_tabular.php on line 33

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

More
10 years 8 months ago #225772 by Xavier
Replied by Xavier on topic Add tab on product page
Hi,

My bad, there is a missing parentheses in the given code, you have to use this one instead:
Code:
if(in_array($fieldName,array('sm_preview','sm_media'))) continue;

To restrict on a user group, you have to add check on the user like that:
Code:
$user = JFactory::getUser(); $groups = isset($user->groups) ? $user->groups : array(); if(in_array('X',$groups)){ }
Where X is the group id you want to apply the restriction.

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

More
10 years 8 months ago #225838 by webhelpus
Replied by webhelpus on topic Add tab on product page
Code:
if(in_array($fieldName,array('sm_preview','sm_media'))) continue;

It doesn't cause any errors, but it also doesn't remove the fields from the Specifications tab.
Code:
$user = JFactory::getUser(); $groups = isset($user->groups) ? $user->groups : array(); if(in_array('X',$groups)){ }

So how would you do multiple groups?

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

More
10 years 8 months ago #225867 by Xavier
Replied by Xavier on topic Add tab on product page
Hi,

1/ I just tried on my local to be sure, and the code:
Code:
if(in_array($fieldName,array('sm_preview','sm_media'))) continue;
Added tight after the code:
Code:
foreach ($this->fields as $fieldName => $oneExtraField) {
In the view:

product / show_block_custom_main

Correctly remove the display of the custom product fields from the specifications tab.

So please check that the name you use is the same than the table name in the custom field settings. Another thing, are we talking about custom product fields or custom item fields ? If it is custom item fields so the view to edit is:

product / show_block_custom_item


2/ To check if one of the user groups match to one of the set groups you can use the code:
Code:
$user = JFactory::getUser(); $groups = isset($user->groups) ? $user->groups : array(); if(in_array(array('X','Y'),$groups)){ }

Please note that these modifications are customizations, and we generally don't support this kind of requests.
If you are not a developer, you can post your customization request in the commercial jobs section of this forum :)

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

More
10 years 8 months ago #225943 by EnerW
Replied by EnerW on topic Add tab on product page
If you can live without the Hikashop standard Specification TAB you could just remove / suppress it in:

Display → Views → Select (the correct) Template → Select Product → show_tabular

and replace:

<?php if($hide_specs == 0){ ?>

by

<?php if($hide_specs == 1){ ?>

So just change 0 to 1 you should find this line of code twice around line 20 and 260

It's a better solution then the CSS hide option(s) since Hikashop will not display or send any unneeded information and an update will not break or overwrite it.

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

More
10 years 8 months ago #225945 by webhelpus
Replied by webhelpus on topic Add tab on product page
I appreciate all your help. So I got the first part working. The last two custom fields are not in the Specifications Tab. Thank you.

Last question on this subject.
What am I doing wrong?
Code:
<?php $user = JFactory::getUser(); $groups = isset($user->groups) ? $user->groups : array(); if(in_array(array('7','8','10','11'),$groups)){ echo $this->element->sm_media; } else {echo $this->element->sm_preview;}?>

What I want it to do is if the group is one of the above listed, then it displays the sm_media field. If not, then do the sm_preview field. It's just displaying the the sm_preview field.

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

More
10 years 8 months ago #225958 by aminweb
Replied by aminweb on topic Add tab on product page
hi,
How do we put the related products in tabular?

Joomla Developer | am.ebrahimzadeh[at]gmail.com

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

More
10 years 8 months ago #226035 by Xavier
Replied by Xavier on topic Add tab on product page
Hi,

@webhelpus: What is the type of your custom fields ? If it is product custom fields, so using your code should be working.
If it is "Item" fields, so you need to use code as in the "show_block_custom_item" view to display the fields.

@aminweb: To display related products in a tab, you can edit the view "product / show_tabular" and add code like:
Code:
<?php echo JHTML::_('content.prepare','{loadposition XX}'); ?>
The {loadposition XX} code is a Joomla feature, this allow to have a module in any content, so that way you can setup a related module and display it where you want. docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F

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

More
10 years 8 months ago #226147 by webhelpus
Replied by webhelpus on topic Add tab on product page
Both fields are Product custom fields. I've copied the code above and below so you can see where it is

Code:
<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> <?php if(!empty($this->element->extraData->bottomBegin)) echo implode("\r\n",$this->element->extraData->bottomBegin); ?> <div class="hikashop_tabs_content" id="listen"> <?php $user = JFactory::getUser(); $groups = isset($user->groups) ? $user->groups : array(); if(in_array(array('7','8','10','11'),$groups)){ echo $this->element->sm_media; } else {echo $this->element->sm_preview;}?> </div> <div class="hikashop_tabs_content" id="hikashop_show_tabular_description"> <div id="hikashop_product_description_main" class="hikashop_product_description_main"> <?php echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description)); ?> </div> <span id="hikashop_product_url_main" class="hikashop_product_url_main"> <?php if (!empty ($this->element->product_url)) { echo JText :: sprintf('MANUFACTURER_URL', '<a href="' . $this->element->product_url . '" target="_blank">' . $this->element->product_url . '</a>'); } ?> </span> </div>

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

More
10 years 8 months ago #226151 by Xavier
Replied by Xavier on topic Add tab on product page
Hi,

So you will have to do some debug, you can use the "var_dump" PHP function for that.
This can help you so see the groups of your user and so why the if condition is not respected.
Code:
var_dump($groups); // to see the groups of the current user var_dump($this->element->sm_media); // to see the content of this variable var_dump($this->element->sm_preview);

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

More
10 years 8 months ago - 10 years 8 months ago #226516 by aminweb
Replied by aminweb on topic Add tab on product page
hi xavier,
when add
Code:
<?php echo JHTML::_('content.prepare','{loadposition XX}'); ?>
in tab ,other tabs not show andd display error :

Notice: Undefined property: stdClass::$product_description in C:\wamp\www\ponisha\components\com_hikashop\views\product\tmpl\show_tabular.php on line 262


this my show_tabular.php bottom part code :
Code:
<div id="hikashop_product_bottom_part" class="hikashop_product_bottom_part show_tabular"> <div id="hikashop_tabs_div"> <ul class="hikashop_tabs_ul"> <li id="hikashop_show_tabular_description_li" class="hikashop_tabs_li ui-corner-top"><a onclick="displayTab('hikashop_show_tabular_description');" href="javascript:void(0);"><?php echo JText::_('PRODUCT_DESCRIPTION');?></a></li> <?php if($hide_specs == 0){ ?> <li id="hikashop_show_tabular_specification_li" class="hikashop_tabs_li ui-corner-top"><a onclick="displayTab('hikashop_show_tabular_specification');" href="javascript:void(0);"><?php echo JText::_('SPECIFICATIONS');?></a></li> <?php } if($status_vote == "comment" || $status_vote == "two" || $status_vote == "both" ){ ?> <li id="hikashop_show_tabular_comment_li" class="hikashop_tabs_li ui-corner-top"><a onclick="displayTab('hikashop_show_tabular_comment');" href="javascript:void(0);"><?php echo JText::_('PRODUCT_COMMENT');?></a></li> <li id="hikashop_show_tabular_new_comment_li" class="hikashop_tabs_li ui-corner-top"><a onclick="displayTab('hikashop_show_tabular_new_comment');" href="javascript:void(0);"><?php echo JText::_('PRODUCT_NEW_COMMENT');?></a></li> <?php } ?> <li id="hikashop_show_tabular_rahnema_li" class="hikashop_tabs_li ui-corner-top"><a onclick="displayTab('hikashop_show_tabular_rahnema');" href="javascript:void(0);"><?php echo JText::_('PRODUCT_RAHNEMA');?></a></li> <li id="hikashop_show_tabular_related_li" class="hikashop_tabs_li ui-corner-top"><a onclick="displayTab('hikashop_show_tabular_related');" href="javascript:void(0);"><?php echo JText::_('PRODUCT_RELATED');?></a></li> </ul> <?php if(!empty($this->element->extraData->bottomBegin)) echo implode("\r\n",$this->element->extraData->bottomBegin); ?> <div class="hikashop_tabs_content" id="hikashop_show_tabular_rahnema"> <div id="hikashop_product_rahnema_main" class="hikashop_product_rahnema_main"> <?php $this->setLayout('show_block_product_files'); echo $this->loadTemplate(); ?> </div> </div> <div class="hikashop_tabs_content" id="hikashop_show_tabular_related"> <div id="hikashop_product_related_main" class="hikashop_product_related_main"> <?php echo JHTML::_('content.prepare','{loadposition related}'); ?> </div> </div> <div class="hikashop_tabs_content" id="hikashop_show_tabular_description"> <div id="hikashop_product_description_main" class="hikashop_product_description_main"> <?php echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description)); ?> </div> <span id="hikashop_product_url_main" class="hikashop_product_url_main"> <?php if (!empty ($this->element->product_url)) { echo JText :: sprintf('MANUFACTURER_URL', '<a href="' . $this->element->product_url . '" target="_blank">' . $this->element->product_url . '</a>'); } ?> </span> </div> <?php if($hide_specs == 0){ ?> <div class="hikashop_tabs_content" id="hikashop_show_tabular_specification"> <?php $this->setLayout('show_block_dimensions'); echo $this->loadTemplate(); if(!empty($this->fields)){ $this->setLayout('show_block_custom_main'); echo $this->loadTemplate(); } ?> </div> <?php } if($status_vote == "comment" || $status_vote == "two" || $status_vote == "both" ){ ?> <form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form" id="hikashop_comment_form"> <?php if(!empty($this->element->extraData->bottomMiddle)) echo implode("\r\n",$this->element->extraData->bottomMiddle); ?> <div class="hikashop_tabs_content" id="hikashop_show_tabular_comment"> <div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing"> <?php echo $layout_vote_listing; ?> </div> </div> <div class="hikashop_tabs_content" id="hikashop_show_tabular_new_comment"> <div id="hikashop_product_vote_form" class="hikashop_product_vote_form"> <?php echo $layout_vote_form; ?> </div> </div> </form> <?php } ?> <input type="hidden" name="selected_tab" id="selected_tab" value="hikashop_show_tabular_description"/> <?php if(!empty($this->element->extraData->bottomEnd)) echo implode("\r\n",$this->element->extraData->bottomEnd); ?> </div> </div>

other quest...!

how can I simillar description main duplication? means : i want two description main form => 1-description 2-other description
and show both in produst page

Joomla Developer | am.ebrahimzadeh[at]gmail.com
Last edit: 10 years 8 months ago by aminweb.

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

More
10 years 8 months ago #226524 by Xavier
Replied by Xavier on topic Add tab on product page
Hi,

To have two descriptions for one product, you can create a custom product field.
Then thanks to code like given in previous posts, you can display the desired descriptions where you want on the product page.

www.hikashop.com/support/documentation/4...shop-field-form.html

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

More
10 years 8 months ago - 10 years 8 months ago #226624 by aminweb
Replied by aminweb on topic Add tab on product page
hi Xavier,
First, thank you for your efforts.
how can meta description form change to WYSIWYG editor? (It is essential)
and displaye in produact page tabullar, simiilar description,comment,...
Please explain in detail,very thanks

Joomla Developer | am.ebrahimzadeh[at]gmail.com
Last edit: 10 years 8 months ago by aminweb.

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

More
10 years 8 months ago #226636 by Jerome
Replied by Jerome on topic Add tab on product page
Hi,

If you have questions which are not related on "add tab on product page" (the title of that thread) ; please create a new thread.

Thanks for your understanding.

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: aminweb

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

More
10 years 8 months ago #227051 by aminweb
Replied by aminweb on topic Add tab on product page
related post : www.hikashop.com/forum/product-category-...html?start=40#226035

when add code for show related product in tab,Don`t worked Characterist variant
attach file : show_tabullar.php

This attachment is hidden for guests.
Please log in or register to see it.

Joomla Developer | am.ebrahimzadeh[at]gmail.com

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

Time to create page: 0.303 seconds
Powered by Kunena Forum