示例#1
0
 public static function getDeliveryServiceList($shipment = null)
 {
     static $result = null;
     $logoPath = '/bitrix/images/sale/logo-default-d.gif';
     if ($result === null) {
         if ($shipment != null) {
             self::$shipment = $shipment;
         }
         $result = array(array('ID' => 0, 'PARENT_ID' => 0, 'NAME' => Loc::getMessage('SALE_ORDER_PAYMENT_NO_DELIVERY_SERVICE'), 'LOGOTIP' => array('MAIN' => $logoPath, 'SHORT' => $logoPath)));
         $deliveryList = Services\Manager::getServicesBriefsForShipment(self::$shipment, array(Services\Manager::SKIP_CHILDREN_PARENT_CHECK, Services\Manager::SKIP_PROFILE_PARENT_CHECK, Services\Manager::SKIP_RESTRICTIONS_CLASSES => array('\\Bitrix\\Sale\\Delivery\\Restrictions\\ByPaySystem')), true);
         foreach ($deliveryList as $delivery) {
             $service = Services\Manager::getService($delivery['ID']);
             if ($service->canHasProfiles()) {
                 $profiles = $service->getProfilesList();
                 if (empty($profiles)) {
                     continue;
                 }
             }
             if (!empty($delivery['LOGOTIP'])) {
                 $mainLogo = self::getMainImgPath($delivery['LOGOTIP']);
                 $shortLogo = self::getShortImgPath($delivery['LOGOTIP']);
                 $delivery['LOGOTIP'] = array('MAIN' => $mainLogo['src'], 'SHORT' => $shortLogo['src']);
             } else {
                 $delivery['LOGOTIP'] = array('MAIN' => $logoPath, 'SHORT' => $logoPath);
             }
             $result[$delivery['ID']] = $delivery;
         }
     }
     return $result;
 }