ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 2 replies, has 2 voices, and was last updated by  seddonm1 3 years ago.

  • Creator
    Topic
  • #4306

    seddonm1
    Participant

    Hi,
    I have returned to Oro after spending some time with the early betas and it is very much improved.

    I have found a scenario where I would like to be able to call a function similar to the javascript renderAddress version. I have seen you have this ‘todo’ action and was wondering if you have any improvements that are available?

    Thanks,
    Mike

    /**
    * Convert address to string
    * @todo: Address format must be used here
    *
    * @return string
    */
    public function __toString()
    {
    $data = array(
    $this->getFirstName(),
    $this->getLastName(),
    ‘,’,
    $this->getStreet(),
    $this->getStreet2(),
    $this->getCity(),
    $this->getUniversalRegion(),
    ‘,’,
    $this->getCountry(),
    $this->getPostalCode(),
    );

    $str = implode(‘ ‘, $data);
    $check = trim(str_replace(‘,’, ”, $str));
    return empty($check) ? ” : $str;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #4321
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello, seddonm1.

    Thank you for notice, we definitely need to improve this behavior.

    For now you can use AddressFormatter::format function to generate localized address format on backend, and twig filter oro_format_address or renderAddress macros in templates.

    #4392

    seddonm1
    Participant

    Thanks Yevhen.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.