예제 #1
0
 protected function getDataFromHeader()
 {
     $data = array('self' => array('minPrice' => 0, 'minTime' => 0, 'timeStr' => '', 'disabled' => true), 'courier' => array('minPrice' => 0, 'minTime' => 0, 'timeStr' => '', 'disabled' => true));
     if (in_array(Sdk\DDeliverySDK::TYPE_SELF, $this->supportedTypes)) {
         $selfCompanies = $this->cachedCalculateSelfPrices($this->order);
         if (count($selfCompanies)) {
             $minPrice = $this->getClientPrice(reset($selfCompanies), $this->order, DDeliverySDK::TYPE_SELF);
             $minTime = PHP_INT_MAX;
             foreach ($selfCompanies as $selfCompany) {
                 if ($minTime > $selfCompany['delivery_time_min']) {
                     $minTime = $selfCompany['delivery_time_min'];
                 }
             }
             $data['self'] = array('minPrice' => $minPrice, 'minTime' => $minTime, 'timeStr' => Utils::plural($minTime, 'дня', 'дней', 'дней', 'дней', false), 'disabled' => false);
         }
     }
     if (in_array(Sdk\DDeliverySDK::TYPE_COURIER, $this->supportedTypes)) {
         $courierCompanies = $this->cachedCalculateCourierPrices($this->order);
         if (count($courierCompanies)) {
             $minPrice = $this->getClientPrice(reset($courierCompanies), $this->order, DDeliverySDK::TYPE_COURIER);
             $minTime = PHP_INT_MAX;
             foreach ($courierCompanies as $courierCompany) {
                 if ($minTime > $courierCompany['delivery_time_min']) {
                     $minTime = $courierCompany['delivery_time_min'];
                 }
             }
             $data['courier'] = array('minPrice' => $minPrice, 'minTime' => $minTime, 'timeStr' => Utils::plural($minTime, 'дня', 'дней', 'дней', 'дней', false), 'disabled' => false);
         }
     }
     return $data;
 }
예제 #2
0
         </td>
         <td class="col2">
             <img src="<?=$staticURL?>img/logo/<?php
             echo ((isset(  $companies[$courierCompany['delivery_company']]['ico'] ) )?$companies[$courierCompany['delivery_company']]['ico']:'pack');
             ?>.png" alt="title"/>
         </td>
         <td class="col3">
             <p>
                 <strong><?=$courierCompany['delivery_company_name']?></strong>
             </p>
         </td>
         <td class="col4">
             <strong><?=$this->getClientPrice($courierCompany, $this->order)?> <i class="icon-rub">&nbsp;</i></strong>
         </td>
         <td class="col5">
             <strong><?=$courierCompany['delivery_time_min']?></strong> <?=\DDelivery\Utils::plural($courierCompany['delivery_time_min'], 'день', 'дня', 'дней', 'дней', false);?>
         </td>
     </tr>
 <?endforeach;?>
 <script type="application/javascript">
     var couriers = <?=json_encode($courierCompanyListJson)?>;
 </script>
 <?php
 }else{ ?>
     <tr>
         <td class="col1">
             <div style="text-align: center">
                 <?=$this->shop->getEmptyCompanyError($this->order);?>
             </div>
         </td>
     </tr>
예제 #3
0
</strong>
                        <span><?php 
echo \DDelivery\Utils::plural($headerData['courier']['minTime'], 'дня', 'дней', 'дней', 'дней', false);
?>
</span>
                    </span>
                </a>
            </li>
        <?endif;?>
        <?if(in_array(DDelivery\Sdk\DDeliverySDK::TYPE_SELF, $this->supportedTypes)):?>
            <li class="delivery-type__drop_self">
                <a href="javascript:void(0)">
                    <span class="name">забрать самовывозом</span>
                    <span class="price"><span><?php 
echo $headerData['self']['minPrice'];
?>
</span> <i class="icon-rub">&nbsp;</i></span>
                    <span class="date">от <strong><?php 
echo $headerData['self']['minTime'];
?>
</strong>
                        <span><?php 
echo \DDelivery\Utils::plural($headerData['self']['minTime'], 'дня', 'дней', 'дней', 'дней', false);
?>
</span>
                    </span>
                </a>
            </li>
        <?endif;?>
    </ul>
</div>