Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘sort_order’ in order clause is ambiguous
 
ronfedele
Member
 
Total Posts:  43
Joined:  2009-01-28
 

Updated to 1.4.2 and am now getting this error when I go to look at an order.

SQLSTATE[23000]: Integrity constraint violation: 1052 Column \’sort_order\’ in order clause is ambiguous

Any thoughts on this one

ron

 
Magento Community Magento Community
Magento Community
Magento Community
 
ronfedele
Member
 
Total Posts:  43
Joined:  2009-01-28
 

This is the full error message

SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘sort_order’ in order clause is ambiguous

Trace:
#0 /home/medware1/public_html/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/medware1/public_html/lib/Zend/Db/Adapter/Abstract.php(468): Zend_Db_Statement->execute(Array)
#2 /home/medware1/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(’SELECT `main_ta...’, Array)
#3 /home/medware1/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract->query(’SELECT `main_ta...’, Array)
#4 /home/medware1/public_html/lib/Zend/Db/Adapter/Abstract.php(706): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#5 /home/medware1/public_html/lib/Varien/Data/Collection/Db.php(724): Zend_Db_Adapter_Abstract->fetchAll(Object(Varien_Db_Select), Array)
#6 /home/medware1/public_html/lib/Varien/Data/Collection/Db.php(637): Varien_Data_Collection_Db->_fetchAll(Object(Varien_Db_Select))
#7 /home/medware1/public_html/app/code/core/Mage/Eav/Model/Config.php(481): Varien_Data_Collection_Db->getData()
#8 /home/medware1/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(498): Mage_Eav_Model_Config->getEntityAttributeCodes(Object(Mage_Eav_Model_Entity_Type), Object(Mage_Customer_Model_Customer))
#9 /home/medware1/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(874): Mage_Eav_Model_Entity_Abstract->loadAllAttributes(Object(Mage_Customer_Model_Customer))
#10 /home/medware1/public_html/app/code/core/Mage/Core/Model/Abstract.php(225): Mage_Eav_Model_Entity_Abstract->load(Object(Mage_Customer_Model_Customer), ‘332’, NULL)
#11 /home/medware1/public_html/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Messages.php(47): Mage_Core_Model_Abstract->load(’332’)
#12 /home/medware1/public_html/app/code/core/Mage/Core/Block/Abstract.php(223): Mage_Adminhtml_Block_Sales_Order_View_Messages->_prepareLayout()
#13 /home/medware1/public_html/app/code/core/Mage/Core/Model/Layout.php(430): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#14 /home/medware1/public_html/app/code/core/Mage/Core/Model/Layout.php(446): Mage_Core_Model_Layout->createBlock(’adminhtml/sales...’, ‘order_messages’)
#15 /home/medware1/public_html/app/code/core/Mage/Core/Model/Layout.php(238): Mage_Core_Model_Layout->addBlock(’adminhtml/sales...’, ‘order_messages’)
#16 /home/medware1/public_html/app/code/core/Mage/Core/Model/Layout.php(204): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#17 /home/medware1/public_html/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#18 /home/medware1/public_html/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#19 /home/medware1/public_html/app/code/core/Mage/Core/Model/Layout.php(209): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#20 /home/medware1/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(343): Mage_Core_Model_Layout->generateBlocks()
#21 /home/medware1/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(270): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#22 /home/medware1/public_html/app/code/core/Mage/Adminhtml/Controller/Action.php(263): Mage_Core_Controller_Varien_Action->loadLayout(NULL, true, true)
#23 /home/medware1/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(59): Mage_Adminhtml_Controller_Action->loadLayout()
#24 /home/medware1/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(115): Mage_Adminhtml_Sales_OrderController->_initAction()
#25 /home/medware1/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_OrderController->viewAction()
#26 /home/medware1/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch(’view’)
#27 /home/medware1/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#28 /home/medware1/public_html/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Controller_Varien_Front->dispatch()
#29 /home/medware1/public_html/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#30 /home/medware1/public_html/index.php(79): Mage::run(’’, ‘store’)
#31 {main}

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jamie Jackson
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2010-03-05
Sheffield, UK
 

