// Improve BackOffice Order
This commit is contained in:
@@ -230,7 +230,7 @@ abstract class PaymentModuleCore extends Module
|
||||
if (!$order_creation_failed & isset($order->id))
|
||||
{
|
||||
if (!$secure_key)
|
||||
$message .= Tools::displayError('Warning : the secure key is empty, check your payment account before validation');
|
||||
$message .= '<br />'.Tools::displayError('Warning : the secure key is empty, check your payment account before validation');
|
||||
// Optional message to attach to this order
|
||||
if (isset($message) & !empty($message))
|
||||
{
|
||||
|
||||
@@ -196,6 +196,8 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->context->cart->id_customer = $id_customer;
|
||||
if ($this->context->cart->OrderExists())
|
||||
return;
|
||||
if (!$this->context->cart->secure_key)
|
||||
$this->context->cart->secure_key = $this->context->customer->secure_key;
|
||||
if (!$this->context->cart->id_shop)
|
||||
$this->context->cart->id_shop = (int)$this->context->shop->id;
|
||||
if (!$this->context->cart->id_lang)
|
||||
@@ -215,6 +217,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->context->cart->id_address_delivery = $addresses[0]['id_address'];
|
||||
elseif ($id_address_delivery)
|
||||
$this->context->cart->id_address_delivery = (int)$id_address_delivery;
|
||||
|
||||
$this->context->cart->save();
|
||||
$currency = new Currency((int)$this->context->cart->id_currency);
|
||||
$this->context->currency = $currency;
|
||||
@@ -371,7 +374,8 @@ class AdminCartsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessUpdateAddress()
|
||||
{
|
||||
echo Tools::jsonEncode(array('addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang)));
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
echo Tools::jsonEncode(array('addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang)));
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateAddresses()
|
||||
@@ -524,25 +528,28 @@ class AdminCartsControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessUpdateProductPrice()
|
||||
{
|
||||
SpecificPrice::deleteByIdCart((int)$this->context->cart->id, (int)Tools::getValue('id_product'), (int)Tools::getValue('id_product_attribute'));
|
||||
$specific_price = new SpecificPrice();
|
||||
$specific_price->id_cart = (int)$this->context->cart->id;
|
||||
$specific_price->id_shop = 0;
|
||||
$specific_price->id_group_shop = 0;
|
||||
$specific_price->id_currency = 0;
|
||||
$specific_price->id_country = 0;
|
||||
$specific_price->id_group = 0;
|
||||
$specific_price->id_customer = (int)$this->context->customer->id;
|
||||
$specific_price->id_product = (int)Tools::getValue('id_product');
|
||||
$specific_price->id_product_attribute = (int)Tools::getValue('id_product_attribute');
|
||||
$specific_price->price = (float)Tools::getValue('price');
|
||||
$specific_price->from_quantity = 1;
|
||||
$specific_price->reduction = 0;
|
||||
$specific_price->reduction_type = 'amount';
|
||||
$specific_price->from = '0000-00-00 00:00:00';
|
||||
$specific_price->to = '0000-00-00 00:00:00';
|
||||
$specific_price->add();
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
SpecificPrice::deleteByIdCart((int)$this->context->cart->id, (int)Tools::getValue('id_product'), (int)Tools::getValue('id_product_attribute'));
|
||||
$specific_price = new SpecificPrice();
|
||||
$specific_price->id_cart = (int)$this->context->cart->id;
|
||||
$specific_price->id_shop = 0;
|
||||
$specific_price->id_group_shop = 0;
|
||||
$specific_price->id_currency = 0;
|
||||
$specific_price->id_country = 0;
|
||||
$specific_price->id_group = 0;
|
||||
$specific_price->id_customer = (int)$this->context->customer->id;
|
||||
$specific_price->id_product = (int)Tools::getValue('id_product');
|
||||
$specific_price->id_product_attribute = (int)Tools::getValue('id_product_attribute');
|
||||
$specific_price->price = (float)Tools::getValue('price');
|
||||
$specific_price->from_quantity = 1;
|
||||
$specific_price->reduction = 0;
|
||||
$specific_price->reduction_type = 'amount';
|
||||
$specific_price->from = '0000-00-00 00:00:00';
|
||||
$specific_price->to = '0000-00-00 00:00:00';
|
||||
$specific_price->add();
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
public static function getOrderTotalUsingTaxCalculationMethod($id_cart)
|
||||
|
||||
@@ -673,7 +673,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
$payment_module = Module::getInstanceByName($module_name);
|
||||
$cart = new Cart((int)$id_cart);
|
||||
$payment_module->validateOrder((int)$cart->id, (int)$id_order_state, $cart->getOrderTotal(true, Cart::BOTH), $payment_module->displayName, sprintf($this->l('Manual order - ID Employee :%1'), (int)Context::getContext()->cookie->id_employee));
|
||||
$payment_module->validateOrder((int)$cart->id, (int)$id_order_state, $cart->getOrderTotal(true, Cart::BOTH), $payment_module->displayName, sprintf($this->l('Manual order - ID Employee :%d'), (int)Context::getContext()->cookie->id_employee), array(), null, false, $cart->secure_key);
|
||||
if ($payment_module->currentOrder)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$payment_module->currentOrder.'&vieworder'.'&token='.$this->token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user