Debugging SQL Syntax Error in Magento Extension - magento

I’m fairly new to Magento and encounter this error when I try to debug an extension I installed recently. I’m trying to understand the log, but left wondering what exactly is the problem. Can anyone tell me where I should start debugging based on the following log?
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 'AS `query_id`, `s`.`product_id`, MATCH (s.data_index) AGAINST ('' IN BOOLEAN MOD' at line 1
Trace:
#0 /var/www/html/springmaternity/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/html/springmaternity/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/html/springmaternity/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /var/www/html/springmaternity/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#4 /var/www/html/springmaternity/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#5 /var/www/html/springmaternity/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php(393): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...', Array)
#6 /var/www/html/springmaternity/app/code/core/Mage/CatalogSearch/Model/Fulltext.php(136): Mage_CatalogSearch_Model_Resource_Fulltext->prepareResult(Object(Mage_CatalogSearch_Model_Fulltext), '', Object(Yireo_DisableLog_Model_Rewrite_Catalogsearch_Query))
#7 /var/www/html/springmaternity/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext/Collection.php(55): Mage_CatalogSearch_Model_Fulltext->prepareResult()
#8 /var/www/html/springmaternity/app/code/core/Mage/CatalogSearch/Model/Layer.php(58): Mage_CatalogSearch_Model_Resource_Fulltext_Collection->addSearchFilter('')
#9 /var/www/html/springmaternity/app/code/community/Rayfox/Catalog/Model/Search/Layer.php(18): Mage_CatalogSearch_Model_Layer->prepareProductCollection(Object(Mage_CatalogSearch_Model_Resource_Fulltext_Collection))
#10 /var/www/html/springmaternity/app/code/core/Mage/CatalogSearch/Model/Layer.php(42): Rayfox_Catalog_Model_Search_Layer->prepareProductCollection(Object(Mage_CatalogSearch_Model_Resource_Fulltext_Collection))
#11 /var/www/html/springmaternity/app/code/core/Mage/Catalog/Model/Layer.php(290): Mage_CatalogSearch_Model_Layer->getProductCollection()
#12 /var/www/html/springmaternity/app/code/core/Mage/Catalog/Model/Layer.php(220): Mage_Catalog_Model_Layer->_getSetIds()
#13 /var/www/html/springmaternity/app/code/core/Mage/Catalog/Block/Layer/View.php(163): Mage_Catalog_Model_Layer->getFilterableAttributes()
#14 /var/www/html/springmaternity/app/code/local/FME/Layerednav/Block/Layer/View.php(85): Mage_Catalog_Block_Layer_View->_getFilterableAttributes()
#15 /var/www/html/springmaternity/app/code/core/Mage/Core/Block/Abstract.php(293): FME_Layerednav_Block_Layer_View->_prepareLayout()
#16 /var/www/html/springmaternity/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#17 /var/www/html/springmaternity/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('layerednav/sear...', 'layer')
#18 /var/www/html/springmaternity/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('layerednav/sear...', 'layer')
#19 /var/www/html/springmaternity/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#20 /var/www/html/springmaternity/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#21 /var/www/html/springmaternity/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#22 /var/www/html/springmaternity/app/code/local/FME/Layerednav/controllers/FrontController.php(54): Mage_Core_Controller_Varien_Action->loadLayout()
#23 /var/www/html/springmaternity/app/code/core/Mage/Core/Controller/Varien/Action.php(418): FME_Layerednav_FrontController->searchAction()
#24 /var/www/html/springmaternity/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('search')
#25 /var/www/html/springmaternity/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#26 /var/www/html/springmaternity/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#27 /var/www/html/springmaternity/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#28 /var/www/html/springmaternity/sg/index.php(90): Mage::run('sg', 'website')
#29 {main}

