Skip to main content

Notice: Trying to get property of non-object

12 years 5 months ago #158471 by Flooder
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.

12 years 5 months ago #158475 by Jerome
Hi,

Which HikaMarket front-edition version number are you using ?

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

12 years 5 months ago #158478 by Flooder
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.

12 years 5 months ago #158572 by Jerome
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.
The following user(s) said Thank You: Flooder

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

12 years 5 months ago #159758 by lousyfool
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.

12 years 5 months ago #159773 by Jerome
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).
Code:
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.

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

12 years 5 months ago #159775 by lousyfool
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.063 seconds
Powered by Kunena Forum