diff --git a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl
index 214d40278..1cbfa25a6 100755
--- a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl
+++ b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl
@@ -69,16 +69,16 @@
{if ((!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN')) AND (int)($product['product_quantity_return']) < (int)($product['product_quantity']))}
- = $product['product_quantity'])}disabled="disabled" {/if}/>
+ = $product['product_quantity'])}disabled="disabled" {/if}/>
{else}
--
{/if}
{if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}
-
+
{elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))}
-
+
{/if}
{if $product['customizationQuantityTotal']}
@@ -96,8 +96,8 @@
{/if}
|
- {l s='Quantity:'} 0/{$productQuantity-$product['product_quantity_refunded']}
- {l s='Amount:'} €
+ {l s='Quantity:'} 0/{$productQuantity-$product['product_quantity_refunded']}
+ {l s='Amount:'} €
|
{if ($can_edit && !$order->hasBeenDelivered())}
diff --git a/classes/Cart.php b/classes/Cart.php
index 8ef02ccd6..cfa1ff5af 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -759,7 +759,7 @@ class CartCore extends ObjectModel
Cache::clean('Cart::getCartRules'.$this->id.'-'.CartRule::FILTER_ACTION_GIFT);
if ((int)$cartRule->gift_product)
- $this->updateQty(1, $cartRule->gift_product, $cartRule->gift_product_attribute, false, 0, 'up', null, false);
+ $this->updateQty(1, $cartRule->gift_product, $cartRule->gift_product_attribute, false, 'up', 0, null, false);
return true;
}
@@ -796,7 +796,7 @@ class CartCore extends ObjectModel
* @param string $operator Indicate if quantity must be increased or decreased
*/
public function updateQty($quantity, $id_product, $id_product_attribute = null, $id_customization = false,
- $id_address_delivery = 0, $operator = 'up', Shop $shop = null, $auto_add_cart_rule = true)
+ $operator = 'up', $id_address_delivery = 0, Shop $shop = null, $auto_add_cart_rule = true)
{
if (!$shop)
$shop = Context::getContext()->shop;
@@ -833,7 +833,7 @@ class CartCore extends ObjectModel
if ((int)$quantity <= 0)
return $this->deleteProduct($id_product, $id_product_attribute, (int)$id_customization);
- else if (!$product->available_for_order || Configuration::get('PS_CATALOG_MODE'))
+ elseif (!$product->available_for_order || Configuration::get('PS_CATALOG_MODE'))
return false;
else
{
@@ -1088,7 +1088,7 @@ class CartCore extends ObjectModel
$cart_rule = new CartRule($id_cart_rule, Configuration::get('PS_LANG_DEFAULT'));
if ((int)$cart_rule->gift_product)
- $this->updateQty(1, $cart_rule->gift_product, $cart_rule->gift_product_attribute, null, null, 'down', null, false);
+ $this->updateQty(1, $cart_rule->gift_product, $cart_rule->gift_product_attribute, null, 'down', 0, null, false);
return $result;
}
@@ -2853,8 +2853,8 @@ class CartCore extends ObjectModel
(int)$product['id_product'],
(int)$product['id_product_attribute'],
null,
- (int)$product['id_address_delivery'],
'up',
+ (int)$product['id_address_delivery'],
new Shop($cart->id_shop)
);
diff --git a/classes/order/Order.php b/classes/order/Order.php
index 069249238..4a3158089 100644
--- a/classes/order/Order.php
+++ b/classes/order/Order.php
@@ -349,7 +349,7 @@ class OrderCore extends ObjectModel
$productPrice = number_format($quantity * $price, 2, '.', '');
/* Update cart */
$cart = new Cart($this->id_cart);
- $cart->updateQty($quantity, $orderDetail->product_id, $orderDetail->product_attribute_id, false, 0, 'down'); // customization are deleted in deleteCustomization
+ $cart->updateQty($quantity, $orderDetail->product_id, $orderDetail->product_attribute_id, false, 'down'); // customization are deleted in deleteCustomization
$cart->update();
/* Update order */
diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php
index c2359d3d5..0bab5e98a 100755
--- a/controllers/admin/AdminCartsController.php
+++ b/controllers/admin/AdminCartsController.php
@@ -338,7 +338,7 @@ class AdminCartsControllerCore extends AdminController
else
$operator = 'up';
- if (!($qty_upd = $this->context->cart->updateQty($qty, $id_product, (int)$id_product_attribute, (int)$id_customization, 0, $operator)))
+ if (!($qty_upd = $this->context->cart->updateQty($qty, $id_product, (int)$id_product_attribute, (int)$id_customization, $operator)))
$errors[] = Tools::displayError('You already have the maximum quantity available for this product.');
}
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index b94ea219d..c21cc7762 100755
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -1474,8 +1474,7 @@ class AdminOrdersControllerCore extends AdminController
}
// Add product to cart
- $cart->updateQty($product_informations['product_quantity'], $product->id, isset($combination) ? $combination->id : null, false, 'up', new Shop($cart->id_shop));
-
+ $cart->updateQty($product_informations['product_quantity'], $product->id, isset($combination) ? $combination->id : null, false, 0, 'up', new Shop($cart->id_shop));
// If order is valid, we can create a new invoice or edit an existing invoice
if ($order->hasInvoice())
{
@@ -1587,6 +1586,7 @@ class AdminOrdersControllerCore extends AdminController
$specific_price->delete();
$products = $this->getProducts($order);
+
// Get the last product
$product = $products[max(array_keys($products))];
diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php
index 7c33aa810..bb5cd7584 100644
--- a/controllers/front/CartController.php
+++ b/controllers/front/CartController.php
@@ -226,7 +226,7 @@ class CartControllerCore extends FrontController
if (!$this->errors)
{
$cart_rules = $this->context->cart->getCartRules();
- $updateQuantity = $this->context->cart->updateQty($this->qty, $this->id_product, $this->id_product_attribute, $this->customization_id, $this->id_address_delivery, Tools::getValue('op', 'up'));
+ $updateQuantity = $this->context->cart->updateQty($this->qty, $this->id_product, $this->id_product_attribute, $this->customization_id, Tools::getValue('op', 'up'), $this->id_address_delivery);
if ($updateQuantity < 0)
{
// If product has attribute, minimal quantity is set with minimal quantity of attribute
|