// Fix backOffice order cart rules management

This commit is contained in:
rGaillard
2012-03-15 14:42:57 +00:00
parent 356f6f4360
commit 3be00c8e6f
6 changed files with 83 additions and 34 deletions
@@ -89,6 +89,15 @@ class AdminCartRulesControllerCore extends AdminController
$this->afterAdd($current_object);
}
public function processAdd($token)
{
if ($cart_rule = parent::processAdd($token))
$this->context->smarty->assign('new_cart_rule', $cart_rule);
if (Tools::getValue('submitFormAjax'))
$this->redirect_after = false;
return $cart_rule;
}
/* @TODO Move this function into CartRule */
protected function afterAdd($currentObject)
{
+2 -2
View File
@@ -388,9 +388,9 @@ class AdminCartsControllerCore extends AdminController
if ($this->tabAccess['edit'] === '1')
{
$errors = array();
if (!$id_cart_rule = Tools::getValue('id_cart_rule') || !$cart_rule = new CartRule((int)$id_cart_rule))
if (!($id_cart_rule = Tools::getValue('id_cart_rule')) || !$cart_rule = new CartRule((int)$id_cart_rule))
$errors[] = Tools::displayError('Invalid voucher');
else if ($err = $cart_rule->checkValidity($this->context))
elseif ($err = $cart_rule->checkValidity($this->context))
$errors[] = $err;
if (!count($errors))
if (!$this->context->cart->addCartRule((int)$cart_rule->id))