Jump to content

Get postal code at end of checkout


Recommended Posts

Hi all,

 

I am using Prestashop 1.6.0.14.

At the end of the checkout page (after the payment by bankwire), the customer receives a thank message. On this page, I want to be able to show the postal code from the customer (entered during the checkout procedure).

 

What I did was opening the shop/modules/bankwire/views/templates/hook/payment_return.tpl and put the {debug} tags in it to search for the variable. However, I see that there is no variable at all with the postal code at this page.

The only relevant item I see is the variable "$customerName".

 

Is there a way to make sure that I can get/echo the postal code (entered previously on the checkout form) from the customer on the payment_return.tpl page?

 

Thanks.

 

Best regards,

Kevin.

Share this post


Link to post
Share on other sites

Hi, if you can get the customer name it means that you can the customer id too. 

So from that id create a new customer, new  Address and simply  retrive the postal code .

Share this post


Link to post
Share on other sites

Hi Ndiaga,

 

Thanks for the fast reply!

 

I'm not that experienced with Prestashop. Do I need to create the new customer in the .tpl file with Smarty? Do you got an example or reference page?

 

Thanks.

 

Best regards,

Kevin.

Share this post


Link to post
Share on other sites

you'll have to add the address into the smarty variables passed to the template in hookPaymentReturn().  It's not the customer object you need but their address, either delivery or invoice, it should still be in the cart at this point though, so

 

$addressDelivery = new Address((int)$this->context->cart->id_address_delivery);

 

or

 

$addressInvoice = new Address((int)$this->context->cart->id_address_invoice);

 

should get you the object, assign it to smarty and away you go.

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More