Post by parkookk » Tue Nov 01, 2022 8:12 pm

Hi, my website has been functioning well for a long time and now realised that when I click on the Special link on the footer I get the following errors.

Notice: Trying to access array offset on value of type bool in product/special.php on line 84 ...... to product/special.php on line 124

Is this the problem of OC3.0.3.1 and why is this happening? And how can I fix it?

Many thanks,
Morty
Last edited by parkookk on Fri Mar 31, 2023 6:54 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by ADD Creative » Tue Nov 01, 2022 8:28 pm

Could be cause by an extension that modifies getProduct() in catalog/model/catalog/product.php. What theme and extensions are you using? Try disabling them one by one to see if one is causing the error.

It also looks like you have display errors on. You should never have error display on on a live production site.

You need make sure display errors in set to off in all 3 places. Your PHP settings, in system/config/default.php and in the settings. Not only can this cause minor notices and warnings to cause bigger errors, as you have seen, it can also be a security risk.

1. In your PHP settings make sure display_errors is set to Off. Use phpinfo() to check. It should be off by default, but there are lots of rubbish hosts out there.

2. In system/config/default.php set error_display to false.

3. In your OpenCart Setting on the server tab set Display Errors to No.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by parkookk » Tue Nov 01, 2022 9:31 pm

Many thanks, very valuable advice about the errors display!

I still get the same error in system maintenance settings after viewing the special page event after disabling all the extensions, refreshing all the cache and clearing all the logs.

I've checked the phpinfo.php and all the error displays are disabled now, then deleted the phpinfo.php.
Last edited by parkookk on Wed Nov 02, 2022 5:27 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by ADD Creative » Wed Nov 02, 2022 1:47 am

If you don't think it's an extension is could be an issue with a product missing a product description of entry in the database.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by parkookk » Thu Nov 03, 2022 10:29 pm

Thanks, when I go to https://www.mediasos.co.uk/index.php?ro ... ct/special there is a product that has no title, image, etc., it's very strange!! I checked all my products in admin page and they all have proper titling.

Any idea what's going on?
Thanks

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by Majnoon » Thu Nov 03, 2022 11:03 pm

parkookk wrote:
Thu Nov 03, 2022 10:29 pm
Thanks, when I go to https://www.mediasos.co.uk/index.php?ro ... ct/special there is a product that has no title, image, etc., it's very strange!! I checked all my products in admin page and they all have proper titling.

Any idea what's going on?
Thanks
It says not product found.
https://prnt.sc/BBTxeOvs6718

Active Member

Posts

Joined
Fri Feb 05, 2021 8:29 pm

Post by ADD Creative » Fri Nov 04, 2022 1:33 am

My best guess is that one of your products is missing an entry in the product_description table in the database. You could check your database has the same number of entries as the product table.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by parkookk » Fri Mar 24, 2023 1:29 am

Majnoon wrote:
Thu Nov 03, 2022 11:03 pm
parkookk wrote:
Thu Nov 03, 2022 10:29 pm
Thanks, when I go to https://www.mediasos.co.uk/index.php?ro ... ct/special there is a product that has no title, image, etc., it's very strange!! I checked all my products in admin page and they all have proper titling.

Any idea what's going on?
Thanks
It says not product found.
https://prnt.sc/BBTxeOvs6718
Yes, that happens when you click on that blank/unusual product. So how that has gone there?

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by parkookk » Fri Mar 24, 2023 1:40 am

ADD Creative wrote:
Fri Nov 04, 2022 1:33 am
My best guess is that one of your products is missing an entry in the product_description table in the database. You could check your database has the same number of entries as the product table.
Thanks,
I used phpMyAdming and product_description had 117 and product had 118 entries. Then I logged in to my Admin and can see 117 products.
Can you please explain what should I do now? :)

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by ADD Creative » Fri Mar 24, 2023 1:53 am

parkookk wrote:
Fri Mar 24, 2023 1:40 am
ADD Creative wrote:
Fri Nov 04, 2022 1:33 am
My best guess is that one of your products is missing an entry in the product_description table in the database. You could check your database has the same number of entries as the product table.
Thanks,
I used phpMyAdming and product_description had 117 and product had 118 entries. Then I logged in to my Admin and can see 117 products.
Can you please explain what should I do now? :)
Try this SQL to see the product. Then edit any product in the admin to set the description.

Code: Select all

SELECT * FROM oc_product p WHERE NOT EXISTS (SELECT * FROM oc_product_description pd WHERE p.product_id = pd.product_id)

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by parkookk » Fri Mar 24, 2023 2:13 am

ADD Creative wrote:
Fri Mar 24, 2023 1:53 am
parkookk wrote:
Fri Mar 24, 2023 1:40 am
ADD Creative wrote:
Fri Nov 04, 2022 1:33 am
My best guess is that one of your products is missing an entry in the product_description table in the database. You could check your database has the same number of entries as the product table.
Thanks,
I used phpMyAdming and product_description had 117 and product had 118 entries. Then I logged in to my Admin and can see 117 products.
Can you please explain what should I do now? :)
Try this SQL to see the product. Then edit any product in the admin to set the description.

Code: Select all

SELECT * FROM oc_product p WHERE NOT EXISTS (SELECT * FROM oc_product_description pd WHERE p.product_id = pd.product_id)
Thanks "ADD Creative" , you're a legend. I found the one and it was an old product that use to have special offer and it has been removed. So I have deleted the extra entry in the "product" and all looking alright now. :D

User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london
Who is online

Users browsing this forum: No registered users and 43 guests