异常错误=> SQLSTATE [42S22]:找不到列:1054未知列

时间:2014-11-25 15:15:33

标签: magento magento-1.9

我在Magento遇到错误。

首先出现错误“出于安全原因,默认情况下禁用例外打印”。

在谷歌搜索之后,我将local.xml.sample更改为local.xml并添加了tmp文件,但它不起作用。

我刷新了缓存,但我仍然遇到错误,请帮忙:

There has been an error processing your request
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'FLOOR((ROUND((e.min_price) * 1, 2)) / 100) + 1' in 'order clause', query was: SELECT FLOOR((ROUND((e.min_price) * 1, 2)) / 100) + 1 AS `range`, COUNT(*) AS `count` FROM `mage_catalog_product_index_price` AS `e`
INNER JOIN `mage_catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '70' AND cat_index.is_parent=1 WHERE ( e.website_id = '1' ) AND ( e.customer_group_id = 0) AND (e.min_price IS NOT NULL) GROUP BY FLOOR((ROUND((e.min_price) * 1, 2)) / 100) + 1 ORDER BY `FLOOR((ROUND((e`.`min_price) * 1, 2)) / 100) + 1` ASC

Trace:
0 /home/estepro01/domains/mydomain.nl/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
1 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
2 /home/estepro01/domains/mydomain.nl/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
3 /home/estepro01/domains/mydomain.nl/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT FLOOR((R...', Array)
4 /home/estepro01/domains/mydomain.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT FLOOR((R...', Array)
5 /home/estepro01/domains/mydomain.nl/public_html/lib/Zend/Db/Adapter/Abstract.php(811): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
6 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php(274): Zend_Db_Adapter_Abstract->fetchPairs(Object(Varien_Db_Select))
7 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php(158): Mage_Catalog_Model_Resource_Layer_Filter_Price->getCount(Object(Mage_Catalog_Model_Layer_Filter_Price), 100)
8 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php(115): Mage_Catalog_Model_Layer_Filter_Price->getRangeItemCounts(100)
9 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php(314): Mage_Catalog_Model_Layer_Filter_Price->getPriceRange()
10 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(151): Mage_Catalog_Model_Layer_Filter_Price->_getItemsData()
11 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(120): Mage_Catalog_Model_Layer_Filter_Abstract->_initItems()
12 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(109): Mage_Catalog_Model_Layer_Filter_Abstract->getItems()
13 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(132): Mage_Catalog_Model_Layer_Filter_Abstract->getItemsCount()
14 /home/estepro01/domains/mydomain.nl/public_html/app/design/frontend/default/vigoshop/template/catalog/layer/view.phtml(26): Mage_Catalog_Block_Layer_Filter_Abstract->getItemsCount()
15 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/estepro01...')
16 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
17 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
18 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
19 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
20 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
21 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
22 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('right', true)
23 /home/estepro01/domains/mydomain.nl/public_html/app/design/frontend/default/vigoshop/template/page/2columns-right.phtml(52): Mage_Core_Block_Abstract->getChildHtml('right')
24 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/estepro01...')
25 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
26 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
27 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
28 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
29 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
30 /home/estepro01/domains/mydomain.nl/public_html/app/code/local/Eternalsoft/Ajaxfilter/controllers/Catalog/CategoryController.php(111): Mage_Core_Controller_Varien_Action->renderLayout()
31 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Eternalsoft_Ajaxfilter_Catalog_CategoryController->viewAction()
32 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
33 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
34 /home/estepro01/domains/mydomain.nl/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
35 /home/estepro01/domains/mydomain.nl/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
36 /home/estepro01/domains/mydomain.nl/public_html/index.php(87): Mage::run('', 'store')
37 {main}

1 个答案:

答案 0 :(得分:0)

问题是查询中ORDER BY子句后面的后退。 对我来说,查询是在文件/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php中生成的 在$select->group($rangeExpr)->order("$rangeExpr ASC");函数中查找getCount()。 将其更改为$select->group($rangeExpr)->order($rangeExpr ," ASC"); 并查看它是否解决了问题并排序是正确的。