添加可配置产品后,我无法在前端查看该类别。
我刚收到以下错误:
处理您的请求时出错。
这是我在没有任何帮助的情况下尝试过的:
即使在所有这些之后,我仍然无法列出该类别而没有错误。如果它是空的,它会显示没有错误,如果我在其他类别中制作产品,它运作良好。 Magento版本1.9.0.1
错误日志是这样的:
a:5:{i:0;s:1223:"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.`tax_class_id WHEN 2 THEN 0`.`2500 WHEN 5 THEN 0`.`1500 ELSE 0 END' at line 2, query was: SELECT FLOOR((ROUND(((e.min_price +(e.min_price*CASE e.tax_class_id WHEN 2 THEN 0.2500 WHEN 5 THEN 0.1500 ELSE 0 END))) * 1, 2)) / 100) + 1 AS `range`, COUNT(*) AS `count` FROM `catalog_product_index_price` AS `e`
INNER JOIN `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 = '3' WHERE ( e.website_id = '1' ) AND ( e.customer_group_id = 0) AND ((e.min_price +(e.min_price*CASE e.tax_class_id WHEN 2 THEN 0.2500 WHEN 5 THEN 0.1500 ELSE 0 END)) IS NOT NULL) GROUP BY FLOOR((ROUND(((e.min_price +(e.min_price*CASE e.tax_class_id WHEN 2 THEN 0.2500 WHEN 5 THEN 0.1500 ELSE 0 END))) * 1, 2)) / 100) + 1 ORDER BY `FLOOR((ROUND(((e`.`min_price +(e`.`min_price*CASE e`.`tax_class_id WHEN 2 THEN 0`.`2500 WHEN 5 THEN 0`.`1500 ELSE 0 END))) * 1, 2)) / 100) + 1` ASC";i:1;s:4946:"#0 /home/31/w266847/www/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/31/w266847/www/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/31/w266847/www/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/31/w266847/www/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT FLOOR((R...', Array)
#4 /home/31/w266847/www/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT FLOOR((R...', Array)
#5 /home/31/w266847/www/lib/Zend/Db/Adapter/Abstract.php(811): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /home/31/w266847/www/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php(274): Zend_Db_Adapter_Abstract->fetchPairs(Object(Varien_Db_Select))
#7 /home/31/w266847/www/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/31/w266847/www/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php(115): Mage_Catalog_Model_Layer_Filter_Price->getRangeItemCounts(100)
#9 /home/31/w266847/www/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php(314): Mage_Catalog_Model_Layer_Filter_Price->getPriceRange()
#10 /home/31/w266847/www/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(151): Mage_Catalog_Model_Layer_Filter_Price->_getItemsData()
#11 /home/31/w266847/www/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(120): Mage_Catalog_Model_Layer_Filter_Abstract->_initItems()
#12 /home/31/w266847/www/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(109): Mage_Catalog_Model_Layer_Filter_Abstract->getItems()
#13 /home/31/w266847/www/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(132): Mage_Catalog_Model_Layer_Filter_Abstract->getItemsCount()
#14 /home/31/w266847/www/app/code/core/Mage/Catalog/Block/Layer/View.php(218): Mage_Catalog_Block_Layer_Filter_Abstract->getItemsCount()
#15 /home/31/w266847/www/app/code/core/Mage/Catalog/Block/Layer/View.php(233): Mage_Catalog_Block_Layer_View->canShowOptions()
#16 /home/31/w266847/www/app/design/frontend/base/default/template/catalog/layer/view.phtml(34): Mage_Catalog_Block_Layer_View->canShowBlock()
#17 /home/31/w266847/www/app/code/core/Mage/Core/Block/Template.php(241): include('/home/31/w26684...')
#18 /home/31/w266847/www/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/base/d...')
#19 /home/31/w266847/www/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#20 /home/31/w266847/www/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#21 /home/31/w266847/www/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#22 /home/31/w266847/www/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#23 /home/31/w266847/www/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#24 /home/31/w266847/www/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#25 /home/31/w266847/www/app/design/frontend/default/hellowired/template/page/3columns.phtml(48): Mage_Core_Block_Abstract->getChildHtml('left')
#26 /home/31/w266847/www/app/code/core/Mage/Core/Block/Template.php(241): include('/home/31/w26684...')
#27 /home/31/w266847/www/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#28 /home/31/w266847/www/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#29 /home/31/w266847/www/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#30 /home/31/w266847/www/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#31 /home/31/w266847/www/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#32 /home/31/w266847/www/app/code/core/Mage/Catalog/controllers/CategoryController.php(161): Mage_Core_Controller_Varien_Action->renderLayout()
#33 /home/31/w266847/www/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Catalog_CategoryController->viewAction()
#34 /home/31/w266847/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#35 /home/31/w266847/www/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#36 /home/31/w266847/www/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#37 /home/31/w266847/www/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#38 /home/31/w266847/www/index.php(87): Mage::run('', 'store')
#39 {main}";s:3:"url";s:29:"/kjaeledyr/hund/hundefor.html";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
答案 0 :(得分:1)
我有同样的问题,在查询中发现了一些奇怪的东西:
SQL语句中有许多后退标记,但是一旦删除了这些标记,SQL语句就会完全运行。
在下面的查询中:
SELECT FLOOR((ROUND(((e.min_price -(e.min_price/(1+(CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END)+((e.min_price-(e.min_price/(1+(CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))) * 1, 2)) / 10) + 1 AS `range`, COUNT(*) AS `count` FROM `catalog_product_index_price` AS `e`
INNER JOIN `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 = '16' AND cat_index.is_parent=1 WHERE ( e.website_id = '1' ) AND ( e.customer_group_id = '1') AND ((e.min_price -(e.min_price/(1+(CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END)+((e.min_price-(e.min_price/(1+(CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END)) IS NOT NULL) GROUP BY FLOOR((ROUND(((e.min_price -(e.min_price/(1+(CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END)+((e.min_price-(e.min_price/(1+(CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))*CASE e.tax_class_id WHEN 2 THEN 0.2000 WHEN 4 THEN 0.2000 ELSE 0 END))) * 1, 2)) / 10) + 1 ORDER BY `FLOOR((ROUND(((e`.`min_price -(e`.`min_price/(1+(CASE e`.`tax_class_id WHEN 2 THEN 0`.`2000 WHEN 4 THEN 0`.`2000 ELSE 0 END))*CASE e`.`tax_class_id WHEN 2 THEN 0`.`2000 WHEN 4 THEN 0`.`2000 ELSE 0 END)+((e`.`min_price-(e`.`min_price/(1+(CASE e`.`tax_class_id WHEN 2 THEN 0`.`2000 WHEN 4 THEN 0`.`2000 ELSE 0 END))*CASE e`.`tax_class_id WHEN 2 THEN 0`.`2000 WHEN 4 THEN 0`.`2000 ELSE 0 END))*CASE e`.`tax_class_id WHEN 2 THEN 0`.`2000 WHEN 4 THEN 0`.`2000 ELSE 0 END))) * 1, 2)) / 10) + 1` ASC
问题一出现在最后一部分:
ORDER BY `FLOOR
在我看来,后面的勾选是错误的。
我通过编辑第272行的Price.php文件解决了这个问题
来自$select->group($rangeExpr)->order("$rangeExpr ASC");
到$select->group($rangeExpr)->order($rangeExpr);
答案 1 :(得分:0)
我已经遇到了这个确切的问题并且喜欢踢它,只是想知道如何解决它。我也有完全相同的Magento版本。
如果您从此模板中删除代码,
/home/31/w266847/www/app/design/frontend/base/default/template/catalog/layer/view.phtml(34):Mage_Catalog_Block_Layer_View-> canShowBlock(),它会起作用,但我可以& #39;弄清楚它的哪一部分正在杀死它。