Post by Vasiliki T. » Fri Mar 01, 2019 6:29 pm

Hello to all! I am using Opencart v.3.0.2.0 with electra theme, you can see it here www.mr-tech.gr and suddenly I took a fatal error on Special Offers page. You can see it here: https://www.mr-tech.gr/special
Fatal error: Uncaught Exception: Error: Unknown column 'ps.quantity' in 'where clause'<br />Error No: 1054<br />SELECT COUNT(DISTINCT ps.product_id) AS total FROM oc_product_special ps LEFT JOIN oc_product p ON (ps.product_id = p.product_id) LEFT JOIN oc_product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '0' AND ps.customer_group_id = '1' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) AND ps.quantity > 0 in /var/www/vhosts/mr-tech.gr/httpdocs/system/library/db/mysqli.php:40 Stack trace: #0 /var/www/vhosts/mr-tech.gr/httpdocs/system/library/db.php(45): DB\MySQLi->query('SELECT COUNT(DI...') #1 /var/www/vhosts/mr-tech.gr/httpdocs/catalog/model/catalog/product.php(531): DB->query('SELECT COUNT(DI...') #2 /var/www/vhosts/mr-tech.gr/httpdocs/storage/modification/system/engine/loader.php(248): ModelCatalogProduct->getTotalProductSpecials() #3 /var/www/vhosts/mr-tech.gr/httpdocs/syste in /var/www/vhosts/mr-tech.gr/httpdocs/system/library/db/mysqli.php on line 40

Any idea?

New member

Posts

Joined
Mon Mar 12, 2018 5:33 pm

Post by letxobnav » Fri Mar 01, 2019 6:41 pm

Code: Select all

AND ps.quantity > 0 
should be

Code: Select all

AND p.quantity > 0
the quantity field resides in the product table, not the product_special table.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Vasiliki T. » Fri Mar 01, 2019 6:50 pm

where I have to change this code? In what file?

New member

Posts

Joined
Mon Mar 12, 2018 5:33 pm

Post by Vasiliki T. » Fri Mar 01, 2019 6:55 pm

Ok I found it! I've changed it on product.php file and it solved! Thanks a lot!

New member

Posts

Joined
Mon Mar 12, 2018 5:33 pm

Post by letxobnav » Fri Mar 01, 2019 7:13 pm

yes, check the error message for the clue:

Fatal error: Uncaught Exception: Error: Unknown column 'ps.quantity' in 'where clause'<br />Error No: 1054<br />SELECT COUNT(DISTINCT ps.product_id) AS total FROM oc_product_special ps LEFT JOIN oc_product p ON (ps.product_id = p.product_id) LEFT JOIN oc_product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '0' AND ps.customer_group_id = '1' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) AND ps.quantity > 0 in /var/www/vhosts/mr-tech.gr/httpdocs/system/library/db/mysqli.php:40 Stack trace: #0 /var/www/vhosts/mr-tech.gr/httpdocs/system/library/db.php(45): DB\MySQLi->query('SELECT COUNT(DI...') #1 /var/www/vhosts/mr-tech.gr/httpdocs/catalog/model/catalog/product.php(531): DB->query('SELECT COUNT(DI...') #2 /var/www/vhosts/mr-tech.gr/httpdocs/storage/modification/system/engine/loader.php(248): ModelCatalogProduct->getTotalProductSpecials() #3 /var/www/vhosts/mr-tech.gr/httpdocs/syste in /var/www/vhosts/mr-tech.gr/httpdocs/system/library/db/mysqli.php on line 40

that is catalog/model/catalog/product.php file
function getTotalProductSpecials()

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan
Who is online

Users browsing this forum: Google [Bot] and 36 guests