1
votes

Hi i am getting error in magento:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'FLOOR((ROUND((e.min_price) * 1, 2)) / 10000) + 1' in 'order clause'.

query was:

SELECT FLOOR((ROUND((e.min_price) * 1, 2)) / 10000) + 1 AS `range`, COUNT(*) AS `count` 
FROM `catalog_product_index_price` AS `e`

My query is:

INNER JOIN `catalogsearch_result` AS `search_result` 
    ON search_result.product_id=e.entity_id 
   AND search_result.query_id='1141'
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(3, 4) AND cat_index.category_id='3' 
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)) / 10000) + 1 
ORDER BY `FLOOR((ROUND((e`.`min_price) * 1, 2)) / 10000) + 1` ASC

and Trace:


#0 /var/www/html/magento/lib/Varien/Db/Statement/Pdo/Mysql.php(110):           Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/html/magento/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/html/magento/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/www/html/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT FLOOR((R...', Array)
#4 /var/www/html/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT FLOOR((R...', Array)
#5 /var/www/html/magento/lib/Zend/Db/Adapter/Abstract.php(811): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /var/www/html/magento/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php(274): Zend_Db_Adapter_Abstract->fetchPairs(Object(Varien_Db_Select))
#7 /var/www/html/magento/app/code/local/Mage/Catalog/Model/Layer/Filter/Price.php(158): Mage_Catalog_Model_Resource_Layer_Filter_Price->getCount(Object(Mage_Catalog_Model_Layer_Filter_Price), 10000)
#8 /var/www/html/magento/app/code/local/Mage/Catalog/Model/Layer/Filter/Price.php(115): Mage_Catalog_Model_Layer_Filter_Price->getRangeItemCounts(10000)
#9 /var/www/html/magento/app/code/local/Mage/Catalog/Model/Layer/Filter/Price.php(316): Mage_Catalog_Model_Layer_Filter_Price->getPriceRange()
#10 /var/www/html/magento/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(151): Mage_Catalog_Model_Layer_Filter_Price->_getItemsData()
#11 /var/www/html/magento/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(120): Mage_Catalog_Model_Layer_Filter_Abstract->_initItems()
#12 /var/www/html/magento/app/code/core/Mage/Catalog/Model/Layer/Filter/Abstract.php(109): Mage_Catalog_Model_Layer_Filter_Abstract->getItems()
#13 /var/www/html/magento/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(132): Mage_Catalog_Model_Layer_Filter_Abstract->getItemsCount()
#14 /var/www/html/magento/app/code/core/Mage/Catalog/Block/Layer/View.php(218): Mage_Catalog_Block_Layer_Filter_Abstract->getItemsCount()
#15 /var/www/html/magento/app/code/core/Mage/Catalog/Block/Layer/View.php(233): Mage_Catalog_Block_Layer_View->canShowOptions()
#16 /var/www/html/magento/app/code/core/Mage/CatalogSearch/Block/Layer.php(90): Mage_Catalog_Block_Layer_View->canShowBlock()
#17 /var/www/html/magento/app/design/frontend/default/sm_sport/template/catalog/layer/view.phtml(34): Mage_CatalogSearch_Block_Layer->canShowBlock()
#18 /var/www/html/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/html/m...')
#19 /var/www/html/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#20 /var/www/html/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#21 /var/www/html/magento/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#22 /var/www/html/magento/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#23 /var/www/html/magento/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List->_toHtml()
#24 /var/www/html/magento/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#25 /var/www/html/magento/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('left', true)
#26 /var/www/html/magento/app/design/frontend/default/sm_sport/template/page/2columns-left.phtml(73): Mage_Core_Block_Abstract->getChildHtml('left')
#27 /var/www/html/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/html/m...')
#28 /var/www/html/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#29 /var/www/html/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#30 /var/www/html/magento/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template->_toHtml()
#31 /var/www/html/magento/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#32 /var/www/html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#33 /var/www/html/magento/app/code/core/Mage/CatalogSearch/controllers/ResultController.php(80): Mage_Core_Controller_Varien_Action->renderLayout()
#34 /var/www/html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_CatalogSearch_ResultController->indexAction()
#35 /var/www/html/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#36 /var/www/html/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#37 /var/www/html/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#38 /var/www/html/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#39 /var/www/html/magento/index.php(90): Mage::run('', 'store')
#40 {main}

1
That is not even a question. Please start off by explaining what you're trying to achieve and how you're trying to do that. And then please phrase a question.Siguza

1 Answers

3
votes

Change at file:

/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php

From :

$select->group($rangeExpr)->order("$rangeExpr ASC");

To:

$select->group($rangeExpr)->order($rangeExpr, "ASC");

Then check it

if not worked the install this manadev extension http://www.magentocommerce.com/magento-connect/multiple-select-in-layered-navigation-filters.html which is category page layered navigation which provide you more feature for filter and solve your problem too.