Post by martExtensions » Tue Aug 12, 2025 9:38 pm

Hello Opencart Experts,

We are working today on Product in Opencart 4.1.0.3 and it shows error when filter product model.

Here is the screenshot https://prnt.sc/svfmIF0uBF9r

Code: Select all

$sql = "SELECT * FROM `" . DB_PREFIX . "product` `p` LEFT JOIN `" . DB_PREFIX . "product_description` `pd` ON (`p`.`product_id` = `pd`.`product_id`)";
Need to be change to this

Code: Select all

$sql = "SELECT p.*,pd.* FROM `" . DB_PREFIX . "product` `p` LEFT JOIN `" . DB_PREFIX . "product_description` `pd` ON (`p`.`product_id` = `pd`.`product_id`)";
Please review this.


Posts

Joined
Sat Jun 06, 2020 5:21 pm
Location - India

Post by JNeuhoff » Tue Aug 12, 2025 11:41 pm

What you describe here has nothing to do with what's shown on your screenshot. According to the latter, it complained about line 2250 in admin/model/catalog/product.php (function getDiscounts). You wrongly called this function with $product_id=null.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by martExtensions » Wed Aug 13, 2025 3:02 pm

Thank you for your reply. This is fresh Opencart 4.1.0.3 and getDiscounts is default function which is called on Product List page. Here is the screenshot https://prnt.sc/6mOe41J08wgI

This is default product query https://prnt.sc/ZBW_21Knk7z6 when we filter the product model it Left Join the "product_code" table and there is no data in this table for this product that's why it is fetching blank product_id.


Posts

Joined
Sat Jun 06, 2020 5:21 pm
Location - India
Who is online

Users browsing this forum: No registered users and 5 guests