Skip to content

Twig include debug comments break address format concat symbol detection #82

Description

@Fluffylicious

PHP Version

8.2.19

Shopware Version

6.7.3.0

Plugin Version

3.0.1

Actual behaviour

Shopware's address renderer leaves a dangling separator symbols in formatted addresses. For example with default address format company - department the output becomes '-' when both fields are empty and 'company-' when department is empty instead of omitting the separator. Reasons is that template Framework/Resources/views/snippets/render.html.twig compares the rendered snippet output against the concat symbols {% set concatSymbol = ['-', '~'] %}.
However sw_include returns the debug include comments together with rendered snippet <!-- INCLUDE BEGIN ... -->-<!-- INCLUDE END ... --> instead of the literal '-'. As a result the comparison snippetRendered|trim in concatSymbol always evaluates to false so the cleanup logic never removes the separator.

Image

Expected behaviour

Debug include comments should not affect Shopware's address formatting logic.

Steps to Reproduce?

  • set address settings in backend country settings to format with company -(dash) department
  • have plugin activated
  • open a address template in storefront (or check preview in backend with matching address)
  • check an address without any company settings or one with company but without department
  • dash will be displayed tho it shouldn't

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions