-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
REST API Product update url_key doesnt re-gerenate url_rewites (INSANE) #30316
Comments
Hi @Seb2nim. Thank you for your report.
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:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
The same is true if you add a product to a website through the api. The product will not generate any new url rewrites for that website. After double checking the url rewrites are also not regerenated when the categories change. The problem seems to be that |
How is this a low priority issue? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions! |
Still relevant. |
Hi @engcom-Delta. Thank you for working on this issue.
|
✅ Confirmed by @engcom-Delta Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
Hi @engcom-Charlie. Thank you for working on this issue.
|
…_rewites when single store enabled
Still reproduces on multi-store |
We are also experiencing this issue in Magento 2.4.6 Commerce with the exact same issues. (including creating multiple duplicate values for Admin store 1 when in single store mode) |
Summary
Updating product
url_key
via REST API ; Product Url Rewrites are not re-generated. (yeah, i know, thats crazy)This occurs on actually "Simple" setup, out of the box : Single-store mode and calls on "all" Rest Endpoint
{{magento_url}}/rest/all/V1/products/{{sku}}
, elementary school levelI use the term "Url Rewrites" (with a "s") because that involves category-path-product-urls also. But i focus on product "direct" url
Preconditions
PUT
{{magento_url}}/rest/all/V1/products/{{sku}}
POST
call for{{magento_url}}/rest/all/V1/products/{{sku}}
Steps to reproduce
entity_id=10
url_key="my-product-url"
(In Admin Product View : Section "Search Engine Optimization")catalog/product/view/id/10
"my-product-url.html"
(i suppose ".html" as most used case prefix)Sorry, no time to write a one line curl call. If you read this, you're smart enough to use Postman and already have this call ready to go.
PUT
{{magento_url}}/rest/all/V1/products/{{sku}}my-new-url
(whaou)catalog/product/view/id/10
(or update tab/search, as you want, take your time)Expected result
Actual result
Additional info
You will not see "real value" for the store (1) in Admin product view (and NO way to see it in Single store mode)
There is another BUG that leads to almost ALL attributes to be copied for store 1 scope, not JUST the one you updated and, sorry but that sucks. I will ckeck if issue is already reported and eventually post. But poor chance to get a fix on that.
Debugging
Actually deep debugged code and i think the issue is on Product Model getStoreIds() even if it HARD to admit on such a central class :
Line
$websiteIds = array_keys($websiteIds);
gets array_keys()... ???Does not have much sense... : Website_ids being either an array from json OR retreived from DB : NO WAY that array_keys would be some website_ids !
Checked current 2.4 develop, still there : https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Model/Product.php#L832
Workaround / I would say "Hack"
To congratulate you for your patience reading me, i offer you this hack if you promise to have a good laugh :
The FACT is that the array_keys() "bug" CAN be used as a temporary workaround hack :
You can pass values so that there will be a key for the targeted website id.
If you pass twice (here) the website_id in extension attribute, you'll exploit the bug and pass => Will work.
Hopefully, these arrays are not "cleaned" by any interceptor before being in product data object... Not surprising.
I think you got what you have to do if you want to re-gen website id 4... LOL
Exract from Magento\Catalog\Model\Product.php
The text was updated successfully, but these errors were encountered: