本文整理汇总了PHP中CCatalogSKU::GetInfoByOfferIBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogSKU::GetInfoByOfferIBlock方法的具体用法?PHP CCatalogSKU::GetInfoByOfferIBlock怎么用?PHP CCatalogSKU::GetInfoByOfferIBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogSKU
的用法示例。
在下文中一共展示了CCatalogSKU::GetInfoByOfferIBlock方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetProductInfo
public static function GetProductInfo($intOfferID, $intIBlockID = 0)
{
$intOfferID = (int) $intOfferID;
if ($intOfferID <= 0) {
return false;
}
$intIBlockID = (int) $intIBlockID;
if ($intIBlockID <= 0) {
$intIBlockID = (int) CIBlockElement::GetIBlockByID($intOfferID);
}
if ($intIBlockID <= 0) {
return false;
}
if (!isset(self::$arOfferCache[$intIBlockID])) {
$arSkuInfo = CCatalogSKU::GetInfoByOfferIBlock($intIBlockID);
} else {
$arSkuInfo = self::$arOfferCache[$intIBlockID];
}
if (empty($arSkuInfo) || empty($arSkuInfo['SKU_PROPERTY_ID'])) {
return false;
}
$rsItems = CIBlockElement::GetProperty($intIBlockID, $intOfferID, array(), array('ID' => $arSkuInfo['SKU_PROPERTY_ID']));
if ($arItem = $rsItems->Fetch()) {
$arItem['VALUE'] = (int) $arItem['VALUE'];
if ($arItem['VALUE'] > 0) {
return array('ID' => $arItem['VALUE'], 'IBLOCK_ID' => $arSkuInfo['PRODUCT_IBLOCK_ID'], 'OFFER_IBLOCK_ID' => $intIBlockID, 'SKU_PROPERTY_ID' => $arSkuInfo['SKU_PROPERTY_ID']);
}
}
return false;
}
示例2: GetProductInfo
public function GetProductInfo($intOfferID, $intIBlockID = 0)
{
$intOfferID = intval($intOfferID);
if (0 >= $intOfferID) {
return false;
}
$intIBlockID = intval($intIBlockID);
if (0 >= $intIBlockID) {
$rsItems = CIBlockElement::GetList(array(), array("ID" => $intOfferID, "SHOW_HISTORY" => "Y"), false, false, array('ID', 'IBLOCK_ID'));
if ($arItem = $rsItems->Fetch()) {
$intIBlockID = intval($arItem['IBLOCK_ID']);
}
}
if (0 >= $intIBlockID) {
return false;
}
$arSkuInfo = CCatalogSKU::GetInfoByOfferIBlock($intIBlockID);
if (empty($arSkuInfo) || empty($arSkuInfo['SKU_PROPERTY_ID'])) {
return false;
}
$rsItems = CIBlockElement::GetProperty($intIBlockID, $intOfferID, array(), array('ID' => $arSkuInfo['SKU_PROPERTY_ID']));
if ($arItem = $rsItems->Fetch()) {
$arItem['VALUE'] = intval($arItem['VALUE']);
if (0 < $arItem['VALUE']) {
return array('ID' => $arItem['VALUE'], 'IBLOCK_ID' => $arSkuInfo['PRODUCT_IBLOCK_ID']);
}
}
return false;
}
示例3: GetIBlockTypes
public function GetIBlockTypes($lid, $catalogOnly = true, $hideOffers = true)
{
CModule::IncludeModule("iblock");
$arTypeAll = array();
$dbIBlock = CIBlock::GetList(array("IBLOCK_TYPE" => "ASC", "NAME" => "ASC"), array("LID" => $lid));
while ($arIBlock = $dbIBlock->Fetch()) {
if (true == $catalogOnly) {
if (CModule::IncludeModule("catalog") && CCatalog::GetByID($arIBlock["ID"])) {
if ($hideOffers == true && CCatalogSKU::GetInfoByOfferIBlock($arIBlock["ID"])) {
continue;
}
$arTypeIblock[] = $arIBlock;
}
} else {
$arTypeIblock[] = $arIBlock;
}
}
unset($dbIBlock);
foreach ($arTypeIblock as $arIBlock) {
$arType = CIBlockType::GetByIDLang($arIBlock["IBLOCK_TYPE_ID"], LANG);
$arTypeAll[$arType["ID"]]["ID"] = $arType["ID"];
$arTypeAll[$arType["ID"]]["NAME"] = "{$arType["NAME"]} [{$arType["ID"]}]";
$arTypeAll[$arType["ID"]]["IBLOCK"][$arIBlock["ID"]] = "{$arIBlock["NAME"]} [{$arIBlock["ID"]}]";
unset($arType);
}
unset($arTypeIblock);
return $arTypeAll;
}
示例4: GetProductInfo
public static function GetProductInfo($intOfferID, $intIBlockID = 0)
{
$intOfferID = (int) $intOfferID;
if ($intOfferID <= 0) {
return false;
}
if (!isset(self::$parentCache[$intOfferID])) {
self::$parentCache[$intOfferID] = false;
$intIBlockID = (int) $intIBlockID;
if ($intIBlockID <= 0) {
$intIBlockID = (int) CIBlockElement::GetIBlockByID($intOfferID);
}
if ($intIBlockID <= 0) {
return self::$parentCache[$intOfferID];
}
if (!isset(self::$arOfferCache[$intIBlockID])) {
$skuInfo = CCatalogSKU::GetInfoByOfferIBlock($intIBlockID);
} else {
$skuInfo = self::$arOfferCache[$intIBlockID];
}
if (empty($skuInfo) || empty($skuInfo['SKU_PROPERTY_ID'])) {
return self::$parentCache[$intOfferID];
}
$conn = Application::getConnection();
$helper = $conn->getSqlHelper();
if ($skuInfo['VERSION'] == 2) {
$productField = $helper->quote('PROPERTY_' . $skuInfo['SKU_PROPERTY_ID']);
$sqlQuery = 'select ' . $productField . ' as ID from ' . $helper->quote('b_iblock_element_prop_s' . $skuInfo['IBLOCK_ID']) . ' where ' . $helper->quote('IBLOCK_ELEMENT_ID') . ' = ' . $intOfferID;
} else {
$productField = $helper->quote('VALUE_NUM');
$sqlQuery = 'select ' . $productField . ' as ID from ' . $helper->quote('b_iblock_element_property') . ' where ' . $helper->quote('IBLOCK_PROPERTY_ID') . ' = ' . $skuInfo['SKU_PROPERTY_ID'] . ' and ' . $helper->quote('IBLOCK_ELEMENT_ID') . ' = ' . $intOfferID;
}
unset($productField);
$parentIterator = $conn->query($sqlQuery);
if ($parent = $parentIterator->fetch()) {
$parent['ID'] = (int) $parent['ID'];
if ($parent['ID'] > 0) {
self::$parentCache[$intOfferID] = array('ID' => $parent['ID'], 'IBLOCK_ID' => $skuInfo['PRODUCT_IBLOCK_ID'], 'OFFER_IBLOCK_ID' => $intIBlockID, 'SKU_PROPERTY_ID' => $skuInfo['SKU_PROPERTY_ID']);
}
}
unset($parent, $parentIterator, $sqlQuery, $helper, $conn, $skuInfo);
}
return self::$parentCache[$intOfferID];
}
示例5: array
?><tr id="tr_OFFERS"><td colspan="2"><?
define('B_ADMIN_SUBELEMENTS',1);
define('B_ADMIN_SUBELEMENTS_LIST',false);
$intSubIBlockID = $arMainCatalog['IBLOCK_ID'];
$arSubIBlock = CIBlock::GetArrayByID($intSubIBlockID);
$arSubIBlock["SITE_ID"] = array();
$rsSites = CIBlock::GetSite($intSubIBlockID);
while($arSite = $rsSites->Fetch())
$arSubIBlock["SITE_ID"][] = $arSite["LID"];
$strSubIBlockType = $arSubIBlock['IBLOCK_TYPE_ID'];
$arSubIBlockType = CIBlockType::GetByIDLang($strSubIBlockType, LANGUAGE_ID);
$boolIncludeOffers = CIBlockRights::UserHasRightTo($intSubIBlockID, $intSubIBlockID, "iblock_admin_display");;
$arSubCatalog = CCatalogSKU::GetInfoByOfferIBlock($arMainCatalog['IBLOCK_ID']);
$boolSubCatalog = (!empty($arSubCatalog) && is_array($arSubCatalog));
if (!$boolCatalogRead && !$boolCatalogPrice)
$boolSubCatalog = false;
$boolSubWorkFlow = CModule::IncludeModule("workflow") && $arSubIBlock["WORKFLOW"] != "N";
$boolSubBizproc = CModule::IncludeModule("bizproc") && $arSubIBlock["BIZPROC"] != "N";
$intSubPropValue = (0 == $ID || $bCopy ? '-'.$TMP_ID : $ID);
$strSubTMP_ID = $TMP_ID;
$strSubElementAjaxPath = '/bitrix/admin/iblock_subelement_admin.php?WF=Y&IBLOCK_ID='.$intSubIBlockID.'&type='.urlencode($strSubIBlockType).'&lang='.LANGUAGE_ID.'&find_section_section=0&find_el_property_'.$arSubCatalog['SKU_PROPERTY_ID'].'='.((0 == $ID) || ($bCopy) ? '-'.$TMP_ID : $ID).'&TMP_ID='.urlencode($strSubTMP_ID);
if ($boolIncludeOffers && file_exists($_SERVER["DOCUMENT_ROOT"].'/bitrix/modules/iblock/admin/templates/iblock_subelement_list.php'))
{
require($_SERVER["DOCUMENT_ROOT"].'/bitrix/modules/iblock/admin/templates/iblock_subelement_list.php');
}
示例6: IncludeModuleLangFile
IncludeModuleLangFile(__FILE__);
if (!Main\Loader::includeModule('catalog')) {
die;
}
Main\Loader::includeModule('fileman');
Main\Page\Asset::getInstance()->addJs('/bitrix/js/catalog/tbl_edit.js');
$arJSDescription = array('js' => '/bitrix/js/iblock/sub_generator.js', 'css' => '/bitrix/panel/iblock/sub-generator.css', 'lang' => '/bitrix/modules/iblock/lang/' . LANGUAGE_ID . '/admin/iblock_subelement_generator.php');
CJSCore::RegisterExt('iblock_generator', $arJSDescription);
CJSCore::Init(array('iblock_generator', 'file_input'));
define('IB_SEG_ROW_PREFIX', 'IB_SEG_');
$subIBlockId = intval($_REQUEST["subIBlockId"]);
$subPropValue = intval($_REQUEST["subPropValue"]);
$subTmpId = intval($_REQUEST["subTmpId"]);
$iBlockId = intval($_REQUEST["iBlockId"]);
$findSection = intval($_REQUEST["findSection"]);
$arSKUInfo = CCatalogSKU::GetInfoByOfferIBlock($subIBlockId);
CUtil::decodeURIComponent($_POST['PRODUCT_NAME']);
$parentProductName = trim($_POST['PRODUCT_NAME']);
$useStoreControl = (string) Main\Config\Option::get('catalog', 'default_use_store_control') == 'Y';
if ($arSKUInfo == false) {
ShowError("SKU error!");
}
$APPLICATION->SetTitle(GetMessage("IB_SEG_MAIN_TITLE"));
/**
* @param $intRangeID
* @param $strPrefix
* @return string
*/
function __AddCellPriceType($intRangeID, $strPrefix)
{
$dbCatalogGroups = CCatalogGroup::GetList(array("SORT" => "ASC", "NAME" => "ASC", "ID" => "ASC"));
示例7: GetDiscountForProduct
public function GetDiscountForProduct($arProduct, $arParams = false)
{
global $DB;
$arResult = array();
$arResultID = array();
if (is_array($arProduct) && !empty($arProduct)) {
if (!is_array($arParams)) {
$arParams = array();
}
if (!isset($arProduct['ID'])) {
$arProduct['ID'] = 0;
}
$arProduct['ID'] = intval($arProduct['ID']);
if (!isset($arProduct['IBLOCK_ID'])) {
$arProduct['IBLOCK_ID'] = 0;
}
$arProduct['IBLOCK_ID'] = intval($arProduct['IBLOCK_ID']);
if (0 >= $arProduct['IBLOCK_ID']) {
return $arResult;
}
$arFieldsParams = array();
if (isset($arParams['TIME_ZONE'])) {
$arFieldsParams['TIME_ZONE'] = $arParams['TIME_ZONE'];
}
if (isset($arParams['PRODUCT'])) {
$arFieldsParams['PRODUCT'] = $arParams['PRODUCT'];
}
$boolGenerate = false;
$arSelect = array("ID", "SITE_ID", "SORT", "NAME", "VALUE_TYPE", "VALUE", "CURRENCY", 'UNPACK');
if (isset($arParams['DISCOUNT_FIELDS']) && is_array($arParams['DISCOUNT_FIELDS']) && !empty($arParams['DISCOUNT_FIELDS'])) {
$arSelect = $arParams['DISCOUNT_FIELDS'];
}
if (!in_array('UNPACK', $arSelect)) {
$arSelect[] = 'UNPACK';
}
$strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")));
if (isset($arParams['CURRENT_DATE'])) {
$strDate = $arParams['CURRENT_DATE'];
}
$strRenewal = 'N';
if (isset($arParams['RENEWAL'])) {
$strRenewal = $arParams['RENEWAL'];
} else {
$rsCatalogs = CCatalog::GetList(array(), array('ID' => $arProduct['IBLOCK_ID']), false, false, array('ID', 'SUBSCRIPTION'));
if ($arCatalog = $rsCatalogs->Fetch()) {
$strRenewal = $arCatalog['SUBSCRIPTION'];
}
}
if ('Y' != $strRenewal) {
$strRenewal = 'N';
}
$arSiteList = array();
if (isset($arParams['SITE_ID'])) {
if (!is_array($arParams['SITE_ID'])) {
$arParams['SITE_ID'] = array($arParams['SITE_ID']);
}
if (!empty($arParams['SITE_ID'])) {
$arSiteList = $arParams['SITE_ID'];
}
}
if (empty($arSiteList)) {
$rsIBlockSites = CIBlock::GetSite($arProduct['IBLOCK_ID']);
while ($arIBlockSite = $rsIBlockSites->Fetch()) {
$arSiteList[] = $arIBlockSite['SITE_ID'];
}
}
$arFilter = array("SITE_ID" => $arSiteList, "TYPE" => DISCOUNT_TYPE_STANDART, "ACTIVE" => "Y", "RENEWAL" => $strRenewal, "+<=ACTIVE_FROM" => $strDate, "+>=ACTIVE_TO" => $strDate, 'COUPON' => '');
$rsPriceDiscounts = CCatalogDiscount::GetList(array(), $arFilter, false, false, $arSelect);
while ($arPriceDiscount = $rsPriceDiscounts->Fetch()) {
if ($arPriceDiscount['COUPON_ACTIVE'] != 'N') {
if (!$boolGenerate) {
if (!self::__GenerateFields($arProduct, $arFieldsParams)) {
return $arResult;
}
$boolGenerate = true;
}
if (CCatalogDiscount::__Unpack($arProduct, $arPriceDiscount['UNPACK'])) {
unset($arPriceDiscount['UNPACK']);
$arResult[] = $arPriceDiscount;
$arResultID[] = $arPriceDiscount['ID'];
}
}
}
if (isset($arParams['SKU']) && 'Y' == $arParams['SKU']) {
if (isset($arParams['SKU_PARAMS']) && is_array($arParams['SKU_PARAMS']) && !empty($arParams['SKU_PARAMS'])) {
$arSKU = $arParams['SKU_PARAMS'];
} else {
$arSKU = CCatalogSKU::GetInfoByOfferIBlock($arProduct['IBLOCK_ID']);
}
if (is_array($arSKU)) {
$arParent = array();
$arParent['ID'] = 0;
$arParent['IBLOCK_ID'] = $arSKU['PRODUCT_IBLOCK_ID'];
if (isset($arProduct['PROPERTY_' . $arSKU['SKU_PROPERTY_ID'] . '_VALUE']) && is_array($arProduct['PROPERTY_' . $arSKU['SKU_PROPERTY_ID'] . '_VALUE'])) {
$intParentID = intval(current($arProduct['PROPERTY_' . $arSKU['SKU_PROPERTY_ID'] . '_VALUE']));
if (0 < $intParentID) {
$arParent['ID'] = $intParentID;
}
}
$arParentParams = array();
//.........这里部分代码省略.........
示例8: SetDiscountProductCache
public static function SetDiscountProductCache($arItem, $arParams = array())
{
if (empty($arItem) || !is_array($arItem)) {
return;
}
if (!empty($arParams) && isset($arParams['GET_BY_ID']) && $arParams['GET_BY_ID'] == 'Y') {
$filter = array('ID' => $arItem);
if (isset($arParams['IBLOCK_ID'])) {
$filter['IBLOCK_ID'] = $arParams['IBLOCK_ID'];
}
$select = array('ID', 'IBLOCK_ID', 'CODE', 'XML_ID', 'NAME', 'ACTIVE', 'DATE_ACTIVE_FROM', 'DATE_ACTIVE_TO', 'SORT', 'PREVIEW_TEXT', 'DETAIL_TEXT', 'DATE_CREATE', 'DATE_CREATE_UNIX', 'CREATED_BY', 'TIMESTAMP_X', 'TIMESTAMP_X_UNIX', 'MODIFIED_BY', 'TAGS', 'CATALOG_QUANTITY');
CTimeZone::Disable();
$rsProducts = CIBlockElement::GetList(array(), $filter, false, false, $select);
CTimeZone::Enable();
while ($arProductFields = $rsProducts->GetNext(false, true)) {
$arProduct = array();
$arProduct['ID'] = (int) $arProductFields['ID'];
$arProduct['IBLOCK_ID'] = (int) $arProductFields['IBLOCK_ID'];
$arProduct['SECTION_ID'] = array();
$arProductSections = self::__GetSectionList($arProduct['IBLOCK_ID'], $arProduct['ID']);
if (false !== $arProductSections) {
$arProduct['SECTION_ID'] = $arProductSections;
}
$arProduct['CODE'] = (string) $arProductFields['~CODE'];
$arProduct['XML_ID'] = (string) $arProductFields['~XML_ID'];
$arProduct['NAME'] = $arProductFields['~NAME'];
$arProduct['ACTIVE'] = $arProductFields['ACTIVE'];
$arProduct['DATE_ACTIVE_FROM'] = (string) $arProductFields['DATE_ACTIVE_FROM'];
if (!empty($arProduct['DATE_ACTIVE_FROM'])) {
$arProduct['DATE_ACTIVE_FROM'] = (int) MakeTimeStamp($arProduct['DATE_ACTIVE_FROM']);
}
$arProduct['DATE_ACTIVE_TO'] = (string) $arProductFields['DATE_ACTIVE_TO'];
if (!empty($arProduct['DATE_ACTIVE_TO'])) {
$arProduct['DATE_ACTIVE_TO'] = (int) MakeTimeStamp($arProduct['DATE_ACTIVE_TO']);
}
$arProduct['SORT'] = (int) $arProductFields['SORT'];
$arProduct['PREVIEW_TEXT'] = (string) $arProductFields['~PREVIEW_TEXT'];
$arProduct['DETAIL_TEXT'] = (string) $arProductFields['~DETAIL_TEXT'];
$arProduct['TAGS'] = (string) $arProductFields['~TAGS'];
if (isset($arProductFields['DATE_CREATE_UNIX'])) {
$arProduct['DATE_CREATE'] = (string) $arProductFields['DATE_CREATE_UNIX'];
if ('' != $arProduct['DATE_CREATE']) {
$arProduct['DATE_CREATE'] = (int) $arProduct['DATE_CREATE'];
}
} else {
$arProduct['DATE_CREATE'] = (string) $arProductFields['DATE_CREATE'];
if ('' != $arProduct['DATE_CREATE']) {
$arProduct['DATE_CREATE'] = (int) MakeTimeStamp($arProduct['DATE_CREATE']);
}
}
if (isset($arProductFields['TIMESTAMP_X_UNIX'])) {
$arProduct['TIMESTAMP_X'] = (string) $arProductFields['TIMESTAMP_X_UNIX'];
if ('' != $arProduct['TIMESTAMP_X']) {
$arProduct['TIMESTAMP_X'] = (int) $arProduct['TIMESTAMP_X'];
}
} else {
$arProduct['TIMESTAMP_X'] = (string) $arProductFields['TIMESTAMP_X'];
if ('' != $arProduct['TIMESTAMP_X']) {
$arProduct['TIMESTAMP_X'] = (int) MakeTimeStamp($arProduct['TIMESTAMP_X']);
}
}
$arProduct['CREATED_BY'] = (int) $arProductFields['CREATED_BY'];
$arProduct['MODIFIED_BY'] = (int) $arProductFields['MODIFIED_BY'];
$arProduct['CATALOG_QUANTITY'] = (string) $arProductFields['CATALOG_QUANTITY'];
if ('' != $arProduct['CATALOG_QUANTITY']) {
$arProduct['CATALOG_QUANTITY'] = doubleval($arProduct['CATALOG_QUANTITY']);
}
$arProduct['CATALOG_WEIGHT'] = (string) $arProductFields['CATALOG_WEIGHT'];
if ('' != $arProduct['CATALOG_WEIGHT']) {
$arProduct['CATALOG_WEIGHT'] = doubleval($arProduct['CATALOG_WEIGHT']);
}
$arProduct['CATALOG_VAT_ID'] = (string) $arProductFields['CATALOG_VAT_ID'];
if ('' != $arProduct['CATALOG_VAT_ID']) {
$arProduct['CATALOG_VAT_ID'] = (int) $arProduct['CATALOG_VAT_ID'];
}
$arProduct['CATALOG_VAT_INCLUDED'] = (string) $arProductFields['CATALOG_VAT_INCLUDED'];
if (!isset(self::$arCacheProductProperties[$arProduct['ID']])) {
$propsList = array($arProduct['ID'] => array());
CIBlockElement::GetPropertyValuesArray($propsList, $arProduct['IBLOCK_ID'], array('ID' => $arProduct['ID'], 'IBLOCK_ID' => $arProduct['IBLOCK_ID']));
self::$arCacheProductProperties[$arProduct['ID']] = $propsList[$arProduct['ID']];
unset($propsList);
}
$arProps = self::$arCacheProductProperties[$arProduct['ID']];
self::__ConvertProperties($arProduct, $arProps, array('TIME_ZONE' => 'N'));
if (isset(self::$arCacheProductProperties[$arProduct['ID']])) {
unset(self::$arCacheProductProperties[$arProduct['ID']]);
}
if (isset(self::$arCacheProductSections[$arProduct['ID']])) {
unset(self::$arCacheProductSections[$arProduct['ID']]);
}
$sku = CCatalogSKU::GetInfoByOfferIBlock($arProduct['IBLOCK_ID']);
if (!empty($sku)) {
if (!self::__GenerateParent($arProduct, $sku)) {
$sku = false;
}
}
self::$arCacheProduct[$arProduct['ID']] = $arProduct;
}
} else {
if (!isset(self::$arCacheProduct[$arItem['ID']])) {
//.........这里部分代码省略.........
示例9: array
if ($arItem) {
$dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arItem["ID"]), false, false, array('NAME', 'CODE', 'VALUE', 'SORT'));
while ($arProp = $dbProp->Fetch()) {
if (!isset($arItem['PROPS'])) {
$arItem['PROPS'] = array();
}
$arItem['PROPS'][] = $arProp;
}
$element = false;
$sku = false;
$parentId = 0;
$elementIterator = \Bitrix\Iblock\ElementTable::getList(array('select' => array('ID', 'IBLOCK_ID', 'XML_ID'), 'filter' => array('ID' => $arItem['PRODUCT_ID'])));
$element = $elementIterator->fetch();
unset($elementIterator);
if (!empty($element)) {
$sku = CCatalogSKU::GetInfoByOfferIBlock($element['IBLOCK_ID']);
if (!empty($sku)) {
$propertyIterator = CIBlockElement::GetProperty($element['IBLOCK_ID'], $element['ID'], array(), array('ID' => $sku['SKU_PROPERTY_ID']));
if ($property = $propertyIterator->Fetch()) {
$parentId = (int) $property['VALUE'];
}
unset($property, $propertyIterator);
}
}
if (!empty($element) && $parentId > 0) {
$bBasketUpdate = false;
$arPropsValues["CML2_LINK"] = $parentId;
$newProductId = getProductByProps($element['IBLOCK_ID'], $arPropsValues, true);
if (!empty($newProductId)) {
if ($productProvider = CSaleBasket::GetProductProvider($arItem)) {
$arFieldsTmp = $productProvider::GetProductData(array("PRODUCT_ID" => $newProductId['ID'], "QUANTITY" => $arItem['QUANTITY'], "RENEWAL" => "N", "USER_ID" => $USER->GetID(), "SITE_ID" => SITE_ID, "BASKET_ID" => $arItem['ID'], "CHECK_QUANTITY" => "Y", "CHECK_PRICE" => "Y", "NOTES" => $arItem["NOTES"]));
示例10: array
</a>
<?php
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
$arSubIBlock["SITE_ID"] = array();
$rsSites = CIBlock::GetSite($intSubIBlockID);
while ($arSite = $rsSites->Fetch()) {
$arSubIBlock["SITE_ID"][] = $arSite["LID"];
}
$boolSubWorkFlow = $boolSubBizproc && $arSubIBlock["WORKFLOW"] != "N";
$boolSubBizproc = $boolSubBizproc && $arSubIBlock["BIZPROC"] != "N";
$boolSubCatalog = false;
$bCatalog = CModule::IncludeModule("catalog");
if ($bCatalog) {
$arSubCatalog = CCatalogSKU::GetInfoByOfferIBlock($arSubIBlock["ID"]);
$boolSubCatalog = !empty($arSubCatalog) && is_array($arSubCatalog);
if (!$boolSubCatalog) {
die;
}
if (!($USER->CanDoOperation('catalog_read') || $USER->CanDoOperation('catalog_price'))) {
$boolSubCatalog = false;
}
} else {
die;
}
$intSubPropValue = 0;
if (array_key_exists('find_el_property_' . $arSubCatalog['SKU_PROPERTY_ID'], $_REQUEST)) {
$intSubPropValue = intval($_REQUEST['find_el_property_' . $arSubCatalog['SKU_PROPERTY_ID']]);
}
if (0 >= $intSubPropValue) {
示例11: getProductIdsByOfferIds
public static function getProductIdsByOfferIds($offerIds)
{
if (empty($offerIds)) {
return array();
}
$bestList = array();
$iblockGroup = array();
$itemIterator = \Bitrix\Iblock\ElementTable::getList(array('select' => array('ID', 'IBLOCK_ID'), 'filter' => array('ID' => $offerIds, 'ACTIVE' => 'Y')));
while ($item = $itemIterator->fetch()) {
if (!isset($iblockGroup[$item['IBLOCK_ID']])) {
$iblockGroup[$item['IBLOCK_ID']] = array();
}
$iblockGroup[$item['IBLOCK_ID']][] = $item['ID'];
$bestList[$item['ID']] = array();
}
if (empty($iblockGroup)) {
return array();
}
$offerLink = array();
foreach ($iblockGroup as $iblockId => $items) {
$skuInfo = \CCatalogSKU::GetInfoByOfferIBlock($iblockId);
if (empty($skuInfo)) {
continue;
}
$offerItetator = \CIBlockElement::GetList(array(), array('IBLOCK_ID' => $iblockId, 'ID' => $items), false, false, array('ID', 'IBLOCK_ID', 'PROPERTY_' . $skuInfo['SKU_PROPERTY_ID']));
while ($offer = $offerItetator->Fetch()) {
$productId = (int) $offer['PROPERTY_' . $skuInfo['SKU_PROPERTY_ID'] . '_VALUE'];
if ($productId <= 0) {
unset($bestList[$offer['ID']]);
} else {
$bestList[$offer['ID']]['PARENT_ID'] = $productId;
$bestList[$offer['ID']]['PARENT_IBLOCK'] = $skuInfo['PRODUCT_IBLOCK_ID'];
if (!isset($offerLink[$productId])) {
$offerLink[$productId] = array();
}
$offerLink[$productId][] = $offer['ID'];
}
}
}
if (!empty($offerLink)) {
$productIterator = \Bitrix\Iblock\ElementTable::getList(array('select' => array('ID'), 'filter' => array('@ID' => array_keys($offerLink), 'ACTIVE' => 'N')));
while ($product = $productIterator->fetch()) {
if (empty($offerLink[$product['ID']])) {
continue;
}
foreach ($offerLink[$product['ID']] as $value) {
unset($bestList[$value]);
}
}
}
if (empty($bestList)) {
return array();
}
$finalIds = array();
foreach ($bestList as $id => $info) {
if (empty($info)) {
$finalIds[] = $id;
} else {
$finalIds[] = $info['PARENT_ID'];
}
}
return $finalIds;
}