Magento – Fix Product URL Key Sporadically Being Set to Blank

product-urls

I am noticing that every so often, maybe once week a couple dozen products will lose their url key. I haven't had much time to look into it but my guess is it's after some type of indexing. Can anyone shed some light into why this is happening? We are running EE 1.13.1.0.

I have an audit to check the catalog_product_entity_url_key table and I can see that there is a record for each of these products, but the value is null.

I haven't been keeping track so I'm not sure if there are repeat offenders but today the audit showed 100+ products so it definitely changes.

UPDATE:
It appears this is happening after we do a product import. I have a ticket open with Magento. They gave me links to similar issues when using MAGMI, but we use the built in import process.

UPDATE:
It's not related to the product import. It's not happening each day but I've setup an audit and when the issue does occur it's between 9:20a and 9:40a. I don't see any external jobs that line up with this so I think I need to monitor either Magento's internal processes or the DB.

Best Answer

Turns out it was an external job running from cron. We created a script to remove special pricing from products. The problem was that the script was not loading the entire product object. When it removed the pricing and saved the product the url_key was removed as well.

The job grabs a collection of all the products with expired special pricing. First I removed the addAttributeToSelect from the collection, but that didn't work and I'm not fully sure why. So my end solution was to loop through each product in the collection and use the id to load the individual product again, makes the changes and save.

If anyone comes upon this keep in mind that it comes down to a product being modified and saved so look into all the places you are doing that in your custom modules or scripts.

Related Topic