Magento upgrade 1.7 caused following error

两盒软妹~` 提交于 2019-12-25 04:41:26

问题


Admin panel works fine, but on front-end I get following error.

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'position' in order clause is ambiguous

Any idea what could this be?


回答1:


Here is the solution i came up with, Many Thanks to Vern Burton.

  1. Located table eav_attribute in phpmyadmin, which was related to catalog_eav_attribute.
  2. Located column position in table eav_attribute and dropped it.
  3. Cleared all cache and reindexed all data, visited front page and got a new error: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘main_table.include_in_menu’ in ‘where clause’

  4. Located and opened file app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php

  5. Commented out following line:267 in my case ----

        ->where('main_table.is_active = ?', '1')
       // ->where('main_table.include_in_menu = ?', '1') 
        ->order('main_table.position');
    

I'm not really sure how esthetic this method is to fix this issue but, certainly works for me for now, If anyone has better way of fixing this I'd appreciate if you'll post your solution.

Hope this will help someone out, Cheers.

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'position' in order clause is ambiguous' in /chroot/home/user/my_domain.com/magento_root/lib/Zend/Db/Statement/Pdo.php:234

Stack trace:
0 /chroot/home/user/my_domain.com/magento_root/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
1 /chroot/home/user/my_domain.com/magento_root/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
2 /chroot/home/user/my_domain.com/magento_root/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
3 /chroot/home/user/my_domain.com/magento_root/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT main_ta...', Array) <br>4 /chroot/home/user/my_domain.com/magento_root/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECTmain_ta...', Array)
5 /chroot/home/user/my_domain.com/magento_root/lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query('SELECT main_ta...', Array) <br>6 /chroot/home/user/my_domain.com/magento_root/lib/Varien/Data/Collection/Db.php(734): Zend_Db_Adapter_Abstract->fetchAll('SELECTmain_ta...', Array)
7 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(521): Varien_Data_Collection_Db->_fetchAll('SELECT `main_ta...', Array)
8 /chroot/home/user/my_domain.com/magento_root/lib/Varien/Data/Collection/Db.php(566): Mage_Core_Model_Resource_Db_Collection_Abstract->getData()
9 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Catalog/Model/Layer.php(232): Varien_Data_Collection_Db->load()
10 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Catalog/Block/Layer/View.php(163): Mage_Catalog_Model_Layer->getFilterableAttributes()
11 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Catalog/Block/Layer/View.php(122): Mage_Catalog_Block_Layer_View->_getFilterableAttributes()
12 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Core/Block/Abstract.php(238): Mage_Catalog_Block_Layer_View->_prepareLayout()
13 /chroot/home/user/my_domain.com/magento_root/app/code/local/Mage/Core/Model/Layout.php(430): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
14 /chroot/home/user/my_domain.com/magento_root/app/code/local/Mage/Core/Model/Layout.php(446): Mage_Core_Model_Layout->createBlock('catalog/layer_v...', 'catalog.leftnav')
15 /chroot/home/user/my_domain.com/magento_root/app/code/local/Mage/Core/Model/Layout.php(238): Mage_Core_Model_Layout->addBlock('catalog/layer_v...', 'catalog.leftnav')
16 /chroot/home/user/my_domain.com/magento_root/app/code/local/Mage/Core/Model/Layout.php(204): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
17 /chroot/home/user/my_domain.com/magento_root/app/code/local/Mage/Core/Model/Layout.php(209): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
18 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
19 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Catalog/Helper/Product/View.php(73): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
20 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Catalog/Helper/Product/View.php(144): Mage_Catalog_Helper_Product_View->initProductLayout(Object(Mage_Catalog_Model_Product), Object(Mage_Catalog_ProductController))
21 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Catalog/controllers/ProductController.php(132): Mage_Catalog_Helper_Product_View->prepareAndRender(28491, Object(Mage_Catalog_ProductController), Object(Varien_Object))
22 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_ProductController->viewAction()
23 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
24 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
25 /chroot/home/user/my_domain.com/magento_root/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
26 /chroot/home/user/my_domain.com/magento_root/app/Mage.php(683): Mage_Core_Model_App->run(Array)
27 /chroot/home/user/my_domain.com/magento_root/index.php(87): Mage::run('', 'store')
28 {main}




回答2:


Have you tried rebuilding your indexes? I had a similar problem, and that fixed it.



来源:https://stackoverflow.com/questions/10520057/magento-upgrade-1-7-caused-following-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!