• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CCatalogSku类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetProductSkuProps

 static function GetProductSkuProps($ID, $IBLOCK_ID = '', $getExt = false)
 {
     $getExt = $getExt === true;
     $arSkuProps = array();
     $ID = (int) $ID;
     $IBLOCK_ID = (int) $IBLOCK_ID;
     if ($ID > 0 && \Bitrix\Main\Loader::includeModule('catalog')) {
         $filter = array('ID' => $ID, 'ACTIVE' => 'Y');
         if ($IBLOCK_ID > 0) {
             $filter['IBLOCK_ID'] = $IBLOCK_ID;
         }
         $res = CIBlockElement::GetList(array(), $filter, false, false, array("ID", "IBLOCK_ID"));
         $arElement = $res->Fetch();
         if ($arElement) {
             $arElement['ID'] = (int) $arElement['ID'];
             $arParent = CCatalogSku::GetProductInfo($ID, $arElement["IBLOCK_ID"]);
             if ($arParent) {
                 $arElement['PROPERTIES'] = array();
                 $arElementLink = array($arElement['ID'] => &$arElement);
                 $arFilter = array('ID' => $arElement['ID'], 'IBLOCK_ID' => $arElement["IBLOCK_ID"]);
                 CIBlockElement::GetPropertyValuesArray($arElementLink, $arElement["IBLOCK_ID"], $arFilter);
                 if (!empty($arElement['PROPERTIES'])) {
                     foreach ($arElement['PROPERTIES'] as &$prop) {
                         if ($prop['XML_ID'] == 'CML2_LINK' || $prop['PROPERTY_TYPE'] == 'F') {
                             continue;
                         }
                         $boolArr = is_array($prop["VALUE"]);
                         if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                             $displayProperty = CIBlockFormatProperties::GetDisplayValue($arElement, $prop, '');
                             $mxValues = '';
                             if ('E' == $prop['PROPERTY_TYPE']) {
                                 if (!empty($displayProperty['LINK_ELEMENT_VALUE'])) {
                                     $mxValues = array();
                                     foreach ($displayProperty['LINK_ELEMENT_VALUE'] as $arTempo) {
                                         $mxValues[] = $arTempo['NAME'] . ' [' . $arTempo['ID'] . ']';
                                     }
                                 }
                             } elseif ('G' == $prop['PROPERTY_TYPE']) {
                                 if (!empty($displayProperty['LINK_SECTION_VALUE'])) {
                                     $mxValues = array();
                                     foreach ($displayProperty['LINK_SECTION_VALUE'] as $arTempo) {
                                         $mxValues[] = $arTempo['NAME'] . ' [' . $arTempo['ID'] . ']';
                                     }
                                 }
                             }
                             if (empty($mxValues)) {
                                 $mxValues = $displayProperty["DISPLAY_VALUE"];
                             }
                             if ($getExt) {
                                 $arSkuProps[$prop["ID"]] = array('ID' => $prop["ID"], 'CODE' => $prop['CODE'], 'NAME' => $prop["NAME"], 'VALUE' => strip_tags(is_array($mxValues) ? implode("/ ", $mxValues) : $mxValues));
                             } else {
                                 $arSkuProps[$prop["NAME"]] = strip_tags(is_array($mxValues) ? implode("/ ", $mxValues) : $mxValues);
                             }
                         }
                     }
                     unset($prop);
                 }
             }
         }
     }
     return $arSkuProps;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:62,代码来源:product.php


