Skip to content

[Forwardport] Module Catalog URL Rewrite: fix issue with product URL Rewrites re-generation after changing product URL Key for product with existing url_path attribute value #18711

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

Closed
wants to merge 2 commits into from

Conversation

mage2pratik
Copy link
Contributor

@mage2pratik mage2pratik commented Oct 19, 2018

Original Pull Request

#18566

Hiving saved product attribute URL Path value causes broken Product URL Rewrites regeneration after changing product URL key.

Description (*)

If there is a product with set URL Path attribute value, product URL Rewrites can't be re-generated clearly after changing product URL Key from Admin panel.
For example, after migrating from Magento 1, there are a lot of values for product attribute URL Path.

Fixed Issues (if relevant)

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

Causes Issues

#18532: Module Catalog: product "Save and Duplicate" causes getting infinite loop.

Manual testing scenarios (*)

  1. Set attribute URL Path value for any product.
    1.1. For example, execute following SQL query:
SET @catalogProductEntityTypeId = (SELECT `entity_type_id`
                                   FROM `eav_entity_type`
                                   WHERE entity_type_code = 'catalog_product');

SET @productUrlPathAttributeId = (SELECT `attribute_id`
                                  FROM `eav_attribute`
                                  WHERE `attribute_code` = 'url_path'
                                    AND entity_type_id = @catalogProductEntityTypeId);

SET @productUrlKeyAttributeId = (SELECT `attribute_id`
                                 FROM `eav_attribute`
                                 WHERE `attribute_code` = 'url_key'
                                   AND `entity_type_id` = @catalogProductEntityTypeId);

SET @storeId = 1; -- change Store ID if it's required

SET @testProductId = 1; -- change Product ID if it's required

SET @existingProductUrlKey = (SELECT `value`
                              FROM `catalog_product_entity_varchar`
                              WHERE `entity_id` = @testProductId
                                AND `attribute_id` = @productUrlKeyAttributeId); -- any value could be there

INSERT INTO `catalog_product_entity_varchar` (`attribute_id`, `store_id`, `entity_id`, `value`)
    VALUES (@productUrlPathAttributeId, @storeId, @testProductId, @existingProductUrlKey);
  1. Go to Admin panel -> Catalog -> Inventory -> Products.
  2. Find and open testable product.
  3. Change URL Key field value.
  4. Save product.
  5. Go to product page on frontend by new URL Key.

Expected result

Product is available by the new URL Key.

Actual result

Product is not available by the new URL Key, but available by the previous one.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

Oleksii Lisovyi and others added 2 commits October 19, 2018 19:36
…neration after changing product URL Key for product with existing url_path attribute value
@magento-engcom-team
Copy link
Contributor

Hi @mage2pratik. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me $VERSION instance - deploy vanilla Magento instance

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

Copy link
Contributor

@okorshenko okorshenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.

Could you please cover this solution with the tests.
Thank you

slavvka
slavvka previously approved these changes Oct 25, 2018
@slavvka slavvka dismissed their stale review October 25, 2018 19:20

Mistakenly approved

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.1 milestone Oct 25, 2018
@magento-engcom-team
Copy link
Contributor

Hi @slavvka, thank you for the review.
ENGCOM-3277 has been created to process this Pull Request

@slavvka
Copy link
Member

slavvka commented Nov 6, 2018

hey @mage2pratik are you going to proceed with this PR?

@orlangur orlangur self-assigned this Nov 7, 2018
@orlangur
Copy link
Contributor

orlangur commented Nov 7, 2018

@slavvka let's wait with merging this until we understand what is going on in #18567 (comment).

@orlangur
Copy link
Contributor

orlangur commented Nov 7, 2018

Closing as there is no response from contributor on review note for over 19 days.

Feel free to reach me out anytime later if you wish to continue work on this pull request and it will be reopened.
Thanks for collaboration!

@orlangur orlangur closed this Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants