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


PHP CSaleDeliveryHandler::GetHandlerCompability方法代码示例

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


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

示例1: GetList

 /**
  * get handlers list based on DB data
  * @deprecated
  */
 public static function GetList($arSort = array("SORT" => "ASC"), $arFilter = array())
 {
     if (self::isFieldInFilter2("SITE", $arFilter)) {
         $arFilter["SITE_ID"] = self::getFilterValue("SITE", $arFilter);
         unset($arFilter["SITE"]);
     }
     if (isset($arFilter["SITE_ID"])) {
         if (is_string($arFilter["SITE_ID"]) && strlen($arFilter["SITE_ID"]) > 0) {
             if ($arFilter["SITE_ID"] == "ALL") {
                 unset($arFilter["SITE_ID"]);
             } elseif (strpos($arFilter["SITE_ID"], ",") !== false) {
                 $arFilter["SITE_ID"] = explode(",", $arFilter["SITE_ID"]);
             } else {
                 $arFilter["SITE_ID"] = array($arFilter["SITE_ID"]);
             }
         }
     } else {
         $arFilter["SITE_ID"] = array(CSite::GetDefSite());
     }
     if (!isset($arFilter["ACTIVE"])) {
         $arFilter["ACTIVE"] = "Y";
     } elseif ($arFilter["ACTIVE"] == "ALL") {
         unset($arFilter["ACTIVE"]);
     }
     $params = array('order' => array_intersect_key($arSort, Bitrix\Sale\Delivery\Services\Table::getMap()), 'filter' => self::convertFilterOldToNew($arFilter));
     $services = array();
     $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList($params);
     while ($service = $dbRes->fetch()) {
         $dbRstrRes = \Bitrix\Sale\Internals\ServiceRestrictionTable::getList(array('filter' => array("=SERVICE_ID" => $service["ID"], "=SERVICE_TYPE" => \Bitrix\Sale\Services\Base\RestrictionManager::SERVICE_TYPE_SHIPMENT)));
         while ($restr = $dbRstrRes->fetch()) {
             if (!self::checkRestrictionFilter($restr, $arFilter)) {
                 continue 2;
             }
             if ($restr["CLASS_NAME"] == '\\Bitrix\\Sale\\Delivery\\Restrictions\\BySite' && !empty($restr["PARAMS"]["SITE_ID"])) {
                 if (is_array($restr["PARAMS"]["SITE_ID"])) {
                     reset($restr["PARAMS"]["SITE_ID"]);
                     $service["LID"] = current($restr["PARAMS"]["SITE_ID"]);
                 } elseif (is_string($restr["PARAMS"]["SITE_ID"])) {
                     $service["LID"] = $restr["PARAMS"]["SITE_ID"];
                 } else {
                     $service["LID"] = "";
                 }
             }
         }
         if (strlen($service['CODE']) > 0) {
             $srv = \Bitrix\Sale\Delivery\Services\Automatic::convertNewServiceToOld($service);
         } else {
             \Bitrix\Sale\Delivery\Services\Manager::getHandlersList();
             if (get_parent_class($service['CLASS_NAME']) == 'Bitrix\\Sale\\Delivery\\Services\\Base') {
                 if ($service['CLASS_NAME']::canHasProfiles()) {
                     continue;
                 }
             }
             $srv = \Bitrix\Sale\Delivery\Services\NewToAutomatic::convertNewServiceToOld($service);
         }
         if (empty($srv)) {
             continue;
         }
         if (is_array($arFilter["COMPABILITY"])) {
             $arProfiles = CSaleDeliveryHandler::GetHandlerCompability($arFilter["COMPABILITY"], $srv);
             if (!is_array($arProfiles) || count($arProfiles) <= 0) {
                 continue;
             } else {
                 $srv["PROFILES"] = $arProfiles;
             }
         }
         if ($srv) {
             $services[] = $srv;
         }
     }
     $result = new \CDBResult();
     $result->InitFromArray($services);
     return $result;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:78,代码来源:delivery_handler.php

示例2: GetList


//.........这里部分代码省略.........
         }
     }
     $bAllSite = false;
     if ($arFilter["SITE_ID"] == "ALL") {
         $bAllSite = true;
         unset($arFilter["SITE_ID"]);
     }
     if ($arFilter["ACTIVE"] == "ALL") {
         unset($arFilter["ACTIVE"]);
     }
     $arWhere = array();
     $strWhere = "";
     $arFilterKeys = array_keys($arFilter);
     foreach ($arFilter as $key => $value) {
         $match_value_set = in_array($key . "_EXACT_MATCH", $arFilterKeys) ? true : false;
         $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
         $key = ToUpper($key);
         switch ($key) {
             // SITE_ID is unavailable for extended sorting! only direct selection; It's needed for after-select filtration.
             case "SITE_ID":
                 if (strlen($value) > 0) {
                     //$arWhere[] = GetFilterQuery("LID", $value, $match);
                     $arWhere[] = "LID='" . $DB->ForSql($value) . "' OR LID='' OR LID IS NULL";
                 }
                 break;
             case "ACTIVE":
                 if (strlen($value) > 0) {
                     $arWhere[] = "ACTIVE='" . ($value == 'N' ? 'N' : 'Y') . "'";
                 }
                 break;
             case "SID":
             case "ID":
                 if (strlen($value) > 0) {
                     $arWhere[] = GetFilterQuery("HID", $DB->ForSql($value), $match);
                 }
                 break;
             case "HANDLER":
             case "PATH":
                 if (strlen($value) > 0) {
                     $arWhere[] = GetFilterQuery("HANDLER", $DB->ForSql($value), $match);
                 }
         }
     }
     $strWhere = GetFilterSqlSearch($arWhere);
     $query = "\nSELECT HID AS SID\nFROM b_sale_delivery_handler\nWHERE\n" . $strWhere . "\n";
     if (count($arSort) > 0) {
         $query .= "ORDER BY ";
         $bFirst = true;
         foreach ($arSort as $SORT => $SORT_DIR) {
             if ($bFirst) {
                 $bFirst = false;
             } else {
                 $query .= ", ";
             }
             $query .= $SORT . " " . $SORT_DIR;
         }
     }
     $dbRes = $DB->Query($query);
     $arLoadedHandlers = array();
     $arLoadedHandlersMap = array();
     while ($arRes = $dbRes->Fetch()) {
         $arLoadedHandlersMap[$arRes["SID"]] = $arRes;
     }
     $arHandlersList = CSaleDeliveryHandler::__getRegisteredHandlers();
     if (is_array($arHandlersList)) {
         foreach ($arHandlersList as $key => $arHandler) {
             if (is_array($arLoadedHandlersMap) && !array_key_exists($arHandler["SID"], $arLoadedHandlersMap)) {
                 unset($arHandlersList[$key]);
             }
         }
         $arHandlersList = array_values($arHandlersList);
         $arHandlersList = CSaleDeliveryHandler::__getHandlersData($arHandlersList);
         if ($arFilter["SITE_ID"] != "ALL" && is_array($arHandlersList)) {
             foreach ($arHandlersList as $key => $arHandler) {
                 if (strlen($arHandler['LID']) > 0 && $arHandler['LID'] != $arFilter["SITE_ID"]) {
                     unset($arHandlersList[$key]);
                 }
             }
         }
         if (is_array($arFilter["COMPABILITY"]) && is_array($arHandlersList)) {
             foreach ($arHandlersList as $key => $arHandler) {
                 $arProfiles = CSaleDeliveryHandler::GetHandlerCompability($arFilter["COMPABILITY"], $arHandler);
                 if (!is_array($arProfiles) || count($arProfiles) <= 0) {
                     unset($arHandlersList[$key]);
                 } else {
                     $arHandlersList[$key]["PROFILES"] = $arProfiles;
                 }
             }
         }
         CSaleDeliveryHandler::__sortList($arHandlersList, $arSort);
     }
     $dbHandlers = new CDBResult();
     if (is_array($arHandlersList)) {
         reset($arHandlersList);
         $dbHandlers->InitFromArray($arHandlersList);
     } else {
         $dbHandlers->InitFromArray(array());
     }
     return $dbHandlers;
 }
