4

I am using Magento 2.2.4, I am having too many Disabled/OutofStock products which are useless.

Now the problem I am simply replacing all Disabled/OutofStock products with New Products. I can successfully change everything in every disable product and make it New Product Besides Url Key. When I simply remove everything from Url Key field and Click save than new Url Key Generates successfully as per new product name but when I try to open that product in the browser, it shows 404 page and that product is still showing with old product's URL key. After that I have to go Marketing-->Url Rewrites and change the URL key manually and than the new product's URL key works fine But when ever I change anything in the new product for example Price, Categories etc than the old product's url key reverts back and the new product shows 404 page on new product's url key and only show the page on old product's url key.

I tried everything I able to found on the internet but failed, unfortunately.

Please guide if anyone has the solution for my above issue. I never faced this issue with Magento 1, This seems very weird.

Update: I just found that this issue is coming with the products only imported from Magento 1 and the products created with Magento 2 are working fine with Url Key.

FYI: we imported products from Magento 1 to Magento 2 with UB Data Migration Lite extension

does any one have any idea on this issue?

5
  • reindex and check again: php bin/magento indexer:reindex Commented May 25, 2018 at 4:54
  • i did this 100 times already but no success. I think because Magento 2 doesn't have URL Rewrite Index and Magento 1 was having URL Rewrite Index
    – zubair
    Commented May 25, 2018 at 9:07
  • try to php bin/magento indexer:clean & indexer:reindex
    – MR.R DNATH
    Commented May 25, 2018 at 23:54
  • issue resolved and i answered as well. Please check. Thank you so much.
    – zubair
    Commented May 26, 2018 at 13:33
  • Please check for this .. I hope it will works for you ... magento.stackexchange.com/questions/244801/…
    – 1990rk4
    Commented Oct 9, 2018 at 10:02

2 Answers 2

6

The issue resolved with below solution.

As I said url_key was not regenerating only with Migrated Products from Magento 1 to Magento 2 with UB Migration Tool Lite Extension.

At the time of Migrating the products UB Migration Tool created multiple url_key and url_path entries for each product instead of creating just 1 entry for url_key. So I deleted the extra entries by using below queries.

DELETE FROM catalog_product_entity_varchar WHERE attribute_id = 120 (This was For url_path which is no longer needed with in my config circumstances and this was populated with the old products url value)

DELETE FROM catalog_product_entity_varchar WHERE store_id = 1 (This was also populated with old products url_key value and not needed because Magento by default is saving all the product url_key with store_id = 0 and not 1 because I am using single store mode)

After above I truncate url_rewrite tables below

TRUNCATE catalog_url_rewrite_product_category TRUNCATE url_rewrite

After above I install the following module and this is excellent tool to regenerate the urls because Magento 2 is not providing such functionality.

https://github.com/karliuka/m2.IndexerUrlRewrite

after installation, i executed below commands

php bin/magento indexer:reindex

all urls reindexed successfully and after that i tested changing the url keys for old migrated products from Magento 1 and they are now successfully generating the new url_key same time after saving the product they simply remove old url_key and insert new url_key in the database which is perfectly fine.

Thank you

2
  • Added the step to check the ID of the attribute "url_path" which I think is important before running the delete commands. Also, in two cases, I have found messy leftovers or two attribute id's for url_path. Thank you Barry and Zubair! Commented Feb 23, 2020 at 9:52
  • What magento 2 doesn't have URL rewrites? But I can swear it worked for me in 2.3.5-p. It is just not working for a Menu that is using Mega Menu extension. I changes the categories instead of creating new ones and changes the URL key and all the categories worked except for this one. I had even changes the demo products URL keys and even that worked. So I am not sure what is the problem. Changing the URL key does change the URL Path for me. I just doesnt change for a menu that is a Mega Menu.
    – rawraj
    Commented Dec 15, 2020 at 19:48
0

Have you set up the cronjob to reindex your data?

If you haven't set up it, I would recommend you to log in by SSH and execute the reindex command manually support.weltpixel.com

1
  • Thanks but i already setup cronjob perfectly and tried reindexing manually as well but no success. Magento 2 doesn't have URL Rewrite index like Magento 1
    – zubair
    Commented May 25, 2018 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.