diff --git a/classes/Product.php b/classes/Product.php index 7a90ea8ab..31b781f9f 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -244,7 +244,7 @@ class ProductCore extends ObjectModel 'multilang' => true, 'multilang_shop' => true, 'fields' => array( - /* Classic fields */ + // Classic fields 'id_shop_default' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), @@ -3722,14 +3722,21 @@ class ProductCore extends ObjectModel $row['specific_prices'] = $specific_prices; + $row['quantity'] = Product::getQuantity( + (int)$row['id_product'], + 0, + isset($row['cache_is_pack']) ? $row['cache_is_pack'] : null + ); + if ($row['id_product_attribute']) - $row['quantity_all_versions'] = Product::getQuantity( + { + $row['quantity_all_versions'] = $row['quantity']; + $row['quantity'] = Product::getQuantity( (int)$row['id_product'], - 0, - isset($row['cache_is_pack']) ? $row['cache_is_pack'] : null + $row['id_product_attribute'], + isset($row['cache_is_pack']) ? $row['cache_is_pack'] : null ); - else - $row['quantity'] = Product::getQuantity((int)$row['id_product']); + } $row['id_image'] = Product::defineProductImage($row, $id_lang); $row['features'] = Product::getFrontFeaturesStatic((int)$id_lang, $row['id_product']); diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index 52bd7e026..94e11ce26 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -2525,7 +2525,7 @@ class BlockLayered extends Module LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category) LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` '.$join.' - LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product) + LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').') LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1) LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)($cookie->id_lang).') LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)