Skip to content

Store Address format in transactional email footer is hardcoded #6538

Closed
@heldchen

Description

@heldchen

Preconditions

  1. CE 2.1.1

Steps to reproduce

  1. try to customise the address format in the mail footer

Expected result

  1. you can customise the address format in the mail footer, for example putting the zip code in front of the city, as used in some European countries

Actual result

  1. you cannot (easily) customise the address format as it is hardcoded:
   /**
     * Format address in a specific way
     *
     * @param DataObject $storeInfo
     * @param string $type
     * @return string
     */
    public function format(DataObject $storeInfo, $type = 'html')
    {
        $this->eventManager->dispatch('store_address_format', ['type' => $type, 'store_info' => $storeInfo]);
        $address = $this->filterManager->template(
            "{{var name}}\n{{var street_line1}}\n{{depend street_line2}}{{var street_line2}}\n{{/depend}}"
            . "{{var city}}, {{var region}} {{var postcode}},\n{{var country}}",
            ['variables' => $storeInfo->getData()]
        );

        if ($type == 'html') {
            $address = nl2br($address);
        }
        return $address;
    }

sure, we could use an interceptor and completely forgo the current implementation, but really? at the least please add the template string into the event so it could be manipulated in an observer...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions