title: Magento Price Range Error: "1054 Unknown column 'e.min_price' in 'where clause'"
body: <p>Folks, ground has skipped away.</p>
  
  <p>I'm getting an error in one particular situation when using magento e-commerce (1.7.0.2). The situation is, when the user tries to filtrate the catalog product's by a price range. The error presented is this</p>
  
  <pre><code>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-&gt;_execute(Array)
  #1 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql-&gt;_execute(Array)
  #2 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement-&gt;execute(Array)
  #3 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&gt;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-&gt;query('SELECT COUNT(DI...', Array)
  #5 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Zend/Db/Adapter/Abstract.php(825): Varien_Db_Adapter_Pdo_Mysql-&gt;query(Object(Varien_Db_Select), Array)
  #6 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract-&gt;fetchOne(Object(Varien_Db_Select), Array)
  #7 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/lib/Varien/Data/Collection.php(225): Varien_Data_Collection_Db-&gt;getSize()
  #8 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/community/Strategery/Infinitescroll2/Model/Catalog/Observer.php(40): Varien_Data_Collection-&gt;getLastPageNumber()
  #9 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/App.php(1338): Strategery_Infinitescroll2_Model_Catalog_Observer-&gt;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-&gt;_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-&gt;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-&gt;_beforeLoad()
  #14 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Review/Model/Observer.php(78): Mage_Eav_Model_Entity_Collection_Abstract-&gt;load()
  #15 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/App.php(1338): Mage_Review_Model_Observer-&gt;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-&gt;_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-&gt;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-&gt;_beforeToHtml()
  #20 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract-&gt;toHtml()
  #21 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract-&gt;_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-&gt;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-&gt;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-&gt;fetchView('frontend/defaul...')
  #26 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView()
  #27 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template-&gt;_toHtml()
  #28 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract-&gt;toHtml()
  #29 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Text_List-&gt;_toHtml()
  #30 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract-&gt;toHtml()
  #31 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract-&gt;_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-&gt;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-&gt;fetchView('frontend/defaul...')
  #35 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView()
  #36 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Core_Block_Template-&gt;_toHtml()
  #37 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract-&gt;toHtml()
  #38 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout-&gt;getOutput()
  #39 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Catalog/controllers/CategoryController.php(159): Mage_Core_Controller_Varien_Action-&gt;renderLayout()
  #40 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_CategoryController-&gt;viewAction()
  #41 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action-&gt;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-&gt;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-&gt;dispatch()
  #44 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/app/Mage.php(683): Mage_Core_Model_App-&gt;run(Array)
  #45 /Applications/XAMPP/xamppfiles/htdocs/parcodesign-setembro/index.php(87): Mage::run('', 'store')
  #46 {main}
  </code></pre>
  
  <p>I've been tracing the problem around, with not much success. I'm not pretty sure if the problem is related to the missing table called "min_price" in database, or anything else. As you can notice, the characters exposed in the error report is "e.min_price", and not only "min_price". The only file which contains these characters is <strong>app/code/core/Mage/CatalogIndex/Model/Indexer.php</strong> </p>
  
  <pre><code>if (strlen($values[$code]['from'])&gt;0) {
     $filter[$code]-&gt;where(
       "($table.min_price".implode('', $additionalCalculations[$code]).")*{$rateConversion} &gt;= ?",
     $values[$code]['from']
     );
  }
  
  if (strlen($values[$code]['to'])&gt;0) {
     $filter[$code]-&gt;where(
        "($table.min_price".implode('', $additionalCalculations[$code]).")*{$rateConversion} &lt;= ?",
     $values[$code]['to']
     );
  }
  </code></pre>
  
  <p>As you can see, actually it is "$table.min_price" and not "e.min_price". But this is the only file which contains these sequence of characters. ("min_price" appears in several others)</p>
  
  <p>It, probably, has come to your attention that I`m pretty lost here. So, ANY help will be appreciated.
  Thanks.</p>