Published: October 25, 2016
Last updated:

the right syntax to use near ‘.`value)` = ‘1’) ORDER BY store_name ASC’ at line 2

Problem description

Checkout / Cart page results in fatal PHP error after Magento upgrade or SUPEE-6788 installation. The following problem report is generated:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version for the right
syntax to use near '.`value)` = '1') ORDER BY store_name ASC' at line 2

Cause

SUPEE-6788 patch changed addFieldToFilter function to prevent SQL injections and Magestore/Storepickup extension should be updated to corresponds new Magento coding standards.

Solution

Request fixed version of Magestore/Storepickup extension from the extension developers. As a workaround it should be possible to comment out two lines that trigger the error:
--- app/code/local/Magestore/Storepickup/Model/Store.php
+++ app/code/local/Magestore/Storepickup/Model/Store.php
@@ -279,4 +279,4 @@
                $stores = $this->getCollection()
-                                               ->addFieldToFilter('status',1)
-                                               ->setOrder('store_name','ASC');
+//                                             ->addFieldToFilter('status',1)
+//                                             ->setOrder('store_name','ASC');

Posted in: Troubleshooting

59 votes, 4.90 avg. rating (97% score)