示例2: getTabs

 public static function getTabs($iblockElementInfo)
 {
     $showTab = false;
     $request = Context::getCurrent()->getRequest();
     if ($iblockElementInfo["ID"] > 0 && (!isset($request['action']) || $request['action'] != 'copy')) {
         $showTab = true;
         if (Loader::includeModule('catalog')) {
             /*
             				$dbRes = CatalogIblockTable::getList(array(
             					'filter' => array(
             						'=IBLOCK_ID' => $iblockElementInfo["IBLOCK"]["ID"],
             						'!PRODUCT_IBLOCK_ID' => 0
             					),
             					'select' => array('IBLOCK_ID'),
             				));
             				if($dbRes->fetch())
             				{
             					$showTab = false;
             				}
             */
             if (\CCatalogSku::getInfoByOfferIBlock($iblockElementInfo["IBLOCK"]["ID"]) !== false) {
                 $showTab = false;
             }
         }
     }
     return $showTab ? array(array("DIV" => "seo_adv", "SORT" => 4, "TAB" => Loc::getMessage("SEO_ADV_TAB"), "TITLE" => Loc::getMessage("SEO_ADV_TAB_TITLE"))) : null;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:27,代码来源:advtabengine.php


示例3: GetProductSkuProps

 static function GetProductSkuProps($ID, $IBLOCK_ID = '')
 {
     $arSkuProps = array();
     if (CModule::IncludeModule('iblock') && CModule::IncludeModule('catalog')) {
         if (IntVal($IBLOCK_ID) <= 0) {
             $res = CIBlockElement::GetList(array(), array("ID" => $ID), false, false, array("IBLOCK_ID"));
             $arElement = $res->Fetch();
             $IBLOCK_ID = $arElement["IBLOCK_ID"];
         }
         $arOfferProperties = array();
         $arOfferPropsValue = array();
         $arFilter = array("ID" => $ID, "IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y");
         $arSelect = array("ID" => 1, "IBLOCK_ID" => 1);
         $arParent = CCatalogSku::GetProductInfo($ID);
         if ($arParent) {
             if (!is_array($arOfferProperties[$IBLOCK_ID]) || count($arOfferProperties[$IBLOCK_ID]) <= 0) {
                 $dbOfferProperties = CIBlock::GetProperties($IBLOCK_ID, array(), array("!XML_ID" => "CML2_LINK"));
                 while ($arTmp = $dbOfferProperties->Fetch()) {
                     $arOfferProperties[$IBLOCK_ID][] = $arTmp;
                     $arSelect["PROPERTY_" . $arTmp["CODE"]] = 1;
                 }
             }
             $rsOffers = CIBlockElement::GetList(array("SORT" => "ASC"), $arFilter, false, false, array_keys($arSelect));
             while ($obOffer = $rsOffers->GetNextElement()) {
                 $arOfferPropsValue[$ID] = $obOffer->fields;
             }
             if (is_array($arOfferProperties[$IBLOCK_ID]) && count($arOfferProperties[$IBLOCK_ID]) > 0) {
                 foreach ($arOfferProperties[$IBLOCK_ID] as $val) {
                     $arSkuProps[$val["NAME"]] = $arOfferPropsValue[$ID]["PROPERTY_" . $val["CODE"] . "_VALUE"];
                 }
             }
         }
     }
     return $arSkuProps;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:35,代码来源:product.php


示例4: 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("'", '&#039;', $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


示例5: GetProductSkuProps

	static function GetProductSkuProps($ID, $IBLOCK_ID = '')
	{
		$arSkuProps = array();
		if (CModule::IncludeModule('iblock') && CModule::IncludeModule('catalog'))
		{
			$res = CIBlockElement::GetList(
				array(),
				array(
					"ID" => $ID,
					"ACTIVE" => "Y",
				),
				false,
				false,
				array(
					"ID",
					"IBLOCK_ID",
				)
			);
			$arElement = $res->Fetch();
			if ($arElement)
			{
				$IBLOCK_ID = $arElement["IBLOCK_ID"];
				$arParent = CCatalogSku::GetProductInfo($ID);
				if ($arParent)
				{
					$rsOffers = CIBlockElement::GetProperty(
						$IBLOCK_ID,
						$ID
					);
					while ($arOffer = $rsOffers->GetNext())
					{
						if ($arOffer["XML_ID"] != "CML2_LINK")
						{
							if ($arOffer["PROPERTY_TYPE"] == "L")
								$arSkuProps[$arOffer["NAME"]] = $arOffer["VALUE_ENUM"];
							else
								$arSkuProps[$arOffer["NAME"]] = $arOffer["VALUE"];
						}
					}
				}
			}
		}
		return $arSkuProps;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:44,代码来源:product.php


示例6: 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


示例7: array

<?php

CModule::includeModule('catalog');
CModule::includeModule('iblock');
CModule::includeModule('sale');
$dbBasketItems = CSaleBasket::GetList(array(), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "DELAY" => 'Y', "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "PRODUCT_ID"));
while ($arItems = $dbBasketItems->Fetch()) {
    $mxResult = CCatalogSku::GetProductInfo($arItems['PRODUCT_ID']);
    if (is_array($mxResult)) {
        $id = $mxResult['ID'];
    } else {
        $id = $arItems['PRODUCT_ID'];
    }
    $GLOBALS['wished']['ID'][] = $id;
}
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:15,代码来源:filter.php


示例8: getReferences

 /**
  * Get common data from cache.
  * @return mixed[]
  */
 protected function getReferences()
 {
     $this->arParams['CACHE_GROUPS'] = isset($this->arParams['CACHE_GROUPS']) && $this->arParams['CACHE_GROUPS'] == 'N' ? 'N' : 'Y';
     $obCache = new CPHPCache();
     if ($this->arParams['CACHE_GROUPS'] == 'Y') {
         $userGroups = implode(",", Main\UserTable::getUserGroupIds($this->getUserId()));
         $cacheId = implode("-", array(__CLASS__, $this->getLanguageId(), $this->getSiteId(), $userGroups));
     } else {
         $cacheId = implode("-", array(__CLASS__, $this->getLanguageId(), $this->getSiteId()));
     }
     $cached = array();
     if ($obCache->StartDataCache($this->arParams["CACHE_TIME"], $cacheId, $this->getSiteId() . '/' . $this->getRelativePath() . '/reference')) {
         // Catalog Groups
         $cached['CATALOG_GROUP'] = array();
         $catalogGroupIterator = CCatalogGroup::GetList(array("SORT" => "ASC"));
         while ($catalogGroup = $catalogGroupIterator->fetch()) {
             $cached['CATALOG_GROUP'][$catalogGroup['NAME']] = $catalogGroup;
         }
         // Catalog Prices
         $cached['CATALOG_PRICE'] = CIBlockPriceTools::GetCatalogPrices(false, array_keys($cached['CATALOG_GROUP']));
         // Catalog Currency
         $cached['CURRENCY'] = array();
         if ($this->isCurrency) {
             $by = "currency";
             $order = "asc";
             $currencyIterator = CCurrency::getList($by, $order);
             while ($currency = $currencyIterator->fetch()) {
                 $cached['CURRENCY'][$currency['CURRENCY']] = $currency;
             }
         }
         // Catalogs list
         $cached['CATALOG'] = array();
         $catalogIterator = CCatalog::getList(array("IBLOCK_ID" => "ASC"));
         while ($catalog = $catalogIterator->fetch()) {
             $info = CCatalogSku::getInfoByIblock($catalog['IBLOCK_ID']);
             $catalog['CATALOG_TYPE'] = $info['CATALOG_TYPE'];
             $cached['CATALOG'][$catalog['IBLOCK_ID']] = $catalog;
         }
         // Measure list
         $cached['MEASURE'] = array();
         $measureIterator = CCatalogMeasure::getList(array("CODE" => "ASC"));
         while ($measure = $measureIterator->fetch()) {
             $cached['MEASURE'][$measure['ID']] = $measure;
         }
         // Default Measure
         $cached['DEFAULT_MEASURE'] = CCatalogMeasure::getDefaultMeasure(true, true);
         $additionalCache = $this->getAdditionalRefereneces();
         if (!empty($additionalCache) && is_array($additionalCache)) {
             foreach ($additionalCache as $cacheKey => $cacheData) {
                 $cached[$cacheKey] = $cacheData;
             }
             unset($cacheKey, $cacheData);
         }
         unset($additionalCache);
         $obCache->EndDataCache($cached);
     } else {
         $cached = $obCache->GetVars();
     }
     return $cached;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:64,代码来源:class.php


示例9: foreach

    }
}
foreach ($arResult["ITEMS"]["nAnCanBuy"] as $key => $val) {
    if ($arResult["ITEMS_IMG"][$val["ID"]]) {
        $arResult["ITEMS"]["nAnCanBuy"][$key]["DETAIL_PICTURE"] = $arResult["ITEMS_IMG"][$val["ID"]];
    }
    if ($productId = CCatalogSku::GetProductInfo($val["PRODUCT_ID"])) {
        $arElementsID[] = $productId["ID"];
        $arProductsToElements[$productId["ID"]][] = $val["PRODUCT_ID"];
    }
}
foreach ($arResult["ITEMS"]["ProdSubscribe"] as $key => $val) {
    if ($arResult["ITEMS_IMG"][$val["ID"]]) {
        $arResult["ITEMS"]["ProdSubscribe"][$key]["DETAIL_PICTURE"] = $arResult["ITEMS_IMG"][$val["ID"]];
    }
    if ($productId = CCatalogSku::GetProductInfo($val["PRODUCT_ID"])) {
        $arElementsID[] = $productId["ID"];
        $arProductsToElements[$productId["ID"]][] = $val["PRODUCT_ID"];
    }
}
$arElementsID = array_unique($arElementsID);
$db_res = CIBlockElement::GetList(array("SORT" => "ASC"), array("ID" => $arElementsID), false, false, array("ID", "IBLOCK_ID", "DETAIL_PAGE_URL", "DETAIL_PICTURE", "PREVIEW_PICTURE"));
while ($arElement = $db_res->GetNext()) {
    foreach ($arResult["ITEMS"]["AnDelCanBuy"] as $key => $val) {
        if ($arProductsToElements && in_array($val["PRODUCT_ID"], $arProductsToElements[$arElement["ID"]])) {
            $arResult["ITEMS"]["AnDelCanBuy"][$key]["DETAIL_PAGE_URL"] = $arElement["DETAIL_PAGE_URL"];
            if (!$arResult["ITEMS"]["AnDelCanBuy"][$key]["DETAIL_PICTURE"]["SRC"]) {
                if (!$arResult["ITEMS"]["AnDelCanBuy"][$key]["PREVIEW_PICTURE"]["SRC"]) {
                    $img = array();
                    if ($arElement["DETAIL_PICTURE"]) {
                        $img = CFile::ResizeImageGet($arElement["DETAIL_PICTURE"], array("width" => "60", "height" => "60"));
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:31,代码来源:result_modifier.php


示例10: getProductDataToFillBasket

function getProductDataToFillBasket($productId, $quantity, $userId, $LID, $userColumns, $tmpId = "")
{
	if (!\Bitrix\Main\Loader::includeModule("catalog"))
		return array();

	$arParams = array();

	$productId = (int)$productId;
	if ($productId <= 0)
	{
		return $arParams;
	}
	$iblockId = (int)CIBlockElement::GetIBlockByID($productId);
	if ($iblockId <= 0)
	{
		return $arParams;
	}

	$arSku2Parent = array();
	$arElementId = array();

	$arElementId[] = $productId;
	$arParent = CCatalogSku::GetProductInfo($productId, $iblockId);
	if ($arParent)
	{
		$arElementId[] = $arParent["ID"];
		$arSku2Parent[$productId] = $arParent["ID"];
	}

	$arPropertyInfo = array();
	$userColumns = (string)$userColumns;
	$arUserColumns = ($userColumns != '') ? explode(",", $userColumns) : array();
	foreach ($arUserColumns as $key => $column)
	{
		if (strncmp($column, 'PROPERTY_', 9) != 0)
		{
			unset($arUserColumns[$key]);
		}
		else
		{
			$propertyCode = substr($column, 9);
			if ($propertyCode == '')
			{
				unset($arUserColumns[$key]);
				continue;
			}
			$dbres = CIBlockProperty::GetList(array(), array("CODE" => $propertyCode));
			if ($arPropData = $dbres->GetNext())
				$arPropertyInfo[$column] = $arPropData;
		}
	}

	$arSelect = array_merge(
		array("ID", "NAME", "LID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "DETAIL_PICTURE", "PREVIEW_PICTURE", "DETAIL_PAGE_URL", "XML_ID", "IBLOCK_XML_ID"),
		$arUserColumns
	);

	$arProductData = getProductProps($arElementId, $arSelect);

	$defaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);

	if (!empty($arProductData))
	{
		$arElementInfo = array();
		foreach ($arProductData as $elemId => &$arElement)
		{
			foreach ($arElement as $key => $value)
			{
				if (strncmp($key, 'PROPERTY_', 9) == 0 && substr($key, -6) == "_VALUE")
				{
					$columnCode = str_replace("_VALUE", "", $key);
					$arElement[$key] = getIblockPropInfo($value, $arPropertyInfo[$columnCode], array("WIDTH" => 90, "HEIGHT" => 90));
				}
			}
		}
		unset($arElement);

		if (isset($arProductData[$productId]))
			$arElementInfo = $arProductData[$productId];

		if (isset( $arSku2Parent[$productId]))
			$arParent = $arProductData[$arSku2Parent[$productId]];

		if (!empty($arSku2Parent)) // if sku element doesn't have value of some property - we'll show parent element value instead
		{
			foreach ($arUserColumns as $field)
			{
				$fieldVal = $field."_VALUE";
				$parentId = $arSku2Parent[$productId];

				if ((!isset($arElementInfo[$fieldVal]) || (isset($arElementInfo[$fieldVal]) && strlen($arElementInfo[$fieldVal]) == 0))
					&& (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) // can be array or string
				{
					$arElementInfo[$fieldVal] = $arProductData[$parentId][$fieldVal];
				}
			}
			if (strpos($arElementInfo["~XML_ID"], '#') === false)
			{
				$arElementInfo["~XML_ID"] = $arParent['~XML_ID'].'#'.$arElementInfo["~XML_ID"];
			}
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:arteva.ru,代码行数:101,代码来源:admin_tool.php


示例11: GetMessage

             }
         }
         if ($bErrorField) {
             $arResult["ERROR"][] = GetMessage("SOA_ERROR_REQUIRE") . " \"" . $arOrderProps["NAME"] . "\"";
         }
         //}//end isset
     }
     //end while
 }
 /* Check Values End */
 // get properties for iblock elements and their parents (if any)
 $arSelect = array_merge(array("ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "PREVIEW_TEXT"), $arCustomSelectFields);
 $arProductData = getProductProps($arElementId, $arSelect);
 foreach ($arResult["BASKET_ITEMS"] as &$arResultItem) {
     $productId = $arResultItem["PRODUCT_ID"];
     $arParent = CCatalogSku::GetProductInfo($productId);
     if (intval($arProductData[$productId]["PREVIEW_PICTURE"]) <= 0 && intval($arProductData[$productId]["DETAIL_PICTURE"]) <= 0 && $arParent) {
         $productId = $arParent["ID"];
     }
     if (intval($arProductData[$productId]["PREVIEW_PICTURE"]) > 0) {
         $arResultItem["PREVIEW_PICTURE"] = $arProductData[$productId]["PREVIEW_PICTURE"];
     }
     if (intval($arProductData[$productId]["DETAIL_PICTURE"]) > 0) {
         $arResultItem["DETAIL_PICTURE"] = $arProductData[$productId]["DETAIL_PICTURE"];
     }
     if (strlen($arProductData[$productId]["PREVIEW_TEXT"]) > 0) {
         $arResultItem["PREVIEW_TEXT"] = $arProductData[$productId]["PREVIEW_TEXT"];
     }
     foreach ($arProductData[$arResultItem["PRODUCT_ID"]] as $key => $value) {
         if (strpos($key, "PROPERTY_") !== false) {
             $arResultItem[$key] = $value;
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:component.php


示例12: function

 echo "window.onload = function () {";
 echo "fUserGetProfile(BX(\"user_id\"));\n";
 if (CModule::IncludeModule('catalog') && CModule::IncludeModule('iblock') && isset($_GET["product"]) && count($_GET["product"]) > 0) {
     $bXmlId = COption::GetOptionString("sale", "show_order_product_xml_id", "N");
     $arProductId = array();
     $arBuyerGroups = CUser::GetUserGroup($str_USER_ID);
     $arGetProduct = array();
     $arSkuParentChildren = array();
     $arSkuParentId = array();
     $arSkuParent = array();
     foreach ($_GET["product"] as $key => $val) {
         $key = IntVal($key);
         if ($key > 0) {
             $arProductId[] = $key;
             $arGetProduct[$key] = floatval($val) > 0 ? floatval($val) : 1;
             $arParent = CCatalogSku::GetProductInfo($key);
             if ($arParent) {
                 $arSkuParentChildren[$key] = $arParent["ID"];
                 $arSkuParentId[$arParent["ID"]] = $arParent["ID"];
             }
         }
     }
     $res = CIBlockElement::GetList(array(), array("ID" => $arSkuParentId), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "NAME", "DETAIL_PAGE_URL"));
     while ($arItems = $res->GetNext()) {
         $arSkuParent[$arItems["ID"]] = $arItems;
     }
     $arOrder["SORT"] = "ASC";
     if (count($arGetProduct) > 0) {
         $res = CIBlockElement::GetList(array(), array("ID" => $arProductId), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "NAME", "DETAIL_PAGE_URL"));
         while ($arItems = $res->GetNext()) {
             $productImg = "";
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:order_new.php


示例13: CalculateAffiliate

 function CalculateAffiliate($affiliate, $dateFrom = false, $dateTo = false, $datePlanFrom = false, $datePlanTo = false)
 {
     global $DB;
     // Prepare function params - affiliate
     $arAffiliate = CSaleAffiliate::CheckAffiliateFunc($affiliate);
     if (!$arAffiliate) {
         return False;
     }
     $db_events = GetModuleEvents("sale", "OnBeforeAffiliateCalculate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array(&$arAffiliate, &$dateFrom, &$dateTo, &$datePlanFrom, &$datePlanTo)) === false) {
             return false;
         }
     }
     $affiliateID = IntVal($arAffiliate["ID"]);
     if (!$dateFrom || StrLen($dateFrom) <= 0) {
         if (StrLen($arAffiliate["LAST_CALCULATE"]) > 0) {
             $dateFrom = $arAffiliate["LAST_CALCULATE"];
         } else {
             $dateFrom = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), mktime(0, 0, 0, 1, 1, 1990));
         }
     }
     if (!$dateTo || StrLen($dateTo) <= 0) {
         $dateTo = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), time() + CTimeZone::GetOffset());
     }
     // Get affiliate plan
     $arAffiliatePlan = CSaleAffiliate::SetAffiliatePlan($arAffiliate, $datePlanFrom, $datePlanTo);
     if (!$arAffiliatePlan) {
         return False;
     }
     if ($arAffiliatePlan && !is_array($arAffiliatePlan)) {
         return true;
     }
     // Get affiliate plan params
     $arPlanSections = array();
     $dbPlanSection = CSaleAffiliatePlanSection::GetList(array(), array("PLAN_ID" => $arAffiliate["PLAN_ID"]), false, false, array("ID", "MODULE_ID", "SECTION_ID", "RATE", "RATE_TYPE", "RATE_CURRENCY"));
     while ($arPlanSection = $dbPlanSection->Fetch()) {
         $arPlanSections[$arPlanSection["MODULE_ID"] . $arPlanSection["SECTION_ID"]] = $arPlanSection;
     }
     // Get affiliate parents
     $arAffiliateParents = array();
     $affiliateParent = IntVal($arAffiliate["AFFILIATE_ID"]);
     $count = 0;
     while ($affiliateParent > 0 && $count < 5) {
         $dbAffiliateParent = CSaleAffiliate::GetList(array(), array("ID" => $affiliateParent, "ACTIVE" => "Y"), false, false, array("ID", "AFFILIATE_ID"));
         if ($arAffiliateParent = $dbAffiliateParent->Fetch()) {
             $count++;
             $arAffiliateParents[] = $affiliateParent;
             $affiliateParent = IntVal($arAffiliateParent["AFFILIATE_ID"]);
         } else {
             $affiliateParent = 0;
         }
     }
     // Get tier
     if (!array_key_exists("SALE_AFFILIATE_TIER_TMP_CACHE", $GLOBALS)) {
         $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"] = array();
     }
     if (!array_key_exists($arAffiliate["SITE_ID"], $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"])) {
         $dbAffiliateTier = CSaleAffiliateTier::GetList(array(), array("SITE_ID" => $arAffiliate["SITE_ID"]), false, false, array("RATE1", "RATE2", "RATE3", "RATE4", "RATE5"));
         if ($arAffiliateTier = $dbAffiliateTier->Fetch()) {
             $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"][$arAffiliate["SITE_ID"]] = array(DoubleVal($arAffiliateTier["RATE1"]), DoubleVal($arAffiliateTier["RATE2"]), DoubleVal($arAffiliateTier["RATE3"]), DoubleVal($arAffiliateTier["RATE4"]), DoubleVal($arAffiliateTier["RATE5"]));
         } else {
             $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"][$arAffiliate["SITE_ID"]] = array(0, 0, 0, 0, 0);
         }
     }
     // Orders cicle
     $affiliateSum = 0;
     $affiliateCurrency = CSaleLang::GetLangCurrency($arAffiliate["SITE_ID"]);
     $dbOrders = \Bitrix\Sale\Internals\OrderTable::getList(array('filter' => array("=ALLOW_DELIVERY" => 'Y', ">=DATE_ALLOW_DELIVERY" => $dateFrom, "<DATE_ALLOW_DELIVERY" => $dateTo, "=AFFILIATE_ID" => $affiliateID, "=LID" => $arAffiliate["SITE_ID"], "=CANCELED" => 'N'), 'select' => array("ID", "LID", "PRICE_DELIVERY", "PRICE", "CURRENCY", "TAX_VALUE", "AFFILIATE_ID", "BASKET_QUANTITY" => 'BASKET.QUANTITY', "BASKET_PRODUCT_ID" => 'BASKET.PRODUCT_ID', "BASKET_MODULE" => 'BASKET.MODULE', "BASKET_PRICE" => 'BASKET.PRICE', "BASKET_CURRENCY" => 'BASKET.CURRENCY', "BASKET_DISCOUNT_PRICE" => 'BASKET.DISCOUNT_PRICE'), 'order' => array('ID' => 'ASC')));
     $fOrderId = "";
     while ($arOrder = $dbOrders->fetch()) {
         $arProductSections = array();
         if (!array_key_exists("SALE_PRODUCT_SECTION_CACHE", $GLOBALS)) {
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = array();
         }
         if (array_key_exists($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"], $GLOBALS["SALE_PRODUCT_SECTION_CACHE"])) {
             $arProductSections = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"][$arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"]];
             unset($GLOBALS["SALE_PRODUCT_SECTION_CACHE"][$arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"]]);
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] + array($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"] => $arProductSections);
         } else {
             if ($arOrder["BASKET_MODULE"] == "catalog") {
                 CModule::IncludeModule("catalog");
                 $arSku = CCatalogSku::GetProductInfo($arOrder["BASKET_PRODUCT_ID"]);
                 if ($arSku && count($arSku) > 0) {
                     $elementId = $arSku["ID"];
                 } else {
                     $elementId = $arOrder["BASKET_PRODUCT_ID"];
                 }
                 $arProductSections = CCatalogProduct::GetProductSections($elementId);
             } else {
                 $events = GetModuleEvents("sale", "OnAffiliateGetSections");
                 if ($arEvent = $events->Fetch()) {
                     $arProductSections = ExecuteModuleEventEx($arEvent, array($arOrder["BASKET_MODULE"], $arOrder["BASKET_PRODUCT_ID"]));
                 }
             }
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] + array($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"] => $arProductSections);
             if (count($GLOBALS["SALE_PRODUCT_SECTION_CACHE"]) > 20) {
                 array_shift($GLOBALS["SALE_PRODUCT_SECTION_CACHE"]);
             }
         }
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:affiliate.php


示例14: unset

<?php

$quantity = $arResult["GRID"]["HEADERS"][5];
$price = $arResult["GRID"]["HEADERS"][4];
$arResult["GRID"]["HEADERS"][4] = $quantity;
$arResult["GRID"]["HEADERS"][5] = $price;
unset($arResult["GRID"]["HEADERS"][7]);
unset($arResult["GRID"]["HEADERS"][8]);
foreach ($arResult["GRID"]["ROWS"] as $k => $arItem) {
    if (CModule::IncludeModule('iblock')) {
        $bres = CCatalogSku::GetProductInfo($arItem['PRODUCT_ID']);
        if ($bres['ID'] > 0) {
            $idToSearch = $bres['ID'];
        } else {
            $idToSearch = $arItem['PRODUCT_ID'];
        }
        $arResult["GRID"]["ROWS"][$k]['realid'] = $idToSearch;
        $res = CIBlockElement::GetByID($idToSearch);
        $tovar = $res->GetNext();
        $arResult["GRID"]["ROWS"][$k]['DETAIL_PAGE_URL'] = $tovar['DETAIL_PAGE_URL'];
    }
    if ($arItem["PREVIEW_PICTURE"]) {
        $arFileTmp = CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"], array("width" => 134, "height" => 100), BX_RESIZE_IMAGE_PROPORTIONAL, true);
        $marginl = (134 - $arFileTmp['width']) / 2;
        $margint = (100 - $arFileTmp['height']) / 2;
        $arResult["GRID"]["ROWS"][$k]['small_pict'] = array("SMALL_SRC" => $arFileTmp["src"], "SMALL_MARGIN_LEFT" => $marginl);
    }
}
开发者ID:Andreyjktl,项目名称:kidster,代码行数:28,代码来源:result_modifier.php


示例15: getReferences

 /**
  * Get common data from cache.
  * @return mixed[]
  */
 protected function getReferences()
 {
     global $USER;
     $this->arParams['CACHE_GROUPS'] = isset($this->arParams['CACHE_GROUPS']) && $this->arParams['CACHE_GROUPS'] == 'N' ? 'N' : 'Y';
     $obCache = new CPHPCache();
     if ($this->arParams['CACHE_GROUPS'] == 'Y') {
         $cacheId = implode("-", array(__CLASS__, LANGUAGE_ID, SITE_ID, $USER->GetGroups()));
     } else {
         $cacheId = implode("-", array(__CLASS__, LANGUAGE_ID, SITE_ID));
     }
     $cached = array();
     if ($obCache->StartDataCache($this->arParams["CACHE_TIME"], $cacheId, SITE_ID . '/' . $this->getRelativePath() . '/reference')) {
         // Catalog Groups
         $cached['CATALOG_GROUP'] = array();
         $catalogGroupIterator = CCatalogGroup::GetList(array("SORT" => "ASC"));
         while ($catalogGroup = $catalogGroupIterator->fetch()) {
             $cached['CATALOG_GROUP'][$catalogGroup['NAME']] = $catalogGroup;
         }
         // Catalog Prices
         $cached['CATALOG_PRICE'] = CIBlockPriceTools::GetCatalogPrices(false, array_keys($cached['CATALOG_GROUP']));
         // Catalog Currency
         $cached['CURRENCY'] = array();
         if ($this->isCurrency) {
             $by = "currency";
             $order = "asc";
             $currencyIterator = CCurrency::getList($by, $order);
             while ($currency = $currencyIterator->fetch()) {
                 $cached['CURRENCY'][$currency['CURRENCY']] = $currency;
             }
         }
         // Catalogs list
         $cached['CATALOG'] = array();
         $catalogIterator = CCatalog::getList(array("IBLOCK_ID" => "ASC"));
         while ($catalog = $catalogIterator->fetch()) {
             $info = CCatalogSku::getInfoByIblock($catalog['IBLOCK_ID']);
             $catalog['CATALOG_TYPE'] = $info['CATALOG_TYPE'];
             $cached['CATALOG'][$catalog['IBLOCK_ID']] = $catalog;
         }
         // Measure list
         $cached['MEASURE'] = array();
         $measureIterator = CCatalogMeasure::getList(array("CODE" => "ASC"));
         while ($measure = $measureIterator->fetch()) {
             $cached['MEASURE'][$measure['ID']] = $measure;
         }
         // Default Measure
         $cached['DEFAULT_MEASURE'] = CCatalogMeasure::getDefaultMeasure(true, true);
         $obCache->EndDataCache($cached);
     } else {
         $cached = $obCache->GetVars();
     }
     return $cached;
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:56,代码来源:class.php


示例16: getProductDataToFillBasket

 /**
  * @param $productId
  * @param $quantity
  * @param $userId
  * @param $LID
  * @param $userColumns
  * @param string $tmpId we can suggest that this mean the set_item
  * @return array
  * @throws Main\LoaderException
  */
 protected function getProductDataToFillBasket($productId, $quantity, $userId, $LID, $userColumns, $tmpId = "")
 {
     $isSetItem = $tmpId != "";
     if (self::$catalogIncluded === null) {
         self::$catalogIncluded = Main\Loader::includeModule('catalog');
     }
     if (!self::$catalogIncluded) {
         return array();
     }
     $arParams = array();
     static $proxyIblockElement = array();
     static $proxyCatalogMeasure = array();
     static $proxyParent = array();
     static $proxyIblockProperty = array();
     static $proxyProductData = array();
     static $proxyCatalogProduct = array();
     static $proxyCatalogMeasureRatio = array();
     $productId = (int) $productId;
     if ($productId <= 0) {
         return $arParams;
     }
     if (!empty($proxyIblockElement[$productId])) {
         $iblockId = $proxyIblockElement[$productId];
     } else {
         $iblockId = (int) \CIBlockElement::getIBlockByID($productId);
         if ($iblockId > 0) {
             $proxyIblockElement[$productId] = $iblockId;
         }
     }
     if ($iblockId <= 0) {
         return $arParams;
     }
     $arSku2Parent = array();
     $arElementId = array();
     $arElementId[] = $productId;
     $proxyParentKey = $productId . "|" . $iblockId;
     if (!empty($proxyParent[$proxyParentKey]) && is_array($proxyParent[$proxyParentKey])) {
         $arParent = $proxyParent[$proxyParentKey];
     } else {
         $arParent = \CCatalogSku::getProductInfo($productId, $iblockId);
         $proxyParent[$proxyParentKey] = $arParent;
     }
     if ($arParent) {
         $arElementId[] = $arParent["ID"];
         $arSku2Parent[$productId] = $arParent["ID"];
     }
     $arPropertyInfo = array();
     $userColumns = (string) $userColumns;
     $arUserColumns = $userColumns != '' ? explode(",", $userColumns) : array();
     foreach ($arUserColumns as $key => $column) {
         if (strncmp($column, 'PROPERTY_', 9) != 0) {
             unset($arUserColumns[$key]);
         } else {
             $propertyCode = substr($column, 9);
             if ($propertyCode == '') {
                 unset($arUserColumns[$key]);
                 continue;
             }
             if (!empty($proxyIblockProperty[$propertyCode]) && is_array($proxyIblockProperty[$propertyCode])) {
                 $arPropertyInfo[$column] = $proxyIblockProperty[$propertyCode];
             } else {
                 $dbres = \CIBlockProperty::GetList(array(), array("CODE" => $propertyCode));
                 if ($arPropData = $dbres->GetNext()) {
                     $arPropertyInfo[$column] = $arPropData;
                     $proxyIblockProperty[$propertyCode] = $arPropData;
                 }
             }
         }
     }
     $arSelect = array_merge(array("ID", "NAME", "IBLOCK_ID", "IBLOCK_SECTION_ID", "DETAIL_PICTURE", "PREVIEW_PICTURE", "XML_ID", "IBLOCK_XML_ID"), $arUserColumns);
     $proxyProductDataKey = md5(join('|', $arElementId) . "_" . join('|', $arSelect));
     if (!empty($proxyProductData[$proxyProductDataKey]) && is_array($proxyProductData[$proxyProductDataKey])) {
         $arProductData = $proxyProductData[$proxyProductDataKey];
     } else {
         $arProductData = getProductProps($arElementId, $arSelect);
         $proxyProductData[$proxyProductDataKey] = $arProductData;
     }
     $defaultMeasure = \CCatalogMeasure::getDefaultMeasure(true, true);
     if (!empty($arProductData)) {
         $arElementInfo = array();
         foreach ($arProductData as $elemId => &$arElement) {
             foreach ($arElement as $key => $value) {
                 if (strncmp($key, 'PROPERTY_', 9) == 0 && substr($key, -6) == "_VALUE") {
                     $columnCode = str_replace("_VALUE", "", $key);
                     $arElement[$key] = getIblockPropInfo($value, $arPropertyInfo[$columnCode], array("WIDTH" => 90, "HEIGHT" => 90));
                 }
             }
         }
         unset($arElement);
         if (isset($arProductData[$productId])) {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:orderbasket.php


示例17: array

<?php

CModule::IncludeModule("sale");
CModule::IncludeModule("iblock");
$arID = array();
$arBasketItems = array();
$dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), arra 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CCatalogStore类代码示例发布时间:2022-05-23
下一篇:
PHP CCatalogSKU类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap