本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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;
}