本文整理汇总了PHP中CIBlockPriceTools::GetOfferProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockPriceTools::GetOfferProperties方法的具体用法?PHP CIBlockPriceTools::GetOfferProperties怎么用?PHP CIBlockPriceTools::GetOfferProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockPriceTools
的用法示例。
在下文中一共展示了CIBlockPriceTools::GetOfferProperties方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetMessage
if (!empty($arParams["PRODUCT_PROPERTIES"])) {
if (isset($_REQUEST[$arParams["PRODUCT_PROPS_VARIABLE"]]) && is_array($_REQUEST[$arParams["PRODUCT_PROPS_VARIABLE"]])) {
$product_properties = CIBlockPriceTools::CheckProductProperties($arParams["IBLOCK_ID"], $productID, $arParams["PRODUCT_PROPERTIES"], $_REQUEST[$arParams["PRODUCT_PROPS_VARIABLE"]], $arParams['PARTIAL_PRODUCT_PROPERTIES'] == 'Y');
if (!is_array($product_properties)) {
$strError = GetMessage("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR");
$successfulAdd = false;
}
} else {
$strError = GetMessage("CATALOG_EMPTY_BASKET_PROPERTIES_ERROR");
$successfulAdd = false;
}
}
} else {
$skuAddProps = isset($_REQUEST['basket_props']) && !empty($_REQUEST['basket_props']) ? $_REQUEST['basket_props'] : '';
if (!empty($arParams["OFFERS_CART_PROPERTIES"]) || !empty($skuAddProps)) {
$product_properties = CIBlockPriceTools::GetOfferProperties($productID, $arParams["IBLOCK_ID"], $arParams["OFFERS_CART_PROPERTIES"], $skuAddProps);
}
}
}
if ($arParams["USE_PRODUCT_QUANTITY"]) {
if (isset($_REQUEST[$arParams["PRODUCT_QUANTITY_VARIABLE"]])) {
$QUANTITY = doubleval($_REQUEST[$arParams["PRODUCT_QUANTITY_VARIABLE"]]);
}
}
if (0 >= $QUANTITY) {
$rsRatios = CCatalogMeasureRatio::getList(array(), array('PRODUCT_ID' => $productID), false, false, array('PRODUCT_ID', 'RATIO'));
if ($arRatio = $rsRatios->Fetch()) {
$intRatio = (int) $arRatio['RATIO'];
$dblRatio = doubleval($arRatio['RATIO']);
$QUANTITY = $dblRatio > $intRatio ? $dblRatio : $intRatio;
}
示例2: define
<?php
define("NOT_CHECK_PERMISSIONS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if (!CModule::IncludeModule("catalog")) {
return;
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["action"]) > 0 && check_bitrix_sessid()) {
$APPLICATION->RestartBuffer();
switch ($_POST["action"]) {
case "catalogSetAdd2Basket":
if (is_array($_POST["set_ids"])) {
foreach ($_POST["set_ids"] as $itemID) {
$product_properties = true;
if (!empty($_POST["setOffersCartProps"])) {
$product_properties = CIBlockPriceTools::GetOfferProperties($itemID, $_POST["iblockId"], $_POST["setOffersCartProps"]);
}
$ratio = 1;
if ($_POST["itemsRatio"][$itemID]) {
$ratio = $_POST["itemsRatio"][$itemID];
}
if (intval($itemID)) {
Add2BasketByProductID(intval($itemID), $ratio, array("LID" => $_POST["lid"]), $product_properties);
}
}
}
break;
case "ajax_recount_prices":
if (strlen($_POST["currency"]) > 0) {
$arPices = array("formatSum" => "", "formatOldSum" => "", "formatDiscDiffSum" => "");
if ($_POST["sumPrice"]) {
示例3: 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));
}
//.........这里部分代码省略.........
示例4: ToUpper
} else {
$action = ToUpper($_REQUEST[$arParams["ACTION_VARIABLE"]]);
}
$productID = intval($_REQUEST[$arParams["PRODUCT_ID_VARIABLE"]]);
//get props sku
$product_properties = array();
$arPropsSku = array();
$arParentSku = CCatalogSku::GetProductInfo($productID);
if ($arParentSku && count($arParentSku) > 0) {
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $productID), 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($productID, $arParentSku["IBLOCK_ID"], $arPropsSku);
}
if (($action == "ADD2BASKET" || $action == "BUY") && $productID > 0) {
if (CModule::IncludeModule('catalog')) {
Add2BasketByProductID($productID, 1, array(), $product_properties);
}
if ($action == "BUY") {
LocalRedirect($arParams["BASKET_URL"]);
} else {
LocalRedirect($APPLICATION->GetCurPageParam("", array($arParams["PRODUCT_ID_VARIABLE"], $arParams["ACTION_VARIABLE"])));
}
}
}
//end add to basket
$arViewed = array();
$arViewedId = array();
示例5: array
$arProps = array();
if (strpos($newProductId['XML_ID'], '#') === false) {
$parentIterator = \Bitrix\Iblock\ElementTable::getList(array('select' => array('ID', 'XML_ID'), 'filter' => array('ID' => $parentId)));
if ($parentProduct = $parentIterator->fetch()) {
$newProductId['XML_ID'] = $parentProduct['XML_ID'] . '#' . $newProductId['XML_ID'];
}
unset($parentProduct, $parentIterator);
}
$arFields["PRODUCT_XML_ID"] = $newProductId['XML_ID'];
$propertyIterator = \Bitrix\Iblock\PropertyTable::getList(array('select' => array('ID', 'CODE'), 'filter' => array('IBLOCK_ID' => $newProductId['IBLOCK_ID'], '!ID' => $sku['SKU_PROPERTY_ID'])));
while ($property = $propertyIterator->fetch()) {
$property['CODE'] = (string) $property['CODE'];
$arPropsSku[] = $property['CODE'] != '' ? $property['CODE'] : $property['ID'];
}
unset($property, $propertyIterator);
$product_properties = CIBlockPriceTools::GetOfferProperties($newProductId['ID'], $sku['PRODUCT_IBLOCK_ID'], $arPropsSku);
$newValues = array();
foreach ($product_properties as $productSkuProp) {
$bFieldExists = false;
foreach ($strOffersProps as $existingSkuProp) {
if ($existingSkuProp == $productSkuProp["CODE"]) {
$bFieldExists = true;
break;
}
}
if ($bFieldExists === true) {
$newValues[] = array("NAME" => $productSkuProp["NAME"], "CODE" => $productSkuProp["CODE"], "VALUE" => $productSkuProp["VALUE"], "SORT" => $productSkuProp["SORT"]);
}
}
$newValues[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $newProductId["XML_ID"]);
$arFields['PROPS'] = isset($arItem['PROPS']) ? updateBasketOffersProps($arItem['PROPS'], $newValues) : $newValues;
示例6: addProductToBasket
/**
* Process Puy Product.
*
* @param int $productID
* @param float $quantity
* @param array $values
* @param array $arRewriteFields
* @throws void|Bitrix\Main\SystemException
*/
protected function addProductToBasket($productID, $quantity, $values = array(), $arRewriteFields = array())
{
$productProperties = array();
$productID = (int) $productID;
$intProductIBlockID = (int) CIBlockElement::GetIBlockByID($productID);
if ($intProductIBlockID > 0) {
$productCatalogInfo = CCatalogSKU::getInfoByIblock($intProductIBlockID);
$isOffer = CCatalogSKU::TYPE_OFFERS == $productCatalogInfo['CATALOG_TYPE'];
if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y') {
// Is not offer
if (!$isOffer) {
// Props not empty
if (!empty($this->arParams['CART_PROPERTIES'][$intProductIBlockID])) {
$productProperties = CIBlockPriceTools::CheckProductProperties($intProductIBlockID, $productID, $this->arParams['CART_PROPERTIES'][$intProductIBlockID], $values, $this->arParams['PARTIAL_PRODUCT_PROPERTIES'] == 'Y');
if (!is_array($productProperties)) {
throw new SystemException(Loc::getMessage("CVP_PARTIAL_BASKET_PROPERTIES_ERROR"));
}
}
} else {
if (!empty($this->arParams['CART_PROPERTIES'][$intProductIBlockID])) {
$productProperties = CIBlockPriceTools::GetOfferProperties($productID, $productCatalogInfo['PRODUCT_IBLOCK_ID'], $this->arParams['CART_PROPERTIES'][$intProductIBlockID]);
}
}
}
if (0 >= $quantity) {
$rsRatios = CCatalogMeasureRatio::getList(array(), array('PRODUCT_ID' => $productID), false, false, array('PRODUCT_ID', 'RATIO'));
if ($arRatio = $rsRatios->Fetch()) {
$intRatio = (int) $arRatio['RATIO'];
$dblRatio = (double) $arRatio['RATIO'];
$quantity = $dblRatio > $intRatio ? $dblRatio : $intRatio;
}
}
if (0 >= $quantity) {
$quantity = 1;
}
} else {
throw new SystemException(Loc::getMessage('CVP_CATALOG_PRODUCT_NOT_FOUND') . ".");
}
if (!Add2BasketByProductID($productID, $quantity, $arRewriteFields, $productProperties)) {
throw new SystemException(Loc::getMessage("CVP_CATALOG_ERROR2BASKET") . ".");
}
}
示例7: 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);
}
}
}
}
}
//.........这里部分代码省略.........
示例8: array
} else {
$dbViewsList = CSaleViewedProduct::GetList(array(), array("FUSER_ID" => $arFuserItems["ID"], "PRODUCT_ID" => $PRODUCT_ID), false, false);
$arViews = $dbViewsList->Fetch();
}
if (strlen($viewedError) <= 0) {
$arFields = array("PROPS" => array());
$arParentSku = CCatalogSku::GetProductInfo($PRODUCT_ID);
if ($arParentSku && count($arParentSku) > 0) {
$arPropsSku = array();
$dbProduct = CIBlockElement::GetList(array(), array("ID" => $PRODUCT_ID), false, false, array('IBLOCK_ID'));
$arProduct = $dbProduct->Fetch();
$dbOfferProperties = CIBlock::GetProperties($arProduct["IBLOCK_ID"], array(), array("!XML_ID" => "CML2_LINK"));
while ($arOfferProperties = $dbOfferProperties->Fetch()) {
$arPropsSku[] = $arOfferProperties["CODE"];
}
$arFields["PROPS"] = CIBlockPriceTools::GetOfferProperties($PRODUCT_ID, $arParentSku["IBLOCK_ID"], $arPropsSku);
}
$arFields["USER_ID"] = $ID;
$arFields["PRODUCT_ID"] = $PRODUCT_ID;
$arFields["PRICE"] = $arViews["PRICE"];
$arFields["CURRENCY"] = $arViews["CURRENCY"];
$arFields["QUANTITY"] = 1;
$arFields["LID"] = $arViews["LID"];
$arFields["DETAIL_PAGE_URL"] = $arViews["DETAIL_PAGE_URL"];
$arFields["NAME"] = $arViews["NAME"];
$arFields["CAN_BUY"] = "Y";
$arFields["TYPE"] = $arViews["TYPE"];
$arFields["MODULE"] = $arViews["MODULE"];
if ($arViews["MODULE"] == "catalog") {
$arFields["CALLBACK_FUNC"] = "CatalogBasketCallback";
$arFields["ORDER_CALLBACK_FUNC"] = "CatalogBasketOrderCallback";