Jump to content

[SOLVED] Display Shipping Address on Payments Page


Recommended Posts

Hi there,

I'm looking for a way to be able to present a summary of the order on the payments page.

So part i have managed to get the shopping cart details on the payments page, but would like to display the delivery address on that page also.

Would someone be able to show me how i can do that?

Thanks so much for your help!

Cheers

Link to comment
Share on other sites

By default, PrestaShop already passes the cart summary details into the payment step, even though it doesn't display it, so you can simply copy the summary code from shopping-cart.tpl and paste it into order-payment.tpl where you want the summary to appear. To get the delivery address, you'll need to add the following code in the displayPayment() function of order.php to get the delivery address:

$address = new Address($cart->id_address_delivery, intval($cookie->id_lang));
$state = State::getNameById($address->id_state);
$smarty->assign('state', $state);



then add code like the following to order-payment.tpl:


Your Shipping Address

{$address->firstname} {$address->lastname}
{$address->address1}
{$address->city}
{$state} - {$address->postcode}
{$address->country}

« Change Shipping Address

  • Like 1
Link to comment
Share on other sites

Thanks heaps for your reply Rocky, you're a champ.

I didn't have any luck, all i get is

>
Delivery Address
</pre>
<ul>
 


 - 

</ul>
<br><a href="order.php?step=1" rel="">« Change Shipping Address</a



is there a particular spot i need to put the code in order.php, i do have it in the display payment func.

Link to comment
Share on other sites

ok i modified the code to:


$address = new Address($cart->id_address_delivery, intval($cookie->id_lang));
$state = State::getNameById($address->id_state);
$smarty->assign('state', $state); 
$smarty->assign('address', $address); 



And it works!

I never would have got this without your help, thanks heaps mate.

Link to comment
Share on other sites

Comon, we are almost there..

I only need to have the delivery address associated with the current shopping cart.

If the billing and delivery address is different, i seem to get a corrupt address on my payments page (it displays my billing address instead of my delivery address), the order delivery address on the print out is accurate, but im just not getting the right record pulled out on the payments page.

Any help would be apprecaited. :)

Link to comment
Share on other sites

I just tested my code on my test site and it displayed the delivery address fine. Are you sure it isn't working on your site? It should display the address on the left side of the "Address" order step. Perhaps the $address variable is being overwritten on your site for some reason. Try changing it to $address2 instead. I doubt there will be a variable called that already used. Another thing you can try is using the $cart->id_address_invoice variable instead of $cart_id->id_address_delivery variable, but that would only work if the addresses were getting swapped somehow.

Link to comment
Share on other sites

Hi Rocky,

Looks like the $address variable was being overwritten some how before the end of the order process.
Changing the variable in question to $address2 fixed the issue.
Its taken about 4 months to get this to work for me, but unless you know the system a little better than i do, its a hard thing to achieve.

Thanks heaps for your help!

Link to comment
Share on other sites

  • 2 years later...

Hi Rocky and thanks for inputs. I simply created a copy of "shopping-cart.tpl" to "shopping-cart-last-step.tpl", and called it in "order-payment.tpl". All seems ok, but the only thing that i'm unable to retrieve is the shipping cost chosen in previous step. How to call it in last step (order-payment.tpl) ?

 

Thanks a lot,

Rob.

 

PS: version 1.4.7.3

Edited by rob84 (see edit history)
Link to comment
Share on other sites

  • 4 months later...

Hi,

 

I'm trying to show the delivery address in "order-payment.tpl" in version 1.5.4.1.

 

When I use $address as stated in Rocky's first answer I get the invoice address.

I have tried following the other answers, but it seems like it is intended for Prestashop 1.4.

 

So how would I go about showing the delivery address in order-payment.tpl?

 

Thanks.

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

By default, PrestaShop already passes the cart summary details into the payment step, even though it doesn't display it, so you can simply copy the summary code from shopping-cart.tpl and paste it into order-payment.tpl where you want the summary to appear. To get the delivery address, you'll need to add the following code in the displayPayment() function of order.php to get the delivery address:

 

$address = new Address($cart->id_address_delivery, intval($cookie->id_lang));$state = State::getNameById($address->id_state);$smarty->assign('state', $state);

then add code like the following to order-payment.tpl:

 

<div id="order_address">    <h4>Your Shipping Address</h4>    <ul id="delivery_address" class="address">        <li class="address_name">{$address->firstname} {$address->lastname}</li>        <li class="address_address1">{$address->address1}</li>        <li class="address_address2">{$address->city}</li>        <li class="address_city">{$state} - {$address->postcode}</li>        <li class="address_country">{$address->country}</li>    </ul>    <a href="order.php?step=1">« Change Shipping Address</a></div>

Hello sir ! i am using prestashop 1.6.0.14. i am not able to find order.php file to place code, so plz help me...

Thank's in advance..

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...