Grafyx89 Posted April 19, 2021 Share Posted April 19, 2021 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 More sharing options...
musicmaster Posted April 19, 2021 Share Posted April 19, 2021 Are you sure the customer is there at all? Did you try {$customer|print_r} as debugging code? Link to comment Share on other sites More sharing options...
Grafyx89 Posted April 20, 2021 Author Share Posted April 20, 2021 Hello Yes, it gives me good customer information. But I cannot write the condition "if the country of delivery is France". Link to comment Share on other sites More sharing options...
musicmaster Posted April 20, 2021 Share Posted April 20, 2021 I don't know what you are doing, but the following works for me: {if $customer.addresses[6].id_country == 13}Hello world{/if} Link to comment Share on other sites More sharing options...
Grafyx89 Posted April 20, 2021 Author Share Posted April 20, 2021 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 More sharing options...
musicmaster Posted April 20, 2021 Share Posted April 20, 2021 Be creative! For almost all customers this address id will be between 1 and 10. To be sure you might take 20. Just check that $customer.addresses[x] exists for each of those numbers and if it exists test the country. Link to comment Share on other sites More sharing options...
Grafyx89 Posted April 20, 2021 Author Share Posted April 20, 2021 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 More sharing options...
musicmaster Posted April 20, 2021 Share Posted April 20, 2021 Just build a for loop. Link to comment Share on other sites More sharing options...
Grafyx89 Posted April 20, 2021 Author Share Posted April 20, 2021 I'm not sure I understand .. in a foreach ? Link to comment Share on other sites More sharing options...
musicmaster Posted April 20, 2021 Share Posted April 20, 2021 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 More sharing options...
Grafyx89 Posted April 20, 2021 Author Share Posted April 20, 2021 Thank you for your help. It doesn't work as it is, but I'll push, and try to get out of it. 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