Skip to content

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

@schnere

Description

@schnere

Preconditions and environment

  • Magento 2.3.3 / Magento 2.4.2

Steps to reproduce

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

Expected result

The meta keywords should be set to NEW PRODUCT, order NEW PRODUCT

Actual result

The meta keywords are set to NEW PRODUCT, order {{name}} .
So the second occurrence is not replaced as expected.

Additional information

I think the substitution is done here?

var value = self._masks[this].replace(self.varsRegexp, function(maskfieldName) {

So the solution would be to use replaceAll instead of replace:

var value = self._masks[this].replaceAll(self.varsRegexp, function(maskfieldName) {
    return $('#' + maskfieldName.slice(2, -2)).val();
});

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Area: CatalogComponent: CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for groomingReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

Status

Ready for Development

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions