siomosp Posted October 20, 2023 Share Posted October 20, 2023 (edited) Hi! Until PS 1.7.5X it was simple to get the mobile phone At view .tpl , {$addresses.delivery->phone_mobile} and voila At PS 1.7.8.1, I am trying to get phone_mobile from {{ orderForViewing.shippingAddressFormatted }} at /src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/Blocks/View/customer.html.twig Any ideas how? Thanks Edited October 24, 2023 by siomosp (see edit history) Link to comment Share on other sites More sharing options...
ventura Posted October 23, 2023 Share Posted October 23, 2023 Address information in a string formatted in lines. To extract the phone number, you can use for example regular expressions to access the information (line) of the phone number. eg: {% set foundPhone = false %} {% for line in orderForViewing.shippingAddressFormatted|split("\n") %} {% if line matches '/^[+0-9. ()\\/\\-]*$/' and not foundPhone %} <p class="mb-0">Phone: {{ line }}</p> {% set foundPhone = true %} {% endif %} {% endfor %} 1 Link to comment Share on other sites More sharing options...
siomosp Posted October 24, 2023 Author Share Posted October 24, 2023 On 10/23/2023 at 11:53 AM, ventura said: Address information in a string formatted in lines. To extract the phone number, you can use for example regular expressions to access the information (line) of the phone number. eg: {% set foundPhone = false %} {% for line in orderForViewing.shippingAddressFormatted|split("\n") %} {% if line matches '/^[+0-9. ()\\/\\-]*$/' and not foundPhone %} <p class="mb-0">Phone: {{ line }}</p> {% set foundPhone = true %} {% endif %} {% endfor %} Exactly what I needed to , Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now