jazerix Posted October 28, 2013 Share Posted October 28, 2013 Hi I need to get the users phone number, name and some basic information about the order using the "actionPaymentConfirmation". Right now I got it working so that my module subscribes to the event and is successfully triggered . My hook code looks like this: public function hookActionPaymentConfirmation($params) { mail("[email protected]", "yay", var_dump($params)); } As you can see I'm trying to send the $params array, however it's empty. How would I acquire the user information using this hook? Kind Regards -Jazerix Link to comment Share on other sites More sharing options...
math_php Posted October 29, 2013 Share Posted October 29, 2013 Hi Look for print_r($params,true) Regards 1 Link to comment Share on other sites More sharing options...
jazerix Posted October 29, 2013 Author Share Posted October 29, 2013 I can't believe it was that easy, haha! Well, it returned a big array now with lots of data, however I would like to find the phone number of the order / customer, how would I do that since it is not sent in the params variable. I got the customer id ^^ Link to comment Share on other sites More sharing options...
math_php Posted October 29, 2013 Share Posted October 29, 2013 Not sure, not tested Phone numbers are stored with an address, then you can get all customer addresses and get phones or you can get the phone related to the order delivery address. This solution is based on order address : $order = $params['order']; $id_address = $order->id_address; $address = new Address($id_address); echo $address->phone; echo $address->phone_mobile; Check if you have the order object in params. Regards Link to comment Share on other sites More sharing options...
jazerix Posted October 29, 2013 Author Share Posted October 29, 2013 I don't see an order object in the params, this is the output Array ( [id_order] => 3 [cookie] => Cookie Object ( [_content:protected] => Array ( [date_add] => 2013-10-29 03:28:35 [id_lang] => 1 [detect_language] => 1 [id_employee] => 1 [email] => [email protected] [profile] => 1 [passwd] => b7541f951288e4df1a0a9e87565e513a [remote_addr] => 1352811034 [shopContext] => s-1 [id_currency] => 1 [order_pagination] => 50 [order_start] => 0 [customer_pagination] => 50 [customer_start] => 0 [checksum] => 1941797116 ) [_name:protected] => b9fbede7e69b9aba478def168a78e3a9 [_expire:protected] => 1384760157 [_domain:protected] => whazer.com [_path:protected] => /presta/ [_cipherTool:protected] => Rijndael Object ( [_key:protected] => nE7V3CoL87RxsndegMcD7Q2L7E3s5qkq [_iv:protected] => C 貐糼 �1勒蕑 ) [_modified:protected] => [_allow_writing:protected] => 1 [_salt:protected] => o2dlqi3z [_standalone:protected] => ) [cart] => Cart Object ( [id] => 3 [id_shop_group] => 1 [id_shop] => 1 [id_address_delivery] => 5 [id_address_invoice] => 5 [id_currency] => 1 [id_customer] => 2 [id_guest] => 5 [id_lang] => 1 [recyclable] => 0 [gift] => 0 [gift_message] => [mobile_theme] => 0 [date_add] => 2013-10-29 03:34:12 [secure_key] => 5002f5d0bd2c2df851452dd4f02b53be [id_carrier] => 2 [date_upd] => 2013-10-29 03:35:36 [checkedTos] => [pictures] => [textFields] => [delivery_option] => a:1:{i:5;s:2:"2,";} [allow_seperated_package] => 0 [_products:protected] => [_taxCalculationMethod:protected] => 1 [webserviceParameters:protected] => Array ( [fields] => Array ( [id_address_delivery] => Array ( [xlink_resource] => addresses ) [id_address_invoice] => Array ( [xlink_resource] => addresses ) [id_currency] => Array ( [xlink_resource] => currencies ) [id_customer] => Array ( [xlink_resource] => customers ) [id_guest] => Array ( [xlink_resource] => guests ) [id_lang] => Array ( [xlink_resource] => languages ) ) [associations] => Array ( [cart_rows] => Array ( [resource] => cart_row [virtual_entity] => 1 [fields] => Array ( [id_product] => Array ( [required] => 1 [xlink_resource] => products ) [id_product_attribute] => Array ( [required] => 1 [xlink_resource] => combinations ) [id_address_delivery] => Array ( [required] => 1 [xlink_resource] => addresses ) [quantity] => Array ( [required] => 1 ) ) ) ) ) [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => cart [identifier:protected] => id_cart [fieldsRequired:protected] => Array ( [0] => id_currency [1] => id_lang ) [fieldsSize:protected] => Array ( [secure_key] => 32 ) [fieldsValidate:protected] => Array ( [id_shop_group] => isUnsignedId [id_shop] => isUnsignedId [id_address_delivery] => isUnsignedId [id_address_invoice] => isUnsignedId [id_carrier] => isUnsignedId [id_currency] => isUnsignedId [id_customer] => isUnsignedId [id_guest] => isUnsignedId [id_lang] => isUnsignedId [recyclable] => isBool [gift] => isBool [gift_message] => isMessage [mobile_theme] => isBool [allow_seperated_package] => isBool [date_add] => isDateFormat [date_upd] => isDateFormat ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => cart [primary] => id_cart [fields] => Array ( [id_shop_group] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_shop] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_address_delivery] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_address_invoice] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_carrier] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_currency] => Array ( [type] => 1 [validate] => isUnsignedId [required] => 1 ) [id_customer] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_guest] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_lang] => Array ( [type] => 1 [validate] => isUnsignedId [required] => 1 ) [recyclable] => Array ( [type] => 2 [validate] => isBool ) [gift] => Array ( [type] => 2 [validate] => isBool ) [gift_message] => Array ( [type] => 3 [validate] => isMessage ) [mobile_theme] => Array ( [type] => 2 [validate] => isBool ) [delivery_option] => Array ( [type] => 3 ) [secure_key] => Array ( [type] => 3 [size] => 32 ) [allow_seperated_package] => Array ( [type] => 2 [validate] => isBool ) [date_add] => Array ( [type] => 5 [validate] => isDateFormat ) [date_upd] => Array ( [type] => 5 [validate] => isDateFormat ) ) [classname] => Cart ) [update_fields:protected] => ) [altern] => 1 ) Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted October 31, 2013 Share Posted October 31, 2013 If you have customer ID, then you can load Customer objectIf you need customer address related to his/her order, you should have Order object to get the valid id_address, then you can load Address object. (Billing/Invoice or Shipping address) But if you want to get customer address without relation to his/her order, the you can use getAddresses($id_lang) function within customer object. Link to comment Share on other sites More sharing options...
math_php Posted October 31, 2013 Share Posted October 31, 2013 Hi, Then $cart = $params['cart']; $id_address = $cart->id_address_delivery; // you may also want [id_address_invoice] => 5 $address = new Address($id_address); echo $address->phone; echo $address->phone_mobile; The same not tested and not sure of new Address(parameters). Regards 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