MDVA-40537: Creating store view gives error when several CMS pages have same URL Key.

The MDVA-40537 patch fixes the issue where users get an error when creating a store view if several CMS pages have the same URL key. This patch is available when the Quality Patches Tool (QPT) 1.1.4 is installed. The patch ID is MDVA-40537. Please note that the issue was fixed in Adobe Commerce 2.4.1.

Affected products and versions

The patch is created for Adobe Commerce version:

Adobe Commerce (all deployment methods) 2.3.5-p2

Compatible with Adobe Commerce versions:

Adobe Commerce (all deployment methods) 2.3.4 - 2.4.0-p1

NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the magento/quality-patches package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.

Issue

Users get an error when creating a store view if several CMS pages have the same URL key.

Steps to reproduce:

  1. Go to the Admin Panel > Stores > All Stores and create two store views.

    code language-sql
    Name: German
    Code: german
    Status: Enabled
    
    code language-sql
    Name: French
    Code: french
    Status: Enabled
    
  2. Go to the Admin Panel > Content > Pages and create two pages.

    code language-sql
    Page Title: About Us
    URL Key: about-us
    Store View: French
    
    code language-sql
    Page Title: About Us
    URL Key: about-us
    Store View: German
    
  3. Go to the Admin Panel > Stores > All stores and create a new store view.

    code language-sql
    Name: Spanish
    Code: spanish
    Status: Enabled
    

Expected results:

Store view is created successfully.

Actual results:

The following error message is shown: Something went wrong while saving. Please review the error log. The log contains an exception like:

Exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'about-us-4' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID', query was: INSERT  INTO }}url_rewrite{{ (}}redirect_type{{,}}is_autogenerated{{,}}metadata{{,}}description{{,}}store_id{{,}}entity_type{{,}}entity_id{{,}}request_path{{,}}target_path{{) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?, ?, ?, ?)

Apply the patch

To apply individual patches, use the following links depending on your deployment method:

To learn more about Quality Patches Tool, refer to:

For info about other patches available in QPT, refer to the Patches available in QPT section.

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a