Navigation on votes / comments is causing errors

  • Posts: 14
  • Thank you received: 0
12 years 1 week ago #75146

I am having errors when I try to use the navigation links at the bottom
of the votes/comments display.

When I go to...
HikaShop > System > Configuration > Vote

under "Vote & Comment" I have
Display vote in products page --Yes
Choose which module you want to enable --Vote & Comment connected

The votes/comments seem at first to be fine, but when I try to see the
rest of the votes using the navigation at the bottom (1,2,Next,End, etc.)
I get a bunch of error messages like:


Notice: Undefined property: stdClass::$product_page_title
in (my joomla site)/components/com_hikashop/views/product/view.html.php on line 941

Notice: Undefined property: stdClass::$product_meta_description
in (my joomla site)/components/com_hikashop/views/product/view.html.php on line 942

Notice: Undefined property: stdClass::$product_keywords
in (my joomla site)/components/com_hikashop/views/product/view.html.php on line 943


Here are those lines of code in that file:

if(!empty($this->element->main)){
$product_name = $this->element->main->product_name;
$product_page_title = $this->element->main->product_page_title; // line 941
$product_description = $this->element->main->product_meta_description; // line 942
$product_keywords = $this->element->main->product_keywords; // line 943
}


I only see these error messages when I'm trying to navigate through these comments/votes.

Anyone have an idea on how to solve the problem?

Thanks.

Last edit: 12 years 1 week ago by tumbleweed.

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

  • Posts: 13201
  • Thank you received: 2322
12 years 1 week ago #75233

Hi,

Try to replace the code:

if(!empty($this->element->main)){
$product_name = $this->element->main->product_name;
$product_page_title = $this->element->main->product_page_title; // line 941
$product_description = $this->element->main->product_meta_description; // line 942
$product_keywords = $this->element->main->product_keywords; // line 943
}
By:
if(!empty($this->element->main)){
$product_name = $this->element->main->product_name;
$product_page_title = @$this->element->main->product_page_title; // line 941
$product_description = @$this->element->main->product_meta_description; // line 942
$product_keywords = @$this->element->main->product_keywords; // line 943
}

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

  • Posts: 14
  • Thank you received: 0
12 years 1 week ago #75319

Thanks for the reply Xavier...

I made the changes you mentioned... those errors went away,
but there are more beside these. I went ahead and applied
your "swallow the error" approach until I could finally use
the navigation and not receive any errors.

The problem is that this didn't really solve my problem. These
errors (although now hidden) are keeping other things from working.
As long as you don't try to page through the comments, the site
seems to work fine.

As an example, earlier you helped me to place content next to a
select box. Here's that thread if you want to refer to it.

The error that I am now getting is...

Notice: Undefined offset: 10
in (my joomla site)/templates/yoo_tasty/html/com_hikashop/product/show_block_characteristic.php on line 15

I've place an '@' in there as well to avoid the error message.
Here is that portion of code:

