Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving Product does not update URL rewrite in Magento 2.1.0 #5929

Closed
JacobDrummond opened this issue Aug 2, 2016 · 101 comments
Closed

Saving Product does not update URL rewrite in Magento 2.1.0 #5929

JacobDrummond opened this issue Aug 2, 2016 · 101 comments
Assignees
Labels
Component: CatalogUrlRewrite Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@JacobDrummond
Copy link

Preconditions

  1. PHP 5.6.16
  2. MySQL 5.6.21-log
  3. Magento 2.1.0
  4. Nginx 1.4.6

Steps to reproduce

  1. Confirm old URL rewrite works:
    hama-1
  2. Update product URL:
    hama-2

Expected result

  1. Product should be visible at /{new product url}

Actual result

  1. 404 error:
    hama-3
  2. url_rewrite entry for product saved above still shows old request_path:
    hama-4
@JacobDrummond
Copy link
Author

Hi @veloraven,

Thank you for labeling this issue as a bug. Do you know if/when it will be escalated to "acknowledged" by developers?

This bug, along with #5923 and #5942, is blocking a go-live. What's the usual workflow and timescale for the Magento team to address bugs?

@Cacasapo
Copy link

Cacasapo commented Aug 4, 2016

Confirmed on 2.0.8->2.1 upgrade.
My product urls end in .html, too, but I'm too new to Magento to know if that's normal.
/myproduct,html works, but /myproduct does not.

@JacobDrummond
Copy link
Author

@Cacasapo,

Rewrite bug

Thanks for narrowing it down to 2.0.8->2.1 upgrade. Were you able to find the commit that broke it?

URL suffix feature

You can change the default ".html" URL suffix in Stores > Configuration > Catalog > Catalog > Search Engine Optimization. I usually set it to blank for nice clean URLs:

hama-1

@Cacasapo
Copy link

Cacasapo commented Aug 4, 2016

@JacobDrummond I've looked at url_rewrite commits, just out of curiosity, and saw that there was a lot of activity on it not too long ago, alas I'm not a coder and thus useless inside Magento's guts.

Thanks for the info on the URL thing. Didn't think to look under SEO for it!

@Cacasapo
Copy link

Cacasapo commented Aug 4, 2016

This bug is also present on a 2.1 fresh install.

@andimov
Copy link
Contributor

andimov commented Aug 5, 2016

@JacobDrummond
Thank you for reporting this issue!
Can't reproduce this bug.
Please, check, did you have made changes in the section "Search Engine Optimization" below?
You can change URL rewrite in this section while you changed product or category name.

@JacobDrummond
Copy link
Author

@andimov,

Yes, I updated "[product] > Search Engine Optimization > URL key" which saved the url_key attribute, but didn't update the url_rewrite table. This issue appears to be with Magento_CatalogUrlRewrite not Magento_Catalog.

Are you trying to reproduce on a 2.1 fresh install, or on a 2.0.7->2.1 upgrade? So far the only reports are from people who upgraded.

@Cacasapo
Copy link

Cacasapo commented Aug 5, 2016

@JacobDrummond I tested this and the other bug you found on a fresh 2.1 composer install. This bug is present on fresh and upgrade, while the other is only present on an upgrade.

@JacobDrummond
Copy link
Author

My mistake, @Cacasapo. #5923 and #5929 are so similar I'm getting my wires crossed

@Cacasapo
Copy link

Cacasapo commented Aug 5, 2016

@JacobDrummond Understandable. They're also pretty nasty, so I'm surprised more people aren't chiming in with #5929

@JacobDrummond
Copy link
Author

Hi @Cacasapo,

Similar to #5923, this issue can be resolved by disabling single-store mode.

The issue appears to be that URL-rewritable entities only regenerate their URLs when a website/store field is present. These fields only show when single-store mode is disabled.

@JacobDrummond
Copy link
Author

@Cacasapo,

To clarify, here's how you regenerate URLs on a site where url_rewrites has become out-of-sync with product entities:

  1. DIsable single-store mode:
    page-1
  2. Select all products, then click "Update attributes":
    prod-2
  3. Assign products to all stores, then click save to regenerate all URLs:
    prod-3