If you have a model, that is doing query and you are curious what the SQL that will be generated you have a few choices,
My favorite is to use the following
$collection = Mage::getModel('customcodes/code')->getCollection()
->addFieldToSelect('code')
->addFieldToFilter('order_id',array('eq'=>247938))
->addFieldToFilter('code_type',array('eq'=>'CODESQAC'));
$sql = $collection->getSelect()->__toString();
And then $sql would have
SELECT `main_table`.`code` FROM `custom_codes` AS `main_table` WHERE (`order_id` = 247938) AND (`code_type` = 'CODESQAC')
Now you can work through the Magneto syntax to figure out why its not pulling the results OR throwing errors like you are seeing.
It sounds like you know where the Magento code is coming from, so using this method will help you figure out if the syntax they used was incorrect.
Also, check the code for hard coded table names instead of using the Magento factory method and/or calls to specific table names rather than using something like the follwoing to get the actual table name ( you could have a table name prefix and the original code could just be hard coded )
$resource = Mage::getSingleton('core/resource');
$customer_table = $resource->getTableName('customer/entity');
Here is an example of using the hard coded table names rather than using configuration to get the table table name, in the case of table name prefixes
$collection->getSelect()->joinLeft(array('sfoa'=>'sales_flat_order_address'), 'main_table.entity_id = sfoa.parent_id and sfoa.address_type = \'billing\'', array('sfoa.company'));
The proper way would be something like this
$resource = Mage::getSingleton('core/resource');
$sales_table = $resource->getTableName('sales/order_address');
$collection->getSelect()->joinLeft(array('sfoa'=>$sales_table), 'main_table.entity_id = sfoa.parent_id and sfoa.address_type = \'billing\'', array('sfoa.company'));
Hopefully this will help you check for bad syntax and eventually how and what the actual SQL is being created.

Related

Laravel: using count in the where clause throwing error

