manulito Posted April 25, 2013 Share Posted April 25, 2013 Hi i m still looking for a way to get the cart_id when i create an order in the back office. in front, i get it in the context, $this->context->cart->id but in BO, if i print_r($this->context) the cart id doesn t appear to be stored here. does anybody know how i could access this id? it s created as when i look the DB, the cart is here... thanks for your help ^^ Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted April 26, 2013 Share Posted April 26, 2013 Hi, Please, try print_r(Context::getContext()) instead of print_r($this->context) Best regards. Link to comment Share on other sites More sharing options...
vekia Posted April 26, 2013 Share Posted April 26, 2013 for the first I must ask you what hook you use? (you created a module?) try to use $param variable, there is a $cart object defined Link to comment Share on other sites More sharing options...
manulito Posted April 26, 2013 Author Share Posted April 26, 2013 Hi, Please, try print_r(Context::getContext()) instead of print_r($this->context) Best regards. Hi, i tried this, but the cart_id is not in it: Context Object ( [cart] => [customer] => [cookie] => Cookie Object ( [_content:protected] => Array ( [date_add] => 2013-04-26 10:13:09 [id_lang] => 2 the cart and customer object seems to be empty... for the first I must ask you what hook you use? (you created a module?) try to use $param variable, there is a $cart object defined i created a hook, i put the call in the override: override/controllers/admin/templates/orders/form.tpl i inserted a line in the db to declare it. the module is correctly hooked and appears i did a print_r() on $params, but nothing about the cart seems to be here: Array ( [cookie] => Cookie Object ( [_content:protected] => Array ( [date_add] => 2013-04-26 10:13:09 [id_lang] => 2 [id_employee] => 1 => [email protected] [profile] => 1 [passwd] => xxxxxxxxxxxxxx [remote_addr] => 1828729758 [shopContext] => s-1 [checksum] => 144873194 ) [_name:protected] => 89507f35cd1520b511e921cf45c2dd8a [_expire:protected] => 1368695949 [_domain:protected] => www.1000mat.com [_path:protected] => /new/ [_cipherTool:protected] => Rijndael Object ( [_key:protected] => 1I2sbNIAYUfaFyxh7MuLkBVXqp6nLCGT [_iv:protected] => [����-m+�̩��� ) [_key:protected] => 0FsfNUYOYf97jFTJCtjgScEsuK2KtjNPNW8kiu17RMN2ou6IIJDBxCCa [_iv:protected] => i28IUZNe [_modified:protected] => [_allow_writing:protected] => 1 ) [cart] => [altern] => 1 ) Link to comment Share on other sites More sharing options...
NemoPS Posted April 26, 2013 Share Posted April 26, 2013 are you using the new hook syntax? if so, and the order ID is available in the template where you added the new hook, you can pass the extra parameter like this {hook h="nameofthehook" id_cart=$id_cart} Of course, use the curent id_cart variable name, that's simply an example. After you do thisd, it should appear in the params array, with the key named as the name of the extra parameter passed in the hook Link to comment Share on other sites More sharing options...
manulito Posted April 26, 2013 Author Share Posted April 26, 2013 (edited) are you using the new hook syntax? if so, and the order ID is available in the template where you added the new hook, you can pass the extra parameter like this {hook h="nameofthehook" id_cart=$id_cart} Of course, use the curent id_cart variable name, that's simply an example. After you do thisd, it should appear in the params array, with the key named as the name of the extra parameter passed in the hook Hi, i tried this, the id_cart appear in the $params, but still empty... but i think i understood the problem: i use this module and this hook on the create order, in BO, but when the page is loaded, the cart doesn t already exists. it s created in the db when a customer is selected. so when the form.tpl or my module is loaded, the cart_id is empty because there is no cart_id defined... how can i check the cart_id when an event is done? the best would be when the user is selected. i don t think there is a hook called when this action is done, do you know how i could create a hook for this ? Edit: i found in the doc 1.5 this: These objects are only accessible for the customer Context: Customer. Existing customer retrieved from the cookie or default customer. Cart. Current cart. Controller. Current controller instance. These objects are only accessible for the administrator Context: Employee. Current employee. does it mean i can t access to the cart objet by the context if im in BO ? thanks for your help Edited April 26, 2013 by manulito (see edit history) Link to comment Share on other sites More sharing options...
manulito Posted May 2, 2013 Author Share Posted May 2, 2013 up ? Link to comment Share on other sites More sharing options...
Recommended Posts