@Cacasapo
Copy link

Cacasapo commented Aug 8, 2016

@JacobDrummond Nicely done.

@andimov Does this keep the two bugs in your neck of the woods?

@andimov andimov added bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed Progress: needs update labels Aug 16, 2016
@andimov
Copy link
Contributor

andimov commented Aug 16, 2016

@JacobDrummond @Cacasapo
Thanks! I've created an internal ticket for this issue - MAGETWO-56862 and linked it to this one.

@andimov andimov removed their assignment Sep 2, 2016
mmansoor-magento pushed a commit that referenced this issue Oct 18, 2016
mmansoor-magento pushed a commit that referenced this issue Oct 18, 2016
mmansoor-magento pushed a commit that referenced this issue Oct 18, 2016
mmansoor-magento pushed a commit that referenced this issue Oct 18, 2016
Bugs
- MAGETWO-56862 [Github] Saving Product does not update URL rewrite in Magento 2.1.0 with single-store mode #5929
- MAGETWO-55935 [Bundle product] Cannot configure bundle product in order editing(admin panel)
- MAGETWO-55849 Customer can be deleted without Merchant permissions verification
- MAGETWO-57118 [github#6201] Form key shared between admin and frontend
- MAGETWO-57989 Unable to create custom image attribute in category
- MAGETWO-55395 Custom address attribute not appearing on Checkout summary
- MAGETWO-59240 There is no WHERE claus for retrieving Media Gallery Data
@magento-engcom-team
Copy link
Contributor

Hi @JacobDrummond. Thank you for your report.
The issue has been fixed in #19170 by @p-bystritsky in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.1 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Nov 16, 2018
@jaxtheking
Copy link

I can confirm that saving a product now does update the URL rewrite correctly.
However, since I've upgraded to 2.3.1 from 2.3.0, I've been getting a new odd problem where a URL rewrite does not get created upon creation of a new product and the URL for the product is messed up (catalog/product/view/id/9027/s/test222/ instead of just catalog/product/view/id/9027).

However, if I edit the product and only if I change the URL manually to say test333, the URL rewrites gets eventually generated as expected.

My site is in single-mode. Am I the only one to get this problem on new products created after the upgrade??
@p-bystritsky Does this sound like it could be related to your commit?

Many thanks, Luca

@davidvthecoder
Copy link

I have run into a problem upgrading to 2.3.1, after doing so, there are random products where the page url will return a 404: catalog/product/view/id/998, some other products work. The broken URL gets fixed only if I go into management and save the product again. Is there any workaround to find all these broken paths and update them?

@chrisbadley
Copy link

I have run into a problem upgrading to 2.3.1, after doing so, there are random products where the page url will return a 404: catalog/product/view/id/998, some other products work. The broken URL gets fixed only if I go into management and save the product again. Is there any workaround to find all these broken paths and update them?

Have you noticed that simple products are not affected, in my case only bundle and configurable products are affected. Also using 2.3.1.

@nicholasscottfish
Copy link

nicholasscottfish commented Jun 6, 2019

This does indeed look to be an issue with the data migration. @hostep's post helped me find the steps to "solve" the issue.

Note: Be sure to run the below steps in a development/staging environment and thoroughly test all url's are working prior to running on a live environment. Take a backup of any database before following any of the steps below.

  1. Identify a product that has the issue; updating the Search Engine Optimization -> URL Key of the product does not reflect on the site after save as no redirect is generated.

  2. In the database, open the 'eav_entity_type' table and get the 'entity_type_id' where 'entity_type_code' = 'catalog_product'

  3. Open the 'eav_attribute' table and find the 'attribute_id' where 'attribute_code' = 'url_path' and 'entity_type_id' = {step2entityTypeId}

  4. Open the 'catalog_product_entity_varchar' table and delete all entries where 'attribute_id' = {step3AttributeId}

You should now be able to update url's for products via the CMS. If you already have url's in the CMS that you would like to apply then you can follow step 5.

  1. Install the olegkoval/magento2-regenerate-url-rewrites extension and run the following command:
php bin/magento ok:urlrewrites:regenerate --entity-type=product --save-old-urls

Note: Be certain to add the --save-old-urls param otherwise redirects won't be created for the old urls

Check your site, this should have updated all product ur's to those specified in the CMS.

@boter3
Copy link

boter3 commented Jun 7, 2019

We are experiencing same problem after upgrade to 2.3.1 - store is in 'single store mode'. New products get catalog/product/view/id/9027/s/product_name/ instead of /product_name/.

If we switch to multistore mode everything works as expected, but this is not an option.

For now the only solution for administrators is:

  • create new product and save it without assigning it to any category
  • assign this product to categories and save it
  • now url generation works fine.

@orlangur orlangur reopened this Jun 7, 2019
@ghost ghost removed their assignment Jun 7, 2019
@ghost ghost removed the Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release label Jun 7, 2019
@orlangur orlangur removed Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Progress: needs update labels Jun 7, 2019
@engcom-Bravo engcom-Bravo self-assigned this Jul 17, 2019
@m2-assistant
Copy link

m2-assistant bot commented Jul 17, 2019

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo
Copy link
Contributor

Hi, @boter3 @orlangur ! I can't reproduce this issue on fresh 2.3-develop branch(
I tried with single store mode enabled and disabled) . If you want to update this issue you can reopen it.

