Notice: Trying to get property of non-object

  • Posts: 263
  • Thank you received: 11
10 years 6 months ago #158471

Hello there,

In my random products module, when i enable joomla debug mode, I get many messages like :
Notice: Trying to get property of non-object in /home/lapagept/public_html/pt4/administrator/components/com_hikamarket/classes/discount.php on line 220

One message for each product in the module I believe...

Bye

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
10 years 6 months ago #158475

Hi,

Which HikaMarket front-edition version number are you using ?

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: 263
  • Thank you received: 11
10 years 6 months ago #158478

lapagept.com
Hikashop 2.3.1
Joomla 3.3.0
Hikamarket 1.4.0

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
10 years 6 months ago #158572

Bonjour,

Merci de télécharger HikaMarket 1.4.1, le problème a été corrigé dans cette version.
La mise à jour automatique d'HikaMarket 1.4.1 devrait être activée prochainement.

Cordialement,


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

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

  • Posts: 2143
  • Thank you received: 747
10 years 6 months ago #159758

Hi Jerome,

Found this thread after taking a quick look at my php_error.log, where I have many lines with the same notice - even after I had installed 1.4.1.

At this point I can't tell what triggers it. Any idea what to do?

Thanks!


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
10 years 6 months ago #159773

Hi,

The problem has been fixed for HikaMarket front-end (where the discounts should not be managed by HikaMarket, there is no vendor filter to apply).
But I could reproduced the problem in my local website, I have some idea of what could happend but I can't reproduce it.

Can you please try this code (which will replace the onSelectDiscount one).

public function onSelectDiscount(&$product, &$discountsSelected, &$discounts, $zone_id, &$parent) {
	$vendor_id = (int)$product->product_vendor_id;
	if($vendor_id == 0 && !empty($parent))
		$vendor_id = (int)$parent->product_vendor_id;

	foreach($discountsSelected as &$discountSelected) {
		$this->recursiveSelectDiscount($vendor_id, $discountSelected);
	}
	unset($discountSelected);
}

protected function recursiveSelectDiscount($vendor_id, &$discounts) {
	foreach($discounts as $k => $v) {
		if(is_array($v)) {
			$this->recursiveSelectDiscount($vendor_id, $discounts[$k]);
			if(empty($discounts[$k]))
				unset($discounts[$k]);
		} else {
			$discount_target = (int)$v->discount_target_vendor;
			if($discount_target > 1 && $vendor_id != $discount_target)
				unset($discounts[$k]);
			if($discount_target == 0 && $vendor_id > 1)
				unset($discounts[$k]);
		}
	}
}
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: 2143
  • Thank you received: 747
10 years 6 months ago #159775

Ok, used your code to replace the "old" onSelectDiscount block, and no more notices.

You might be well aware of it, but BTW, meanwhile I had figured that the notices were written into the log whenever I loaded a product listing page with discounted products - one line of notice for each discounted product.

Guess I'll leave the new code in... ;)

Merci!


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

Moderators: Obsidev
Time to create page: 0.075 seconds
Powered by Kunena Forum