<?php
if (!empty ($this->element->characteristics)) {
?><div id="hikashop_product_characteristics" class="hikashop_product_characteristics"><?php
  echo $this->characteristic->displayFE($this->element, $this->params);
  if (@$this->element->characteristics[10]) {

The last line showing is the line 10 that it mentions.

That line allows me to know when the select box for 'Please Select Size' appears
on the page. I placed additional content to the right of this select box.

With the '@' applied, my additional content is displayed unless you try to see the
rest of the comments and votes)

Anyway, what I'm saying is that everything seems to work with the site UNTIL you try
to page through the comments... As soon as you try to see more of the comments/votes,
that is when problems come up.

Last edit: 12 years 1 week ago by tumbleweed.

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

  • Posts: 13201
  • Thank you received: 2322
12 years 4 days ago #75821

Hi,

That's because the characteristic id change from on page to another page, try to replace the code in the view "show_block_characteristic" to:

<?php
JHTML::_('behavior.tooltip');
if (!empty ($this->element->characteristics)) {
?><div id="hikashop_product_characteristics" class="hikashop_product_characteristics"><?php
	echo $this->characteristic->displayFE($this->element, $this->params);
	foreach($this->element->characteristics as $characteristic){
		if($characteristic->characteristic_parent_id == 10){
			echo "<span style='position:relative;top:-18px; left: 100px;'>";
			echo JHTML::tooltip('This is the tooltip text', 'Tooltip title', 'tooltip.png', '', 'http://www.joomla.org');
			echo "</span>";
		}
	}
?></div><?php
}
?>

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

  • Posts: 14
  • Thank you received: 0
12 years 4 days ago #75901

I applied the change you mentioned (although now I am using just a link instead of a tooltip),
and at least that part is solved now. Thank you.

Applying the change that you mentioned is keeping the link present along side of the SELECT
dropdown box all the time. This is great.


Now, back to the topic of this thread...

I still need to find out why navigating the reviews/comments is causing problems.

Here is my current problem:

If I go straight to the product page and choose size and color, the 'add to cart' button
appears. This seems fine.

However, if I page through the comments/reviews of this product, the 'add to cart' button
goes away and stays away even with the size and color selected. Once I click on any of the
navigation links at the bottom of the comments, I am no longer able to see the add to cart
button, no matter what I try.

After I navigate through the reviews, I must start the product selection fresh with a new
page request before the color and size selections will cause the 'add to cart' button to
appear again.

I was getting errors displayed to me earlier after clicking on the comments navigation
links. I applied the '@' to specific variables in files that were specified in the errors.
Now I don't see any of the errors, but I am pretty sure they are still being generated.

Do you have any ideas why navigating the reviews/comments might be causing problems?

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

  • Posts: 13201
  • Thank you received: 2322
12 years 3 days ago #76143

Hi,

I have reproduce the problem on my end, indeed the quantity is affected when we change the page of the comments listing.

I am looking for a solution.

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

  • Posts: 13201
  • Thank you received: 2322
12 years 3 days ago #76150

Hi again,

I find a solution, edit the view "product / show" in HikaShop > Display > Views and add the code:

<form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">
	<div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
		<?php
		if($this->params->get('show_vote_product')){
			//LAYOUT listing of the comments for this 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
			//LAYOUT form to send a comment & vote
			$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>
	<input type="hidden" name="add" value="1"/>
	<input type="hidden" name="ctrl" value="product"/>
	<input type="hidden" name="task" value="show"/>
	<input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>
Just after the code: "</form>"

Then edit the view "product / show_default" and remove the code:
	<div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
		<?php
		if($this->params->get('show_vote_product')){
			//LAYOUT listing of the comments for this 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
			//LAYOUT form to send a comment & vote
			$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>

And the last modification is in the file "vote / listing", replace:
$this->pagination->form = '; document.hikashop_product_form.task.value=\'show\'; document.hikashop_product_form.action=\''.hikashop_currentURL().'\'; document.hikashop_product_form';
By:
$this->pagination->form = '; document.hikashop_comment_form';

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

  • Posts: 14
  • Thank you received: 0
12 years 2 days ago #76275

Hello,

When I made the change to product/show it added more stars.




My product/show_default doesn't seem to match what you gave me.

Let me attach my versions of the 3 views that you mentioned,
and see if that helps.

File Attachment:

File Name: orig-product-show.txt
File Size:14 KB

File Attachment:

File Name: orig-produ...ault.txt
File Size:9 KB

File Attachment:

File Name: orig-vote-listing.txt
File Size:9 KB

Attachments:
Last edit: 12 years 2 days ago by tumbleweed.

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

  • Posts: 13201
  • Thank you received: 2322
12 years 2 days ago #76324

Hi,

I don't see why more stars appears, because the modifications just moves some code from one view to another one.
Could you do the modifications again, and give me a link to your website ?

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

  • Posts: 14
  • Thank you received: 0
12 years 2 days ago #76377

I sent you a PM.

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

  • Posts: 13201
  • Thank you received: 2322
12 years 2 days ago #76391

Could you try to replace the content of your views by the content of the following files ?

Don't forget to save your files before, we never know.


File Attachment:

File Name: orig-product-show.txt
File Size:14 KB


File Attachment:

File Name: orig-produ...ault.txt
File Size:9 KB


File Attachment:

File Name: orig-vote-listing.txt
File Size:9 KB

Attachments:

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

  • Posts: 14
  • Thank you received: 0
12 years 2 days ago #76424

Hey Xavier,

I think that fixed it!

I can make the selections, and the add to cart button will appear.

If I then navigate through the comments, the add to cart button
disappears and the selections are reset.

I can then go and make my selections again and the add to cart
button appears again.

I think it is working correctly now.

Thank you.

Last edit: 12 years 2 days ago by tumbleweed.

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

Time to create page: 0.102 seconds
Powered by Kunena Forum