本文整理汇总了PHP中CCatalogSKU::GetInfoByProductIBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogSKU::GetInfoByProductIBlock方法的具体用法?PHP CCatalogSKU::GetInfoByProductIBlock怎么用?PHP CCatalogSKU::GetInfoByProductIBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogSKU
的用法示例。
在下文中一共展示了CCatalogSKU::GetInfoByProductIBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeComponent
public function executeComponent()
{
$this->IBLOCK_ID = $this->arParams["IBLOCK_ID"];
$this->SECTION_ID = $this->arParams["SECTION_ID"];
$this->FILTER_NAME = $this->arParams["FILTER_NAME"];
$this->SAFE_FILTER_NAME = htmlspecialcharsbx($this->FILTER_NAME);
if (self::$catalogIncluded === null)
self::$catalogIncluded = Loader::includeModule('catalog');
if (self::$catalogIncluded)
{
$arCatalog = CCatalogSKU::GetInfoByProductIBlock($this->IBLOCK_ID);
if (!empty($arCatalog))
{
$this->SKU_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
$this->SKU_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
}
}
/*DEMO CODE for "pure" class.php component
$this->arResult["FFF"] = "ggg";
$this->includeComponentTemplate();
return $this->ELEMENT_ID;
*/
return parent::executeComponent();
}
示例2: GetProductList
public static function GetProductList($ID, $minCNT, $limit, $getParentOnly = false)
{
global $DB;
$ID = (int) $ID;
if ($ID <= 0) {
return false;
}
$limit = (int) $limit;
if ($limit < 0) {
$limit = 0;
}
$minCNT = (int) $minCNT;
if ($minCNT < 0) {
$minCNT = 0;
}
$getParentOnly = $getParentOnly === true;
$elementInclude = array($ID);
$elementExclude = array();
if (Loader::includeModule('catalog')) {
$intIBlockID = (int) CIBlockElement::GetIBlockByID($ID);
if ($intIBlockID == 0) {
return false;
}
$skuInfo = CCatalogSKU::GetInfoByProductIBlock($intIBlockID);
if (!empty($skuInfo)) {
$itemsIterator = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $skuInfo['IBLOCK_ID'], 'PROPERTY_' . $skuInfo['SKU_PROPERTY_ID'] => $ID), false, false, array('ID', 'IBLOCK_ID', 'PROPERTY_' . $skuInfo['SKU_PROPERTY_ID']));
while ($item = $itemsIterator->Fetch()) {
$item['ID'] = (int) $item['ID'];
$elementInclude[] = $item['ID'];
$elementExclude[] = $item['ID'];
}
}
}
if ($getParentOnly) {
$strSql = "select PARENT_PRODUCT_ID from b_sale_product2product where PRODUCT_ID IN (" . implode(',', $elementInclude) . ")";
if (!empty($elementExclude)) {
$strSql .= " and PARENT_PRODUCT_ID not in (" . implode(',', $elementExclude) . ")";
}
if ($minCNT > 0) {
$strSql .= " and CNT >= " . $minCNT;
}
$strSql .= ' group by PARENT_PRODUCT_ID';
if ($limit > 0) {
$strSql .= " limit " . $limit;
}
} else {
$strSql = "select * from b_sale_product2product where PRODUCT_ID in (" . implode(',', $elementInclude) . ")";
if (!empty($elementExclude)) {
$strSql .= " and PARENT_PRODUCT_ID not in (" . implode(',', $elementExclude) . ")";
}
if ($minCNT > 0) {
$strSql .= " and CNT >= " . $minCNT;
}
$strSql .= " order by CNT desc, PRODUCT_ID asc";
if ($limit > 0) {
$strSql .= " limit " . $limit;
}
}
return $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
示例3: getOffers
function getOffers()
{
if (!class_exists('\\CCatalogSKU')) {
\CModule::IncludeModule('catalog');
}
$retval = array();
$arInfo = \CCatalogSKU::GetInfoByProductIBlock($this->iblock_id);
if (is_array($arInfo)) {
$retval = \Cpeople\Classes\Block\Getter::instance()->setFilter(array('IBLOCK_ID' => $arInfo['IBLOCK_ID'], 'PROPERTY_' . $arInfo['SKU_PROPERTY_ID'] => $this->id))->setClassName('\\Cpeople\\Classes\\Catalog\\Offer')->get();
}
return empty_array($retval) ? false : $retval;
}
示例4: getOffers
protected function getOffers()
{
$arPropertyMap = array();
$arSelectedPropTypes = array('S', 'N', 'L', 'E', 'G');
$this->arSelectOfferProps = array();
$arOffers = \CCatalogSKU::GetInfoByProductIBlock($this->iBlockId);
if (empty($arOffers['IBLOCK_ID'])) {
return array();
}
$this->intOfferIBlockID = $arOffers['IBLOCK_ID'];
$rsOfferIBlocks = \CIBlock::GetByID($this->intOfferIBlockID);
if (!($this->arOfferIBlock = $rsOfferIBlocks->Fetch())) {
throw new SystemException("Bad offers iBlock ID (" . __CLASS__ . "::" . __METHOD__ . ")");
}
$rsProps = \CIBlockProperty::GetList(array('SORT' => 'ASC', 'NAME' => 'ASC'), array('IBLOCK_ID' => $this->intOfferIBlockID, 'ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'));
while ($arProp = $rsProps->Fetch()) {
$arProp['ID'] = (int) $arProp['ID'];
if ($arOffers['SKU_PROPERTY_ID'] != $arProp['ID']) {
$arProp['USER_TYPE'] = (string) $arProp['USER_TYPE'];
$arProp['CODE'] = (string) $arProp['CODE'];
$this->arIblock['OFFERS_PROPERTY'][$arProp['ID']] = $arProp;
$this->arProperties[$arProp['ID']] = $arProp;
if (in_array($arProp['PROPERTY_TYPE'], $arSelectedPropTypes)) {
$this->arSelectOfferProps[] = $arProp['ID'];
}
if ($arProp['CODE'] !== '') {
foreach ($this->arIblock['PROPERTY'] as &$arMainProp) {
if ($arMainProp['CODE'] == $arProp['CODE']) {
$arPropertyMap[$arProp['ID']] = $arMainProp['CODE'];
break;
}
}
if (isset($arMainProp)) {
unset($arMainProp);
}
}
}
}
$this->arOfferIBlock['LID'] = $this->arIblock['LID'];
$this->arOfferIBlock['PROPERTY'] = array();
$rsProps = \CIBlockProperty::GetList(array('SORT' => 'ASC', 'NAME' => 'ASC'), array('IBLOCK_ID' => $this->intOfferIBlockID, 'ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'));
while ($arProp = $rsProps->Fetch()) {
$arProp['ID'] = (int) $arProp['ID'];
$arProp['USER_TYPE'] = (string) $arProp['USER_TYPE'];
$arProp['CODE'] = (string) $arProp['CODE'];
$this->arOfferIBlock['PROPERTY'][$arProp['ID']] = $arProp;
}
return $arOffers;
}
示例5: executeComponent
public function executeComponent()
{
$this->IBLOCK_ID = $this->arParams["IBLOCK_ID"];
$this->SECTION_ID = $this->arParams["SECTION_ID"];
$this->FILTER_NAME = $this->arParams["FILTER_NAME"];
if (CModule::IncludeModule("catalog")) {
$arCatalog = CCatalogSKU::GetInfoByProductIBlock($this->IBLOCK_ID);
if (!empty($arCatalog) && is_array($arCatalog)) {
$this->SKU_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
$this->SKU_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
}
}
/*DEMO CODE for "pure" class.php component
$this->arResult["FFF"] = "ggg";
$this->includeComponentTemplate();
return $this->ELEMENT_ID;
*/
return parent::executeComponent();
}
示例6: executeComponent
public function executeComponent()
{
$this->IBLOCK_ID = $this->arParams["IBLOCK_ID"];
$this->SECTION_ID = $this->arParams["SECTION_ID"];
$this->FILTER_NAME = $this->arParams["FILTER_NAME"];
$this->SAFE_FILTER_NAME = htmlspecialcharsbx($this->FILTER_NAME);
if (self::$catalogIncluded === null)
self::$catalogIncluded = Loader::includeModule('catalog');
if (self::$catalogIncluded)
{
$arCatalog = CCatalogSKU::GetInfoByProductIBlock($this->IBLOCK_ID);
if (!empty($arCatalog))
{
$this->SKU_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
$this->SKU_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
}
}
$this->facet = new \Bitrix\Iblock\PropertyIndex\Facet($this->IBLOCK_ID);
return parent::executeComponent();
}
示例7: array
<?php
$arInfo = CCatalogSKU::GetInfoByProductIBlock($arParams["IBLOCK_ID"]);
if ($arInfo) {
$arConvertParams = array();
if ('Y' == $arParams['CONVERT_CURRENCY']) {
if (!CModule::IncludeModule('currency')) {
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
} else {
$arCurrencyInfo = CCurrency::GetByID($arParams['CURRENCY_ID']);
if (!(is_array($arCurrencyInfo) && !empty($arCurrencyInfo))) {
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
} else {
$arParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
$arConvertParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
}
}
}
foreach ($arResult["ITEMS"] as $key => $arItem) {
$rsOffers = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arInfo["IBLOCK_ID"], "PROPERTY_" . $arInfo["SKU_PROPERTY_ID"] => $arItem["ID"]), false, false, array("ID", "CATALOG_QUANTITY"));
$arOffers = CIBlockPriceTools::GetOffersArray($arParams["IBLOCK_ID"], $arItem["ID"], array($arParams["OFFERS_SORT_FIELD"] => $arParams["OFFERS_SORT_ORDER"], "ID" => "DESC"), $arParams["OFFERS_FIELD_CODE"], $arParams["OFFERS_PROPERTY_CODE"], $arParams["OFFERS_LIMIT"], $arResult["PRICES"], $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
foreach ($arOffers as $arOffer) {
$arResult["ITEMS"][$key]["OFFERS"][] = $arOffer;
$dbProductDiscounts = CCatalogDiscount::GetList(array(), array("PRODUCT_ID" => $arOffer["ID"]));
if ($dbProductDiscounts && $dbProductDiscounts->SelectedRowsCount() > 0) {
while ($arProductDiscounts = $dbProductDiscounts->GetNext()) {
if ($arProductDiscounts["VALUE_TYPE"] == "F") {
echo "f";
$i = 0;
示例8: GetProductSku
/**
* get sku for product.
*
* @param integer $USER_ID User.
* @param string $LID Site.
* @param integer $PRODUCT_ID Product id.
* @param string $PRODUCT_NAME Product name.
* @param string CURRENCY Currency.
* @param array $arProduct Iblock list.
* @return array|false
*/
function GetProductSku($USER_ID, $LID, $PRODUCT_ID, $PRODUCT_NAME = '', $CURRENCY = '', $arProduct = array())
{
$USER_ID = (int) $USER_ID;
$PRODUCT_ID = (int) $PRODUCT_ID;
if ($PRODUCT_ID <= 0) {
return false;
}
$LID = trim($LID);
if ($LID == '') {
return false;
}
$PRODUCT_NAME = trim($PRODUCT_NAME);
$arResult = array();
$arOffers = array();
static $arCacheGroups = array();
if (!is_set($arCacheGroups[$USER_ID])) {
$arCacheGroups[$USER_ID] = CUser::GetUserGroup($USER_ID);
}
$arGroups = $arCacheGroups[$USER_ID];
if (empty($arProduct)) {
$arProduct = CSaleProduct::GetProductListIblockInfo(array($PRODUCT_ID));
}
static $arOffersIblock = array();
if (!is_set($arOffersIblock[$arProduct["IBLOCK_ID"]])) {
$mxResult = CCatalogSKU::GetInfoByProductIBlock($arProduct["IBLOCK_ID"]);
if (is_array($mxResult)) {
$arOffersIblock[$arProduct["IBLOCK_ID"]] = $mxResult["IBLOCK_ID"];
}
}
if ($arOffersIblock[$arProduct["IBLOCK_ID"]] > 0) {
static $arCacheOfferProperties = array();
if (!is_set($arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]])) {
$dbOfferProperties = CIBlock::GetProperties($arOffersIblock[$arProduct["IBLOCK_ID"]], array(), array("!XML_ID" => "CML2_LINK"));
while ($arOfferProperties = $dbOfferProperties->Fetch()) {
$arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]][] = $arOfferProperties;
}
}
$arOfferProperties = $arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]];
$arIblockOfferProps = array();
$arIblockOfferPropsFilter = array();
if (is_array($arOfferProperties)) {
foreach ($arOfferProperties as $val) {
$arIblockOfferProps[] = array("CODE" => $val["CODE"], "NAME" => $val["NAME"]);
$arIblockOfferPropsFilter[] = $val["CODE"];
}
}
$arOffers = CIBlockPriceTools::GetOffersArray($arProduct["IBLOCK_ID"], $PRODUCT_ID, array("ID" => "DESC"), array("NAME"), $arIblockOfferPropsFilter, 0, array(), 1, array(), $USER_ID, $LID);
$arSku = array();
$minItemPrice = 0;
$minItemPriceFormat = "";
$arSkuId = array();
$arImgSku = array();
foreach ($arOffers as $arOffer) {
$arSkuId[] = $arOffer['ID'];
}
if (!empty($arSkuId)) {
$res = CIBlockElement::GetList(array(), array("ID" => $arSkuId), false, false, array("ID", "IBLOCK_ID", "NAME", "PREVIEW_PICTURE", "DETAIL_PICTURE", "DETAIL_PAGE_URL"));
while ($arOfferImg = $res->GetNext()) {
$arImgSku[$arOfferImg["ID"]] = $arOfferImg;
}
}
foreach ($arOffers as $arOffer) {
$arPrice = CCatalogProduct::GetOptimalPrice($arOffer['ID'], 1, $arGroups, "N", array(), $LID);
if (empty($arPrice)) {
break;
} elseif (strlen($CURRENCY) > 0) {
$arPrice["PRICE"]["PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["PRICE"]["PRICE"], $arPrice["PRICE"]["CURRENCY"], $CURRENCY);
if ($arPrice["DISCOUNT_PRICE"] > 0) {
$arPrice["DISCOUNT_PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"], $CURRENCY);
}
$arPrice["PRICE"]["CURRENCY"] = $CURRENCY;
}
$arSkuTmp = array();
$arOffer["CAN_BUY"] = "N";
$arCatalogProduct = CCatalogProduct::GetByID($arOffer['ID']);
if (!empty($arCatalogProduct)) {
if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) <= 0)) {
$arOffer["CAN_BUY"] = "N";
} else {
$arOffer["CAN_BUY"] = "Y";
}
}
$arSkuTmp["ImageUrl"] = '';
if ($arOffer["CAN_BUY"] == "Y") {
$productImg = "";
if (isset($arImgSku[$arOffer['ID']]) && !empty($arImgSku[$arOffer['ID']])) {
if ('' == $PRODUCT_NAME) {
$PRODUCT_NAME = $arImgSku[$arOffer['ID']]["~NAME"];
}
//.........这里部分代码省略.........
示例9: array
$arThemesList = array('blue' => GetMessage('CP_BCT_TPL_THEME_BLUE'), 'green' => GetMessage('CP_BCT_TPL_THEME_GREEN'), 'red' => GetMessage('CP_BCT_TPL_THEME_RED'), 'wood' => GetMessage('CP_BCT_TPL_THEME_WOOD'), 'yellow' => GetMessage('CP_BCT_TPL_THEME_YELLOW'), 'black' => GetMessage('CP_BCT_TPL_THEME_BLACK'));
$dir = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . '/' . $arCurrentValues['VIEW_MODE'] . '/themes/'));
if (is_dir($dir)) {
foreach ($arThemesList as $themeID => $themeName) {
if (!is_file($dir . $themeID . '/style.css')) {
continue;
}
$arThemes[$themeID] = $themeName;
}
}
$arTemplateParameters['TEMPLATE_THEME'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage("CP_BCT_TPL_TEMPLATE_THEME"), 'TYPE' => 'LIST', 'VALUES' => $arThemes, 'DEFAULT' => 'blue', 'ADDITIONAL_VALUES' => 'Y');
}
$arSKU = false;
$boolSKU = false;
if ($boolCatalog && (isset($arCurrentValues['IBLOCK_ID']) && 0 < intval($arCurrentValues['IBLOCK_ID']))) {
$arSKU = CCatalogSKU::GetInfoByProductIBlock($arCurrentValues['IBLOCK_ID']);
$boolSKU = !empty($arSKU) && is_array($arSKU);
}
if ($boolSKU) {
$arDisplayModeList = array('N' => GetMessage('CP_BCT_TPL_DML_SIMPLE'), 'Y' => GetMessage('CP_BCT_TPL_DML_EXT'));
$arTemplateParameters['PRODUCT_DISPLAY_MODE'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCT_TPL_PRODUCT_DISPLAY_MODE'), 'TYPE' => 'LIST', 'MULTIPLE' => 'N', 'ADDITIONAL_VALUES' => 'N', 'REFRESH' => 'Y', 'DEFAULT' => 'N', 'VALUES' => $arDisplayModeList);
}
if (isset($arCurrentValues['IBLOCK_ID']) && 0 < intval($arCurrentValues['IBLOCK_ID'])) {
$arAllPropList = array();
$arFilePropList = array('-' => GetMessage('CP_BCT_TPL_PROP_EMPTY'));
$arListPropList = array('-' => GetMessage('CP_BCT_TPL_PROP_EMPTY'));
$rsProps = CIBlockProperty::GetList(array('SORT' => 'ASC', 'ID' => 'ASC'), array('IBLOCK_ID' => $arCurrentValues['IBLOCK_ID'], 'ACTIVE' => 'Y'));
while ($arProp = $rsProps->Fetch()) {
$strPropName = '[' . $arProp['ID'] . ']' . ('' != $arProp['CODE'] ? '[' . $arProp['CODE'] . ']' : '') . ' ' . $arProp['NAME'];
if ('' == $arProp['CODE']) {
$arProp['CODE'] = $arProp['ID'];
示例10: obtainBasketPropsSKU
public function obtainBasketPropsSKU(&$arBasketItems, $arSkuProps, $arParents)
{
$arRes = array();
$arSkuIblockID = array();
if (self::isNonemptyArray($arBasketItems) && self::isNonemptyArray($arParents)) {
foreach ($arBasketItems as &$arItem) {
// catalog-specific logic farther
if (!$this->cameFromCatalog($arItem)) {
continue;
}
if (array_key_exists($arItem["PRODUCT_ID"], $arParents)) {
$arSKU = CCatalogSKU::GetInfoByProductIBlock($arParents[$arItem["PRODUCT_ID"]]["IBLOCK_ID"]);
if (!array_key_exists($arSKU["IBLOCK_ID"], $arSkuIblockID)) {
$arSkuIblockID[$arSKU["IBLOCK_ID"]] = $arSKU;
}
$arItem["IBLOCK_ID"] = $arSKU["IBLOCK_ID"];
$arItem["SKU_PROPERTY_ID"] = $arSKU["SKU_PROPERTY_ID"];
}
}
unset($arItem);
if ($this->useIBlock) {
if (!self::isNonemptyArray($arSkuProps)) {
$arSkuProps = array();
}
foreach ($arSkuIblockID as $skuIblockID => $arSKU) {
// possible props values
$rsProps = CIBlockProperty::GetList(array('SORT' => 'ASC', 'ID' => 'ASC'), array('IBLOCK_ID' => $skuIblockID, 'ACTIVE' => 'Y'));
while ($arProp = $rsProps->Fetch()) {
if ($arProp['PROPERTY_TYPE'] == 'L' || $arProp['PROPERTY_TYPE'] == 'E' || $arProp['PROPERTY_TYPE'] == 'S' && $arProp['USER_TYPE'] == 'directory') {
if ($arProp['XML_ID'] == 'CML2_LINK') {
continue;
}
if (!in_array($arProp['CODE'], $arSkuProps)) {
continue;
}
$arRes[$skuIblockID][$arProp['ID']] = array('ID' => $arProp['ID'], 'CODE' => $arProp['CODE'], 'NAME' => $arProp['NAME'], 'TYPE' => $arProp['PROPERTY_TYPE'], 'VALUES' => array());
if ($arProp['PROPERTY_TYPE'] == 'L') {
$arValues = array();
$rsPropEnums = CIBlockProperty::GetPropertyEnum($arProp['ID']);
while ($arEnum = $rsPropEnums->Fetch()) {
$arValues[$arEnum['ID']] = array('ID' => $arEnum['ID'], 'NAME' => $arEnum['VALUE'], 'PICT' => false);
}
$arRes[$skuIblockID][$arProp['ID']]['VALUES'] = $arValues;
} elseif ($arProp['PROPERTY_TYPE'] == 'E') {
$arValues = array();
$rsPropEnums = CIBlockElement::GetList(array('SORT' => 'ASC'), array('IBLOCK_ID' => $arProp['LINK_IBLOCK_ID'], 'ACTIVE' => 'Y'), false, false, array('ID', 'NAME', 'PREVIEW_PICTURE'));
while ($arEnum = $rsPropEnums->Fetch()) {
$arEnum['PREVIEW_PICTURE'] = CFile::GetFileArray($arEnum['PREVIEW_PICTURE']);
if (!is_array($arEnum['PREVIEW_PICTURE'])) {
continue;
}
$productImg = CFile::ResizeImageGet($arEnum['PREVIEW_PICTURE'], array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
$arEnum['PREVIEW_PICTURE']['SRC'] = $productImg['src'];
$arValues[$arEnum['ID']] = array('ID' => $arEnum['ID'], 'NAME' => $arEnum['NAME'], 'SORT' => $arEnum['SORT'], 'PICT' => $arEnum['PREVIEW_PICTURE']);
}
$arRes[$skuIblockID][$arProp['ID']]['VALUES'] = $arValues;
} elseif ($arProp['PROPERTY_TYPE'] == 'S' && $arProp['USER_TYPE'] == 'directory') {
$arValues = array();
if ($this->useHL) {
$hlblock = HL\HighloadBlockTable::getList(array("filter" => array("TABLE_NAME" => $arProp["USER_TYPE_SETTINGS"]["TABLE_NAME"])))->fetch();
if ($hlblock) {
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
$entity_data_class = $entity->getDataClass();
$rsData = $entity_data_class::getList();
while ($arData = $rsData->fetch()) {
$arValues[$arData['ID']] = array('ID' => $arData['ID'], 'NAME' => $arData['UF_NAME'], 'SORT' => $arData['UF_SORT'], 'FILE' => $arData['UF_FILE'], 'PICT' => '', 'XML_ID' => $arData['UF_XML_ID']);
}
$arRes[$skuIblockID][$arProp['ID']]['VALUES'] = $arValues;
}
}
}
}
}
}
foreach ($arBasketItems as &$arItem) {
// catalog-specific logic farther: iblocks, catalogs and other friends
if (!$this->cameFromCatalog($arItem)) {
continue;
}
$arSelectSkuProps = array();
foreach ($arSkuProps as $prop) {
$arSelectSkuProps[] = "PROPERTY_" . $prop;
}
if (isset($arItem["IBLOCK_ID"]) && intval($arItem["IBLOCK_ID"]) > 0 && array_key_exists($arItem["IBLOCK_ID"], $arRes)) {
$arItem["SKU_DATA"] = $arRes[$arItem["IBLOCK_ID"]];
$arUsedValues = array();
$arTmpRes = array();
$arOfFilter = array("IBLOCK_ID" => $arItem["IBLOCK_ID"], "PROPERTY_" . $arSkuIblockID[$arItem["IBLOCK_ID"]]["SKU_PROPERTY_ID"] => $arParents[$arItem["PRODUCT_ID"]]["PRODUCT_ID"]);
$rsOffers = CIBlockElement::GetList(array(), $arOfFilter, false, false, array_merge(array("ID"), $arSelectSkuProps));
while ($arOffer = $rsOffers->GetNext()) {
foreach ($arSkuProps as $prop) {
if (!empty($arOffer["PROPERTY_" . $prop . "_VALUE"]) && (!is_array($arUsedValues[$arItem["PRODUCT_ID"]][$prop]) || !in_array($arOffer["PROPERTY_" . $prop . "_VALUE"], $arUsedValues[$arItem["PRODUCT_ID"]][$prop]))) {
$arUsedValues[$arItem["PRODUCT_ID"]][$prop][] = $arOffer["PROPERTY_" . $prop . "_VALUE"];
}
}
}
if (!empty($arUsedValues)) {
// add only used values to the item SKU_DATA
foreach ($arRes[$arItem["IBLOCK_ID"]] as $propId => $arProp) {
if (!array_key_exists($arProp["CODE"], $arUsedValues[$arItem["PRODUCT_ID"]])) {
//.........这里部分代码省略.........
示例11: define
<?php
define("NO_KEEP_STATISTIC", true);
// Не собираем стату по действиям AJAX
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (CModule::IncludeModule("iblock") && CModule::IncludeModule("catalog")) {
if (isset($_POST['id']) && isset($_POST['ib']) && isset($_POST['fl'])) {
$ids = $_POST['id'];
$IBLOCK_ID = $_POST['ib'];
$f = fopen($_POST['fl'], "a");
$arInfo = CCatalogSKU::GetInfoByProductIBlock($IBLOCK_ID);
foreach ($ids as $id) {
$rsOffers = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $arInfo['IBLOCK_ID'], 'PROPERTY_' . $arInfo['SKU_PROPERTY_ID'] => $id));
while ($arOffer = $rsOffers->GetNextElement()) {
$el = $arOffer->GetFields();
$el["PROPERTIES"] = $arOffer->GetProperties();
$NewCnt = $id . '|' . $el['ID'] . '|' . $el['ACTIVE'] . '|' . $el['NAME'] . '|' . $el['XML_ID'] . '|' . $el['DETAIL_PAGE_URL'] . '|';
//$NewCnt.=$el['PROPERTIES']['CML2_2']['VALUE'].'|'.$el['PROPERTIES']['COLOR']['VALUE'].'|'.$el['PROPERTIES']['CML2_1']['VALUE'].'|';
$NewCnt .= chr(13);
$NewCnt = iconv('UTF-8', "windows-1251", $NewCnt);
fwrite($f, $NewCnt);
}
}
fclose($f);
//print_r($ids);
echo true;
} else {
echo md5('GET OUT!!!');
示例12: GetInheritedPropertyTemplateElementMenuItems
public static function GetInheritedPropertyTemplateElementMenuItems($iblock_id, $action_function, $menuID, $inputID = "")
{
$result = array();
$result["this"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT"),
"MENU" => array(
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_NAME"),
"ONCLICK" => "$action_function('{=this.Name}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_LOWER_NAME"),
"ONCLICK" => "$action_function('{=lower this.Name}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_CODE"),
"ONCLICK" => "$action_function('{=this.Code}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_PREVIEW_TEXT"),
"ONCLICK" => "$action_function('{=this.PreviewText}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_ELEMENT_DETAIL_TEXT"),
"ONCLICK" => "$action_function('{=this.DetailText}', '$menuID', '$inputID')",
),
),
);
if ($iblock_id > 0)
{
$result["properties"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_PROPERTIES"),
"MENU" => array(
),
);
$rsProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $iblock_id));
while($property = $rsProperty->fetch())
{
if ($property["PROPERTY_TYPE"] != "F")
{
$result["properties"]["MENU"][] = array(
"TEXT" => $property["NAME"],
"ONCLICK" => "$action_function('{=this.property.".($property["CODE"]!=""? $property["CODE"]: $property["ID"])."}', '$menuID', '$inputID')",
);
}
}
}
$result["parent"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT"),
"MENU" => array(
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_NAME"),
"ONCLICK" => "$action_function('{=parent.Name}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_CODE"),
"ONCLICK" => "$action_function('{=parent.Code}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_PARENT_TEXT"),
"ONCLICK" => "$action_function('{=parent.PreviewText}', '$menuID', '$inputID')",
),
),
);
$result["iblock"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK"),
"MENU" => array(
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_NAME"),
"ONCLICK" => "$action_function('{=iblock.Name}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_CODE"),
"ONCLICK" => "$action_function('{=iblock.Code}', '$menuID', '$inputID')",
),
array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_IBLOCK_TEXT"),
"ONCLICK" => "$action_function('{=iblock.PreviewText}', '$menuID', '$inputID')",
),
),
);
if (\Freetrix\Main\Loader::includeModule('catalog'))
{
$arCatalog = \CCatalogSKU::GetInfoByProductIBlock($iblock_id);
if (is_array($arCatalog))
{
$result["sku_properties"] = array(
"TEXT" => GetMessage("IB_COMPLIB_POPUP_SKU_PROPERTIES"),
"MENU" => array(
),
);
$rsProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $arCatalog["IBLOCK_ID"]));
while($property = $rsProperty->fetch())
{
if ($property["PROPERTY_TYPE"] != "F")
{
$result["sku_properties"]["MENU"][] = array(
"TEXT" => $property["NAME"],
"ONCLICK" => "$action_function('{=concat {=distinct this.catalog.sku.property.".($property["CODE"]!=""? $property["CODE"]: $property["ID"])." \", \"}}', '$menuID', '$inputID')",
);
//.........这里部分代码省略.........
示例13: getOffersCatalog
protected function getOffersCatalog()
{
if ($this->offersCatalog === null) {
$this->offersCatalog = \CCatalogSKU::GetInfoByProductIBlock($this->getIblockId());
}
return $this->offersCatalog;
}
示例14: array
'TITLE' => $storeName,
'PHONE' => $storePhone,
'SCHEDULE' => $storeSchedule,
'AMOUNT' => $amount,
'ELEMENT_ID' => $arProp["ELEMENT_ID"],
),$numAmount);
}
$isProductExistSKU = CCatalogSKU::IsExistOffers($arParams["ELEMENT_ID"]);
$arResult["IS_SKU"] = false;
if($isProductExistSKU)
{
$arSkuElements = $arSkuInfo = $arResultSkuId = array();
$intIBlockID = (int)CIBlockElement::GetIBlockByID($arParams["ELEMENT_ID"]);
if($intIBlockID > 0)
$arSkuInfo = CCatalogSKU::GetInfoByProductIBlock($intIBlockID);
if(!empty($arSkuInfo) && is_array($arSkuInfo))
{
$dbAllSkuElements = CIBlockElement::GetList(
array(),
array('IBLOCK_ID' => $arSkuInfo['IBLOCK_ID'], '=PROPERTY_'.$arSkuInfo['SKU_PROPERTY_ID'] => $arParams["ELEMENT_ID"]),
false,
false,
array('ID')
);
while($arAllSkuElements = $dbAllSkuElements->fetch())
{
$arSkuElements[] = $arAllSkuElements;
}
}
foreach($arSkuElements as $skuId)
示例15: getTreeProperties
public static function getTreeProperties($skuInfo, $propertiesCodes, $defaultFields = array())
{
$requireFields = array(
'ID',
'UF_XML_ID',
'UF_NAME',
);
$result = array();
if (empty($skuInfo))
return $result;
if (!is_array($skuInfo))
{
$skuInfo = (int)$skuInfo;
if ($skuInfo <= 0)
return $result;
if (self::$catalogIncluded === null)
self::$catalogIncluded = Loader::includeModule('catalog');
if (!self::$catalogIncluded)
return $result;
$skuInfo = CCatalogSKU::GetInfoByProductIBlock($skuInfo);
if (empty($skuInfo))
return $result;
}
if (empty($propertiesCodes) || !is_array($propertiesCodes))
return $result;
$showMode = '';
$propertyIterator = PropertyTable::getList(array(
'select' => array(
'ID', 'IBLOCK_ID', 'CODE', 'NAME', 'SORT', 'LINK_IBLOCK_ID', 'PROPERTY_TYPE', 'USER_TYPE', 'USER_TYPE_SETTINGS'
),
'filter' => array(
'IBLOCK_ID' => $skuInfo['IBLOCK_ID'],
'PROPERTY_TYPE' => array(
PropertyTable::TYPE_LIST,
PropertyTable::TYPE_ELEMENT,
PropertyTable::TYPE_STRING
),
'ACTIVE' => 'Y', 'MULTIPLE' => 'N'
),
'order' => array(
'SORT' => 'ASC', 'ID' => 'ASC'
)
));
while ($propInfo = $propertyIterator->fetch())
{
$propInfo['ID'] = (int)$propInfo['ID'];
if ($propInfo['ID'] == $skuInfo['SKU_PROPERTY_ID'])
continue;
$propInfo['CODE'] = (string)$propInfo['CODE'];
if ($propInfo['CODE'] === '')
$propInfo['CODE'] = $propInfo['ID'];
if (!in_array($propInfo['CODE'], $propertiesCodes))
continue;
$propInfo['SORT'] = (int)$propInfo['SORT'];
$propInfo['USER_TYPE'] = (string)$propInfo['USER_TYPE'];
if ($propInfo['PROPERTY_TYPE'] == PropertyTable::TYPE_STRING)
{
if ('directory' != $propInfo['USER_TYPE'])
continue;
$propInfo['USER_TYPE_SETTINGS'] = (string)$propInfo['USER_TYPE_SETTINGS'];
if ($propInfo['USER_TYPE_SETTINGS'] == '')
continue;
$propInfo['USER_TYPE_SETTINGS'] = unserialize($propInfo['USER_TYPE_SETTINGS']);
if (!isset($propInfo['USER_TYPE_SETTINGS']['TABLE_NAME']) || empty($propInfo['USER_TYPE_SETTINGS']['TABLE_NAME']))
continue;
if (self::$highLoadInclude === null)
self::$highLoadInclude = Loader::includeModule('highloadblock');
if (!self::$highLoadInclude)
continue;
$highBlock = HighloadBlockTable::getList(array(
'filter' => array('TABLE_NAME' => $propInfo['USER_TYPE_SETTINGS']['TABLE_NAME'])
))->fetch();
if (!isset($highBlock['ID']))
continue;
$entity = HighloadBlockTable::compileEntity($highBlock);
$entityDataClass = $entity->getDataClass();
$fieldsList = $entityDataClass::getEntity()->getFields();
if (empty($fieldsList))
continue;
$flag = true;
foreach ($requireFields as &$fieldCode)
{
if (!isset($fieldsList[$fieldCode]) || empty($fieldsList[$fieldCode]))
{
$flag = false;
break;
}
}
unset($fieldCode);
if (!$flag)
continue;
$propInfo['USER_TYPE_SETTINGS']['FIELDS_MAP'] = $fieldsList;
$propInfo['USER_TYPE_SETTINGS']['ENTITY'] = $entity;
}
//.........这里部分代码省略.........