当前位置: 首页>>代码示例>>PHP>>正文


PHP CCatalogSku::IsExistOffers方法代码示例

本文整理汇总了PHP中CCatalogSku::IsExistOffers方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogSku::IsExistOffers方法的具体用法?PHP CCatalogSku::IsExistOffers怎么用?PHP CCatalogSku::IsExistOffers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCatalogSku的用法示例。


在下文中一共展示了CCatalogSku::IsExistOffers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: productView

 static function productView($arResult, $user_id = false)
 {
     if ($arResult["ID"] != "") {
         $arResult["PRODUCT_ID"] = $arResult["ID"];
     }
     if (class_exists("DataManager")) {
         return false;
     }
     if (self::contains($_SERVER["HTTP_USER_AGENT"], "facebook.com")) {
         return;
     }
     $api_key = COption::GetOptionString(self::$MODULE_ID, "tracker_code", '');
     if (!$api_key) {
         return;
     }
     global $APPLICATION;
     global $USER;
     $visitor_uid = false;
     if (!$user_id) {
         $user_id = $USER->GetID();
     }
     $visitor_info = false;
     if ($user_id && ($visitor_info = self::getVisitorInfo($user_id))) {
         $visitor_uid = (int) $user_id;
     }
     $guest_uid = self::getUid($visitor_uid);
     $tracker = new ConveadTracker($api_key, SITE_SERVER_NAME, $guest_uid, $visitor_uid, $visitor_info, false, SITE_SERVER_NAME);
     $arProduct = CCatalogProduct::GetByIDEx($arResult["PRODUCT_ID"]);
     if ($arProduct && strpos($APPLICATION->GetCurPage(), $arProduct["DETAIL_PAGE_URL"]) !== false) {
         if (CCatalogSku::IsExistOffers($arResult["PRODUCT_ID"])) {
             $arOffers = CIBlockPriceTools::GetOffersArray(array("IBLOCK_ID" => $arProduct["IBLOCK_ID"]), array($arResult["PRODUCT_ID"]), array(), array("ID", "ACTIVE"));
             foreach ($arOffers as $array) {
                 if ($array["ACTIVE"] == "Y") {
                     $arResult["PRODUCT_ID"] = $array["ID"];
                     break;
                 }
             }
         }
         $_SESSION["CONVEAD_PRODUCT_ID"] = $arResult["PRODUCT_ID"];
         $_SESSION["CONVEAD_PRODUCT_NAME"] = str_replace("'", ''', $arProduct["NAME"]);
         $_SESSION["CONVEAD_PRODUCT_URL"] = "http://" . SITE_SERVER_NAME . $arProduct["DETAIL_PAGE_URL"];
         $product_id = $arResult["PRODUCT_ID"];
         $product_name = $arProduct["NAME"];
         $product_url = "http://" . SITE_SERVER_NAME . $arProduct["DETAIL_PAGE_URL"];
         if ($_SESSION["LAST_VIEW_ID"] == $arResult["PRODUCT_ID"]) {
             return false;
         } else {
             $_SESSION["LAST_VIEW_ID"] = $arResult["PRODUCT_ID"];
             return true;
         }
         //$result = $tracker->eventProductView($product_id, $product_name, $product_url);
         return true;
     }
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:54,代码来源:cConveadTracker.php

示例2: getProductPhotoId

 /**
  * Find product photo ID
  * @param integer $item_id Item ID
  * @return integer|null
  */
 public static function getProductPhotoId($item_id)
 {
     $picture = null;
     // Получаем цену товара или товарного предложения
     if (CCatalogSku::IsExistOffers($item_id)) {
         // Пытаемся найти цену среди торговых предложений
         $res = CIBlockElement::GetByID($item_id);
         if ($ar_res = $res->GetNext()) {
             if (isset($ar_res['IBLOCK_ID']) && $ar_res['IBLOCK_ID']) {
                 $offers = CIBlockPriceTools::GetOffersArray(array('IBLOCK_ID' => $ar_res['IBLOCK_ID'], 'HIDE_NOT_AVAILABLE' => 'Y', 'CHECK_PERMISSIONS' => 'Y'), array($item_id));
                 foreach ($offers as $offer) {
                     // Ищем фото
                     if (isset($offer['DETAIL_PICTURE']) && (int) $offer['DETAIL_PICTURE'] > 0) {
                         $picture = $offer['DETAIL_PICTURE'];
                     }
                 }
             }
         }
     }
     if ($picture == null) {
         $item_id = intval($item_id);
         $libCatalogProduct = new CCatalogProduct();
         $item = $libCatalogProduct->GetByIDEx($item_id);
         $picture = $item['DETAIL_PICTURE'] ?: $item['PREVIEW_PICTURE'];
     }
     return $picture;
 }
开发者ID:ASDAFF,项目名称:rees46_bitrix,代码行数:32,代码来源:Data.php

示例3: canCreateSetByProduct

 public static function canCreateSetByProduct($intProductID, $intSetType)
 {
     $intProductID = (int) $intProductID;
     if ($intProductID <= 0) {
         return false;
     }
     if (self::isProductInSet($intProductID, $intSetType)) {
         return false;
     }
     if (CCatalogSku::IsExistOffers($intProductID)) {
         return false;
     }
     return true;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:14,代码来源:product_set.php

示例4: getFinalPriceInCurrency

function getFinalPriceInCurrency($item_id, $sale_currency = 'UAH')
{
    global $USER;
    // Do item have offers?
    if (CCatalogSku::IsExistOffers($item_id)) {
        // Find price in offers
        $res = CIBlockElement::GetByID($item_id);
        if ($ar_res = $res->GetNext()) {
            if (isset($ar_res['IBLOCK_ID']) && $ar_res['IBLOCK_ID']) {
                // Find all offers
                $offers = CIBlockPriceTools::GetOffersArray(array('IBLOCK_ID' => $ar_res['IBLOCK_ID'], 'HIDE_NOT_AVAILABLE' => 'Y', 'CHECK_PERMISSIONS' => 'Y'), array($item_id), null, null, null, null, null, null, array('CURRENCY_ID' => $sale_currency), $USER->getId(), null);
                foreach ($offers as $offer) {
                    $price = CCatalogProduct::GetOptimalPrice($offer['ID'], 1, $USER->GetUserGroupArray(), 'N');
                    if (isset($price['PRICE'])) {
                        if ($price['PRICE']['CURRENCY'] != $sale_currency) {
                            $price['PRICE']['PRICE'] = CCurrencyRates::ConvertCurrency($price['PRICE']['PRICE'], $price['PRICE']['CURRENCY'], $sale_currency);
                            $price['PRICE']['CURRENCY'] = $sale_currency;
                        }
                        $price['PRICE']['PRICE_WITH_DISCOUNT'] = $price['PRICE']['PRICE'];
                        $currency_code = $price['PRICE']['CURRENCY'];
                        // Find discounts and calculate price with discounts
                        $arDiscounts = CCatalogDiscount::GetDiscountByProduct($item_id, $USER->GetUserGroupArray(), "N");
                        if (is_array($arDiscounts) && sizeof($arDiscounts) > 0) {
                            $price['PRICE']['PRICE_WITH_DISCOUNT'] = CCatalogProduct::CountPriceWithDiscount($price['PRICE']['PRICE_WITH_DISCOUNT'], $sale_currency, $arDiscounts);
                        }
                        // Stop cycle, use found value
                        break;
                    }
                }
            }
        }
    } else {
        // Simple product, not trade offers
        $price = CCatalogProduct::GetOptimalPrice($item_id, 1, $USER->GetUserGroupArray(), 'N');
        // Got price?
        if (!$price || !isset($price['PRICE'])) {
            return false;
        }
        if ($price['PRICE']['CURRENCY'] != $sale_currency) {
            $price['PRICE']['PRICE'] = CCurrencyRates::ConvertCurrency($price['PRICE']['PRICE'], $price['PRICE']['CURRENCY'], $sale_currency);
            $price['DISCOUNT_PRICE'] = CCurrencyRates::ConvertCurrency($price['DISCOUNT_PRICE'], $price['PRICE']['CURRENCY'], $sale_currency);
            $price['PRICE']['CURRENCY'] = $sale_currency;
        }
        // Change currency code if found
        if (isset($price['CURRENCY'])) {
            $currency_code = $price['CURRENCY'];
        }
        if (isset($price['PRICE']['CURRENCY'])) {
            $currency_code = $price['PRICE']['CURRENCY'];
        }
        // Get final price
        $price['PRICE']['PRICE_WITH_DISCOUNT'] = $price['DISCOUNT_PRICE'];
        // Find discounts and calculate price with discounts
        $arDiscounts = CCatalogDiscount::GetDiscountByProduct($item_id, $USER->GetUserGroupArray(), "N", 2);
        if (is_array($arDiscounts) && sizeof($arDiscounts) > 0) {
            $price['PRICE']['PRICE_WITH_DISCOUNT'] = CCatalogProduct::CountPriceWithDiscount($price['PRICE']['PRICE_WITH_DISCOUNT'], $sale_currency, $arDiscounts);
        }
    }
    // Convert to sale currency if needed
    if ($currency_code != $sale_currency) {
        $price['PRICE']['PRICE_WITH_DISCOUNT'] = CCurrencyRates::ConvertCurrency($price['PRICE']['PRICE_WITH_DISCOUNT'], $sale_currency, $sale_currency);
    }
    return $price;
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:64,代码来源:complects.php


注:本文中的CCatalogSku::IsExistOffers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。