Jump to content

comment acceder aux info d'un Hook


Recommended Posts

bonjour,

je développe un module qui vas agir sur le hook PostUpdateOrderStatus.

 

je cherche a comprendre comment on accède aux données passer en paramètre dans la variable $params. D’après ce que j'ai compris c'est un gros tableau. J arrive a accéder au premier niveau du tableau comme quand on accède a un élément d'un tableau $params['clef'].

Comment faire pour acceder au autres info notament le champs "name"? je vous affiche ci dessous ce que me renvois print_r:

 

Array ( [newOrderStatus] => OrderState Object ( [name] => Préparation en cours [template] => preparation [send_email] => 1 [invoice] => 1 => #FFDD99 [unremovable] => 1 [logable] => 1 [delivery] => 1 [hidden] => 0 [fieldsValidate:protected] => Array ( [send_email] => isBool [invoice] => isBool => isColor [logable] => isBool ) [fieldsRequiredLang:protected] => Array ( [0] => name ) [fieldsSizeLang:protected] => Array ( [name] => 64 [template] => 64 ) [fieldsValidateLang:protected] => Array ( [name] => isGenericName [template] => isTplName ) [table:protected] => order_state [identifier:protected] => id_order_state [webserviceParameters:protected] => Array ( [fields] => Array ( [unremovable] => Array ( ) [delivery] => Array ( ) [hidden] => Array ( ) ) ) [id] => 3 [id_lang:protected] => 2 [fieldsRequired:protected] => Array ( ) [fieldsSize:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg ) [id_order] => 4 [cookie] => Cookie Object ( [_content:protected] => Array ( [date_add] => 2011-10-07 10:26:39 [id_lang] => 2 [id_employee] => 1 => [email protected] [profile] => 1 [passwd] => 8301edba3cec35649500d7ec59f057d7 [remote_addr] => 2130706433 [show_screencast] => 1 [stats_granularity] => 10 [image_type_pagination] => 50 [order_pagination] => 50 [customer_pagination] => 50 [orderFilter_os!id_order_state] => [order_state_pagination] => 50 [order_return_state_pagination] => 50 [carrier_pagination] => 50 [state_pagination] => 50 [carrierBox] => a:4:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"3";i:3;s:1:"4";} ) [_name:protected] => 0ce3beb550fcd80fa4e2751c91d13df6 [_expire:protected] => 1320221316 [_domain:protected] => [_path:protected] => /prestashop/boutique_admin/ [_cipherTool:protected] => Rijndael Object ( [_key:protected] => Pq3ojZMGeitfTdTbHPws5x9eLb86CZXK [_iv:protected] => ($�%w��e�$�i ) [_key:protected] => f0AWUtXMV4PB8B7GrfS6PH6U4CNud680UGqvdh5AQe6jLc4873YGMzNE [_iv:protected] => aJdSzb5E [_modified:protected] => ) [cart] => [altern] => 1 )

 

merci.

Link to comment
Share on other sites

Bon, on comprend rien avec ce c/c mais :

 

Quand tu vois "Array", c'est "variable['clé']". Quand tu vois "Objet", c'est "variable->clé".

 

D'après ce que je comprends, je dirais comme ceci :

 

$param['newOrderStatus']->name.

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