@engcom-Bravo engcom-Bravo added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jul 17, 2019
@Kashiffrq
Copy link

@Cacasapo,

To clarify, here's how you regenerate URLs on a site where url_rewrites has become out-of-sync with product entities:

1. DIsable single-store mode:
   ![page-1](https://cloud.githubusercontent.com/assets/8377620/17472170/4a2839fa-5d41-11e6-8e25-20f9f0ea1aa3.png)

2. Select all products, then click "Update attributes":
   ![prod-2](https://cloud.githubusercontent.com/assets/8377620/17473550/efaf4f4c-5d48-11e6-806a-485098ed6e4e.png)

3. Assign products to all stores, then click save to regenerate all URLs:
   ![prod-3](https://cloud.githubusercontent.com/assets/8377620/17473566/ffda9426-5d48-11e6-99ca-d030ffefd606.png)

Great 💯 🥇 👍

@michel334
Copy link

Hi @veloraven,

Thank you for labeling this issue as a bug. Do you know if/when it will be escalated to "acknowledged" by developers?

This bug, along with #5923 and #5942, is blocking a go-live. What's the usual workflow and timescale for the Magento team to address bugs?

About 3 years, so good luck

@shrma-smit
Copy link

@twoatechguy
Copy link

twoatechguy commented Jan 23, 2020

@sumitCueBlocks unfortunately your workaround doesn't work for me on 2.3.3.
edit: it's now working

@shrma-smit
Copy link

shrma-smit commented Feb 5, 2020

@twoatechguy This will work when you saved a new product or edit and save an existing one. I'm using this code on one of my site in Magento 2.3.3 and it is working fine for me.

@twoatechguy
Copy link

@sumitCueBlocks Thanks for following up, I created the module again and this time was successful in my tests on 2.3.3.

@SewHappy58
Copy link

I'm on Magento 2.3.4 and just uploaded my products from Magento 1 store and am facing this problem. No matter what I try, I'm still seeing the incorrect URL. Any suggestions? I have a multi-store and not sure if that is causing the issues as well

@dimplemenon
Copy link

@SewHappy58 Add url_key column in ur CSV, add unique URL for ur product (ex: name-sku) and then try to upload.

@DanielRuf
Copy link
Contributor

For anyone stuck on this issue, I'd be happy to share a solution that works with Magento 2.0 (and later with some minor tweaks) feel free to contact me

Why not post it publicly? You would help many with this. Also 2.0 (and 2.1) is very old.

@Eddcapone
Copy link

Eddcapone commented Oct 2, 2020

If you get "Notice: Undefined offset: 32000 in /vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml" when trying to update the attributes, then try this solution:

A flaw in the migration script left the setting empty for:

Stores -> Settings: Configuration -> Catalog -> Inventory -> Product Stock Options: Minimum Qty Allowed in Shopping Cart

Change the quantity to 1 for "ALL GROUPS" and save.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CatalogUrlRewrite Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests