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


PHP CCatalog类代码示例

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


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

示例1: getOfferObject

 public static function getOfferObject(array $offerParams)
 {
     if (!isset($offerParams["IBLOCK_ID"]) || intval($offerParams["IBLOCK_ID"]) <= 0) {
         throw new SystemException("Incorrect iBlock ID  (" . __CLASS__ . "::" . __METHOD__ . ")");
     }
     $arCatalog = \CCatalog::GetByIDExt($offerParams["IBLOCK_ID"]);
     if (empty($arCatalog)) {
         throw new SystemException("IBlock is not catalog. (" . __CLASS__ . "::" . __METHOD__ . ")");
     }
     $catalogType = $arCatalog["CATALOG_TYPE"];
     $catalogTypes = \CCatalogSKU::GetCatalogTypes();
     if (!in_array($catalogType, $catalogTypes)) {
         throw new SystemException("Unknown type of catalog (" . __CLASS__ . "::" . __METHOD__ . ")");
     }
     $result = array();
     switch ($catalogType) {
         case \CCatalogSKU::TYPE_CATALOG:
         case \CCatalogSKU::TYPE_OFFERS:
             $result = new ExportOffer($catalogType, $offerParams);
             break;
         case \CCatalogSKU::TYPE_PRODUCT:
         case \CCatalogSKU::TYPE_FULL:
             $result = new ExportOfferSKU($catalogType, $offerParams);
             break;
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:27,代码来源:exportoffercreator.php

示例2: GetList

 function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     $arFields = array("ID" => array("FIELD" => "CPG.ID", "TYPE" => "int"), "PRODUCT_ID" => array("FIELD" => "CPG.PRODUCT_ID", "TYPE" => "int"), "GROUP_ID" => array("FIELD" => "CPG.GROUP_ID", "TYPE" => "int"), "ACCESS_LENGTH" => array("FIELD" => "CPG.ACCESS_LENGTH", "TYPE" => "int"), "ACCESS_LENGTH_TYPE" => array("FIELD" => "CPG.ACCESS_LENGTH_TYPE", "TYPE" => "char"), "GROUP_ACTIVE" => array("FIELD" => "G.ACTIVE", "TYPE" => "char", "FROM" => "INNER JOIN b_group G ON (CPG.GROUP_ID = G.ID)"), "GROUP_NAME" => array("FIELD" => "G.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_group G ON (CPG.GROUP_ID = G.ID)"));
     $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     if (is_array($arGroupBy) && empty($arGroupBy)) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_product2group CPG " . "\t" . $arSqls["FROM"] . " ";
         if (!empty($arSqls["WHERE"])) {
             $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (!empty($arSqls["GROUPBY"])) {
             $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return False;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_product2group CPG " . "\t" . $arSqls["FROM"] . " ";
     if (!empty($arSqls["WHERE"])) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (!empty($arSqls["GROUPBY"])) {
         $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
     }
     if (!empty($arSqls["ORDERBY"])) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) <= 0) {
         $strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_catalog_product2group CPG " . "\t" . $arSqls["FROM"] . " ";
         if (!empty($arSqls["WHERE"])) {
             $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (!empty($arSqls["GROUPBY"])) {
             $strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (empty($arSqls["GROUPBY"])) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             $cnt = $dbRes->SelectedRowsCount();
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) > 0) {
             $strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:product_group.php

示例3: GetList

 static function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     $arFields = array("ID" => array("FIELD" => "CP.ID", "TYPE" => "int"), "PRODUCT_ID" => array("FIELD" => "CP.PRODUCT_ID", "TYPE" => "int"), "STORE_ID" => array("FIELD" => "CP.STORE_ID", "TYPE" => "int"), "AMOUNT" => array("FIELD" => "CP.AMOUNT", "TYPE" => "double"), "STORE_NAME" => array("FIELD" => "CS.TITLE", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_ADDR" => array("FIELD" => "CS.ADDRESS", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_DESCR" => array("FIELD" => "CS.DESCRIPTION", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_GPS_N" => array("FIELD" => "CS.GPS_N", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_GPS_S" => array("FIELD" => "CS.GPS_S", "TYPE" => "string", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_IMAGE" => array("FIELD" => "CS.IMAGE_ID", "TYPE" => "int", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"), "STORE_LOCATION" => array("FIELD" => "CS.LOCATION_ID", "TYPE" => "int", "FROM" => "RIGHT JOIN b_catalog_store CS ON (CS.ID = CP.STORE_ID)"));
     $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     if (is_array($arGroupBy) && count($arGroupBy) == 0) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_store_product CP " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return false;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_store_product CP " . "\t" . $arSqls["FROM"] . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (strlen($arSqls["GROUPBY"]) > 0) {
         $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) <= 0) {
         $strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_catalog_store_product CP " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             $cnt = $dbRes->SelectedRowsCount();
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) > 0) {
             $strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:store_product.php

示例4: getList

 static function getList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     $arFields = array("ID" => array("FIELD" => "DE.ID", "TYPE" => "int"), "DOC_ID" => array("FIELD" => "DE.DOC_ID", "TYPE" => "int"), "STORE_FROM" => array("FIELD" => "DE.STORE_FROM", "TYPE" => "int"), "STORE_TO" => array("FIELD" => "DE.STORE_TO", "TYPE" => "int"), "ELEMENT_ID" => array("FIELD" => "DE.ELEMENT_ID", "TYPE" => "int"), "AMOUNT" => array("FIELD" => "DE.AMOUNT", "TYPE" => "double"), "PURCHASING_PRICE" => array("FIELD" => "DE.PURCHASING_PRICE", "TYPE" => "double"), "IS_MULTIPLY_BARCODE" => array("FIELD" => "CP.BARCODE_MULTI", "TYPE" => "int", "FROM" => "INNER JOIN b_catalog_product CP ON (DE.ELEMENT_ID = CP.ID)"));
     $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     if (is_array($arGroupBy) && count($arGroupBy) == 0) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_docs_element DE " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return false;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_catalog_docs_element DE " . "\t" . $arSqls["FROM"] . " ";
     if (strlen($arSqls["WHERE"]) > 0) {
         $strSql .= "WHERE " . $arSqls["WHERE"] . " ";
     }
     if (strlen($arSqls["GROUPBY"]) > 0) {
         $strSql .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
     }
     if (strlen($arSqls["ORDERBY"]) > 0) {
         $strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
     }
     if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) <= 0) {
         $strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_catalog_docs_element DE " . "\t" . $arSqls["FROM"] . " ";
         if (strlen($arSqls["WHERE"]) > 0) {
             $strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
         }
         if (strlen($arSqls["GROUPBY"]) > 0) {
             $strSql_tmp .= "GROUP BY " . $arSqls["GROUPBY"] . " ";
         }
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (strlen($arSqls["GROUPBY"]) <= 0) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             $cnt = $dbRes->SelectedRowsCount();
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) > 0) {
             $strSql .= "LIMIT " . intval($arNavStartParams["nTopCount"]);
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:store_docs_element.php

示例5: GetInfoByLinkProperty

 public function GetInfoByLinkProperty($intPropertyID)
 {
     $ID = intval($intPropertyID);
     if (0 >= $intPropertyID) {
         return false;
     }
     $rsProducts = CCatalog::GetList(array(), array('SKU_PROPERTY_ID' => $intPropertyID), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID', 'SKU_PROPERTY_ID'));
     return $rsProducts->Fetch();
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:9,代码来源:catalog_sku.php

示例6: getCatalogList

 /**
  * Метод вернет список инфоблоков которые являются торговыми каталогами
  *
  * @return array
  */
 function getCatalogList()
 {
     $result = array();
     $selectedCatalog = getSelectedCatalog();
     $dbCatalog = CCatalog::GetList(array(), array(), false, false, array('ID', 'NAME'));
     while ($catalog = $dbCatalog->GetNext()) {
         if (in_array($catalog['ID'], $selectedCatalog)) {
             $catalog['SELECTED'] = true;
         }
         $result[] = $catalog;
     }
     return $result;
 }
开发者ID:ASDAFF,项目名称:module.markup,代码行数:18,代码来源:CQuetzalMarkupPriceOptionsEdit.php

示例7: executeComponent

 public function executeComponent()
 {
     $this->IBLOCK_ID = $this->arParams["IBLOCK_ID"];
     $this->SECTION_ID = $this->arParams["SECTION_ID"];
     $this->FILTER_NAME = $this->arParams["FILTER_NAME"];
     if (CModule::IncludeModule("catalog")) {
         $arCatalog = CCatalog::GetSkuInfoByProductID($this->IBLOCK_ID);
         if (is_array($arCatalog)) {
             $this->SKU_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
             $this->SKU_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
         }
     }
     /*DEMO CODE for "pure" class.php component
     		$this->arResult["FFF"] = "ggg";
     		$this->includeComponentTemplate();
     		return $this->ELEMENT_ID;
     		*/
     return parent::executeComponent();
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:19,代码来源:class.php

示例8: onPrepareComponentParams

 /**
  * @param $params
  * @override
  * @return array
  */
 public function onPrepareComponentParams($params)
 {
     if (Loader::includeModule("catalog")) {
         $catalogIterator = CCatalog::getList(array("IBLOCK_ID" => "ASC"));
         while ($row = $catalogIterator->fetch()) {
             $params['SHOW_PRODUCTS_' . $row['IBLOCK_ID']] = true;
         }
     }
     $params = parent::onPrepareComponentParams($params);
     if (!isset($params["CACHE_TIME"])) {
         $params["CACHE_TIME"] = 86400;
     }
     $params["DETAIL_URL"] = trim($params["DETAIL_URL"]);
     $params["MIN_BUYES"] = IntVal($params["MIN_BUYES"]);
     if ($params["MIN_BUYES"] <= 0) {
         $params["MIN_BUYES"] = 2;
     }
     if (isset($params['ID'])) {
         $params['ID'] = (int) $params["ID"];
     } else {
         $params['ID'] = -1;
     }
     if (isset($params['CODE'])) {
         $params['CODE'] = trim($params['CODE']);
     } else {
         $params['CODE'] = '';
     }
     if (isset($params['IBLOCK_ID'])) {
         $params['IBLOCK_ID'] = (int) $params['IBLOCK_ID'];
     } else {
         $params['IBLOCK_ID'] = -1;
     }
     $params['ID'] = CIBlockFindTools::getElementID($params["ID"], $params["CODE"], false, false, array("IBLOCK_ID" => $params["IBLOCK_ID"], "IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y"));
     if ($params["ID"] <= 0) {
         $this->errors[] = Loc::getMessage("SRP_PRODUCT_ID_REQUIRED");
     }
     return $params;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:43,代码来源:class.php

示例9: onBeforeIndex

 /**
  * @param array $fields		Item fields.
  * @return array
  */
 public function onBeforeIndex($fields)
 {
     if ($fields["MODULE_ID"] == "iblock") {
         $catalogs = \CCatalog::getList(array(), array('IBLOCK_ID' => $fields['PARAM2']), false, false, array('IBLOCK_ID'));
         if ($catalogs->fetch()) {
             $fields["PARAMS"]["iblock_section"] = array();
             if (strpos($fields['ITEM_ID'], 'S') === false) {
                 $sections = \CIBlockElement::getElementGroups($fields["ITEM_ID"], true, array('ID'));
                 while ($section = $sections->fetch()) {
                     $nav = \CIBlockSection::getNavChain($fields['PARAM2'], $section["ID"], array('ID'));
                     while ($chain = $nav->fetch()) {
                         $fields["PARAMS"]["iblock_section"][] = $chain['ID'];
                     }
                 }
             } else {
                 $nav = \CIBlockSection::getNavChain($fields['PARAM2'], preg_replace('#[^0-9]+#', '', $fields["ITEM_ID"]), array('ID'));
                 while ($chain = $nav->fetch()) {
                     $fields["PARAMS"]["iblock_section"][] = $chain['ID'];
                 }
             }
         }
     }
     return $fields;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:28,代码来源:searchhandlers.php

示例10: GetList


//.........这里部分代码省略.........
  *
  *
  *
  * @return CDBResult <p>Метод возвращает объект класса CDBResult.</p>
  *
  *
  * <h4>Example</h4> 
  * <pre>
  * if (CModule::IncludeModule("catalog"))
  * { 
  *    $arFilter = array('COUPON' =&gt; 'CP-R8RFW-5YGGPZJ'); 
  *    $dbCoupon = CCatalogDiscountCoupon::GetList (array(), $arFilter); 
  *    if($arCoupon = $dbCoupon-&gt;Fetch()) 
  *    { 
  *        echo "&lt;pre&gt;"; 
  *        print_r($arCoupon); 
  *        echo "&lt;/pre&gt;"; 
  *    } 
  *    else
  *    { 
  *        echo "купона нет"; 
  *    } 
  * }
  * </pre>
  *
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li><a href="http://dev.1c-bitrix.ru/api_help/catalog/fields.php">Структура таблицы</a></li> <li><a
  * href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/getbyid.php">CCatalogDiscountCoupon::GetByID</a></li>
  * </ul> </ht
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/getlist.php
  * @author Bitrix
  */
 public static function GetList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
 {
     global $DB;
     $arFields = array("ID" => array("FIELD" => "CD.ID", "TYPE" => "int"), "DISCOUNT_ID" => array("FIELD" => "CD.DISCOUNT_ID", "TYPE" => "string"), "ACTIVE" => array("FIELD" => "CD.ACTIVE", "TYPE" => "char"), "ONE_TIME" => array("FIELD" => "CD.ONE_TIME", "TYPE" => "char"), "COUPON" => array("FIELD" => "CD.COUPON", "TYPE" => "string"), "DATE_APPLY" => array("FIELD" => "CD.DATE_APPLY", "TYPE" => "datetime"), "DISCOUNT_NAME" => array("FIELD" => "CDD.NAME", "TYPE" => "string", "FROM" => "INNER JOIN b_catalog_discount CDD ON (CD.DISCOUNT_ID = CDD.ID)"), "DESCRIPTION" => array("FIELD" => "CD.DESCRIPTION", "TYPE" => "string"), "TIMESTAMP_X" => array("FIELD" => "CD.TIMESTAMP_X", "TYPE" => "datetime"), "MODIFIED_BY" => array("FIELD" => "CD.MODIFIED_BY", "TYPE" => "int"), "DATE_CREATE" => array("FIELD" => "CD.DATE_CREATE", "TYPE" => "datetime"), "CREATED_BY" => array("FIELD" => "CD.CREATED_BY", "TYPE" => "int"));
     $arSqls = CCatalog::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     if (empty($arGroupBy) && is_array($arGroupBy)) {
         $strSql = "SELECT " . $arSqls["SELECT"] . " FROM b_catalog_discount_coupon CD " . $arSqls["FROM"];
         if (!empty($arSqls["WHERE"])) {
             $strSql .= " WHERE " . $arSqls["WHERE"];
         }
         if (!empty($arSqls["GROUPBY"])) {
             $strSql .= " GROUP BY " . $arSqls["GROUPBY"];
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if ($arRes = $dbRes->Fetch()) {
             return $arRes["CNT"];
         } else {
             return false;
         }
     }
     $strSql = "SELECT " . $arSqls["SELECT"] . " FROM b_catalog_discount_coupon CD " . $arSqls["FROM"];
     if (!empty($arSqls["WHERE"])) {
         $strSql .= " WHERE " . $arSqls["WHERE"];
     }
     if (!empty($arSqls["GROUPBY"])) {
         $strSql .= " GROUP BY " . $arSqls["GROUPBY"];
     }
     if (!empty($arSqls["ORDERBY"])) {
         $strSql .= " ORDER BY " . $arSqls["ORDERBY"];
     }
     $intTopCount = 0;
     $boolNavStartParams = !empty($arNavStartParams) && is_array($arNavStartParams);
     if ($boolNavStartParams && array_key_exists('nTopCount', $arNavStartParams)) {
         $intTopCount = intval($arNavStartParams["nTopCount"]);
     }
     if ($boolNavStartParams && 0 >= $intTopCount) {
         $strSql_tmp = "SELECT COUNT('x') as CNT FROM b_catalog_discount_coupon CD " . $arSqls["FROM"];
         if (!empty($arSqls["WHERE"])) {
             $strSql_tmp .= " WHERE " . $arSqls["WHERE"];
         }
         if (!empty($arSqls["GROUPBY"])) {
             $strSql_tmp .= " GROUP BY " . $arSqls["GROUPBY"];
         }
         $dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $cnt = 0;
         if (empty($arSqls["GROUPBY"])) {
             if ($arRes = $dbRes->Fetch()) {
                 $cnt = $arRes["CNT"];
             }
         } else {
             $cnt = $dbRes->SelectedRowsCount();
         }
         $dbRes = new CDBResult();
         $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
     } else {
         if ($boolNavStartParams && 0 < $intTopCount) {
             $strSql .= " LIMIT " . $intTopCount;
         }
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     return $dbRes;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:discount_coupon.php

示例11: array

    $arFields = array("ACTIVE" => "Y", "FIELDS" => array('IBLOCK_SECTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y'), 'ACTIVE_FROM' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE_TO' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SORT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'PREVIEW_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'PREVIEW_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'PREVIEW_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'DETAIL_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'DETAIL_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y')), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_NAME' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'SECTION_DESCRIPTION_TYPE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => 'text'), 'SECTION_DESCRIPTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'SECTION_XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y'))), "CODE" => "clothes_offers", "XML_ID" => $iblockCodeOffers);
    $iblock->Update($IBLOCK_OFFERS_ID, $arFields);
}
if ($IBLOCK_CATALOG_ID) {
    $iblockCode = "clothes_" . WIZARD_SITE_ID;
    //IBlock fields
    $iblock = new CIBlock();
    $arFields = array("ACTIVE" => "Y", "FIELDS" => array('IBLOCK_SECTION' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'ACTIVE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y'), 'ACTIVE_FROM' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE_TO' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SORT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'PREVIEW_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'PREVIEW_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'PREVIEW_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'DETAIL_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'DETAIL_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'CODE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y')), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'SECTION_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'SECTION_DESCRIPTION_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'SECTION_DESCRIPTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'SECTION_XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_CODE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y'))), "CODE" => "clothes", "XML_ID" => $iblockCode);
    $iblock->Update($IBLOCK_CATALOG_ID, $arFields);
    if ($IBLOCK_OFFERS_ID) {
        $ID_SKU = CCatalog::LinkSKUIBlock($IBLOCK_CATALOG_ID, $IBLOCK_OFFERS_ID);
        $rsCatalogs = CCatalog::GetList(array(), array('IBLOCK_ID' => $IBLOCK_OFFERS_ID), false, false, array('IBLOCK_ID'));
        if ($arCatalog = $rsCatalogs->Fetch()) {
            CCatalog::Update($IBLOCK_OFFERS_ID, array('PRODUCT_IBLOCK_ID' => $IBLOCK_CATALOG_ID, 'SKU_PROPERTY_ID' => $ID_SKU));
        } else {
            CCatalog::Add(array('IBLOCK_ID' => $IBLOCK_OFFERS_ID, 'PRODUCT_IBLOCK_ID' => $IBLOCK_CATALOG_ID, 'SKU_PROPERTY_ID' => $ID_SKU));
        }
        //create facet index
        $index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_CATALOG_ID);
        $index->startIndex();
        $index->continueIndex(0);
        $index->endIndex();
        $index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_OFFERS_ID);
        $index->startIndex();
        $index->continueIndex(0);
        $index->endIndex();
        \Bitrix\Iblock\PropertyIndex\Manager::checkAdminNotification();
    }
    //user fields for sections
    $arLanguages = array();
    $rsLanguage = CLanguage::GetList($by, $order, array());
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:catalog3.php

示例12: CheckFields

 /**
  * <p>Метод служит для проверки (и корректировки, если это возможно) параметров, переданных в методы <a href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/add.php">CCatalogDiscountCoupon::Add</a> и <a href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/update.php">CCatalogDiscountCoupon::Update</a>.</p>
  *
  *
  *
  *
  * @param string $ACTION  указывает, для какого метода идет проверка. Возможные значения:
  * <br><ul> <li> <b>ADD</b> - для метода <a
  * href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/add.php">CCatalogDiscountCoupon::Add</a>;</li>
  * <li> <b>UPDATE</b> - для метода <a
  * href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/update.php">CCatalogDiscountCoupon::Update</a>.</li>
  * </ul>
  *
  *
  *
  * @param array &$arFields  Ассоциативный массив параметров купона. Массив передается по
  * ссылке и его значения могут быть изменены функцией. <br> Допустимые
  * ключи: <ul> <li> <b>DISCOUNT_ID</b> - код (ID) скидки;</li> <li> <b>ACTIVE</b> - флаг
  * активности купона (Y/N);</li> <li> <b>ONE_TIME</b> - флаг однократного
  * использования купона (Y|N);</li> <li> <b>COUPON</b> - код купона;</li> <li>
  * <b>DATE_APPLY</b> - дата применения купона;</li> <li> <b>DESCRIPTION</b> -
  * комментарий.</li> </ul>
  *
  *
  *
  * @param int $ID = 0 код (ID) купона (только для CCatalogDiscountCoupon::Update). </htm
  *
  *
  *
  * @return boolean <p> В случае корректности переданных параметров возвращает true,
  * иначе - false. Если функция вернула false, с помощью $APPLICATION-&gt;GetException()
  * можно получить текст ошибок.</p> <p><b>Обязательные проверки</b></p>
  * </htm<ul> <li>для <b>CCatalogDiscountCoupon::Add</b> <ul> <li>поле DISCOUNT_ID присутствует и
  * содержит код (ID) существующей скидки;</li> <li>если поле ACTIVE не
  * существует или не равно N, ему присваивается значение Y;</li> <li>если
  * поле ONE_TIME не существует или не равно N, ему присваивается значение
  * Y;</li> <li>поле COUPON существует и содержит уникальный код,
  * отсутствующий в списке купонов;</li> <li>если поле DATE_APPLY не
  * существует или не содержит корректную дату, ему присваивается
  * значение false.</li> </ul> <br> </li> <li>для <b>CCatalogDiscountCoupon::Update</b> <ul> <li>если
  * поле DISCOUNT_ID присутствует, оно должно содержать код (ID)
  * существующей скидки;</li> <li>если поле ACTIVE существует и не равно N,
  * ему присваивается значение Y;</li> <li>если поле ONE_TIME существует и не
  * равно N, ему присваивается значение Y;</li> <li>если поле COUPON
  * существует, оно содержит уникальный код, заданный только для
  * этого купона (с таким ID);</li> <li>если поле DATE_APPLY существует и
  * содержит некорректную дату, ему присваивается значение false.</li> </ul>
  * </li> </ul>
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li><a href="http://dev.1c-bitrix.ru/api_help/catalog/fields.php">Структура таблицы</a></li> <li><a
  * href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/add.php">CCatalogDiscountCoupon::Add</a></li>
  * <li><a
  * href="http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/update.php">CCatalogDiscountCoupon::Update</a></li>
  * </ul> </ht<br><br>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogdiscountcoupon/checkfields.php
  * @author Bitrix
  */
 public static function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     global $DB;
     global $APPLICATION;
     global $USER;
     $ACTION = strtoupper($ACTION);
     if ('UPDATE' != $ACTION && 'ADD' != $ACTION) {
         return false;
     }
     if ((is_set($arFields, "DISCOUNT_ID") || $ACTION == "ADD") && intval($arFields["DISCOUNT_ID"]) <= 0) {
         $APPLICATION->ThrowException(GetMessage("KGDC_EMPTY_DISCOUNT"), "EMPTY_DISCOUNT_ID");
         return false;
     }
     if ((is_set($arFields, "COUPON") || $ACTION == "ADD") && strlen($arFields["COUPON"]) <= 0) {
         $APPLICATION->ThrowException(GetMessage("KGDC_EMPTY_COUPON"), "EMPTY_COUPON");
         return false;
     } elseif (is_set($arFields, "COUPON")) {
         $arFilter = array("COUPON" => substr($arFields["COUPON"], 0, 32));
         if ($ID > 0) {
             $arFilter["!ID"] = $ID;
         }
         $rsCoupon = CCatalogDiscountCoupon::GetList(array(), $arFilter);
         if ($arCoupon = $rsCoupon->Fetch()) {
             $APPLICATION->ThrowException(GetMessage("KGDC_DUPLICATE_COUPON"), "DUPLICATE_COUPON");
             return false;
         }
     }
     if ((is_set($arFields, "ACTIVE") || $ACTION == "ADD") && $arFields["ACTIVE"] != "N") {
         $arFields["ACTIVE"] = "Y";
     }
     if ((is_set($arFields, "ONE_TIME") || $ACTION == "ADD") && !in_array($arFields["ONE_TIME"], self::GetCoupontTypes())) {
         $arFields["ONE_TIME"] = self::TYPE_ONE_TIME;
     }
     if ((is_set($arFields, "DATE_APPLY") || $ACTION == "ADD") && !$DB->IsDate($arFields["DATE_APPLY"], false, SITE_ID, "FULL")) {
         $arFields["DATE_APPLY"] = false;
     }
     $intUserID = 0;
     $boolUserExist = CCatalog::IsUserExists();
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:discount_coupon.php

示例13: CCatalog

			{
				if (0 < $arIBlockInfo['PRODUCT_IBLOCK_ID'])
				{
					if ($intIBlockID != $arNewIBlocksList[$arIBlockInfo['PRODUCT_IBLOCK_ID']]['OFFERS_IBLOCK_ID'])
					{
						$arCurrentIBlocks[$intIBlockID]['UNLINK'] = 'Y';
					}
				}
			}
		}
		// go exist iblock
		$boolCatalogUpdate = false;
		if ($boolFlag)
		{
			$DB->StartTransaction();
			$obCatalog = new CCatalog();
			foreach ($arCurrentIBlocks as $intIBlockID => $arIBlockInfo)
			{
				$boolAttr = true;
				if (isset($arIBlockInfo['UNLINK']) && 'Y' == $arIBlockInfo['UNLINK'])
				{
					$boolFlag = $obCatalog->UnLinkSKUIBlock($arIBlockInfo['PRODUCT_IBLOCK_ID']);
					if ($boolFlag)
					{
						$arIBlockInfo['PRODUCT_IBLOCK_ID'] = 0;
						$arIBlockInfo['SKU_PROPERTY_ID'] = 0;
						$boolCatalogUpdate = true;
					}
					else
					{
						$boolFlag = false;
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:31,代码来源:options.php

示例14: init

 public static function init()
 {
     IncludeModuleLangFile(__FILE__);
     if (!self::$fInit) {
         self::$fInit = true;
         self::$siteCookieId = md5('SALE_REPORT_SITE_ID');
         // Initializing list of sites.
         $result = Bitrix\Main\SiteTable::getList(array('select' => array('LID', 'DEF', 'NAME')));
         $i = 0;
         while ($row = $result->fetch()) {
             self::$sitelist[$row['LID']] = $row['NAME'];
             if (++$i === 1) {
                 self::$defaultSiteId = $row['LID'];
             } else {
                 if ($row['DEF'] === 'Y') {
                     self::$defaultSiteId = $row['LID'];
                 }
             }
             self::$weightOptions[$row['LID']] = array('unit' => COption::GetOptionString('sale', 'weight_unit', null, $row['LID']), 'koef' => COption::GetOptionInt('sale', 'weight_koef', null, $row['LID']));
         }
         unset($i, $row, $result);
         // hack, add virtual ID field into StatusLang entity for filtering
         $statusEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\StatusLang');
         if ($statusEntity instanceof \Bitrix\Main\Entity\Base) {
             $statusEntity->addField(array('data_type' => 'string', 'expression' => array('%s', 'STATUS_ID')), 'ID');
         }
         unset($statusEntity);
         // hack, add virtual REPS_ORDER field into Shipment entity for filtering system records
         $shipmentEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\Shipment');
         if ($shipmentEntity instanceof \Bitrix\Main\Entity\Base) {
             $shipmentEntity->addField(array('data_type' => 'Order', 'reference' => array('=ref.ID' => 'this.ORDER_ID', '!=this.SYSTEM' => array('?', 'Y'))), 'REPS_ORDER');
         }
         unset($shipmentEntity);
         // Initializing list of statuses of orders.
         $result = Bitrix\Sale\Internals\StatusLangTable::getList(array('select' => array('STATUS_ID', 'NAME'), 'filter' => array('=LID' => LANGUAGE_ID)));
         while ($row = $result->fetch()) {
             self::$statuslist[$row['STATUS_ID']] = $row['NAME'];
         }
         unset($row, $result);
         self::$genders = array('M' => GetMessage('USER_MALE'), 'F' => GetMessage('USER_FEMALE'));
         // Initializing list of person types.
         $result = Bitrix\Sale\Internals\PersonTypeTable::getList(array('select' => array('ID', 'LID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$personTypes[$row['ID']] = array('LID' => $row['LID'], 'NAME' => $row['NAME']);
         }
         unset($row, $result);
         // Initializing list of pay systems of orders.
         $result = Bitrix\Sale\PaySystemTable::getList(array('select' => array('ID', 'LID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$paySystemList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => $row['LID']);
         }
         unset($row, $result);
         // Initializing list of services and methods of delivery.
         $result = \Bitrix\Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$deliveryList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => '');
         }
         unset($row, $result);
         // Obtaining table of correspondences of iblocks to sites.
         $result = Bitrix\Iblock\IblockSiteTable::getList();
         while ($row = $result->fetch()) {
             self::$iblockSite[$row['SITE_ID']][] = $row['IBLOCK_ID'];
         }
         unset($row, $result);
         // Obtaining the list of iblocks which are directories and filling
         // a property $catalogSections with sections of these units.
         $ent = new CCatalog();
         $result = $ent->GetList();
         while ($ibRow = $result->Fetch()) {
             // Obtaining list of sections of the catalog.
             self::$catalogs[] = $ibRow;
             $path = array();
             $curLevel = $prevLevel = 0;
             $sections = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $ibRow['IBLOCK_ID']));
             $row = null;
             while ($row = $sections->GetNext()) {
                 // Formation of an array of identifiers of current and parent sections.
                 $curLevel = $row['DEPTH_LEVEL'];
                 for ($i = 0; $i <= $prevLevel - $curLevel; $i++) {
                     array_pop($path);
                 }
                 array_push($path, $row['ID']);
                 $prevLevel = $curLevel;
                 self::$catalogSections[$row['ID']] = array('name' => ltrim(str_repeat(' . ', $curLevel) . $row['NAME']), 'path' => $path, 'catalog' => array('ID' => $ibRow['ID'], 'NAME' => $ibRow['NAME']));
             }
         }
         unset($ent, $ibRow, $row, $sections, $result);
         // Initialization of the list of warehouses.
         $result = Bitrix\Catalog\StoreTable::getList(array('select' => array('ID', 'TITLE')));
         while ($row = $result->fetch()) {
             self::$productStores[$row['ID']] = $row['TITLE'];
         }
         unset($row, $result);
         // Getting currencies
         $obj = new CCurrency();
         $by = '';
         $order = '';
         $result = $obj->GetList($by, $order, LANGUAGE_ID);
         while ($row = $result->Fetch()) {
             self::$currencies[$row['CURRENCY']] = array('name' => $row['FULL_NAME']);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:sale_report_helper.php

示例15: __GetDiscountID

 protected function __GetDiscountID($arFilter)
 {
     global $DB;
     $arResult = array();
     $boolRest = array_key_exists('RESTRICTIONS', $arFilter);
     $arFields = array("DISCOUNT_ID" => array("FIELD" => "DC.DISCOUNT_ID", "TYPE" => "int"), "ACTIVE" => array("FIELD" => "DC.ACTIVE", "TYPE" => "char"), "USER_GROUP_ID" => array("FIELD" => "DC.USER_GROUP_ID", "TYPE" => "int"), "PRICE_TYPE_ID" => array("FIELD" => "DC.PRICE_TYPE_ID", "TYPE" => "int"));
     if (!isset($arFilter['USER_GROUP_ID'])) {
         $arFilter['USER_GROUP_ID'] = array();
     } elseif (!is_array($arFilter['USER_GROUP_ID'])) {
         $arFilter['USER_GROUP_ID'] = array($arFilter['USER_GROUP_ID']);
     }
     if (!empty($arFilter['USER_GROUP_ID'])) {
         $arFilter['USER_GROUP_ID'][] = -1;
     } else {
         unset($arFilter['USER_GROUP_ID']);
     }
     if (!isset($arFilter['PRICE_TYPE_ID'])) {
         $arFilter['PRICE_TYPE_ID'] = array();
     } elseif (!is_array($arFilter['PRICE_TYPE_ID'])) {
         $arFilter['PRICE_TYPE_ID'] = array($arFilter['PRICE_TYPE_ID']);
     }
     if (!empty($arFilter['PRICE_TYPE_ID'])) {
         $arFilter['PRICE_TYPE_ID'][] = -1;
     } else {
         unset($arFilter['PRICE_TYPE_ID']);
     }
     $active = 'Y';
     if (array_key_exists('ACTIVE', $arFilter)) {
         if ($arFilter['ACTIVE'] === null) {
             $active = '';
         } elseif ($arFilter['ACTIVE'] == 'Y' || $arFilter['ACTIVE'] == 'N') {
             $active = $arFilter['ACTIVE'];
         }
         unset($arFilter['ACTIVE']);
     }
     if ($active != '') {
         $arFilter['ACTIVE'] = $active;
     }
     if (array_key_exists('DISCOUNT_ID', $arFilter)) {
         unset($arFilter['DISCOUNT_ID']);
     }
     $arSelectFields = array('DISCOUNT_ID');
     if ($boolRest) {
         $arSelectFields[] = 'USER_GROUP_ID';
         $arSelectFields[] = 'PRICE_TYPE_ID';
         unset($arFilter['RESTRICTIONS']);
     }
     $arSqls = CCatalog::PrepareSql($arFields, array(), $arFilter, false, $arSelectFields);
     $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
     if (empty($arSqls["WHERE"])) {
         $arSqls["WHERE"] = "1=1";
     }
     $strQuery = "SELECT " . $arSqls["SELECT"] . " FROM b_catalog_discount_cond DC WHERE " . $arSqls["WHERE"];
     $arDiscountID = array();
     $rsDiscounts = $DB->Query($strQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($boolRest) {
         $arRestrictions = array();
         while ($arDiscount = $rsDiscounts->Fetch()) {
             $arDiscount['DISCOUNT_ID'] = intval($arDiscount['DISCOUNT_ID']);
             $arDiscountID[$arDiscount['DISCOUNT_ID']] = true;
             if (!array_key_exists($arDiscount['DISCOUNT_ID'], $arRestrictions)) {
                 $arRestrictions[$arDiscount['DISCOUNT_ID']] = array('USER_GROUP' => array(), 'PRICE_TYPE' => array());
             }
             $arDiscount['USER_GROUP_ID'] = intval($arDiscount['USER_GROUP_ID']);
             $arDiscount['PRICE_TYPE_ID'] = intval($arDiscount['PRICE_TYPE_ID']);
             $arRestrictions[$arDiscount['DISCOUNT_ID']]['USER_GROUP'][$arDiscount['USER_GROUP_ID']] = true;
             $arRestrictions[$arDiscount['DISCOUNT_ID']]['PRICE_TYPE'][$arDiscount['PRICE_TYPE_ID']] = true;
         }
         if (!empty($arDiscountID)) {
             $arDiscountID = array_keys($arDiscountID);
             foreach ($arRestrictions as $intKey => $arOneRestrictions) {
                 if (array_key_exists(-1, $arOneRestrictions['USER_GROUP'])) {
                     $arOneRestrictions['USER_GROUP'] = array();
                 }
                 if (array_key_exists(-1, $arOneRestrictions['PRICE_TYPE'])) {
                     $arOneRestrictions['PRICE_TYPE'] = array();
                 }
                 $arRestrictions[$intKey] = $arOneRestrictions;
             }
         }
         $arResult = array('DISCOUNTS' => $arDiscountID, 'RESTRICTIONS' => $arRestrictions);
     } else {
         while ($arDiscount = $rsDiscounts->Fetch()) {
             $arDiscount['DISCOUNT_ID'] = intval($arDiscount['DISCOUNT_ID']);
             $arDiscountID[$arDiscount['DISCOUNT_ID']] = true;
         }
         if (!empty($arDiscountID)) {
             $arResult = array_keys($arDiscountID);
         }
     }
     return $arResult;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:92,代码来源:discount.php


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