0

I am working in magento1.7.
When I placed an order in the last step of checkout process, then it gives me the following error instead of showing success page..

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 ')' at line 1

The full error log file is as follows..

a:5:{i:0;s:203:"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 ')' at line 1";i:1;s:5461:"#0 /chroot/home/project/Mystore.com/html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /chroot/home/project/Mystore.com/html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /chroot/home/project/Mystore.com/html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /chroot/home/project/Mystore.com/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `sales_f...', Array)
#4 /chroot/home/project/Mystore.com/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `sales_f...', Array)
#5 /chroot/home/project/Mystore.com/html/lib/Zend/Db/Adapter/Abstract.php(753): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(380): Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select))
#7 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Model/Abstract.php(225): Mage_Core_Model_Resource_Db_Abstract->load(Object(Mage_Sales_Model_Order), Object(Mage_Sales_Model_Order), 'increment_id')
#8 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Sales/Model/Order.php(512): Mage_Core_Model_Abstract->load(Object(Mage_Sales_Model_Order), 'increment_id')
#9 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Sales/Model/Order.php(500): Mage_Sales_Model_Order->loadByAttribute('increment_id', Object(Mage_Sales_Model_Order))
#10 /chroot/home/project/Mystore.com/html/app/design/frontend/tapestore/iphone/template/checkout/success.phtml(42): Mage_Sales_Model_Order->loadByIncrementId(Object(Mage_Sales_Model_Order))
#11 /chroot/home/project/Mystore.com/html/var/ait_rewrite/Mage_Core_Block_Template.php(412): include('/chroot/home/th...')
#12 /chroot/home/project/Mystore.com/html/var/ait_rewrite/Mage_Core_Block_Template.php(274): Mage_Core_Block_Template->fetchView('frontend/tapest...')
#13 /chroot/home/project/Mystore.com/html/var/ait_rewrite/Mage_Core_Block_Template.php(288): Aitoc_Aitsys_Model_Rewriter_Mage_Core_Block_Template->renderView()
#14 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Block/Abstract.php(863): Aitoc_Aitsys_Model_Rewriter_Mage_Core_Block_Template->_toHtml()
#15 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#16 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#17 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#18 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#19 /chroot/home/project/Mystore.com/html/app/design/frontend/tapestore/iphone/template/page/1column.phtml(42): Mage_Core_Block_Abstract->getChildHtml('content')
#20 /chroot/home/project/Mystore.com/html/var/ait_rewrite/Mage_Core_Block_Template.php(412): include('/chroot/home/th...')
#21 /chroot/home/project/Mystore.com/html/var/ait_rewrite/Mage_Core_Block_Template.php(274): Mage_Core_Block_Template->fetchView('frontend/tapest...')
#22 /chroot/home/project/Mystore.com/html/var/ait_rewrite/Mage_Core_Block_Template.php(288): Aitoc_Aitsys_Model_Rewriter_Mage_Core_Block_Template->renderView()
#23 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Block/Abstract.php(863): Aitoc_Aitsys_Model_Rewriter_Mage_Core_Block_Template->_toHtml()
#24 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#25 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#26 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Checkout/controllers/OnepageController.php(244): Mage_Core_Controller_Varien_Action->renderLayout()
#27 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_OnepageController->successAction()
#28 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('success')
#29 /chroot/home/project/Mystore.com/html/app/code/community/ArtsOnIT/OfflineMaintenance/Controller/Router/Standard.php(46): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#30 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): ArtsOnIT_OfflineMaintenance_Controller_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#31 /chroot/home/project/Mystore.com/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#32 /chroot/home/project/Mystore.com/html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#33 /chroot/home/project/Mystore.com/html/index.php(89): Mage::run('', 'store')
#34 {main}";s:3:"url";s:26:"/checkout/onepage/success/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:23:"mystore_store_view";}

And in the browser console following error shows..

"Network error : 503 service unavailable - http://Mystore.com/checkout/onepage/success"

Could anyone suggest where to start investigation for the above error ?

4
  • Check your logs and update your question with a more specific error message. Mar 16, 2016 at 14:25
  • You'll need to provide the erroneous query. Follow this question to enable SQL logging: magento.stackexchange.com/questions/25113/…. Then, post the last query that tried to execute in var/debug/pdo_mysql.log. It should start with SELECT sales_f....
    – laketuna
    Mar 16, 2016 at 14:58
  • @musicliftsme, I enable the query debug and came to that ,the erroneous query is same as the first line of the information that I have provided here. And the extra information is a "503 service unavailable is coming in the console of the browser".. Mar 18, 2016 at 4:23

1 Answer 1

0

It is the success.phtml that was creating problem, in my case.
The way I get the order_id was wrong.
I had written..

$order_id = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastRealOrderId());

When I change it to defalut one..like..

$order_id = $this->getOrderId();

then it worked fine.
But I still can't figure out why is it happend ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.