Also seeing this error in admin when trying to view orders, waiting in anticipation for a update

 
Magento Community Magento Community
Magento Community
Magento Community
 
pourquoi_moi
Jr. Member
 
Total Posts:  8
Joined:  2008-12-31
France, Poitou Charentes
 

same error after upgrade. anyone knows the answer ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
pourquoi_moi
Jr. Member
 
Total Posts:  8
Joined:  2008-12-31
France, Poitou Charentes
 

for customers, orders or products : have you made mass import whith cart2cart ? or anything else like it ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jpffm
Jr. Member
 
Total Posts:  24
Joined:  2010-09-29
 

Yes, we migrated products with Cart2Cart and get this error. Is this a problem with 1.4.2?

 
Magento Community Magento Community
Magento Community
Magento Community
 
husby
Member
 
Avatar
Total Posts:  72
Joined:  2009-01-07
Roseville, MN
 

I’m getting the same error after upgrading to 1.4.2 with accounts that were migrated using cart2cart from 1.3 to 1.4.  Any accounts created since 1.4 are not affected by this issue.  Anyone know a solution?!?

 
Magento Community Magento Community
Magento Community
Magento Community
 
husby
Member
 
Avatar
Total Posts:  72
Joined:  2009-01-07
Roseville, MN
 

Found a fix!  For some reason cart2cart imported some extra fields, and also the wrong attribute_set_id.  Because I did things in a backwards order, I’m assuming you only have to do one thing to fix it, but in case it doesn’t work, you can try the other things I did.  Start by doing things in this order, testing after each SQL command to see if it worked:  (and as always, back up your database just in case!!!)

UPDATE `customer_entity` SET attribute_set_id=0;
(because the 1.3 imported customers had this =1 for me, and all the rest =0.  Check to see what attribute_set_id number your new customers are getting, in case it’s not 0!)

TRUNCATE TABLE `customer_entity_datetime`;
(because for me, it only contained a DOB field for the old, 1.3 customers)

I also did a few other things like selectively deleting some extra fields in eav_attributes, but that may not have been necessary.

 
Magento Community Magento Community
Magento Community
Magento Community
 
DCAlmeida
Sr. Member
 
Avatar
Total Posts:  164
Joined:  2008-12-28
PRT
 
husby - 18 December 2010 02:16 PM

I’m getting the same error after upgrading to 1.4.2 with accounts that were migrated using cart2cart from 1.3 to 1.4.  Any accounts created since 1.4 are not affected by this issue.  Anyone know a solution?!?

Same here and the last fix do not works!

Any tips?

 
Magento Community Magento Community
Magento Community
Magento Community
 
DCAlmeida
Sr. Member
 
Avatar
Total Posts:  164
Joined:  2008-12-28
PRT
 

someone knows how to solve this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
DCAlmeida
Sr. Member
 
Avatar
Total Posts:  164
Joined:  2008-12-28
PRT
 

Another tip: check customer_address_entity, there are another field named attribute_set_id, it must be with value 0

In my case I ran this query, for all entries:

UPDATE customer_address_entity
SET attribute_set_id 
0
 
Magento Community Magento Community
Magento Community
Magento Community
 
Markus0707
Member
 
Total Posts:  44
Joined:  2008-10-06
 

UPDATE customer_entity SET attribute_set_id 0 WHERE 1

UPDATE customer_address_entity SET attribute_set_id 
0 WHERE 1

I had to update both befor solve my problem.

Markus

 
Magento Community Magento Community
Magento Community
Magento Community
 
maheshmagento
Jr. Member
 
Total Posts:  2
Joined:  2011-08-21
 

$collection->addFilterToMap(’sort_order’, ‘main_table.sort_order‘);

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top