伙计们,地面已经跳开。
在使用 magento 电子商务(1.7.0.2)时,我在一种特定情况下遇到错误。情况是,当用户尝试按价格范围过滤目录产品时。出现的错误是这样的
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.min_price' in 'where clause'
Trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT COUNT(DI...', Array)
#4 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT COUNT(DI...', Array)
#5 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Zend/Db/Adapter/Abstract.php(825): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract->fetchOne(Object(Varien_Db_Select), Array)
#7 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Varien/Data/Collection.php(225): Varien_Data_Collection_Db->getSize()
#8 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/community/Strategery/Infinitescroll2/Model/Catalog/Observer.php(40): Varien_Data_Collection->getLastPageNumber()
#9 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/App.php(1338): Strategery_Infinitescroll2_Model_Catalog_Observer->modifyCollection(Object(Varien_Event_Observer))
#10 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Strategery_Infinitescroll2_Model_Catalog_Observer), 'modifyCollectio...', Object(Varien_Event_Observer))
#11 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('catalog_product...', Array)
#12 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php(506): Mage::dispatchEvent('catalog_product...', Array)
#13 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(864): Mage_Catalog_Model_Resource_Product_Collection->_beforeLoad()
#14 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Review/Model/Observer.php(78): Mage_Eav_Model_Entity_Collection_Abstract->load()
#15 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/App.php(1338): Mage_Review_Model_Observer->catalogBlockProductCollectionBeforeToHtml(Object(Varien_Event_Observer))
#16 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/App.php(1311): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Review_Model_Observer), 'catalogBlockPro...', Object(Varien_Event_Observer))
#17 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('catalog_block_p...', Array)
#18 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Catalog/Block/Product/List.php(163): Mage::dispatchEvent('catalog_block_p...', Array)
#19 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(862): Mage_Catalog_Block_Product_List->_beforeToHtml()
#20 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#21 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('product_list', true)
#22 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Catalog/Block/Category/View.php(85): Mage_Core_Block_Abstract->getChildHtml('product_list')
#23 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/design/frontend/default/madame-modern/template/catalog/category/view.phtml(70): Mage_Catalog_Block_Category_View->getProductListHtml()
#24 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Template.php(241): include('/Applications/X...')
#25 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#26 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#27 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#28 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#29 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#30 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#31 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#32 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/design/frontend/default/madame-modern/template/page/2columns-left.phtml(19): Mage_Core_Block_Abstract->getChildHtml('content')
#33 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Template.php(241): include('/Applications/X...')
#34 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#35 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#36 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#37 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#38 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#39 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Catalog/controllers/CategoryController.php(159): Mage_Core_Controller_Varien_Action->renderLayout()
#40 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_CategoryController->viewAction()
#41 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#42 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#43 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#44 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#45 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/index.php(87): Mage::run('', 'store')
#46 {main}
我一直在追踪这个问题,但没有多大成功。我不太确定问题是否与数据库中名为“min_price”的缺失表有关,或者与其他任何问题有关。如您所见,错误报告中显示的字符是“e.min_price”,而不仅仅是“min_price”。唯一包含这些字符的文件是app/code/core/Mage/CatalogIndex/Model/Indexer.php
if (strlen($values[$code]['from'])>0) {
$filter[$code]->where(
"($table.min_price".implode('', $additionalCalculations[$code]).")*{$rateConversion} >= ?",
$values[$code]['from']
);
}
if (strlen($values[$code]['to'])>0) {
$filter[$code]->where(
"($table.min_price".implode('', $additionalCalculations[$code]).")*{$rateConversion} <= ?",
$values[$code]['to']
);
}
如您所见,实际上它是“$table.min_price”而不是“e.min_price”。但这是唯一包含这些字符序列的文件。(“min_price”出现在其他几个)
你可能已经注意到我在这里迷路了。因此,我们将不胜感激任何帮助。谢谢。