jcomments in tabber on product page

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #68939

I looked up this thread : www.hikashop.com/en/forum/5-support-en-f...un-onglet.html#49818

Do I get this right - I can not put jcomments into a tab with tabber?

Regards,

Thomas

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 1 month ago #69039

It's not impossible. Other users are doing it.
For that you will have to modify the code of the "show" file of the "product" view as explained here:
www.hikashop.com/en/forum/4-how-to/52260...on-product-page.html

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69072

Hi Nicolas,

so if I understand this right the code change would put the taps on the product page by default.

I am already displaying tabs on the product page by simply inserting the tabber syntax into the product description - that is really easy.

www.juzodesign.com/index.php/shop/produc...wool-and-velvet-vest

At the body of the product page jcomments is listed and this is the part that I want in a tab. Your code change is the way to do this?

Thomas

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 1 month ago #69073

Yes, to have comments in tabs, you should not use tabs in the description but in the layout code as explained in the link I gave.

The following user(s) said Thank You: thomas.boepple

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69078

Hello again Nicolas,

I am still a little bit confused about the details.
I am editing the show.php file from the product view of my template's front end - correct?

I can not find the string
<div id="hikashop_product_description_main" class="hikashop_product_description_main">
in this file

also can not find string
<?php
$this->setLayout('show_block_product_files');


I can find
<div class="hikashop_submodules" id="hikashop_submodules" style="clear:both">
<?php

if (!empty ($this->modules) && is_array($this->modules)) {
jimport('joomla.application.module.helper');
foreach ($this->modules as $module) {
echo JModuleHelper :: renderModule($module);
}
}
?>
</div>


in line 284 - 293

so where in product/show.php am I to insert the tabber syntax?

I have attached the show.php file as is at the moment

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69079

Or am I editing show_default.php ?

I guess that is the one to change?

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69081

so these are the changes I did - and I think I followed the example of the link you provided

<div id="hikashop_product_bottom_part" class="hikashop_product_bottom_part">
{tab=Portrait}
<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 id="hikashop_product_quantity_main" class="hikashop_product_quantity_main">
<?php
$this->row = & $this->element;
$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';
$this->setLayout('quantity');
echo $this->loadTemplate();
?>
</div>
<span id="hikashop_product_price_main" class="hikashop_product_price_main">
<?php
if ($this->params->get('show_price')) {
$this->row = & $this->element;
$this->setLayout('listing_price');
echo $this->loadTemplate();
}
?>
</span>
</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>
{tab=Shipping}
<?php
$this->setLayout('show_block_product_files');
echo $this->loadTemplate();
?>
<div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
<?php
if($this->params->get('show_vote_product')){
$js = '';
if(isset($this->element->main)){
$product_id = $this->element->main->product_id;
}else{
$product_id = $this->element->product_id;
}
$this->params->set('product_id',$product_id);
echo hikashop_getLayout('vote', 'listing', $this->params, $js);
?>
</div>
<div id="hikashop_product_vote_form" class="hikashop_product_vote_form">
<?php
$js = '';
if(isset($this->element->main)){
$product_id = $this->element->main->product_id;
}else{
$product_id = $this->element->product_id;
}
$this->params->set('product_id',$product_id);
echo hikashop_getLayout('vote', 'form', $this->params, $js);
}
?>
</div>
{tab=Comments}
<div class="hikashop_submodules" id="hikashop_submodules" style="clear:both">
<?php

if (!empty ($this->modules) && is_array($this->modules)) {
jimport('joomla.application.module.helper');
foreach ($this->modules as $module) {
echo JModuleHelper :: renderModule($module);
}
}
?>
</div>
</div>




and this is the front end view I get
www.juzodesign.com/index.php/shop/produc...velvet-vest#shipping

the top tabs are still from the syntax in the field description from backend - but the tabs underneath dont work either.
Also, the module in the tab is the related items and not jcomments, which is still at the bottom.

So how do I do it properly?

3 Tabs - description - text - text - jcomments


Regards,

Thomas

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69082

4 tabs of course :) haha

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69206

I will have to revert back to the view I had originally for now - it looks too off.

So Nicolas, the placement of the first tabber tag works great - it displays the contents of description including cart button and price.

Issues:
1.)Jcomments does not show up in a tab
2.)I get an error message
Warning: trim() expects parameter 1 to be string, array given in /...URL/libraries/joomla/registry/format/json.php on line 59

What I would like:
Tab #2 (shipping) should display custom text - I state free shipping if it applies
Tab #3 (size chart) then is a size chart.
Tab #4 (comments) I would like to have the jcomments contents.

The 'related items' module I would like to leave out of a tab - as is on the bottom of the product page.

1. how do I include the string that calls just the jcomments but not the related article
2. how do I have tabs that let me enter text on an individual basis

It would be great if you could help me with this.

Kind regards,

Thomas

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 1 month ago #69404

Hi,

It's normal that jcomments does not show up in a tab with the way you did it.
As I said, you would have to also edit the file "show" of the view "product". That's where jcomments is called:

