diff --git a/admin-dev/tabs/AdminOrders.php b/admin-dev/tabs/AdminOrders.php index 61de6a81d..cb810c12a 100644 --- a/admin-dev/tabs/AdminOrders.php +++ b/admin-dev/tabs/AdminOrders.php @@ -780,12 +780,8 @@ class AdminOrders extends AdminTab SELECT id_image FROM '._DB_PREFIX_.'image WHERE id_product = '.(int)($product['product_id']).' AND cover = 1'); - $stock = Db::getInstance()->getRow(' - SELECT '.($product['product_attribute_id'] ? 'pa' : 'p').'.quantity - FROM '._DB_PREFIX_.'product p - '.($product['product_attribute_id'] ? 'LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON p.id_product = pa.id_product' : '').' - WHERE p.id_product = '.(int)($product['product_id']).' - '.($product['product_attribute_id'] ? 'AND pa.id_product_attribute = '.(int)($product['product_attribute_id']) : '')); + // @FIXME + $stock = StockManagerFactory::getManager()->getProductRealQuantities($product['product_id'], $product['product_attribute_id'], null, true); if (isset($image['id_image'])) { $target = _PS_TMP_IMG_DIR_.'product_mini_'.(int)($product['product_id']).(isset($product['product_attribute_id']) ? '_'.(int)($product['product_attribute_id']) : '').'.jpg'; @@ -794,7 +790,7 @@ class AdminOrders extends AdminTab } // Customization display $this->displayCustomizedDatas($customizedDatas, $product, $currency, $image, $tokenCatalog, $k); - + if (!isset($product['customizationQuantityTotal'])) $product['customizationQuantityTotal'] = 0; // Normal display @@ -816,7 +812,7 @@ class AdminOrders extends AdminTab 1 ? 'style="font-weight:700;font-size:1.1em;color:red"' : '').'>'.(int)$product['product_quantity'].' '.($order->hasBeenPaid() ? ''.(int)($product['product_quantity_refunded']).'' : '').' '.($order->hasBeenDelivered() ? ''.(int)($product['product_quantity_return']).'' : '').' - '.$productObj->getStock($product['product_attribute_id']).' + '.StockManagerFactory::getManager()->getProductRealQuantities($product['product_id'], $product['product_attribute_id'], null, true).' '.Tools::displayPrice(Tools::ps_round($product_price, 2) * ((int)($product['product_quantity']) - $product['customizationQuantityTotal']), $currency, false).' diff --git a/classes/Product.php b/classes/Product.php index db9f59c75..31d9eb7e9 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -196,7 +196,7 @@ class ProductCore extends ObjectModel protected $langMultiShop = true; public $cache_is_pack; - public $cache_has_attachments; + public $cache_has_attachments; public $is_virtual; public $cache_default_attribute; @@ -336,7 +336,10 @@ class ProductCore extends ObjectModel $this->tags = Tag::getProductTags((int)$this->id); } - $this->quantity = $this->getStock(); + /** + * @FIXME + */ + $this->quantity = 0; if ($this->id_category_default) $this->category = Category::getLinkRewrite((int)$this->id_category_default, (int)$id_lang);