當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCatalogSKU::getInfoByIblock方法代碼示例

本文整理匯總了PHP中CCatalogSKU::getInfoByIblock方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCatalogSKU::getInfoByIblock方法的具體用法?PHP CCatalogSKU::getInfoByIblock怎麽用?PHP CCatalogSKU::getInfoByIblock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CCatalogSKU的用法示例。


在下文中一共展示了CCatalogSKU::getInfoByIblock方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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") . ".");
     }
 }
開發者ID:akniyev,項目名稱:arteva.ru,代碼行數:51,代碼來源:class.php


注:本文中的CCatalogSKU::getInfoByIblock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。