MKhve Posted April 30, 2013 Share Posted April 30, 2013 (edited) Hello! We are creating new payment module, alongside with other cart information, we need to send the payment service provider shipping address of order. Can someone tell me how can we get order shipping address in the payment module? In php code, of course. Thanks.. Edited April 30, 2013 by MKhve (see edit history) Link to comment Share on other sites More sharing options...
Joel Bardsley Posted April 30, 2013 Share Posted April 30, 2013 (edited) Something like: public function hookPayment($params) { global $smarty; $address = new Address(intval($params['cart']->id_address_delivery)); $smarty->assign(array( 'address' => $address, 'country' => new Country(intval($address->id_country)) )); } Edited April 30, 2013 by Joel B (see edit history) 1 Link to comment Share on other sites More sharing options...
MKhve Posted April 30, 2013 Author Share Posted April 30, 2013 thanks $address = new Address(intval($params['cart']->id_address_delivery)); this returns id of the address of corresponding user. I need to get actual address(string value), as i guess i can get it from user information by id which is taken by code above, but don't know exact code which will request string value of address id. Link to comment Share on other sites More sharing options...
Joel Bardsley Posted April 30, 2013 Share Posted April 30, 2013 I assume you have a .tpl file for the module where you're sending a form of all the information across to the payment provider. If so, using the $smarty variable you've assigned for address above, send across the address in a string like this: <input type="hidden" name="name" value="{$address->firstname} {$address->lastname}" /> <input type="hidden" name="address" value="{$address->address1}{if !empty($address->address2)}, {$address->address2}{/if}, {$address->city}" /> <input type="hidden" name="country" value="{$country->iso_code}" /> Link to comment Share on other sites More sharing options...
MKhve Posted May 1, 2013 Author Share Posted May 1, 2013 (edited) Actually I have php file in new payment module folder and there is : class newpamentmodule extends PaymentModule { //.... $shippingAddress = "shipping address string"; // here i want to get order shipping address //.... } Here i want to assign shipping address (string value not just id) of order to variable $shippingAddress Can you help me with this, i don't know how to "call" for shipping address string. Edited May 1, 2013 by MKhve (see edit history) 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