I am working on a Laravel project. I am trying to write an Eloquent where I need to use raw where clause for COUNT.
This is my query.
$eligibleReceivers = ReceiverDevice::havingRaw('COUNT(phone_number) < 10')
->having('phone_number', '!=', $device->phone_number)
->groupBy('phone_number')->get();
I am trying to select the records where records the same phone_number must be less than 10.
When I run the code, I am getting the following error.
[previous exception] [object] (PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1055 'fork.receiver_devices.id' isn't in GROUP BY at /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:331)
[stacktrace]
#0 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(331): PDO->prepare('select * from `...')
#1 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(662): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}('select * from `...', Array)
#2 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(629): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#3 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(338): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#4 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2149): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#5 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2137): Illuminate\\Database\\Query\\Builder->runSelect()
#6 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2609): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#7 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2138): Illuminate\\Database\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#8 /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(545): Illuminate\\Database\\Query\\Builder->get(Array)
#9 /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(529): Illuminate\\Database\\Eloquent\\Builder->getModels(Array)
#10 /var/www/app/Http/Requests/RegisterDeviceRequest.php(72): Illuminate\\Database\\Eloquent\\Builder->get()
#11 /var/www/app/Http/Requests/RegisterDeviceRequest.php(60): App\\Http\\Requests\\RegisterDeviceRequest->registerReceiversFor(Object(App\\Models\\ClientDevice))
#12 /var/www/app/Http/Controllers/Auth/RegisterDeviceController.php(14): App\\Http\\Requests\\RegisterDeviceRequest->persist()
#13 [internal function]: App\\Http\\Controllers\\Auth\\RegisterDeviceController->store(Object(App\\Http\\Requests\\RegisterDeviceRequest))
#14 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#15 /var/www/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('store', Array)
#16 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\Auth\\RegisterDeviceController), 'store')
#17 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\\Routing\\Route->runController()
#18 /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\\Routing\\Route->run()
What is wrong with my code and how can I fix it?
try to do this :-
In config\database.php in mysql array
Set 'strict' => false // to disable all.

CakePHP 3 having bake troubles with oracle tables

Every time bake oracle table having bellow issue. Is there any one get any solution.
Exception: Columns used in constraints must be added to the Table schema first. The column "region_id" was not found in table "COUNTRIES". in [C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Database\Schema\Table.php, line 606]
2016-12-03 06:47:03 Error: [Cake\Database\Exception] Columns used in constraints must be added to the Table schema first. The column "region_id" was not found in table "COUNTRIES".
Stack Trace:
#0 C:\xampp\htdocs\production\vendor\cakedc\cakephp-oracle-driver\src\Database\Schema\OracleSchema.php(623): Cake\Database\Schema\Table->addConstraint('COUNTR_REG_FK', Array)
#1 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Database\Schema\Collection.php(134): CakeDC\OracleDriver\Database\Schema\OracleSchema->convertForeignKeyDescription(Object(Cake\Database\Schema\Table), Array)
#2 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Database\Schema\Collection.php(103): Cake\Database\Schema\Collection->_reflect('ForeignKey', 'COUNTRIES', Array, Object(Cake\Database\Schema\Table))
#3 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Database\Schema\CachedCollection.php(63): Cake\Database\Schema\Collection->describe('COUNTRIES', Array)
#4 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\ORM\Table.php(440): Cake\Database\Schema\CachedCollection->describe('COUNTRIES')
#5 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(345): Cake\ORM\Table->schema()
#6 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(221): Bake\Shell\Task\ModelTask->findHasMany(Object(Cake\ORM\Table), Array)
#7 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(127): Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table))
#8 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(110): Bake\Shell\Task\ModelTask->getTableContext(Object(Cake\ORM\Table), 'users', 'Users')
#9 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(97): Bake\Shell\Task\ModelTask->bake('Users')
#10 [internal function]: Bake\Shell\Task\ModelTask->main('users')
#11 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\Shell.php(466): call_user_func_array(Array, Array)
#12 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\Shell.php(459): Cake\Console\Shell->runCommand(Array, false, Array)
#13 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(227): Cake\Console\Shell->runCommand(Array, true, Array)
#14 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(182): Cake\Console\ShellDispatcher->_dispatch(Array)
#15 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(128): Cake\Console\ShellDispatcher->dispatch(Array)
#16 C:\xampp\htdocs\production\bin\cake.php(34): Cake\Console\ShellDispatcher::run(Array)
#17 {main}
Issue has been solved just need to fix the naming convention of "SEQUENCE", cause cakephp support that way. Example below,
If you have a table name "users" your sequnce name will be "seq_users".

Magento 1.9.1.0 - Unable to generate the sitemap

I guess if you meet the same error when trying to create the Google Sitemap from Magento 1.9.1.0 backend (Unable to generate the sitemap).
Under is what I found from the Exception Log:
2015-05-09T09:52:02+00:00 DEBUG (7): Exception message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'main_table.entity_id' in 'on clause', query was: SELECT `e`.`entity_id`, `e`.`created_at`, `e`.`updated_at`, `ur`.`request_path` AS `url` FROM `tts_catalog_category_entity` AS `e`
LEFT JOIN `tts_core_url_rewrite` AS `ur` ON e.entity_id=ur.category_id AND ur.store_id='1' AND ur.product_id IS NULL AND ur.is_system=1
INNER JOIN `tts_catalog_category_entity_int` AS `t1_is_active` ON main_table.entity_id=t1_is_active.entity_id AND t1_is_active.store_id=0
LEFT JOIN `tts_catalog_category_entity_int` AS `t2_is_active` ON t1_is_active.entity_id = t2_is_active.entity_id AND t1_is_active.attribute_id = t2_is_active.attribute_id AND t2_is_active.store_id = '1' WHERE (e.path LIKE '1/2/%') AND (t1_is_active.attribute_id='42') AND ((IF(t2_is_active.value_id > 0, t2_is_active.value, t1_is_active.value))=1)
Trace: #0 /home/blairsin/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/blairsin/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/blairsin/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/blairsin/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `e`.`ent...', Array)
#4 /home/blairsin/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `e`.`ent...', Array)
#5 /home/blairsin/public_html/app/code/community/Activo/Xmlsitemap/Model/Sitemap/Resource/Catalog/Category.php(47): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select))
#6 /home/blairsin/public_html/app/code/community/Activo/Xmlsitemap/Model/Sitemap/Sitemap.php(28): Activo_Xmlsitemap_Model_Sitemap_Resource_Catalog_Category->getCollection('1')
#7 /home/blairsin/public_html/app/code/core/Mage/Adminhtml/controllers/SitemapController.php(255): Activo_Xmlsitemap_Model_Sitemap_Sitemap->generateXml()
#8 /home/blairsin/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_SitemapController->generateAction()
#9 /home/blairsin/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('generate')
#10 /home/blairsin/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /home/blairsin/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#12 /home/blairsin/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#13 /home/blairsin/public_html/index.php(87): Mage::run('base', 'website')
#14 {main}
This should be an error happened when generating the MySQL sentence, a "main_table" table was inserted and it cannot be found in the database.
I think this is a Magento core code error - please help me figure it out.
Thank you.
You are using a module (Activo_Xmlsitemap) which is rewriting the model of sitemap based on the code of an older Magento version.
I used to have the same issue after upgrading Magento 1.7 to Magento 1.9
The override needs to be adjusted by changing the table alias of catalog_category_entity from "e" to "main_table"

Magento - Cannot run reindexing, missing column in database

I'm running with an extension for my layered navigation, which worked well till I tried to update it to a never version. I'm not able to reindex the extension again, this is what i get from it:
2012-11-29T21:35:30+01:00 DEBUG (7): Exception message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'target.default_mask1' in 'field list'
Trace: #0 /var/www/site.com/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/site.com/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /var/www/site.com/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /var/www/site.com/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT DISTINCT...', Array)
#4 /var/www/site.com/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query('SELECT DISTINCT...', Array)
#5 /var/www/site.com/public_html/lib/Zend/Db/Adapter/Abstract.php(734): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /var/www/site.com/public_html/app/code/local/Mana/Db/Helper/Data.php(146): Zend_Db_Adapter_Abstract->fetchAll(Object(Varien_Db_Select))
#7 /var/www/site.com/public_html/app/code/local/Mana/Db/Model/Indexer.php(36): Mana_Db_Helper_Data->replicate()
#8 /var/www/site.com/public_html/app/code/core/Mage/Index/Model/Process.php(207): Mana_Db_Model_Indexer->reindexAll()
#9 /var/www/site.com/public_html/app/code/core/Mage/Index/Model/Process.php(253): Mage_Index_Model_Process->reindexAll()
#10 /var/www/site.com/public_html/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(124): Mage_Index_Model_Process->reindexEverything()
#11 /var/www/site.com/public_html/app/code/local/Mage/Core/Controller/Varien/Action.php(420): Mage_Index_Adminhtml_ProcessController->reindexProcessAction()
#12 /var/www/site.com/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('reindexProcess')
#13 /var/www/site.com/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#14 /var/www/site.com/public_html/app/code/local/Mage/Core/Model/App.php(348): Mage_Core_Controller_Varien_Front->dispatch()
#15 /var/www/site.com/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#16 /var/www/site.com/public_html/index.php(82): Mage::run('', 'store')
And this is the replicate:
2012-11-29T21:49:20+01:00 DEBUG (7): UPDATE: SELECT DISTINCT 'target'.'id', 'target'.'code', 'target'.'type', 'target'.'default_mask0', 'target'.'default_mask1', 'eav_attribute_additional'.'is_filterable' AS 'is_enabled', 'eav_attribute'.'frontend_label' AS 'name', 'eav_attribute_additional'.'is_filterable_in_search' AS 'is_enabled_in_search', 'eav_attribute_additional'.'position' FROM 'eav_attribute'
INNER JOIN 'catalog_eav_attribute' AS 'eav_attribute_additional' ON eav_attribute.attribute_id = eav_attribute_additional.attribute_id
INNER JOIN 'eav_entity_type' ON eav_attribute.entity_type_id = eav_entity_type.entity_type_id
INNER JOIN 'm_filter2' AS 'target' ON target.code = eav_attribute.attribute_code WHERE (eav_entity_type.entity_type_code = 'catalog_product') AND (eav_attribute_additional.is_filterable <> 0)
If however, I remove the 'target','default_mask1' part, I'am able to find the attributes. I also found the default_mask in eav_attribute, but I'm not able to figure out what exactly the problem is unfortunatly. Any help would be appreciated!
(The extension is Manapro seo layered navigation)
The problem was that the "upgrade" was interrupted due to visitors on the site. I put down the site, removed the /includes/ folder, ran a script from the developer in the sql, re-cached, and all worked as a charm again! So a lesson to myself, always put down the site before upgrading extensions!

Magento error with layered navigation

I am using a custom theme from themeforest, I have added all my attributes and attribute sets and a few products so I could test the layerd navigation however when I try to filter down by anything except price or category I get the "There has been an error processing your request" error.
I have noticed that when I filter down by price or category it is adding the option that was choose twice in the "Currently Shopping By" instead of just once and if you click the cross to remove it it will remove both.
But back to the main error maybe that has somehting to do with it not sure, I have pasted the error here:
a:5:{i:0;s:62:"You cannot define a correlation name 'type_idx' more than once";i:1;s:3295:"#0 /home/towelsjt/public_html/lib/Varien/Db/Select.php(281): Zend_Db_Select->_join('inner join', Array, 'type_idx.entity...', Array, NULL)
#1 /home/towelsjt/public_html/lib/Zend/Db/Select.php(336): Varien_Db_Select->_join('inner join', Array, 'type_idx.entity...', Array, NULL)
#2 /home/towelsjt/public_html/lib/Zend/Db/Select.php(315): Zend_Db_Select->joinInner(Array, 'type_idx.entity...', Array, NULL)
#3 /home/towelsjt/public_html/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Attribute.php(70): Zend_Db_Select->join(Array, 'type_idx.entity...', Array)
#4 /home/towelsjt/public_html/app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php(94): Mage_Catalog_Model_Resource_Layer_Filter_Attribute->applyFilterToCollection(Object(Mage_Catalog_Model_Layer_Filter_Attribute), '35')
#5 /home/towelsjt/public_html/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(91): Mage_Catalog_Model_Layer_Filter_Attribute->apply(Object(Mage_Core_Controller_Request_Http), Object(Mage_Catalog_Block_Layer_Filter_Attribute))
#6 /home/towelsjt/public_html/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(73): Mage_Catalog_Block_Layer_Filter_Abstract->_initFilter()
#7 /home/towelsjt/public_html/app/code/core/Mage/Catalog/Block/Layer/View.php(136): Mage_Catalog_Block_Layer_Filter_Abstract->init()
#8 /home/towelsjt/public_html/app/code/core/Mage/Core/Block/Abstract.php(238): Mage_Catalog_Block_Layer_View->_prepareLayout()
#9 /home/towelsjt/public_html/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#10 /home/towelsjt/public_html/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('catalog/layer_v...', 'catalog.rightna...')
#11 /home/towelsjt/public_html/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('catalog/layer_v...', 'catalog.rightna...')
#12 /home/towelsjt/public_html/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#13 /home/towelsjt/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#14 /home/towelsjt/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#15 /home/towelsjt/public_html/app/code/core/Mage/Catalog/controllers/CategoryController.php(146): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#16 /home/towelsjt/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_CategoryController->viewAction()
#17 /home/towelsjt/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#18 /home/towelsjt/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /home/towelsjt/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /home/towelsjt/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#21 /home/towelsjt/public_html/index.php(87): Mage::run('', 'store')
#22 {main}";s:3:"url";s:32:"/index.php/products.html?type=35";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
I had almost exactly the same problem and it was indeed a duplication issue causing the error.
I've been using a local.xml file for some layout changes and had duplicated a block somehow
/app/design/frontend/default/mytheme/layout.xml
I think you'd have to look in here or catalog.xml
I had the same error. The solution in my case was that I made a layered navigation invisble with "unsetChild" first and then added it again. Removing the first one instead of unsetting it was the solution.

Resources