Ticket #26003 - Notice "country" on module "pkfavorites"
Hello,
I bought Alysum theme 9.0.0. I have notices with pkfavorites theme on homepage, I use Jewelry template:
Notice: Trying to get property ‘country’ of non-object
in Module.php line 2426
at ModuleCore→getCacheId()in DisplayProductButton.php line 49
at DisplayProductButton→init()in pkfavorites.php line 140
at Pkfavorites→executeHook()in pkfavorites.php line 101
at Pkfavorites→hookDisplayProductButton()in Hook.php line 1007
Regards,
Aude.
Comments
Hi, Aude C.
What prestashop version do you use?
Hi,
I use PrestaShop 1.7.8.11.
Regards,
Aude
Ok, where I can see that error? Because I can't find it
Hi,
You need to active debug mode or to check error logs to see it.
You can see it in my screenshot attached.
I toke it on home page : http://ps17811.stbh8010.odns.fr/
But, I need to enable debug mode today before 6PM. You can set it this evening or tomorrow.
Regards,
Aude
Attachments:
Yes, I see now.
I assume you have added favorites module to a page in a wrong way, like through the "module" widget. Can you check that?
Hi,
I set favorites module with Elementor, please see scrennshot.
But, when I remove this widget, I always have notice "country".
Attachments:
It looks like a cache, have you tried to clear it?
As for that widget it can be used on Product page only. I know that's confusing. We will try to make that more clear
Hi,
I will want to add a favorite widget in header (with a badge with favorites number) and a link to access to favorites list, is it possible?
But this error occures even if the favorite widget is removed and I removed all other widget except navigation and logo from my header.
I think it's other thing that create this notice.
I see this hook when Debug Mode is enabled https://mega.nz/file/tcIHVJYT#vQh5XHbDExiwOyuBxUwk3D8TlqJnzNQfwYC0AnYAurw and there is no such hook in the theme by default. How did you add it and which modules are hooked there?
Hi,
I don't find this hook in all of files (I use a grep search)… But, more strange, this hook have a random name! Please, see my new screenshot: now it looks for "displayProductButton1".
I didn't install module on this test website. Only your theme.
So, 2 options:
- it comes from your theme
OR
- it comes from a PrestaShop module
This hook name is created dynamically.
Attachments:
But it's a cache call with product ID (so the 1 or 2 comes from a product ID), I think this hook is called here:
/modules/pkfavorites/src/Hooks/DisplayProductButton.php line 49