本文整理汇总了PHP中ProductDownload::isFeatureActive方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductDownload::isFeatureActive方法的具体用法?PHP ProductDownload::isFeatureActive怎么用?PHP ProductDownload::isFeatureActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductDownload
的用法示例。
在下文中一共展示了ProductDownload::isFeatureActive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: containsVirtualProducts
public function containsVirtualProducts()
{
/*
* EU-Legal
* is at least one virtual product in cart?
*/
if (!ProductDownload::isFeatureActive()) {
return false;
}
if (!isset(self::$_isPartlyVirtualCart[$this->id])) {
$products = $this->getProducts();
if (!count($products)) {
return false;
}
$is_partly_virtual = 0;
foreach ($products as $product) {
if ($product['is_virtual']) {
$is_partly_virtual = 1;
}
}
self::$_isPartlyVirtualCart[$this->id] = (int) $is_partly_virtual;
}
return self::$_isPartlyVirtualCart[$this->id];
}
示例2: getIdFromIdProduct
/**
* Return the id_product_download from an id_product
*
* @param int $id_product Product the id
* @return int Product the id for this virtual product
*/
public static function getIdFromIdProduct($id_product)
{
if (!ProductDownload::isFeatureActive()) {
return false;
}
if (array_key_exists((int) $id_product, self::$_productIds)) {
return self::$_productIds[$id_product];
}
self::$_productIds[$id_product] = (int) Db::getInstance()->getValue('
SELECT `id_product_download`
FROM `' . _DB_PREFIX_ . 'product_download`
WHERE `id_product` = ' . (int) $id_product . '
AND `active` = 1
ORDER BY `id_product_download` DESC');
return self::$_productIds[$id_product];
}
示例3: isVirtualCart
/**
* Check if cart contains only virtual products
*
* @return boolean true if is a virtual cart or false
*/
public function isVirtualCart($strict = false)
{
if (!ProductDownload::isFeatureActive()) {
return false;
}
if (!isset(self::$_isVirtualCart[$this->id])) {
$products = $this->getProducts();
if (!count($products)) {
return false;
}
$is_virtual = 1;
foreach ($products as $product) {
if (empty($product['is_virtual'])) {
$is_virtual = 0;
}
}
self::$_isVirtualCart[$this->id] = (int) $is_virtual;
}
return self::$_isVirtualCart[$this->id];
}
示例4: getIdFromIdProduct
/**
* Return the id_product_download from an id_product
*
* @param int $id_product Product the id
* @return int Product the id for this virtual product
*/
public static function getIdFromIdProduct($id_product, $active = true)
{
if (!ProductDownload::isFeatureActive()) {
return false;
}
self::$_productIds[$id_product] = (int) Db::getInstance()->getValue('
SELECT `id_product_download`
FROM `' . _DB_PREFIX_ . 'product_download`
WHERE `id_product` = ' . (int) $id_product . '
' . ($active ? ' AND `active` = 1' : '') . '
ORDER BY `id_product_download` DESC');
return self::$_productIds[$id_product];
}