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

Page 3 of 3
Reindexing “Catalog URL Rewrites” fails
 
OrangeToybox
Jr. Member
 
Total Posts:  1
Joined:  2012-07-08
 
hillzzz - 13 October 2011 01:58 PM

I had the URL indexing Processing issue

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.

It appears to have fixed the problem

OMG after 2 days of searching this solution actually worked. I was a bit worried about emptying data out of my SQL db but after 2 days I was ready to try anything.

Used PHPMYADMIN, found the core_url_rewrite table, selected browse and used the truncate command (bottom right). Then went back into the magento admin and reindexed all.

WHOOOOOOHOOOOO it took a while but finished without error 500. Now I know its good I’m gonna back this mf up!

PS Magento Ver 1.7.0.0

THANKS HILLZZZ

 
Magento Community Magento Community
Magento Community
Magento Community
 
getoutdoors
Jr. Member
 
Total Posts:  7
Joined:  2011-11-17
 

The new Zend security update screwed with my URL rewrites for some reason. However I was able to get my re-indexing back to being error-free by simply truncating the core_url_rewrite table based on this thread’s advice. Thanks for the help guys!

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiliosKris
Jr. Member
 
Total Posts:  2
Joined:  2010-03-31
 

For what its worth, I ran into this problem after upgrading Magento v1.4 to v1.6.

Due to SEO reasons, I couldn’t truncate core_url_rewrite table.

Instead, I ran the following SQL query which fixed my problem:

UPDATE core_url_rewrite SET product_id NULL WHERE id_path LIKE 'category%';

Some of the original categories (created under v1.4) had a blank/whitespace (not NULL) value under the product_id column in the table. This command manually set the product_id to NULL for any categories.

Clear the cache, and re-try indexing.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hyyudu
Jr. Member
 
Total Posts:  2
Joined:  2012-08-24
 

Good day. Today I met such an error when tried to reindex catalog URLs:
Fatal error: Call to undefined method Varien_Db_Adapter_Pdo_Mysql::getSubstringSql() in C:\Webserver\Apache\htdocs\default\app\code\core\Mage\Catalog\Model\Resource\Url.php on line 190

The function in Url.php is

public function getLastUsedRewriteRequestIncrement($prefix$suffix$storeId)
    
