// Context part 10

This commit is contained in:
rMalie
2011-07-18 15:27:32 +00:00
parent bc5d36821d
commit e16a8ab8d3
24 changed files with 375 additions and 304 deletions
+1 -2
View File
@@ -90,14 +90,13 @@ class StockMvtCore extends ObjectModel
// Search missing stock movement on products without attributes
$sql = 'SELECT s.id_stock, (s.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
FROM '._DB_PREFIX_.'product p
INNER JOIN '._DB_PREFIX_.'stock s ON s.id_product = p.id_product
'.Product::sqlStock('p', null, true).'
LEFT JOIN '._DB_PREFIX_.'stock_mvt sm ON s.id_stock = sm.id_stock
WHERE (
SELECT COUNT(*) FROM '._DB_PREFIX_.'stock s2
WHERE s2.id_product = p.id_product
AND s2.id_product_attribute > 0
) = 0
'.Shop::sqlSharedStock('s').'
GROUP BY s.id_product, s.id_shop
HAVING qty <> 0';
$products_without_attributes = Db::getInstance()->ExecuteS($sql);