本文整理汇总了PHP中CCatalogProductSet::getAllSetsByProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogProductSet::getAllSetsByProduct方法的具体用法?PHP CCatalogProductSet::getAllSetsByProduct怎么用?PHP CCatalogProductSet::getAllSetsByProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogProductSet
的用法示例。
在下文中一共展示了CCatalogProductSet::getAllSetsByProduct方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$arParams['CURRENCY_ID'] = '';
}
else
{
$arParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
$arConvertParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
}
}
}
$arResult['CONVERT_CURRENCY'] = $arConvertParams;
$countSetDefaultItems = 0;
$arSetItemsID = array($arResult['ELEMENT_ID']);
$arSetItemsDefaultID = array();
$arSetItemsOtherID = array();
$arSetItems = CCatalogProductSet::getAllSetsByProduct($arResult['PRODUCT_ID'], CCatalogProductSet::TYPE_GROUP);
foreach ($arSetItems as $arItems)
{
sortByColumn($arItems["ITEMS"], array('SORT' => SORT_ASC));
foreach ($arItems["ITEMS"] as $arItem)
{
$arSetItemsID[] = $arItem["ITEM_ID"];
if ($countSetDefaultItems < 3)
{
$arSetItemsDefaultID[$arItem["ITEM_ID"]] = $arItem["SORT"];
$countSetDefaultItems++;
}
else
{
$arSetItemsOtherID[$arItem["ITEM_ID"]] = $arItem["SORT"];
示例2: GetMessage
?></td></tr><?
$tabControl->EndCustomField('PRODUCT_SET', '');
}
if ($arShowTabs['product_group'])
{
$tabControl->BeginNextFormTab();
$tabControl->BeginCustomField('PRODUCT_GROUP', GetMessage('IBLOCK_EL_PRODUCT_GROUP').':', false);
?><tr id="tr_PRODUCT_GROUP"><td colspan="2"><?
$intProductID = (0 < $ID ? CIBlockElement::GetRealElement($ID) : 0);
$arSets = false;
CCatalogAdminProductSetEdit::setProductFormParams(array('TYPE' => CCatalogProductSet::TYPE_GROUP));
if (0 < $intProductID)
{
$arSets = CCatalogProductSet::getAllSetsByProduct($intProductID, CCatalogProductSet::TYPE_GROUP);
if ($bCopy)
CCatalogAdminProductSetEdit::clearOwnerSet($arSets);
}
if (empty($arSets))
$arSets = CCatalogAdminProductSetEdit::getEmptySet($intProductID);
if ($bVarsFromForm)
CCatalogAdminProductSetEdit::getFormValues($arSets);
CCatalogAdminProductSetEdit::addEmptyValues($arSets);
CCatalogAdminProductSetEdit::showEditForm($arSets);
?></td></tr><?
$tabControl->EndCustomField('PRODUCT_SET', '');
}
if($arShowTabs['workflow']):?>
示例3: ExportProductSet
function ExportProductSet($elementId, $elementXml)
{
$arSetItems = CCatalogProductSet::getAllSetsByProduct($elementId, CCatalogProductSet::TYPE_GROUP);
if (is_array($arSetItems) && !empty($arSetItems)) {
fwrite($this->fp, "\t\t<" . GetMessage("IBLOCK_XML2_PRODUCT_SETS") . ">\n");
fwrite($this->fp, "\t\t\t<" . GetMessage("IBLOCK_XML2_ID") . ">" . htmlspecialcharsbx($elementXml) . "</" . GetMessage("IBLOCK_XML2_ID") . ">\n");
foreach ($arSetItems as $arOneSet) {
fwrite($this->fp, "\t\t\t<" . GetMessage("IBLOCK_XML2_PRODUCT_SET") . ">\n");
if (is_array($arOneSet["ITEMS"]) && !empty($arOneSet["ITEMS"])) {
foreach ($arOneSet["ITEMS"] as $setItem) {
$xmlId = $this->GetElementXML_ID($this->arIBlock["ID"], $setItem["ITEM_ID"]);
if ($xmlId !== false) {
fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_PRODUCT_SET_ITEM") . ">\n");
fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_VALUE") . ">" . htmlspecialcharsbx($xmlId) . "</" . GetMessage("IBLOCK_XML2_VALUE") . ">\n");
fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_SORT") . ">" . intval($setItem["SORT"]) . "</" . GetMessage("IBLOCK_XML2_SORT") . ">\n");
fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_PRODUCT_SET_ITEM") . ">\n");
}
}
}
fwrite($this->fp, "\t\t\t</" . GetMessage("IBLOCK_XML2_PRODUCT_SET") . ">\n");
}
fwrite($this->fp, "\t\t</" . GetMessage("IBLOCK_XML2_PRODUCT_SETS") . ">\n");
}
}
示例4: GetSetItems
public static function GetSetItems($productID, $intType, $arProducInfo = array())
{
$arProductId = array();
static $proxyCatalogProductSet = array();
static $proxyCatalogSkuData = array();
static $proxyCatalogProduct = array();
static $proxyIblockProperty = array();
static $proxyProductProperty = array();
$proxyCatalogProductSetKey = $productID . "|" . $intType;
if (!empty($proxyCatalogProductSet[$proxyCatalogProductSetKey]) && is_array($proxyCatalogProductSet[$proxyCatalogProductSetKey])) {
$arSets = $proxyCatalogProductSet[$proxyCatalogProductSetKey];
} else {
$arSets = CCatalogProductSet::getAllSetsByProduct($productID, $intType);
if (!empty($arSets) && is_array($arSets)) {
$proxyCatalogProductSet[$proxyCatalogProductSetKey] = $arSets;
}
}
if (is_array($arSets)) {
foreach ($arSets as $k => $arSet) {
foreach ($arSet["ITEMS"] as $k1 => $item) {
$arItem = self::GetProductData(array("PRODUCT_ID" => $item["ITEM_ID"], "QUANTITY" => $item["QUANTITY"], "CHECK_QUANTITY" => "N", "CHECK_PRICE" => "N"));
if (array_key_exists('QUANTITY_TRACE', $arItem)) {
unset($arItem['QUANTITY_TRACE']);
}
$arItem["PRODUCT_ID"] = $item["ITEM_ID"];
$arItem["MODULE"] = "catalog";
$arItem["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
if ($intType == CCatalogProductSet::TYPE_SET) {
$arItem['SET_DISCOUNT_PERCENT'] = $item['DISCOUNT_PERCENT'] == '' ? false : (double) $item['DISCOUNT_PERCENT'];
}
$arProductId[] = $item["ITEM_ID"];
$arItem["PROPS"] = array();
if (!empty($proxyCatalogSkuData[$item["ITEM_ID"]]) && is_array($proxyCatalogSkuData[$item["ITEM_ID"]])) {
$arParentSku = $proxyCatalogSkuData[$item["ITEM_ID"]];
} else {
if ($arParentSku = CCatalogSku::GetProductInfo($item["ITEM_ID"])) {
$proxyCatalogSkuData[$item["ITEM_ID"]] = $arParentSku;
}
}
if (!empty($arParentSku)) {
$arPropsSku = array();
if (!($arProduct = static::getHitCache('IBLOCK_ELEMENT', $item["ITEM_ID"]))) {
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $item["ITEM_ID"]), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'IBLOCK_SECTION_ID'));
if ($arProduct = $dbProduct->Fetch()) {
static::setHitCache('IBLOCK_ELEMENT', $item["ITEM_ID"], $arProduct);
}
}
if (!($arPropsSku = static::getHitCache('IBLOCK_PROPERTY', $arProduct["IBLOCK_ID"]))) {
$dbOfferProperties = CIBlock::GetProperties($arProduct["IBLOCK_ID"], array(), array("!XML_ID" => "CML2_LINK"));
while ($arOfferProperties = $dbOfferProperties->Fetch()) {
$arPropsSku[] = $arOfferProperties["CODE"];
}
static::setHitCache('IBLOCK_PROPERTY', $arProduct["IBLOCK_ID"], $arPropsSku);
}
$proxyProductPropertyKey = $item["ITEM_ID"] . "_" . $arParentSku["IBLOCK_ID"] . "_" . md5(join('|', $arPropsSku));
if (!($product_properties = static::getHitCache('PRODUCT_PROPERTY', $proxyProductPropertyKey))) {
$product_properties = CIBlockPriceTools::GetOfferProperties($item["ITEM_ID"], $arParentSku["IBLOCK_ID"], $arPropsSku);
static::setHitCache('PRODUCT_PROPERTY', $proxyProductPropertyKey, $product_properties);
}
foreach ($product_properties as $propData) {
$arItem["PROPS"][] = array("NAME" => $propData["NAME"], "CODE" => $propData["CODE"], "VALUE" => $propData["VALUE"], "SORT" => $propData["SORT"]);
}
}
$arSets[$k]["ITEMS"][$k1] = array_merge($item, $arItem);
}
}
if (!($productList = static::getHitCache('IBLOCK_ELEMENT_LIST', $productID))) {
$rsProducts = CIBlockElement::GetList(array(), array('ID' => $arProductId), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "IBLOCK_TYPE_ID", "XML_ID"));
while ($arProduct = $rsProducts->GetNext()) {
$productList[] = $arProduct;
}
if (!empty($productList) && is_array($productList)) {
static::setHitCache('IBLOCK_ELEMENT_LIST', $productID, $productList);
}
}
if (!empty($productList) && is_array($productList)) {
foreach ($productList as $arProduct) {
foreach ($arSets as $k => $arSet) {
foreach ($arSet["ITEMS"] as $k1 => $item) {
if ($item["ITEM_ID"] == $arProduct["ID"]) {
$arProps = array();
$strIBlockXmlID = strval(CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID'));
if ($strIBlockXmlID != "") {
$arProps[] = array("NAME" => "Catalog XML_ID", "CODE" => "CATALOG.XML_ID", "VALUE" => $strIBlockXmlID);
}
$arProps[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $arProduct["XML_ID"]);
$arSets["{$k}"]["ITEMS"][$k1]["IBLOCK_ID"] = $arProduct["IBLOCK_ID"];
$arSets["{$k}"]["ITEMS"][$k1]["IBLOCK_SECTION_ID"] = $arProduct["IBLOCK_SECTION_ID"];
$arSets["{$k}"]["ITEMS"][$k1]["PREVIEW_PICTURE"] = $arProduct["PREVIEW_PICTURE"];
$arSets["{$k}"]["ITEMS"][$k1]["DETAIL_PICTURE"] = $arProduct["DETAIL_PICTURE"];
$arSets["{$k}"]["ITEMS"][$k1]["PROPS"] = array_merge($arSets["{$k}"]["ITEMS"][$k1]["PROPS"], $arProps);
}
}
}
}
}
}
foreach (GetModuleEvents("sale", "OnGetSetItems", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arSets));
}
//.........这里部分代码省略.........
示例5: GetSetItems
public static function GetSetItems($productID, $intType, $arProducInfo = array())
{
$arProductId = array();
$arSets = CCatalogProductSet::getAllSetsByProduct($productID, $intType);
if (is_array($arSets))
{
foreach ($arSets as $k => $arSet)
{
foreach ($arSet["ITEMS"] as $k1 => $item)
{
$arItem = self::GetProductData(array("PRODUCT_ID" => $item["ITEM_ID"], "QUANTITY" => $item["QUANTITY"], "CHECK_QUANTITY" => "N", "CHECK_PRICE" => "N"));
$arItem["PRODUCT_ID"] = $item["ITEM_ID"];
$arItem["MODULE"] = "catalog";
$arItem["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
if ($intType == CCatalogProductSet::TYPE_SET)
{
$arItem['SET_DISCOUNT_PERCENT'] = ($item['DISCOUNT_PERCENT'] == '' ? false : (float)$item['DISCOUNT_PERCENT']);
}
$arProductId[] = $item["ITEM_ID"];
$arItem["PROPS"] = array();
$arParentSku = CCatalogSku::GetProductInfo($item["ITEM_ID"]);
if (!empty($arParentSku))
{
$arPropsSku = array();
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $item["ITEM_ID"]), false, false, array('IBLOCK_ID', 'IBLOCK_SECTION_ID'));
$arProduct = $dbProduct->Fetch();
$dbOfferProperties = CIBlock::GetProperties($arProduct["IBLOCK_ID"], array(), array("!XML_ID" => "CML2_LINK"));
while($arOfferProperties = $dbOfferProperties->Fetch())
$arPropsSku[] = $arOfferProperties["CODE"];
$product_properties = CIBlockPriceTools::GetOfferProperties(
$item["ITEM_ID"],
$arParentSku["IBLOCK_ID"],
$arPropsSku
);
foreach ($product_properties as $propData)
{
$arItem["PROPS"][] = array(
"NAME" => $propData["NAME"],
"CODE" => $propData["CODE"],
"VALUE" => $propData["VALUE"],
"SORT" => $propData["SORT"]
);
}
}
$arSets[$k]["ITEMS"][$k1] = array_merge($item, $arItem);
}
}
$rsProducts = CIBlockElement::GetList(
array(),
array('ID' => $arProductId),
false,
false,
array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "IBLOCK_TYPE_ID", "XML_ID")
);
while ($arProduct = $rsProducts->GetNext())
{
foreach ($arSets as $k => $arSet)
{
foreach ($arSet["ITEMS"] as $k1 => $item)
{
if ($item["ITEM_ID"] == $arProduct["ID"])
{
$arProps = array();
$strIBlockXmlID = strval(CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID'));
if ($strIBlockXmlID != "")
{
$arProps[] = array(
"NAME" => "Catalog XML_ID",
"CODE" => "CATALOG.XML_ID",
"VALUE" => $strIBlockXmlID
);
}
$arProps[] = array(
"NAME" => "Product XML_ID",
"CODE" => "PRODUCT.XML_ID",
"VALUE" => $arProduct["XML_ID"]
);
$arSets["$k"]["ITEMS"][$k1]["IBLOCK_ID"] = $arProduct["IBLOCK_ID"];
$arSets["$k"]["ITEMS"][$k1]["IBLOCK_SECTION_ID"] = $arProduct["IBLOCK_SECTION_ID"];
$arSets["$k"]["ITEMS"][$k1]["PREVIEW_PICTURE"] = $arProduct["PREVIEW_PICTURE"];
$arSets["$k"]["ITEMS"][$k1]["DETAIL_PICTURE"] = $arProduct["DETAIL_PICTURE"];
$arSets["$k"]["ITEMS"][$k1]["PROPS"] = array_merge($arSets["$k"]["ITEMS"][$k1]["PROPS"], $arProps);
}
}
}
}
}
//.........这里部分代码省略.........
示例6: array
$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'];
}
}
}
$arResult['CONVERT_CURRENCY'] = $arConvertParams;
$countSetDefaultItems = 0;
$arSetItemsID = array($elementID);
$arSetItemsDefaultID = array();
$arSetItemsOtherID = array();
$arSetItems = CCatalogProductSet::getAllSetsByProduct($elementID, CCatalogProductSet::TYPE_GROUP);
foreach ($arSetItems as $arItems) {
sortByColumn($arItems["ITEMS"], array('SORT' => SORT_ASC));
foreach ($arItems["ITEMS"] as $arItem) {
$arSetItemsID[] = $arItem["ITEM_ID"];
if ($countSetDefaultItems < 3) {
$arSetItemsDefaultID[$arItem["ITEM_ID"]] = $arItem["SORT"];
$countSetDefaultItems++;
} else {
$arSetItemsOtherID[$arItem["ITEM_ID"]] = $arItem["SORT"];
}
}
}
$arSelect = array("ID", "NAME", "CODE", "IBLOCK_ID", "IBLOCK_SECTION_ID", "DETAIL_PAGE_URL", "PREVIEW_PICTURE", "DETAIL_PICTURE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE");
$arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices($arParams["IBLOCK_ID"], $arParams["PRICE_CODE"]);
foreach ($arResult["PRICES"] as $key => $value) {
示例7: array
$arIblockOfferProps[] = array("CODE" => "TITLE", "NAME" => GetMessage("CATALOG_OFFER_NAME"));
}
$arResult["SKU_ELEMENTS"] = $arSku;
$arResult["SKU_PROPERTIES"] = $arIblockOfferProps;
}
if ($arParams['USE_COMPARE']) {
$delimiter = strpos($arParams['COMPARE_URL'], '?') ? '&' : '?';
//$arResult['COMPARE_URL'] = str_replace("#ACTION_CODE#", "ADD_TO_COMPARE_LIST",$arParams['COMPARE_URL']).$delimiter."id=".$arResult['ID'];
$arResult['COMPARE_URL'] = htmlspecialcharsbx($APPLICATION->GetCurPageParam("action=ADD_TO_COMPARE_LIST&id=" . $arResult['ID'], array("action", "id")));
}
if ($arParams["SHOW_KIT_PARTS"] == "Y") {
//const TYPE_SET = 1;
//const TYPE_GROUP = 2;
$arSetItems = array();
$arResult["SET_ITEMS_IDS"] = array();
$arSets = CCatalogProductSet::getAllSetsByProduct($arResult["ID"], 1);
if (is_array($arSets) && $arSets) {
foreach ($arSets as $key => $set) {
foreach ($set["ITEMS"] as $i => $val) {
$arSetItems[] = $val["ITEM_ID"];
$arResult["SET_ITEMS_IDS"][$val["ITEM_ID"]] = $val;
}
}
$arResultPrices = CIBlockPriceTools::GetCatalogPrices($arParams["IBLOCK_ID"], $arParams["PRICE_CODE"]);
$arSelect = array("ID", "IBLOCK_ID", "NAME", "DETAIL_PAGE_URL", "PREVIEW_PICTURE", "DETAIL_PICTURE");
foreach ($arResultPrices as &$value) {
if ($value['CAN_VIEW'] && $value['CAN_BUY']) {
$arSelect[] = $value["SELECT"];
}
}
if (!empty($arSetItems)) {
示例8:
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;
}
$prodsSet = CCatalogProductSet::getAllSetsByProduct($kitsIDs[0], CCatalogProductSet::TYPE_SET);