Skip to content

Conversation

@p-bystritsky
Copy link
Contributor

Port for #18566

Saving 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)

@magento-engcom-team
Copy link
Contributor

Hi @p-bystritsky. 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 2.3-develop instance - deploy vanilla Magento instance

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

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

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

@magento-engcom-team
Copy link
Contributor

Hi @p-bystritsky. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

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.

3 participants