// Update and fix some bugs on stock display on orders in backoffice
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
</td>
|
</td>
|
||||||
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['product_quantity_refunded']}</td>{/if}
|
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['product_quantity_refunded']}</td>{/if}
|
||||||
{if ($order->hasBeenDelivered())}<td align="center" class="productQuantity">{$product['product_quantity_return']}</td>{/if}
|
{if ($order->hasBeenDelivered())}<td align="center" class="productQuantity">{$product['product_quantity_return']}</td>{/if}
|
||||||
<td align="center" class="productQuantity product_stock">{StockManagerFactory::getManager()->getProductRealQuantities($product['product_id'], $product['product_attribute_id'], null, true)}</td>
|
<td align="center" class="productQuantity product_stock">{$product['current_stock']}</td>
|
||||||
<td align="center" class="total_product">
|
<td align="center" class="total_product">
|
||||||
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
|
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
+13
-6
@@ -321,11 +321,11 @@ class OrderCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
return $this->_deleteProduct($orderDetail, (int)($quantity));
|
return $this->_deleteProduct($orderDetail, (int)($quantity));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function return products of the orders
|
* This function return products of the orders
|
||||||
* It's similar to Order::getProducts but witrh similar outputs of Cart::getProducts
|
* It's similar to Order::getProducts but witrh similar outputs of Cart::getProducts
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCartProducts()
|
public function getCartProducts()
|
||||||
@@ -336,7 +336,7 @@ class OrderCore extends ObjectModel
|
|||||||
.$product['product_id'].'_'
|
.$product['product_id'].'_'
|
||||||
.$product['product_attribute_id'].'_'
|
.$product['product_attribute_id'].'_'
|
||||||
.(isset($product['id_customization']) ? $product['id_customization'] : '0');
|
.(isset($product['id_customization']) ? $product['id_customization'] : '0');
|
||||||
|
|
||||||
$product_list = array();
|
$product_list = array();
|
||||||
foreach ($cart->getProducts() as $product)
|
foreach ($cart->getProducts() as $product)
|
||||||
{
|
{
|
||||||
@@ -344,13 +344,13 @@ class OrderCore extends ObjectModel
|
|||||||
.$product['id_product'].'_'
|
.$product['id_product'].'_'
|
||||||
.$product['id_product_attribute'].'_'
|
.$product['id_product_attribute'].'_'
|
||||||
.(isset($product['id_customization']) ? $product['id_customization'] : '0');
|
.(isset($product['id_customization']) ? $product['id_customization'] : '0');
|
||||||
|
|
||||||
if (in_array($key, $product_id_list))
|
if (in_array($key, $product_id_list))
|
||||||
$product_list[] = $product;
|
$product_list[] = $product;
|
||||||
}
|
}
|
||||||
return $product_list;
|
return $product_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DOES delete the product */
|
/* DOES delete the product */
|
||||||
protected function _deleteProduct($orderDetail, $quantity)
|
protected function _deleteProduct($orderDetail, $quantity)
|
||||||
{
|
{
|
||||||
@@ -632,11 +632,18 @@ class OrderCore extends ObjectModel
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This method allow to add stock information on a product detail
|
* This method allow to add stock information on a product detail
|
||||||
|
*
|
||||||
|
* If advanced stock management is active, get physical stock of this product in the warehouse associated to the ptoduct for the current order
|
||||||
|
* Else get the available quantity of the product in fucntion of the shop associated to the order
|
||||||
|
*
|
||||||
* @param array &$product
|
* @param array &$product
|
||||||
*/
|
*/
|
||||||
protected function setProductCurrentStock(&$product)
|
protected function setProductCurrentStock(&$product)
|
||||||
{
|
{
|
||||||
$product['current_stock'] = StockManagerFactory::getManager()->getProductPhysicalQuantities($product['product_id'], $product['product_attribute_id'], null, true);
|
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)$product['id_warehouse'] > 0)
|
||||||
|
$product['current_stock'] = StockManagerFactory::getManager()->getProductPhysicalQuantities($product['product_id'], $product['product_attribute_id'], (int)$product['id_warehouse'], true);
|
||||||
|
else
|
||||||
|
$product['current_stock'] = '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2213,7 +2213,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
foreach ($warehouses as $warehouse)
|
foreach ($warehouses as $warehouse)
|
||||||
{
|
{
|
||||||
$key = $warehouse['id_warehouse'].'_'.$attribute['id_product'].'_'.$attribute['id_product_attribute'];
|
$key = $warehouse['id_warehouse'].'_'.$product->id.'_'.$attribute['id_product_attribute'];
|
||||||
|
|
||||||
// get elements to manage
|
// get elements to manage
|
||||||
if (Tools::isSubmit('check_warehouse_'.$key))
|
if (Tools::isSubmit('check_warehouse_'.$key))
|
||||||
|
|||||||
Reference in New Issue
Block a user