// Many improvements for Feature Detachable
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8648 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+8
-8
@@ -36,7 +36,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return false;
|
||||
|
||||
|
||||
if (!array_key_exists($id_product, self::$cacheIsPack))
|
||||
{
|
||||
$result = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'pack WHERE id_product_pack = '.(int)($id_product));
|
||||
@@ -49,7 +49,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return false;
|
||||
|
||||
|
||||
if (!array_key_exists($id_product, self::$cacheIsPacked))
|
||||
{
|
||||
$result = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'pack WHERE id_product_item = '.(int)($id_product));
|
||||
@@ -72,7 +72,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
if (array_key_exists($id_product, self::$cachePackItems))
|
||||
return self::$cachePackItems[$id_product];
|
||||
$result = Db::getInstance()->ExecuteS('SELECT id_product_item, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)($id_product));
|
||||
@@ -91,7 +91,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return true;
|
||||
|
||||
|
||||
$items = self::getItems((int)($id_product), Configuration::get('PS_LANG_DEFAULT'));
|
||||
foreach ($items AS $item)
|
||||
if ($item->quantity < $item->pack_quantity AND !$item->isAvailableWhenOutOfStock((int)($item->out_of_stock)))
|
||||
@@ -103,7 +103,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
$sql = 'SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity
|
||||
FROM `'._DB_PREFIX_.'pack` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
||||
@@ -132,7 +132,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (!self::isFeatureActive())
|
||||
return array();
|
||||
|
||||
|
||||
$packs = Db::getInstance()->getValue('
|
||||
SELECT GROUP_CONCAT(a.`id_product_pack`)
|
||||
FROM `'._DB_PREFIX_.'pack` a
|
||||
@@ -196,7 +196,7 @@ class PackCore extends Product
|
||||
// If return query result, a non-pack product will return false
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is allow to know if a feature is used or active
|
||||
* @since 1.5.0.1
|
||||
@@ -206,7 +206,7 @@ class PackCore extends Product
|
||||
{
|
||||
if (self::$feature_active === null)
|
||||
self::$feature_active = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
SELECT `id_pack`
|
||||
FROM `'._DB_PREFIX_.'pack`
|
||||
');
|
||||
return self::$feature_active;
|
||||
|
||||
Reference in New Issue
Block a user