magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.51k stars 9.31k forks source link

Magento 2.3.2 wrong product url with multiple store views #25084

Closed LouNik1984 closed 4 years ago

LouNik1984 commented 5 years ago

This issue is similar to (not the same as) #16134 which is marked as closed even if the url issue is not fixed:

Preconditions (*)

Steps to reproduce (*)

Expected result (*)

Actual result (*)

Notes

m2-assistant[bot] commented 5 years ago

Hi @LouNik1984. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@LouNik1984 do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


m2-assistant[bot] commented 5 years ago

Hi @vikalps4. 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: :point_down:


m2-assistant[bot] commented 5 years ago

Hi @shikhamis11. 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: :point_down:

kingletas commented 4 years ago

@LouNik1984 one thing you want to verify is that the product is associated with the other stores and it has generated the URLs. When you see URLs like catalog/product/view/{id} it usually means the URL rewrite was not found. Another thing, for the no default store you may start seeing the store __param if you access them from a separate store.

LouNik1984 commented 4 years ago

"one thing you want to verify is that the product is associated with the other stores and it has generated the URLs"

I'm not sure I understand correctly, but when I open the backend I can see that the website is correctly flagged for all store views, so apparently everything is right but if I check the rewrite table in database then the rows corrisponding to the other stores are missing (only the default store is there). Saving the product from backend, clearing cache and reindex doesn't help. Olegkoval works because it adds the missing rows in the rewrite table.

"When you see URLs like catalog/product/view/{id} it usually means the URL rewrite was not found"

Yes, that's exactly the issue: the urls from additional stores are not written in the rewrite table. Olegkoval extension fixes this by adding the missing record in the database table.

I did a bunch of tests and I think I understood the issue:

I usually create the product for all store views and then update the products with only those fields which are store specific (such as description which changes based on store language). Because of this I only add the store_id key on product update. I test the product creation by adding the store_id = 0 and it seems to work: if I create a product specifying store_id = 0 in the data array, then the urls are created for all store views.

LouNik1984 commented 4 years ago

I noticed something else, this time during the update of the product:

if I try to update a field for a specific store view (eg: the description field on the german store view), the new value is correctly saved but all the "use default value" checkboxes gets unchecked. I think that only the edited field should have the box unchecked

m2-assistant[bot] commented 4 years ago

Hi @engcom-Charlie. 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: :point_down:

engcom-Charlie commented 4 years ago

Hello @LouNik1984

We are not able to reproduce this issue on the latest 2.3-develop branch by provided steps.

Testing scenario:

  1. Create two or more store views image

  2. create products programmatically (code instead of backend admin) My code: image

  3. Check product URL on all store views

Result: on frontend, URL for product = http://magento2pr3.loc/sample-simple-product11132555558885.html for all store views Default store view: image test1: image test2: image

URL Rewrites: image

So i have to close this issue.

Thanks for your report!