开发者ID:,项目名称:,代码行数:101,代码来源:

示例3: GetList


//.........这里部分代码省略.........
  * <td>BASE_CURRENCY</td> <td>Идентификатор валюты, в которой работает
  * обработчик службы доставки.</td> </tr> <tr> <td>TAX_RATE</td> <td>Значение
  * наценки, автоматически добавляемой к стоимости доставки (%).</td> </tr>
  * <tr> <td>HANDLER</td> <td>Путь к файлу обработчика доставки.</td> </tr> <tr>
  * <td>DBSETSETTINGS</td> <td>callback к методу обработчика, обеспечивающему
  * сохранение массива настроек в БД.</td> </tr> <tr> <td>DBGETSETTINGS</td> <td>callback к
  * методу обработчика, обеспечивающему получение массива настроек
  * из БД.</td> </tr> <tr> <td>GETCONFIG</td> <td>callback к методу обработчика,
  * возвращающему список настроек обработчика.</td> </tr> <tr> <td>COMPATIBILITY</td>
  * <td>callback к методу обработчика, осуществляющему проверку
  * применимости обработчика к заказу.</td> </tr> <tr> <td>CALCULATE</td> <td>callback к
  * методу обработчика, осуществляющему расчёт стоимости
  * доставки.</td> </tr> <tr> <td>PROFILES</td> <td>Массив профилей обработки
  * доставки. Представляет собой ассоциативный массив вида: <pre
  * class="syntax">Array ( "<i>строковый_идентификатор_профиля</i>" =&gt; Array ( "TITLE" =&gt;
  * "<i>название_профиля</i>", "DESCRIPTION" =&gt; "<i>описание_профиля</i>",
  * "RESTRICTIONS_WEIGHT" =&gt; Array ( //< ограничения обработчика по весу >// ),
  * "RESTRICTIONS_SUM" =&gt; Array ( //< ограничения обработчика по стоимости >// ),
  * "ACTIVE" =&gt; "<i>флаг_активности_профиля</i>", ), //< ................... >// ) </pre> </td>
  * </tr> <tr> <td>CONFIG</td> <td>Массив настроек обработчика доставки со
  * значениями. Подробнее см. <a
  * href="http://dev.1c-bitrix.ru/api_help/sale/delivery.php">Руководство по созданию
  * автоматизированных обработчиков доставки</a>.</td> </tr> <tr>
  * <td>PROFILE_USE_DEFAULT</td> <td>Значение флага "используются параметры
  * профилей по умолчанию" (Y|N).</td> </tr> </table> <a name="examples"></a>
  *
  * <h4>Example</h4> 
  * <pre>
  * CModule::IncludeModule('sale');
  * 
  * $dbResult = CSaleDeliveryHandler::GetList(
  *   array(
  *     'SORT' =&gt; 'ASC', 
  *     'NAME' =&gt; 'ASC'
  *   ), 
  *   array(
  *     'ACTIVE' =&gt; 'Y'
  *   )
  * );
  * echo '&lt;ul&gt;';
  * while ($arResult = $dbResult-&gt;GetNext())
  * {
  *   echo '&lt;li&gt;('.$arResult['SID'].') &lt;b&gt;'.$arResult['NAME'].'&lt;/b&gt;&lt;br /&gt;'; 
  *   echo '&lt;small&gt;'.$arResult['DESCRIPTION'].'&lt;/small&gt;&lt;/li&gt;';
  * }
  * echo '&lt;/ul&gt;';
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csaledeliveryhandler/csaledeliveryh_getlist.php
  * @author Bitrix
  * @deprecated
  */
 public static function GetList($arSort = array("SORT" => "ASC"), $arFilter = array())
 {
     if (self::isFieldInFilter2("SITE", $arFilter)) {
         $arFilter["SITE_ID"] = self::getFilterValue("SITE", $arFilter);
         unset($arFilter["SITE"]);
     }
     if (!isset($arFilter["SITE_ID"])) {
         $arFilter["SITE_ID"] = SITE_ID;
     } elseif ($arFilter["SITE_ID"] == "ALL") {
         unset($arFilter["SITE_ID"]);
     }
     if (!isset($arFilter["ACTIVE"])) {
         $arFilter["ACTIVE"] = "Y";
     } elseif ($arFilter["ACTIVE"] == "ALL") {
         unset($arFilter["ACTIVE"]);
     }
     $params = array('order' => array_intersect_key($arSort, Bitrix\Sale\Delivery\Services\Table::getMap()), 'filter' => self::convertFilterOldToNew($arFilter));
     $services = array();
     $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList($params);
     while ($service = $dbRes->fetch()) {
         $dbRstrRes = \Bitrix\Sale\Delivery\Restrictions\Table::getList(array('filter' => array("=DELIVERY_ID" => $service["ID"])));
         while ($restr = $dbRstrRes->fetch()) {
             if (!self::checkRestrictionFilter($restr, $arFilter)) {
                 continue 2;
             }
             if ($restr["CLASS_NAME"] == '\\Bitrix\\Sale\\Delivery\\Restrictions\\BySite') {
                 $service["LID"] = $restr["PARAMS"]["SITE_ID"];
             }
         }
         $srv = \Bitrix\Sale\Delivery\Services\Automatic::convertNewServiceToOld($service);
         if (is_array($arFilter["COMPABILITY"])) {
             $arProfiles = CSaleDeliveryHandler::GetHandlerCompability($arFilter["COMPABILITY"], $srv);
             if (!is_array($arProfiles) || count($arProfiles) <= 0) {
                 continue;
             } else {
                 $srv = $arProfiles;
             }
         }
         if ($srv) {
             $services[] = $srv;
         }
     }
     $result = new \CDBResult();
     $result->InitFromArray($services);
     return $result;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:delivery_handler.php


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