Skip to content

magento/magento2#35670: Meta tags auto generation: variables cannot be used multiple times#40412

Merged
magento-devops-reposync-svc merged 7 commits intomagento:2.4-developfrom
MaximLogic:fix-for-issue-35670
Feb 10, 2026
Merged

magento/magento2#35670: Meta tags auto generation: variables cannot be used multiple times#40412
magento-devops-reposync-svc merged 7 commits intomagento:2.4-developfrom
MaximLogic:fix-for-issue-35670

Conversation

@MaximLogic
Copy link
Copy Markdown
Contributor

Description (*)

According to issue #35670, when a field mask contains the same placeholder multiple times (e.g., {{name}}, order {{name}}), only the first occurrence was being replaced. This happened because string.replace() only replaces the first match by default.

Changed the replacement logic in import-handler.js to use split().join() pattern instead, which replaces all occurrences of the placeholder. This ensures that masks like {{name}}, order {{name}} correctly produce "Product Name, order Product Name" instead of "Product Name, order {{name}}".

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Meta tags auto generation: variables cannot be used multiple times #35670

Manual testing scenarios (*)

  1. Set the meta keyword mask via CLI: bin/magento config:set catalog/fields_masks/meta_keyword '{{name}}, order {{name}}'
  2. Log in to Magento Admin
  3. Navigate to Catalog > Products and create a new product
  4. Set the product name to "Test Product"
  5. Check the meta keywords field - it should now display "Test Product, order Test Product"
  6. Verify that both occurrences of {{name}} are replaced correctly

Questions or comments

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

…ltiple times

- fixed issue with multiple identical placeholders in catalog fields masks not being replaced correctly
@m2-assistant
Copy link
Copy Markdown

m2-assistant Bot commented Jan 8, 2026

Hi @MaximLogic. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@ct-prd-pr-scan
Copy link
Copy Markdown

ct-prd-pr-scan Bot commented Jan 8, 2026

The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email psirt@adobe.com.

@MaximLogic
Copy link
Copy Markdown
Contributor Author

@magento run all tests

@MaximLogic
Copy link
Copy Markdown
Contributor Author

@magento run WebAPI Tests

@MaximLogic
Copy link
Copy Markdown
Contributor Author

@magento run all tests

@engcom-Hotel
Copy link
Copy Markdown
Contributor

@magento run all tests

Copy link
Copy Markdown
Contributor

@engcom-Hotel engcom-Hotel left a comment

Choose a reason for hiding this comment

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

Hello @MaximLogic,

Thank you for the contribution!

The changes looks good to us. But a small minor change requested below.

Comment thread app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js Outdated
@engcom-Hotel engcom-Hotel moved this from Review in Progress to Changes Requested in Community Dashboard Jan 28, 2026
@engcom-Hotel
Copy link
Copy Markdown
Contributor

@magento run Database Compare, Functional Tests B2B, Functional Tests CE, Functional Tests EE, Integration Tests, Static Tests, Unit Tests, WebAPI Tests

@engcom-Hotel
Copy link
Copy Markdown
Contributor

@magento run all tests

@engcom-Bravo
Copy link
Copy Markdown
Contributor

@magento run all tests

@engcom-Bravo
Copy link
Copy Markdown
Contributor

Hi @MaximLogic,

Thanks for the collaboration & contribution!

✔️ QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop

Steps to reproduce

  • Execute bin/magento config:set catalog/fields_masks/meta_keyword '{{name}}, order {{name}}' or set manually
  • Login to Magento2 Backend
  • Create a new product
  • Set product name to "NEW PRODUCT"
  • Check meta keywords

Before: ✖️

Screenshot 2026-02-05 at 3 52 47 pm

After: ✔️

Screenshot 2026-02-05 at 3 57 06 pm

Builds are failed. Hence, moving this PR to Extended Testing.

Thanks

@engcom-Bravo engcom-Bravo moved this from Testing in Progress to Extended testing (optional) in Community Dashboard Feb 5, 2026
@engcom-Charlie engcom-Charlie self-assigned this Feb 6, 2026
@engcom-Charlie
Copy link
Copy Markdown
Contributor

@magento run all tests

@engcom-Charlie
Copy link
Copy Markdown
Contributor

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE

@engcom-Charlie
Copy link
Copy Markdown
Contributor

Few test failure from Functional B2B, and EE are not consistent in recent 2 builds. They neither part of PR nor failing because of the PR changes. Seems to be flaky. The consistent failures are known issues and have the open JIRAs for them. Hence moving the PR to Merge in Progres..

Functional B2B Run 1:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/40412/df121305181529a90a4d4eef27b50ecd/Functional/allure-report-b2b/index.html#categories

image

Run 2:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/40412/205f29cecfbf722421d8a866971a7b94/Functional/allure-report-b2b/index.html#categories/dad3b5a7b0574462665553fcc880a350/3f1356d5d00edbd7/

image

Functional CE Run 1:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/40412/b0dc899669b62c044568ac8694b1e7fb/Functional/allure-report-ce/index.html#categories/dad3b5a7b0574462665553fcc880a350/98656a473bc5454d/

image

Run 2:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/40412/0d7dbcd400525e091af62d2523921c04/Functional/allure-report-ce/index.html#categories/dad3b5a7b0574462665553fcc880a350/b19d2e97cbda35e/

image

Functional EE Run 1:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/40412/e4d7622778899937b66c88a7bb5b601f/Functional/allure-report-ee/index.html#categories/bdbf199525818fae7a8651db9eafe741

image

Run 2:
https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/40412/002d0df89ad3fe2b350746162d754859/Functional/allure-report-ee/index.html#categories/dad3b5a7b0574462665553fcc880a350/728d2f1de6ff2f22/

image

Known Issues:
ACQE-9358: AdminDisplayingCartAndCatalogPriceRulesGridsTest
ACQE-9359: AssertSuccessMessageAppearsAfterAddingProductToCartThatContainsOutOfStockProductTest
ACQE-9362: PurchaseOrderEnableDisableE2ETest

@engcom-Charlie engcom-Charlie moved this from Extended testing (optional) to Merge in Progress in Community Dashboard Feb 6, 2026
@magento-devops-reposync-svc magento-devops-reposync-svc merged commit 37a25f0 into magento:2.4-develop Feb 10, 2026
9 of 12 checks passed
@ct-prd-projects-boards-automation ct-prd-projects-boards-automation Bot moved this from Merge in Progress to Recently Merged in Community Dashboard Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: deployment queue Project: Community Picked PRs upvoted by the community

Projects

Status: Recently Merged

Development

Successfully merging this pull request may close these issues.

Meta tags auto generation: variables cannot be used multiple times

5 participants