예제 #1
0
 public function carrier()
 {
     if (isset($this->Carrier)) {
         return;
     }
     if ('NOTRACKING' == $this->carrier) {
         $notrack = new StdClass();
         $notrack->name = Shopp::__('No Tracking');
         return $notrack;
     }
     $carriers = ShoppLookup::shipcarriers();
     $this->Carrier = $carriers[$this->carrier];
 }
예제 #2
0
파일: Orders.php 프로젝트: msigley/shopp
 public function shipcarriers()
 {
     $shipcarriers = ShoppLookup::shipcarriers();
     // The full list of available shipping carriers
     $selectcarriers = (array) shopp_setting('shipping_carriers');
     // The store-preferred shipping carriers
     $default = get_user_meta(get_current_user_id(), 'shopp_shipping_carrier', true);
     // User's last used carrier
     // Add "No Tracking" option
     $shipcarriers['NOTRACKING'] = json_decode('{"name":"' . Shopp::__('No tracking') . '","trackpattern":false,"areas":"*"}');
     $selectcarriers[] = 'NOTRACKING';
     $carriers = array();
     $serviceareas = array('*', ShoppBaseLocale()->country());
     foreach ($shipcarriers as $code => $carrier) {
         if (!empty($selectcarriers) && !in_array($code, $selectcarriers)) {
             continue;
         }
         if (!in_array($carrier->areas, $serviceareas)) {
             continue;
         }
         $carriers[$code] = array($carrier->name, $carrier->trackpattern);
     }
     $first = isset($carriers[$default]) ? $default : 'NOTRACKING';
     return array($first => $carriers[$first]) + $carriers;
 }