$config = & hikashop_config();
if ($config->get('comments_feature') == 'jcomments') {
	$comments = HIKASHOP_ROOT . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
	if (file_exists($comments)) {
		require_once ($comments);
		if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name)){
			$product_id = $this->element->main->product_id;
			$product_name = $this->element->main->product_name;
		}else{
			$product_id = $this->element->product_id;
			$product_name = $this->element->product_name;
		}
		echo JComments::showComments($product_id, 'com_hikashop', $product_name);
	}
}
The simplest will be to remove the external comments block of code from the show file and add it inside your tabs in the show_default view file.

I don't see any warning on your page.

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69745

Hello Nicolas,

yes I understand this and it makes sense to me.
I edited the default_view accordingly

this is the code:

{tab=Portrait}
<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>

<?php
$this->setLayout('show_block_product_files');
echo $this->loadTemplate();
?>
<div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
<?php
if($this->params->get('show_vote_product')){
$js = '';
if(isset($this->element->main)){
$product_id = $this->element->main->product_id;
}else{
$product_id = $this->element->product_id;
}
$this->params->set('product_id',$product_id);
echo hikashop_getLayout('vote', 'listing', $this->params, $js);
?>
</div>
<div id="hikashop_product_vote_form" class="hikashop_product_vote_form">
<?php
$js = '';
if(isset($this->element->main)){
$product_id = $this->element->main->product_id;
}else{
$product_id = $this->element->product_id;
}
$this->params->set('product_id',$product_id);
echo hikashop_getLayout('vote', 'form', $this->params, $js);
}
?>
</div>
{tab=comments}
$config = & hikashop_config();
if ($config->get('comments_feature') == 'jcomments') {
$comments = HIKASHOP_ROOT . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
if (file_exists($comments)) {
require_once ($comments);
if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name)){
$product_id = $this->element->main->product_id;
$product_name = $this->element->main->product_name;
}else{
$product_id = $this->element->product_id;
$product_name = $this->element->product_name;
}
echo JComments::showComments($product_id, 'com_hikashop', $product_name);
}
}

</div>





I thought this should now display 2 tabs, one with the description and the other with the comments.
Anyway, nothing has changed on the front end view and I am very confused by that.

I have cleared the cache of the site.
This is the URL of a product page that loads default view, which should now have the tabs - but it looks just like before:
www.juzodesign.com/index.php/shop/produc...aux-chenille-cushion

and this is one where the tabs syntax is still in the description field.
www.juzodesign.com/index.php/categories/...wool-and-velvet-vest

As you can see both are not effected by the changes in the default_view.php

I don't get it.

What do you think I do wrong?

Thanks,

Thomas

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69747

Got the php to work and this is what it is doing:

www.juzodesign.com/index.php/shop/produc...lle-cushion#comments

it displays the string that pulls the comments in the comments tab as code.
The comments at the bottom are still there because I did not remove them in the show.php yet.

How do I get the comments to show as comments and not as code?

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

  • Posts: 72
  • Thank you received: 2
12 years 1 month ago #69755

I inserted the whole jcomments block including div tags and now it works

this is the code:
<div class="hikashop_external_comments" id="hikashop_external_comments" style="clear:both">
<?php
$config = & hikashop_config();
if ($config->get('comments_feature') == 'jcomments') {
$comments = HIKASHOP_ROOT . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
if (file_exists($comments)) {
require_once ($comments);
if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name)){
$product_id = $this->element->main->product_id;
$product_name = $this->element->main->product_name;
}else{
$product_id = $this->element->product_id;
$product_name = $this->element->product_name;
}
echo JComments::showComments($product_id, 'com_hikashop', $product_name);
}
}
elseif ($config->get('comments_feature') == 'jomcomment') {
$comments = HIKASHOP_ROOT . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php';
if (file_exists($comments)) {
require_once ($comments);
if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name))
$product_id = $this->element->main->product_id;
else
$product_id = $this->element->product_id;
echo jomcomment($product_id, 'com_hikashop');
}
}
?>
</div>


Thank you very much Nicolas for helping me with this.

I have now the descriptions and the comments in a tab as I wanted, so that is great.

Now comes the next question - how can I add a tab to display custom text when needed.
What I mean is - some products need 2 tabs - like I have now - and some products need 3, or even 4 tabs and the input into the tab is custom.
Do I have to add a custom field or how do you suggest going about this?

Thomas

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 1 month ago #69905

Yes, you should add a custom product field and then add a check in your show_default view file:

if(!empty($this->element->my_custom_field)){
echo '{tab=comments}'.$this->element->my_custom_field;
}

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

  • Posts: 72
  • Thank you received: 2
11 years 11 months ago #81003

Only today I noticed that jcomments in tabber will not execute.
If I click ' send' nothing happens.

jcomments in an ordinary article works fine.
I must admit that I did not test functionallity when I set up jcomments in tabber for Hikashop.

Any ideas what is stopping it from executing?

Thomas

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

  • Posts: 72
  • Thank you received: 2
11 years 11 months ago #81004

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 11 months ago #81338

I can see that the POST request is sent on your page when you click on submit for the comment but nothing is returned by jcomments on the server. So it seems to be something related to jcomments, not hikashop. You might want to contact jcomments support about that.

Also, note that we have our own commenting system integrated in HikaShop so you can always use that as an alternative.

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

Time to create page: 0.084 seconds
Powered by Kunena Forum