0

管理面板工作正常,但在前端我收到以下错误。

SQLSTATE [23000]:违反完整性约束:1052 列“位置”在 order 子句中不明确

知道这可能是什么吗?

4

2 回答 2

1

这是我想出的解决方案,非常感谢 Vern Burton。

  1. 在 phpmyadmin 中找到与 catalog_eav_attribute 相关的表 eav_attribute。
  2. 在表 eav_attribute 中定位列位置并将其删除。
  3. 清除所有缓存并重新索引所有数据,访问首页并得到一个新错误:SQLSTATE[42S22]: Column not found: 1054 Unknown column 'main_table.include_in_menu' in 'where Clause'</p>

  4. 找到并打开文件 app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php

  5. 注释掉以下行:在我的情况下为 267 ----

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

我不太确定这种方法解决这个问题有多美观,但现在肯定对我有用,如果有人有更好的方法来解决这个问题,如果你能发布你的解决方案,我将不胜感激。

希望这会帮助别人,干杯。

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

堆栈跟踪:
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 ...',数组)
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...',数组)
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.. .',数组)
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(对象(Mage_Core_Model_Layout_Element),对象(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(对象(Mage_Catalog_Model_Product),对象(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,对象(Mage_Catalog_ProductController),对象(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 }

于 2012-05-16T05:21:46.390 回答
0

您是否尝试过重建索引?我有一个类似的问题,并解决了它。

于 2012-05-29T15:15:35.177 回答