Wishes module - Call to a member function displayButton() on null

  • Posts: 353
  • Thank you received: 14
3 years 7 months ago #256198

-- HikaShop version -- : 2.6.4

Hi today hikashop upgraded to latest archive from today and the wishes module gives the following error: Error displaying the error page: Call to a member function displayButton () on null: Call to a member function displayButton () on null. The previous archive was no problem.
template: Gantry 5.3.9 / hydrogen 5.3.9
Displayed somewhere here's the problem:
echo $this->cartHelper->displayButton($displayText, 'wishlist', $this->params, hikashop_completeLink('cart&task=showcart&cart_id=' . $this->element->cart_id . $this->cart_itemid . '&cart_type='.$this->cart_type), 'window.location.href = \''.hikashop_completeLink('cart&task=showcart&cart_id='.$this->element->cart_id . $this->cart_itemid . '&cart_type='.$this->cart_type).'\';return false;');

Attachments:
Last edit: 3 years 7 months ago by neo191987.

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

  • Posts: 24228
  • Thank you received: 3743
  • MODERATOR
3 years 7 months ago #256208

Hi,

You're displaying the view "product / cart".
Your problem is related to the variable "cartHelper" which should be an object but which is currently "null" in your case.

If we take a look at the "view.html.php" file for "product", we can see that code in the function "cart" (function called just before the display of the view), line 2216:

		$cartHelper = hikashop_get('helper.cart');
		$this->assignRef('cartHelper', $cartHelper);
		$this->cart = $this->cartHelper;
So the cart helper is right loaded by HikaShop and right assigned as reference for the view.

Now, the first possibility is that your helper cart file is missing.
The second possibility is that you have something in your website which interact with HikaShop and remove that reference.

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.

  • Posts: 353
  • Thank you received: 14
3 years 7 months ago #256249

Hi I compared the old and the new file and the difference is:
if($cart_id){
$cartInfo = $cartClass->loadCart($cart_id);
$currUser = hikashop_loadUser(true);
$session = JFactory::getSession();
if(@$currUser->user_cms_id != $cartInfo->user_id && $session->getId() != $cartInfo->session_id){
$notice_html = '';
$this->assignRef('notice_html', $notice_html);
return;
}
}

If you remove the line: return; - already working but do not know if Incorrect be removed.

Last edit: 3 years 7 months ago by neo191987.

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

  • Posts: 69999
  • Thank you received: 10483
  • MODERATOR
3 years 7 months ago #256287

Hi,

Thanks for the feedback.
That's a security check we've added and is necessary.
Removing the return is not a good solution.
It's better to move the code that Jerome pointed at before the code you pointed at.
It will avoid the fatal error and will keep the security check working properly.
I've done the change on our end in the install package available on our website.

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

  • Posts: 353
  • Thank you received: 14
3 years 7 months ago #256293

Hi this problem disappeared but after a short test already has several other problems:
1. Product information (such as name, image, delete button and etc.) no longer appear in module - Wishes.
2. If you go to another page module Wishes will display that no products, although there are.

Last edit: 3 years 7 months ago by neo191987.

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

  • Posts: 69999
  • Thank you received: 10483
  • MODERATOR
3 years 7 months ago #256301

Hi,

This indicates that the code is not able to load the content of the cart.
You're talking about the "wishes" module, so I assume that you're talking about a wishlist module.
I's possible that the type set to load the data is not correct.
Try adding the line:
$cartClass->cart_type = $cart_type;
before the line:
$cartInfo = $cartClass->loadCart($cart_id);
in that view.html.php file.
That will force the type of the cart and should hopefully fix that.

The following user(s) said Thank You: neo191987

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

  • Posts: 353
  • Thank you received: 14
3 years 7 months ago #256324

Great all is well now. Can you fix the archives of Hikashop.

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

  • Posts: 24228
  • Thank you received: 3743
  • MODERATOR
3 years 7 months ago #256327

Hi,

The patch is already commit for the current release.

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.
The following user(s) said Thank You: neo191987

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

  • Posts: 23
  • Thank you received: 0
  • Hikashop Business
3 years 7 months ago #256727

Hi,
thanks for this patch it has also solved my ERR 0 - Call to a member function displayButton() on null.

But now if I change my cart to o wishlist and I go back with the ('HIKA_BACK') button there will occure the next ERR because the wishlist is emty.

ERR_CACHE_MISS
(same in Chrome and Firefox)

components\com_hikashop\views\cart\tmpl\showcart.php line: 124
<a href="#" onclick="history.back(); return false;">
<span class="icon-32-back" title="<?php echo JText::_('HIKA_BACK'); ?>"></span> <?php echo JText::_('HIKA_BACK'); ?>
</a>

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

  • Posts: 69999
  • Thank you received: 10483
  • MODERATOR
3 years 7 months ago #256731

Hi,

I'm not able to reproduce the problem on my end.
I've also tried to look for information about that error online but I couldn't find any conclusive thing.

Note that with HikaShop 3 which will be released in the next few weeks, we'll have a whole new cart/wishlist system and it should prevent strange issues like that.

The following user(s) said Thank You: CarlosC

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

Time to create page: 0.086 seconds
Powered by Kunena Forum