{
        $adapter 
$this->_getWriteAdapter();
        
$requestPathField = new Zend_Db_Expr($adapter->quoteIdentifier('request_path'));
        
//select increment part of request path and cast expression to integer
        
$urlIncrementPartExpression Mage::getResourceHelper('eav')
            ->
getCastToInt($adapter->getSubstringSql(
                
$requestPathField,
                
strlen($prefix) + 1,
                
$adapter->getLengthSql($requestPathField) . ' - ' strlen($prefix) . ' - ' strlen($suffix)
            ));
I made a search in sources of a whole site - there is really not a single sign of a getSubstringSql function, neither in Varien_Db_Adapter_Pdo_Mysql, nor in other files. One day before it worked correctly. I didn’t change indexer.php or any of it’s includes, just added some more products in catalog. What can be the source of this problem? Thank you.
 
Magento Community Magento Community
Magento Community
Magento Community
 
Flipmedia
Member
 
Avatar
Total Posts:  43
Joined:  2009-09-24
 

Reading the following explains how I resolved this issue without truncating core_url_rewrite or making edits to Magento core files.

My problem was following and upgrade from 1.4 to 1.6

http://stackoverflow.com/questions/11781312/constraint-violation-duplicate-key-when-reindexing-magento/12236584#12236584

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hyyudu
Jr. Member
 
Total Posts:  2
Joined:  2012-08-24
 
Flipmedia - 02 September 2012 05:08 AM

Reading the following explains how I resolved this issue without truncating core_url_rewrite or making edits to Magento core files.

My problem was following and upgrade from 1.4 to 1.6

http://stackoverflow.com/questions/11781312/constraint-violation-duplicate-key-when-reindexing-magento/12236584#12236584

Thanks, but this wasn’t my problem. You had an SQL error, my error was in PHP.
Solved by changing

$adapter->getSubstringSql(
                
$requestPathField,
                
strlen($prefix) + 1,
                
$adapter->getLengthSql($requestPathField) . ' - ' strlen($prefix) . ' - ' strlen($suffix)
            )
to
"substring($requestPathField, ".(strlen($prefix)+1).", length($requestPathField)-length('$prefix')-length('$suffix'))"
 
Magento Community Magento Community
Magento Community
Magento Community
 
broesch
Jr. Member
 
Total Posts:  11
Joined:  2012-04-23
 

One other possible cause of the core_url_rewrite table having issues is from a third party product import tool improperly injecting data into the database. Take a look at this thread:
http://www.magentocommerce.com/boards/v/viewthread/260663/

 
Magento Community Magento Community
Magento Community
Magento Community
 
zbikram
Jr. Member
 
Total Posts:  12
Joined:  2011-08-01
 

You can trauncate tables from sql and create new product and reindex it will work . I have tried it in the magento 1.7.0.2.

SET FOREIGN_KEY_CHECKS 0
 
TRUNCATE TABLE `catalog_product_bundle_price_index`; 
TRUNCATE TABLE `catalog_product_bundle_selection`; 
TRUNCATE TABLE `catalog_product_bundle_selection_price`; 
TRUNCATE TABLE `catalog_product_bundle_option_value`; 
TRUNCATE TABLE `catalog_product_bundle_option`; 
TRUNCATE TABLE `catalog_product_entity_datetime`; 
TRUNCATE TABLE `catalog_product_entity_decimal`; 
TRUNCATE TABLE `catalog_product_entity_gallery`; 
truncate table `catalog_product_entity_group_price`; 
TRUNCATE TABLE `catalog_product_entity_int`; 
TRUNCATE TABLE `catalog_product_entity_media_gallery`; 
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`; 
TRUNCATE TABLE `catalog_product_entity_text`; 
TRUNCATE TABLE `catalog_product_entity_tier_price`; 
TRUNCATE TABLE `catalog_product_entity_varchar`; 
TRUNCATE TABLE `catalog_product_flat_1`; 
TRUNCATE TABLE `catalog_product_link`; 
TRUNCATE TABLE `catalog_product_link_attribute_decimal`; 
TRUNCATE TABLE `catalog_product_link_attribute_int`; 
TRUNCATE TABLE `catalog_product_link_attribute_varchar`; 
TRUNCATE TABLE `catalog_product_option`; 
TRUNCATE TABLE `catalog_product_option_price`; 
TRUNCATE TABLE `catalog_product_option_title`; 
TRUNCATE TABLE `catalog_product_option_type_price`; 
TRUNCATE TABLE `catalog_product_option_type_title`; 
TRUNCATE TABLE `catalog_product_option_type_value`; 
TRUNCATE TABLE `catalog_product_super_attribute_label`; 
TRUNCATE TABLE `catalog_product_super_attribute_pricing`; 
TRUNCATE TABLE `catalog_product_super_attribute`; 
TRUNCATE TABLE `catalog_product_super_link`; 
TRUNCATE TABLE `catalog_product_enabled_index`; 
TRUNCATE TABLE `catalog_product_website`; 
TRUNCATE TABLE `catalog_category_product_index`; 
 
TRUNCATE TABLE `catalog_category_product`; 
 
TRUNCATE TABLE `catalog_product_entity`; 
truncate table `catalog_product_relation`; 

TRUNCATE TABLE `cataloginventory_stock_item`; 
TRUNCATE TABLE `cataloginventory_stock_status`; 
SET FOREIGN_KEY_CHECKS 1;
 
Magento Community Magento Community
Magento Community
Magento Community
 
basti0071
Jr. Member
 
Total Posts:  1
Joined:  2010-11-13
 

For later reference, perhaps this can save someone a lot of time later.
I had the the very same problem and where unable to reindex the catalog url rewrites after an update from 1.6.0 to 1.6.1.

I tried truncating the table ‘core_url_rewrite’, what did not help at all. In fact, that was a bad idea, because all my manually created redirects were deleted, too. Gladly I did a backup before.
I tried the mentioned tips with changing the code and only throwing the mentioned exception in some cases (see code above), which also did not help me.
The funny thing was: on my test-box everything went fine, I only had this problem on production (what else ...).

So I went to my database on the test-box and ran the sql command:

explain core_url_rewrite;
then I did the same on my production-db. The column ‘product_id’ was not nullable there any more, which was exactly what I found in my exception.log

Solution:

ALTER TABLE `core_url_rewriteMODIFY `product_idint(10unsigned DEFAULT NULL;

Done. Reindexing worked fine again.

 
Magento Community Magento Community
Magento Community
Magento Community
 
skipx
Jr. Member
 
Total Posts:  3
Joined:  2013-03-12
 

This worked for me!

http://www.yireo.com/tutorials/magento/magento-administration/664-fixing-url-rewrites-with-magento

Hope it helps some of you guys.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rakesh Gangani
Jr. Member
 
Total Posts:  2
Joined:  2013-03-18
 

Hello,

On reindex \"Catalog URL rewrites\” i have received following error.

\"SQLSTATE[23000]: Integrity constraint violation:
1062 Duplicate entry \’60191400_1381900658-0-1\’ for key \’UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID\’\”

Many people have tried to solve this problem by truncating \"Core_url_rewrite\",
but truncating \"Core_url_rewrite\" is just a workaround and not a fixed solution. Does any one find a solution for this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
fgiplaza
Jr. Member
 
Total Posts:  1
Joined:  2013-09-09
 

Yeah!!!!! Truncating the ‘core_url_rewrite’ table seems to have completely resolved this issue for me as well!!!!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Long Kidsland
Jr. Member
 
Total Posts:  2
Joined:  2013-10-28
 

Hello,

Is there any other way other than truncating the core_url_rewrite table ?
I created a lot of custom URL Rewrite there to handle 404 pages and back links from the old system, so I don’t want to re-create them all.

Many thanks,

Long.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Flipmedia
Member
 
Avatar
Total Posts:  43
Joined:  2009-09-24
 

See: http://stackoverflow.com/a/23430982/473990

 
Magento Community Magento Community
Magento Community
Magento Community
 
MenteSimple
Jr. Member
 
Total Posts:  1
Joined:  2012-07-25
 
skipx - 04 September 2013 07:42 AM

This worked for me!

http://www.yireo.com/tutorials/magento/magento-administration/664-fixing-url-rewrites-with-magento

Hope it helps some of you guys.

This worked just fine for me. Easy and fast !!

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 3 of 3