// Improved Pack management

This commit is contained in:
bMancone
2012-01-10 15:40:46 +00:00
parent d84dce3377
commit fa61172aa8
8 changed files with 156 additions and 36 deletions
+22
View File
@@ -228,5 +228,27 @@ class PackCore extends Product
FROM `'._DB_PREFIX_.'pack`
');
}
/**
* For a given pack, tells if it has at least one product using the advanced stock management
*
* @param int $id_product id_pack
* @return bool
*/
public static function usesAdvancedStockManagement($id_product)
{
if (!Pack::isPack($id_product))
return false;
$products = self::getItems($id_product, Configuration::get('PS_LANG_DEFAULT'));
foreach ($products as $product)
{
// if one product uses the advanced stock management
if ($product->advanced_stock_management == 1)
return true;
}
// not used
return false;
}
}