In index-management “Catalog URL Rewrites” is in state processing (but seems that there is no progress). Triggering reindex fails with message “An error occurred while saving the URL rewrite”.
Deleting var/cache, var/session as I read in other thread didn’t fix.
Sorted the Target Path column and filtered for “category/13” (as there was sth with category/13-xxx in the log). So there where 2 rows, one for the default store and for our current store, however with different request paths. Corrected the path and now it’s running.
I am experiencing the same problems as gatinho. Deleting the cache or session date doesn’t work for me either.
Running the PHP indexer script gives me the following exceptions:
Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000] [2002] No such file or directory’ in [...]/lib/Zend/Db/Adapter/Pdo/Abstract.php:129
Stack trace:
#0 [...]/lib/Zend/Db/Adapter/Pdo/Abstract.php(129): PDO->__construct(’mysql:host=loca...’, ‘root’, ‘root’, Array)
#1 [...]/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#2 [...]/lib/Varien/Db/Adapter/Pdo/Mysql.php(300): Zend_Db_Adapter_Pdo_Mysql->_connect()
#3 [...]/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect()
#4 [...]/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(’SET NAMES utf8’, Array)
#5 [...]/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract->query(’SET NA in [...]/lib/Zend/Db/Adapter/Pdo/Abstract.php on line 144
I tried this with an updated version of 1.6. and a new installed one with old data imported in db.
I emptied the core_url_rewrite table and was able to rebuild the indices for the backend. Just to make sure I also reset the rights. Finally running the indexer worked for me on the server environment.
Rebuilding the indices locally with the PHP-script still gives me the exceptions above.
i’ve had this reindex fail for me as well on 1.6.0.0 CE
An error occurred while saving the URL rewrite
i saw this in the magento wiki:
http://www.magentocommerce.com/wiki/steps_to_solve_re-indexing_errors_in_magento_admin
but i’m not liking the looks of it as it seems a bit drastic that you have to manually delete stuff from the database in order to get it functioning again - so i havn’t tried this.
The problem comes from the method _refreshProductRewrite() in the model Mage_Catalog_Model_Url
This condition was changed from Magento 1.4
// v. 1.4 $categoryId = null; if ($category->getUrlPath()) { $categoryId = $category->getId(); $updateKeys = false; }
to
// v. 1.6 $categoryId = null; if ($category->getLevel() > 1) { $categoryId = $category->getId(); $updateKeys = false; }
So if you have a product in 2 (or more) categories (in the root category (level 1)), Magento’ll try to insert 2 times the sames datas..
So an exception is launch and kill the script (in Mage_Catalog_Model_Resource_Url)
public function saveRewrite($rewriteData, $rewrite) { .... try { $adapter->insert($this->getMainTable(), $rewriteData); } catch (Exception $e) { Mage::logException($e); Mage::throwException(Mage::helper('catalog')->__('An error occurred while saving the URL rewrite')); } } unset($rewriteData);
return $this; }
A simple correction is to launch the exception only if the datas contains a valid category_id :
try { $adapter->insert($this->getMainTable(), $rewriteData); } catch (Exception $e) { // Bug - the category_id is set to null when the category has a level <= 1 // So if our product is in 2 differents level 1 categories, the indexer crashes if ($rewriteData['category_id'] != null) { Mage::logException($e); Mage::throwException(Mage::helper('catalog')->__('An error occurred while saving the URL rewrite')); } }
or use the previous conditon from 1.4 (not tested).
I had the URL indexing Processing issue after upgrading from 1.4.01 to 1.6.
I tried re-indexing from the admin screen and the URL Rewrite just hangs forever.
I tried re-indexing from the command line via ssh with
php shell/indexer.php reindexall
and it gave an error message on the URL-Rewrite index Error saving URL Re-Wite to database
The problem is I am running multiple stores on one instance of magento.
Then I had an idea I used phpmyadmin to truncate the core_url_rewrite table. Note I did not delete it I emptied the table that is I deleted all the rows but left the table structure intact.
Next I re-indexed from the command line again and it worked without errors. I tried re-indexing in the admin interface and again it worked without errors.
The problem comes from the method _refreshProductRewrite() in the model Mage_Catalog_Model_Url
This condition was changed from Magento 1.4
// v. 1.4 $categoryId = null; if ($category->getUrlPath()) { $categoryId = $category->getId(); $updateKeys = false; }
to
// v. 1.6 $categoryId = null; if ($category->getLevel() > 1) { $categoryId = $category->getId(); $updateKeys = false; }
So if you have a product in 2 (or more) categories (in the root category (level 1)), Magento’ll try to insert 2 times the sames datas..
So an exception is launch and kill the script (in Mage_Catalog_Model_Resource_Url)
public function saveRewrite($rewriteData, $rewrite) { .... try { $adapter->insert($this->getMainTable(), $rewriteData); } catch (Exception $e) { Mage::logException($e); Mage::throwException(Mage::helper('catalog')->__('An error occurred while saving the URL rewrite')); } } unset($rewriteData);
return $this; }
A simple correction is to launch the exception only if the datas contains a valid category_id :
try { $adapter->insert($this->getMainTable(), $rewriteData); } catch (Exception $e) { // Bug - the category_id is set to null when the category has a level <= 1 // So if our product is in 2 differents level 1 categories, the indexer crashes if ($rewriteData['category_id'] != null) { Mage::logException($e); Mage::throwException(Mage::helper('catalog')->__('An error occurred while saving the URL rewrite')); } }
or use the previous conditon from 1.4 (not tested).
Djay
Where do I find this? I had my store moved from one domain to another and I’m getting this same problem. I’ve been working on it for hours.
I had the URL indexing Processing issue after upgrading from 1.4.01 to 1.6.
I tried re-indexing from the admin screen and the URL Rewrite just hangs forever.
I tried re-indexing from the command line via ssh with
php shell/indexer.php reindexall
and it gave an error message on the URL-Rewrite index Error saving URL Re-Wite to database
The problem is I am running multiple stores on one instance of magento.
Then I had an idea I used phpmyadmin to truncate the core_url_rewrite table. Note I did not delete it I emptied the table that is I deleted all the rows but left the table structure intact.
Next I re-indexed from the command line again and it worked without errors. I tried re-indexing in the admin interface and again it worked without errors.