本文整理汇总了PHP中CIBlockPriceTools::CheckProductProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockPriceTools::CheckProductProperties方法的具体用法?PHP CIBlockPriceTools::CheckProductProperties怎么用?PHP CIBlockPriceTools::CheckProductProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockPriceTools
的用法示例。
在下文中一共展示了CIBlockPriceTools::CheckProductProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtoupper
} else {
$action = strtoupper($_REQUEST[$arParams["ACTION_VARIABLE"]]);
}
$productID = intval($_REQUEST[$arParams["PRODUCT_ID_VARIABLE"]]);
if (($action == "ADD2BASKET" || $action == "BUY" || $action == "SUBSCRIBE_PRODUCT") && $productID > 0) {
if (CModule::IncludeModule("sale") && CModule::IncludeModule("catalog")) {
if ($arParams["USE_PRODUCT_QUANTITY"]) {
$QUANTITY = intval($_POST[$arParams["PRODUCT_QUANTITY_VARIABLE"]]);
}
if ($QUANTITY <= 1) {
$QUANTITY = 1;
}
$product_properties = array();
if (count($arParams["PRODUCT_PROPERTIES"])) {
if (is_array($_POST[$arParams["PRODUCT_PROPS_VARIABLE"]])) {
$product_properties = CIBlockPriceTools::CheckProductProperties($arParams["IBLOCK_ID"], $productID, $arParams["PRODUCT_PROPERTIES"], $_POST[$arParams["PRODUCT_PROPS_VARIABLE"]]);
if (!is_array($product_properties)) {
$strError = GetMessage("CATALOG_ERROR2BASKET") . ".";
}
} else {
$strError = GetMessage("CATALOG_ERROR2BASKET") . ".";
}
}
if (is_array($arParams["OFFERS_CART_PROPERTIES"])) {
foreach ($arParams["OFFERS_CART_PROPERTIES"] as $i => $pid) {
if ($pid === "") {
unset($arParams["OFFERS_CART_PROPERTIES"][$i]);
}
}
if (!empty($arParams["OFFERS_CART_PROPERTIES"])) {
$product_properties = CIBlockPriceTools::GetOfferProperties($productID, $arParams["IBLOCK_ID"], $arParams["OFFERS_CART_PROPERTIES"]);
示例2: strtoupper
} else {
$action = strtoupper($_REQUEST[$arParams["ACTION_VARIABLE"]]);
}
$productID = (int) $_REQUEST[$arParams["PRODUCT_ID_VARIABLE"]];
if (($action == "ADD2BASKET" || $action == "BUY" || $action == "SUBSCRIBE_PRODUCT") && $productID > 0) {
if (Loader::includeModule("sale") && Loader::includeModule("catalog")) {
$addByAjax = isset($_REQUEST['ajax_basket']) && 'Y' == $_REQUEST['ajax_basket'];
$QUANTITY = 0;
$product_properties = array();
$intProductIBlockID = (int) CIBlockElement::GetIBlockByID($productID);
if (0 < $intProductIBlockID) {
if ($arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y') {
if ($intProductIBlockID == $arParams["IBLOCK_ID"]) {
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);
}
}
示例3: 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") . ".");
}
}