Jump to content

smarty condition on the country id of the customer address


Recommended Posts

Hello,
I would like to make a smarty condition on Prestashop 1.7 in the shipping.tpl to say "if the country in the customer's shipping address is 8" But I don't know how to get it.

I tried

$ customer.addresses [8] .id_country
$ customer.addresses-> id_country

thank you for your comeback

Link to comment
Share on other sites

Thanks, it works but I want it to be for all clients. The address ID is unique per customer.
I would like to put my condition for all customers on id_country 8.

For more details, it is to say on the section shipping.tpl
If the customer's country of delivery is! = ID 8, then do not display delivery methods.

Thank you for your responses and your help

Link to comment
Share on other sites

Ho believe me I am yet ^^ '

the address id is unlimited .. so it is not included in 1-20 (for example) ..
Is such a code possible?

{if $ customer.addresses [1-200] .id_country == 13} Hello world {/ if}?
The idea is to have a range of id addresses taken into consideration in my if

Thank you man 

Link to comment
Share on other sites

This is the last time I try to help. There are limits to free support.

The solution will look something like the following. I didn't test it but I hope you get the idea:

{$myaddress = -1}
{for $foo=1 to 200}
    {if $customer.addresses [$foo] } {$myaddress =$foo}{$foo=200} {/ if}
{/for}
{if $foo!=200 AND $customer.addresses [$foo] .id_country != 8} Hello world {/ if}

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...