Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

SQL error when flat product is enabled in Magento 1.3.1
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

ok with Use Flat Catalog Product enabled, I get the following error when clicking on Filter by Category links in Layered Navigation.
Please note that this does NOT happen when filtering by other attributes.

SELECT 1 AS `status`, `e`.`entity_id`, `e`.`type_id`, `e`.`attribute_set_id`, `cat_index`.`position`, `e`.`name`, `e`.`price`, `e`.`small_image`, `e`.`tax_class_id`, `e`.`url_key`, `e`.`thumbnail`, `e`.`short_description`, `e`.`special_price`, `e`.`special_from_date`, `e`.`special_to_date`, `e`.`news_from_date`, `e`.`news_to_date`, `e`.`required_options`, `e`.`price_type`, `e`.`weight_type`, `e`.`price_view`, `e`.`shipment_type`, `e`.`image_label`, `e`.`small_image_label`, `e`.`thumbnail_label`, `e`.`price`, `e`.`special_price`, `e`.`special_from_date`, `e`.`special_to_date`, `cat_index_34`.`position`, `e`.`display_price_group_0` AS `_rule_priceFROM `catalog_product_flat_1` AS `e`
 
INNER JOIN `catalog_category_product_index` AS `cat_indexON cat_index.product_id=e.entity_id AND cat_index.store_id='1' AND cat_index.category_id='40'
 
INNER JOIN `catalog_category_product_index` AS `cat_index_34ON cat_index_34.product_id=e.entity_id AND cat_index_34.store_id='1' AND cat_index_34.category_id='34' WHERE (cat_index.visibility IN (24)) ORDER BY `positionasc LIMIT 9


Trace
:
#0 /var/www/alex/meanmachines.biz/html/lib/Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/alex/meanmachines.biz/html/lib/Zend/Db/Adapter/Abstract.php(457): Zend_Db_Statement->execute(Array)
#2 /var/www/alex/meanmachines.biz/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(230): Zend_Db_Adapter_Abstract->query('SELECT 1 AS `st...', Array)
#3 /var/www/alex/meanmachines.biz/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(259): Zend_Db_Adapter_Pdo_Abstract->query('SELECT 1 AS `st...', Array)
#4 /var/www/alex/meanmachines.biz/html/lib/Zend/Db/Adapter/Abstract.php(668): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#5 /var/www/alex/meanmachines.biz/html/lib/Varien/Data/Collection/Db.php(761): Zend_Db_Adapter_Abstract->fetchAll(Object(Varien_Db_Select), Array)
#6 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(933): Varien_Data_Collection_Db->_fetchAll(Object(Varien_Db_Select))
#7 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(783): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false)
#8 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Catalog/Block/Product/List.php(151): Mage_Eav_Model_Entity_Collection_Abstract->load()
#9 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Abstract.php(642): Mage_Catalog_Block_Product_List->_beforeToHtml()
#10 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#11 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml('product_list', true)
#12 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Catalog/Block/Category/View.php(86): Mage_Core_Block_Abstract->getChildHtml('product_list')
#13 /var/www/alex/meanmachines.biz/html/app/design/frontend/default/default/template/catalog/category/view.phtml(92): Mage_Catalog_Block_Category_View->getProductListHtml()
#14 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Template.php(144): include('/var/www/alex/m...')
#15 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Template.php(176): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#16 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Template.php(193): Mage_Core_Block_Template->renderView()
#17 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Template->_toHtml()
#18 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#19 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Text_List->_toHtml()
#20 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#21 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#22 /var/www/alex/meanmachines.biz/html/app/design/frontend/default/default/template/page/3columns.phtml(63): Mage_Core_Block_Abstract->getChildHtml('content')
#23 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Template.php(144): include('/var/www/alex/m...')
#24 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Template.php(176): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#25 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Template.php(193): Mage_Core_Block_Template->renderView()
#26 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Template->_toHtml()
#27 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Model/Layout.php(526): Mage_Core_Block_Abstract->toHtml()
#28 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Controller/Varien/Action.php(339): Mage_Core_Model_Layout->getOutput()
#29 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Catalog/controllers/CategoryController.php(103): Mage_Core_Controller_Varien_Action->renderLayout()
#30 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Controller/Varien/Action.php(367): Mage_Catalog_CategoryController->viewAction()
#31 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(247): Mage_Core_Controller_Varien_Action->dispatch('view')
#32 /var/www/alex/meanmachines.biz/html/app/code/core/Mage/Core/Controller/Varien/Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#33 /var/www/alex/meanmachines.biz/html/app/Mage.php(457): Mage_Core_Controller_Varien_Front->dispatch()
#34 /var/www/alex/meanmachines.biz/html/index.php(52): Mage::run()
#35 {main}

If it’s any help I have installed a few locales.  No idea if this affects queries (probably not), but I have noticed that in the back end it states ‘Product listing sort by’ - ‘Best Value’ and on the front end it states ‘sort by’ - ‘Position’.  It is broken in all languages.

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

Pretty huge bug to let slip in, considering the flat products etc was a main feature of 1.3.
Bug has been reported here;

http://www.magentocommerce.com/bug-tracking/issue?issue=5996

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bladimir Arroyo
Jr. Member
 
Total Posts:  7
Joined:  2009-04-29
 

The issue says is fixed, but in what version were fixed, what should I do to make it work on my store?

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

The upcoming 1.3.2. It is in the roadmap.

http://www.magentocommerce.com/roadmap/release/1.3.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bladimir Arroyo
Jr. Member
 
Total Posts:  7
Joined:  2009-04-29
 

Thank you Alex, I was thinking that for now I could use the Name as the default filter for the store (I did it and it works) but I would need to remove or disable the “Position” filter, any help with that?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top