How to change order of comments and related produc

  • Posts: 44
  • Thank you received: 7
  • Hikashop Business
10 years 7 months ago #188170

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6

Hello,
How can I change order of comments on product? I want to change order of related products and comments – related product first, comments second – comments after related products.
I have edited a product / show.php file. When I had changed order of code that you see below, comment form was moved after related product, but when I add a comment, product ID was not assigned, so my new comment was displayed on every product in shop. I also see that parm “hikashop_vote_ref_id” after that change is null.



<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>

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

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #188207

Hi,

That's potentially because the value is edited in the module.
What can be done is to add this code before the submodules one:

			if(isset($this->element->main)){
				$product_id = $this->element->main->product_id;
			}else{
				$product_id = $this->element->product_id;
			}
$tmpVar = $product_id;

And in the comment part, replace:
			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);
By:
$this->params->set('product_id',$tmpVar);

The following user(s) said Thank You: Bprak

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

  • Posts: 44
  • Thank you received: 7
  • Hikashop Business
10 years 7 months ago #188927

Hi, thank You for help, it is working! I replace code in two places in thaht script

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

Time to create page: 0.054 seconds
Powered by Kunena Forum