当前位置: 首页>>代码示例>>PHP>>正文


PHP CCatalogProduct::GetProductSections方法代码示例

本文整理汇总了PHP中CCatalogProduct::GetProductSections方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogProduct::GetProductSections方法的具体用法?PHP CCatalogProduct::GetProductSections怎么用?PHP CCatalogProduct::GetProductSections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCatalogProduct的用法示例。


在下文中一共展示了CCatalogProduct::GetProductSections方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CalculateAffiliate

 function CalculateAffiliate($affiliate, $dateFrom = false, $dateTo = false, $datePlanFrom = false, $datePlanTo = false)
 {
     global $DB;
     // Prepare function params - affiliate
     $arAffiliate = CSaleAffiliate::CheckAffiliateFunc($affiliate);
     if (!$arAffiliate) {
         return False;
     }
     $db_events = GetModuleEvents("sale", "OnBeforeAffiliateCalculate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array(&$arAffiliate, &$dateFrom, &$dateTo, &$datePlanFrom, &$datePlanTo)) === false) {
             return false;
         }
     }
     $affiliateID = IntVal($arAffiliate["ID"]);
     if (!$dateFrom || StrLen($dateFrom) <= 0) {
         if (StrLen($arAffiliate["LAST_CALCULATE"]) > 0) {
             $dateFrom = $arAffiliate["LAST_CALCULATE"];
         } else {
             $dateFrom = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), mktime(0, 0, 0, 1, 1, 1990));
         }
     }
     if (!$dateTo || StrLen($dateTo) <= 0) {
         $dateTo = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), time() + CTimeZone::GetOffset());
     }
     // Get affiliate plan
     $arAffiliatePlan = CSaleAffiliate::SetAffiliatePlan($arAffiliate, $datePlanFrom, $datePlanTo);
     if (!$arAffiliatePlan) {
         return False;
     }
     if ($arAffiliatePlan && !is_array($arAffiliatePlan)) {
         return true;
     }
     // Get affiliate plan params
     $arPlanSections = array();
     $dbPlanSection = CSaleAffiliatePlanSection::GetList(array(), array("PLAN_ID" => $arAffiliate["PLAN_ID"]), false, false, array("ID", "MODULE_ID", "SECTION_ID", "RATE", "RATE_TYPE", "RATE_CURRENCY"));
     while ($arPlanSection = $dbPlanSection->Fetch()) {
         $arPlanSections[$arPlanSection["MODULE_ID"] . $arPlanSection["SECTION_ID"]] = $arPlanSection;
     }
     // Get affiliate parents
     $arAffiliateParents = array();
     $affiliateParent = IntVal($arAffiliate["AFFILIATE_ID"]);
     $count = 0;
     while ($affiliateParent > 0 && $count < 5) {
         $dbAffiliateParent = CSaleAffiliate::GetList(array(), array("ID" => $affiliateParent, "ACTIVE" => "Y"), false, false, array("ID", "AFFILIATE_ID"));
         if ($arAffiliateParent = $dbAffiliateParent->Fetch()) {
             $count++;
             $arAffiliateParents[] = $affiliateParent;
             $affiliateParent = IntVal($arAffiliateParent["AFFILIATE_ID"]);
         } else {
             $affiliateParent = 0;
         }
     }
     // Get tier
     if (!array_key_exists("SALE_AFFILIATE_TIER_TMP_CACHE", $GLOBALS)) {
         $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"] = array();
     }
     if (!array_key_exists($arAffiliate["SITE_ID"], $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"])) {
         $dbAffiliateTier = CSaleAffiliateTier::GetList(array(), array("SITE_ID" => $arAffiliate["SITE_ID"]), false, false, array("RATE1", "RATE2", "RATE3", "RATE4", "RATE5"));
         if ($arAffiliateTier = $dbAffiliateTier->Fetch()) {
             $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"][$arAffiliate["SITE_ID"]] = array(DoubleVal($arAffiliateTier["RATE1"]), DoubleVal($arAffiliateTier["RATE2"]), DoubleVal($arAffiliateTier["RATE3"]), DoubleVal($arAffiliateTier["RATE4"]), DoubleVal($arAffiliateTier["RATE5"]));
         } else {
             $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"][$arAffiliate["SITE_ID"]] = array(0, 0, 0, 0, 0);
         }
     }
     // Orders cicle
     $affiliateSum = 0;
     $affiliateCurrency = CSaleLang::GetLangCurrency($arAffiliate["SITE_ID"]);
     $dbOrders = \Bitrix\Sale\Internals\OrderTable::getList(array('filter' => array("=ALLOW_DELIVERY" => 'Y', ">=DATE_ALLOW_DELIVERY" => $dateFrom, "<DATE_ALLOW_DELIVERY" => $dateTo, "=AFFILIATE_ID" => $affiliateID, "=LID" => $arAffiliate["SITE_ID"], "=CANCELED" => 'N'), 'select' => array("ID", "LID", "PRICE_DELIVERY", "PRICE", "CURRENCY", "TAX_VALUE", "AFFILIATE_ID", "BASKET_QUANTITY" => 'BASKET.QUANTITY', "BASKET_PRODUCT_ID" => 'BASKET.PRODUCT_ID', "BASKET_MODULE" => 'BASKET.MODULE', "BASKET_PRICE" => 'BASKET.PRICE', "BASKET_CURRENCY" => 'BASKET.CURRENCY', "BASKET_DISCOUNT_PRICE" => 'BASKET.DISCOUNT_PRICE'), 'order' => array('ID' => 'ASC')));
     $fOrderId = "";
     while ($arOrder = $dbOrders->fetch()) {
         $arProductSections = array();
         if (!array_key_exists("SALE_PRODUCT_SECTION_CACHE", $GLOBALS)) {
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = array();
         }
         if (array_key_exists($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"], $GLOBALS["SALE_PRODUCT_SECTION_CACHE"])) {
             $arProductSections = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"][$arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"]];
             unset($GLOBALS["SALE_PRODUCT_SECTION_CACHE"][$arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"]]);
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] + array($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"] => $arProductSections);
         } else {
             if ($arOrder["BASKET_MODULE"] == "catalog") {
                 CModule::IncludeModule("catalog");
                 $arSku = CCatalogSku::GetProductInfo($arOrder["BASKET_PRODUCT_ID"]);
                 if ($arSku && count($arSku) > 0) {
                     $elementId = $arSku["ID"];
                 } else {
                     $elementId = $arOrder["BASKET_PRODUCT_ID"];
                 }
                 $arProductSections = CCatalogProduct::GetProductSections($elementId);
             } else {
                 $events = GetModuleEvents("sale", "OnAffiliateGetSections");
                 if ($arEvent = $events->Fetch()) {
                     $arProductSections = ExecuteModuleEventEx($arEvent, array($arOrder["BASKET_MODULE"], $arOrder["BASKET_PRODUCT_ID"]));
                 }
             }
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] + array($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"] => $arProductSections);
             if (count($GLOBALS["SALE_PRODUCT_SECTION_CACHE"]) > 20) {
                 array_shift($GLOBALS["SALE_PRODUCT_SECTION_CACHE"]);
             }
         }
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:affiliate.php


注:本文中的CCatalogProduct::GetProductSections方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。