From ac24d5ddd8f8ce777fd3b7486407e67a5bef3134 Mon Sep 17 00:00:00 2001 From: fSerny Date: Wed, 23 Nov 2011 20:52:37 +0000 Subject: [PATCH] [-] BO : Load customer and cart in AdminOrderController init to fix a bug with CancelProduct git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10601 b9a71923-0436-4b27-9f14-aed3839534dd --- controllers/admin/AdminOrdersController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 7ec6ee24c..c34b078aa 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -77,6 +77,11 @@ class AdminOrdersControllerCore extends AdminController $this->shopLinkType = 'shop'; $this->shopShareDatas = Shop::SHARE_ORDER; + // Save context (in order to apply cart rule) + $order = new Order((int)Tools::getValue('id_order')); + $this->context->cart = new Cart($order->id_cart); + $this->context->customer = new Customer($order->id_customer); + parent::__construct(); } @@ -100,6 +105,11 @@ class AdminOrdersControllerCore extends AdminController { if ($this->display == 'view') { + $order = new Order((int)Tools::getValue('id_order')); + if ($order->hasBeenDelivered()) $type = $this->l('Return'); + elseif ($order->hasBeenPaid()) $type = $this->l('Refund'); + else $type = $this->l('Cancel'); + $this->toolbar_btn['new'] = array( 'short' => 'Create', 'href' => '', @@ -109,7 +119,7 @@ class AdminOrdersControllerCore extends AdminController $this->toolbar_btn['standard_refund'] = array( 'short' => 'Create', 'href' => '', - 'desc' => $this->l('Standard refund'), + 'desc' => $type.' '.$this->l('refund'), 'class' => 'process-icon-new standard_refund' ); $this->toolbar_btn['partial_refund'] = array(