本文整理汇总了PHP中Pack::isFeatureActive方法的典型用法代码示例。如果您正苦于以下问题:PHP Pack::isFeatureActive方法的具体用法?PHP Pack::isFeatureActive怎么用?PHP Pack::isFeatureActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pack
的用法示例。
在下文中一共展示了Pack::isFeatureActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPacksContainingItem
/**
* Returns Packs that conatins the given product in the right declinaison.
*
* @param integer $id_item Product item id that could be contained in a|many pack(s)
* @param integer $id_attribute_item The declinaison of the product
* @param integer $id_lang
* @return array[Product] Packs that contains the given product
*/
public static function getPacksContainingItem($id_item, $id_attribute_item, $id_lang)
{
if (!Pack::isFeatureActive() || !$id_item) {
return array();
}
$query = 'SELECT `id_product_pack`, `quantity` FROM `' . _DB_PREFIX_ . 'pack`
WHERE `id_product_item` = ' . (int) $id_item;
if (Combination::isFeatureActive()) {
$query .= ' AND `id_product_attribute_item` = ' . (int) $id_attribute_item;
}
$result = Db::getInstance()->executeS($query);
$array_result = array();
foreach ($result as $row) {
$p = new Product($row['id_product_pack'], true, $id_lang);
$p->loadStockData();
$p->pack_item_quantity = $row['quantity'];
// Specific need from StockAvailable::updateQuantity()
$array_result[] = $p;
}
return $array_result;
}
示例2: getPacksTable
public static function getPacksTable($id_product, $id_lang, $full = false, $limit = null)
{
if (!Pack::isFeatureActive()) {
return array();
}
$packs = Db::getInstance()->getValue('
SELECT GROUP_CONCAT(a.`id_product_pack`)
FROM `' . _DB_PREFIX_ . 'pack` a
WHERE a.`id_product_item` = ' . (int) $id_product);
if (!(int) $packs) {
return array();
}
$sql = '
SELECT p.*, product_shop.*, pl.*, MAX(image_shop.`id_image`) id_image, il.`legend`
FROM `' . _DB_PREFIX_ . 'product` p
NATURAL LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl
' . Shop::addSqlAssociation('product', 'p') . '
LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = p.`id_product`)' . Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1') . '
LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $id_lang . ')
WHERE pl.`id_lang` = ' . (int) $id_lang . '
' . Shop::addSqlRestrictionOnLang('pl') . '
AND p.`id_product` IN (' . $packs . ')
GROUP BY product_shop.id_product';
if ($limit) {
$sql .= ' LIMIT ' . (int) $limit;
}
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
if (!$full) {
return $result;
}
$array_result = array();
foreach ($result as $row) {
if (!Pack::isPacked($row['id_product'])) {
$array_result[] = Product::getProductProperties($id_lang, $row);
}
}
return $array_result;
}