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


PHP Lookup::shipcarriers方法代码示例

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


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

示例1: manager


//.........这里部分代码省略.........
         $Customer = new ShoppCustomer((int) $_GET['customerid']);
         if ((int) $Customer->id > 0) {
             $Purchase->copydata($Customer);
             $Purchase->customer = $Customer->id;
             $Purchase->save();
         } else {
             $this->notice(__('The selected customer was not found.', 'Shopp'), 'error');
         }
     }
     if (isset($_POST['save-item']) && !empty($_POST['lineid'])) {
         // Create a cart representation of the order to recalculate order totals
         $Cart = new ShoppCart();
         foreach ($Purchase->purchased as $OrderItem) {
             $CartItem = new Item($OrderItem);
             $Cart->contents[$OrderItem->id] = $CartItem;
         }
         $purchasedid = (int) $_POST['lineid'];
         $Purchased = $Purchase->purchased[$purchasedid];
         if ($Purchased->id) {
             $override_total = Shopp::floatval($_POST['total']) != $Purchased->total;
             // Override total
             $Item = $Cart->contents[$purchasedid];
             $Item->quantity($_POST['quantity']);
             $Item->unitprice = Shopp::floatval($_POST['unitprice']);
             $Item->retotal();
             $Purchased->quantity = $Item->quantity;
             $Purchased->unitprice = $Item->unitprice;
             $Purchased->unittax = $Item->unittax;
             $Purchased->total = $Item->total;
             if ($override_total) {
                 $Purchased->total = Shopp::floatval($_POST['total']);
             }
             $Purchased->save();
         }
         $Cart->retotal = true;
         $Cart->totals();
         $Purchase->copydata($Cart->Totals);
         $Purchase->save();
     }
     if (isset($_POST['charge']) && $Gateway && $Gateway->captures) {
         if (!current_user_can('shopp_capture')) {
             wp_die(__('You do not have sufficient permissions to carry out this action.', 'Shopp'));
         }
         $user = wp_get_current_user();
         shopp_add_order_event($Purchase->id, 'capture', array('txnid' => $Purchase->txnid, 'gateway' => $Purchase->gateway, 'amount' => $Purchase->capturable(), 'user' => $user->ID));
         $Purchase->load_events();
     }
     $base = shopp_setting('base_operations');
     $targets = shopp_setting('target_markets');
     $countries = array('' => ' ');
     $countrydata = Lookup::countries();
     foreach ($countrydata as $iso => $c) {
         if ($base['country'] == $iso) {
             $base_region = $c['region'];
         }
         $countries[$iso] = $c['name'];
     }
     $Purchase->_countries = $countries;
     $regions = Lookup::country_zones();
     $Purchase->_billing_states = array_merge(array('' => ' '), (array) $regions[$Purchase->country]);
     $Purchase->_shipping_states = array_merge(array('' => ' '), (array) $regions[$Purchase->shipcountry]);
     // Setup shipping carriers menu and JS data
     $carriers_menu = $carriers_json = array();
     $shipping_carriers = (array) shopp_setting('shipping_carriers');
     // The store-preferred shipping carriers
     $shipcarriers = Lookup::shipcarriers();
     // The full list of available shipping carriers
     $notrack = Shopp::__('No Tracking');
     // No tracking label
     $default = get_user_meta(get_current_user_id(), 'shopp_shipping_carrier', true);
     if (isset($shipcarriers[$default])) {
         $carriers_menu[$default] = $shipcarriers[$default]->name;
         $carriers_json[$default] = array($shipcarriers[$default]->name, $shipcarriers[$default]->trackpattern);
     } else {
         $carriers_menu['NOTRACKING'] = $notrack;
         $carriers_json['NOTRACKING'] = array($notrack, false);
     }
     $serviceareas = array('*', $base['country']);
     foreach ($shipcarriers as $code => $carrier) {
         if ($code == $default) {
             continue;
         }
         if (!empty($shipping_carriers) && !in_array($code, $shipping_carriers)) {
             continue;
         }
         if (!in_array($carrier->areas, $serviceareas)) {
             continue;
         }
         $carriers_menu[$code] = $carrier->name;
         $carriers_json[$code] = array($carrier->name, $carrier->trackpattern);
     }
     if (isset($shipcarriers[$default])) {
         $carriers_menu['NOTRACKING'] = $notrack;
         $carriers_json['NOTRACKING'] = array($notrack, false);
     }
     if (empty($statusLabels)) {
         $statusLabels = array('');
     }
     include $this->ui('order.php');
 }
开发者ID:jonathandavis,项目名称:shopp,代码行数:101,代码来源:Service.php

示例2: screen

 public function screen()
 {
     $shipcarriers = Lookup::shipcarriers();
     $serviceareas = array('*', ShoppBaseLocale()->code());
     foreach ($shipcarriers as $c => $record) {
         if (!in_array($record->areas, $serviceareas)) {
             continue;
         }
         $carriers[$c] = $record->name;
     }
     unset($shipcarriers);
     $shipping_carriers = shopp_setting('shipping_carriers');
     if (empty($shipping_carriers)) {
         $shipping_carriers = array_keys($carriers);
     }
     $imperial = 'imperial' == ShoppBaseLocale()->units();
     $weights = $imperial ? array('oz' => Shopp::__('ounces (oz)'), 'lb' => Shopp::__('pounds (lbs)')) : array('g' => Shopp::__('gram (g)'), 'kg' => Shopp::__('kilogram (kg)'));
     $weightsmenu = menuoptions($weights, shopp_setting('weight_unit'), true);
     $dimensions = $imperial ? array('in' => Shopp::__('inches (in)'), 'ft' => Shopp::__('feet (ft)')) : array('cm' => Shopp::__('centimeters (cm)'), 'm' => Shopp::__('meters (m)'));
     $dimsmenu = menuoptions($dimensions, shopp_setting('dimension_unit'), true);
     $rates = shopp_setting('shipping_rates');
     if (!empty($rates)) {
         ksort($rates);
     }
     $Shopp = Shopp::object();
     $Shipping = $Shopp->Shipping;
     $Shipping->settings();
     // Load all installed shipping modules for settings UIs
     $methods = $Shopp->Shipping->methods;
     $edit = false;
     if (isset($_REQUEST['id'])) {
         $edit = (int) $_REQUEST['id'];
     }
     $active = shopp_setting('active_shipping');
     if (!$active) {
         $active = array();
     }
     if (isset($_POST['module'])) {
         $setting = false;
         $module = isset($_POST['module']) ? $_POST['module'] : false;
         $id = isset($_POST['id']) ? $_POST['id'] : false;
         if ($id == $module) {
             if (isset($_POST['settings'])) {
                 shopp_set_formsettings();
             }
             /** Save shipping service settings **/
             $active[$module] = true;
             shopp_set_setting('active_shipping', $active);
             $updated = __('Shipping settings saved.', 'Shopp');
             // Cancel editing if saving
             if (isset($_POST['save'])) {
                 unset($_REQUEST['id']);
             }
             $Errors = ShoppErrors();
             do_action('shopp_verify_shipping_services');
             if ($Errors->exist()) {
                 // Get all addon related errors
                 $failures = $Errors->level(SHOPP_ADDON_ERR);
                 if (!empty($failures)) {
                     $updated = __('Shipping settings saved but there were errors: ', 'Shopp');
                     foreach ($failures as $error) {
                         $updated .= '<p>' . $error->message(true, true) . '</p>';
                     }
                 }
             }
         } else {
             /** Save shipping calculator settings **/
             $setting = $_POST['id'];
             if (empty($setting)) {
                 // Determine next available setting ID
                 $index = 0;
                 if (is_array($active[$module])) {
                     $index = count($active[$module]);
                 }
                 $setting = "{$module}-{$index}";
             }
             // Cancel editing if saving
             if (isset($_POST['save'])) {
                 unset($_REQUEST['id']);
             }
             $setting_module = $setting;
             $id = 0;
             if (false !== strpos($setting, '-')) {
                 list($setting_module, $id) = explode('-', $setting);
             }
             // Prevent fishy stuff from happening
             if ($module != $setting_module) {
                 $module = false;
             }
             // Save shipping calculator settings
             $Shipper = $Shipping->get($module);
             if ($Shipper && isset($_POST[$module])) {
                 $Shipper->setting($id);
                 $_POST[$module]['label'] = stripslashes($_POST[$module]['label']);
                 // Sterilize $values
                 foreach ($_POST[$module]['table'] as $i => &$row) {
                     if (isset($row['rate'])) {
                         $row['rate'] = Shopp::floatval($row['rate']);
                     }
                     if (!isset($row['tiers'])) {
//.........这里部分代码省略.........
开发者ID:forthrobot,项目名称:inuvik,代码行数:101,代码来源:ShippingRates.php

示例3: shipping

 /**
  * Renders the shipping settings screen and processes updates
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function shipping()
 {
     if (!current_user_can('shopp_settings_shipping')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $sub = 'settings';
     $term_recount = false;
     if (shopp_setting_enabled('shipping')) {
         $sub = 'rates';
     }
     if (isset($_GET['sub']) && in_array($_GET['sub'], array_keys($this->subscreens))) {
         $sub = $_GET['sub'];
     }
     if (!empty($_POST['save']) && empty($_POST['module'])) {
         check_admin_referer('shopp-settings-shipping');
         $_POST['settings']['order_shipfee'] = Shopp::floatval($_POST['settings']['order_shipfee']);
         // Recount terms when this setting changes
         if (isset($_POST['settings']['inventory']) && $_POST['settings']['inventory'] != shopp_setting('inventory')) {
             $term_recount = true;
         }
         shopp_set_formsettings();
         $updated = __('Shipping settings saved.', 'Shopp');
     }
     // Handle ship rates UI
     if ('rates' == $sub && 'on' == shopp_setting('shipping')) {
         return $this->shiprates();
     }
     if ($term_recount) {
         $taxonomy = ProductCategory::$taxon;
         $terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
         if (!empty($terms)) {
             wp_update_term_count_now($terms, $taxonomy);
         }
     }
     $base = shopp_setting('base_operations');
     $regions = Lookup::regions();
     $region = $regions[$base['region']];
     $useRegions = shopp_setting('shipping_regions');
     $areas = Lookup::country_areas();
     if (is_array($areas[$base['country']]) && $useRegions == 'on') {
         $areas = array_keys($areas[$base['country']]);
     } else {
         $areas = array($base['country'] => $base['name']);
     }
     unset($countries, $regions);
     $carrierdata = Lookup::shipcarriers();
     $serviceareas = array('*', substr($base['country'], 0, 2));
     foreach ($carrierdata as $c => $record) {
         if (!in_array($record->areas, $serviceareas)) {
             continue;
         }
         $carriers[$c] = $record->name;
     }
     unset($carrierdata);
     $shipping_carriers = shopp_setting('shipping_carriers');
     if (empty($shipping_carriers)) {
         $shipping_carriers = array_keys($carriers);
     }
     $rates = shopp_setting('shipping_rates');
     if (!empty($rates)) {
         ksort($rates);
     }
     $lowstock = shopp_setting('lowstock_level');
     if (empty($lowstock)) {
         $lowstock = 0;
     }
     include $this->ui('shipping.php');
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:76,代码来源:System.php

示例4: screen


//.........这里部分代码省略.........
                 foreach ($fields as $label => $amount) {
                     $entries[] = new $OrderAmountObject(array('id' => count($entries) + 1, 'label' => $label, 'amount' => $amount));
                 }
                 $savetotal = isset($methods[$property]) ? $methods[$property] : $fees;
                 $Purchase->{$savetotal}($entries);
                 $sum = array_sum($fields);
                 if ($sum > 0) {
                     $Purchase->{$property} = $sum;
                 }
             } else {
                 $Purchase->{$property} = Shopp::floatval($fields[0]);
             }
             $total += 'discount' == $property ? $Purchase->{$property} * -1 : $Purchase->{$property};
         }
         $Purchase->total = $Purchase->subtotal + $total;
         $Purchase->save();
     }
     if (!empty($_GET['rmvline'])) {
         $lineid = (int) $_GET['rmvline'];
         if (isset($Purchase->purchased[$lineid])) {
             $Purchase->purchased[$lineid]->delete();
             unset($Purchase->purchased[$lineid]);
         }
         $Cart = new ShoppCart();
         $taxcountry = $Purchase->country;
         $taxstate = $Purchase->state;
         if (!empty($Purchase->shipcountry) && !empty($Purchase->shipstate)) {
             $taxcountry = $Purchase->shipcountry;
             $taxstate = $Purchase->shipstate;
         }
         ShoppOrder()->Tax->location($taxcountry, $taxstate);
         foreach ($Purchase->purchased as &$Purchased) {
             $Cart->additem($Purchased->quantity, new ShoppCartItem($Purchased));
         }
         $Cart->Totals->register(new OrderAmountShipping(array('id' => 'cart', 'amount' => $Purchase->freight)));
         $Purchase->total = $Cart->total();
         $Purchase->subtotal = $Cart->total('order');
         $Purchase->discount = $Cart->total('discount');
         $Purchase->tax = $Cart->total('tax');
         $Purchase->freight = $Cart->total('shipping');
         $Purchase->save();
         $Purchase->load_purchased();
     }
     if (isset($_POST['charge']) && $Gateway && $Gateway->captures) {
         if (!current_user_can('shopp_capture')) {
             wp_die(__('You do not have sufficient permissions to carry out this action.', 'Shopp'));
         }
         $user = wp_get_current_user();
         shopp_add_order_event($Purchase->id, 'capture', array('txnid' => $Purchase->txnid, 'gateway' => $Purchase->gateway, 'amount' => $Purchase->capturable(), 'user' => $user->ID));
         $Purchase->load_events();
     }
     $targets = shopp_setting('target_markets');
     $default = array('' => '&nbsp;');
     $Purchase->_countries = array_merge($default, ShoppLookup::countries());
     $regions = Lookup::country_zones();
     $Purchase->_billing_states = array_merge($default, (array) $regions[$Purchase->country]);
     $Purchase->_shipping_states = array_merge($default, (array) $regions[$Purchase->shipcountry]);
     // Setup shipping carriers menu and JS data
     $carriers_menu = $carriers_json = array();
     $shipping_carriers = (array) shopp_setting('shipping_carriers');
     // The store-preferred shipping carriers
     $shipcarriers = Lookup::shipcarriers();
     // The full list of available shipping carriers
     $notrack = Shopp::__('No Tracking');
     // No tracking label
     $default = get_user_meta(get_current_user_id(), 'shopp_shipping_carrier', true);
     if (isset($shipcarriers[$default])) {
         $carriers_menu[$default] = $shipcarriers[$default]->name;
         $carriers_json[$default] = array($shipcarriers[$default]->name, $shipcarriers[$default]->trackpattern);
     } else {
         $carriers_menu['NOTRACKING'] = $notrack;
         $carriers_json['NOTRACKING'] = array($notrack, false);
     }
     $serviceareas = array('*', ShoppBaseLocale()->country());
     foreach ($shipcarriers as $code => $carrier) {
         if ($code == $default) {
             continue;
         }
         if (!empty($shipping_carriers) && !in_array($code, $shipping_carriers)) {
             continue;
         }
         if (!in_array($carrier->areas, $serviceareas)) {
             continue;
         }
         $carriers_menu[$code] = $carrier->name;
         $carriers_json[$code] = array($carrier->name, $carrier->trackpattern);
     }
     if (isset($shipcarriers[$default])) {
         $carriers_menu['NOTRACKING'] = $notrack;
         $carriers_json['NOTRACKING'] = array($notrack, false);
     }
     if (empty($statusLabels)) {
         $statusLabels = array('');
     }
     $Purchase->taxes();
     $Purchase->discounts();
     $columns = get_column_headers($this->id);
     $hidden = get_hidden_columns($this->id);
     include $this->ui('new.php');
 }
开发者ID:msigley,项目名称:shopp,代码行数:101,代码来源:Orders.php

示例5: email_event

 /**
  * Provides a property of the current notification event
  *
  * @api `shopp('purchase.email-event')`
  * @since 1.3
  *
  * @param string        $result  The output
  * @param array         $options The options
  * @param ShoppPurchase $O       The working object
  * @return string The event property
  **/
 public static function email_event($result, $options, $O)
 {
     if (!isset($O->message['event'])) {
         return '';
     }
     extract($options);
     $Event = $O->message['event'];
     if (isset($Event->{$name})) {
         $string = $Event->{$name};
         if ('shipped' == $Event->name) {
             $carriers = Lookup::shipcarriers();
             $carrier = $carriers[$Event->carrier];
             if ('carrier' == $name) {
                 $string = $carrier->name;
             }
             if ('tracking' == $name && Shopp::str_true($link)) {
                 $params = apply_filters('shopp_shipped_trackurl_params', array($string), $Event->order());
                 return '<a href="' . esc_url(vsprintf($carrier->trackurl, $params)) . '">' . esc_html($string) . '</a>';
             }
         }
         return esc_html($string);
     }
     return '';
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:35,代码来源:purchase.php

示例6: shipping

 /**
  * Renders the shipping settings screen and processes updates
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function shipping()
 {
     if (!current_user_can('shopp_settings_shipping')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $sub = 'settings';
     $term_recount = false;
     if (shopp_setting_enabled('shipping')) {
         $sub = 'rates';
     }
     if (isset($_GET['sub']) && in_array($_GET['sub'], array_keys($this->subscreens))) {
         $sub = $_GET['sub'];
     }
     if (!empty($_POST['save']) && empty($_POST['module'])) {
         check_admin_referer('shopp-settings-shipping');
         $_POST['settings']['order_shipfee'] = Shopp::floatval($_POST['settings']['order_shipfee']);
         // Recount terms when this setting changes
         if (isset($_POST['settings']['inventory']) && $_POST['settings']['inventory'] != shopp_setting('inventory')) {
             $term_recount = true;
         }
         shopp_set_formsettings();
         $updated = __('Shipping settings saved.', 'Shopp');
     }
     // Handle ship rates UI
     if ('rates' == $sub && 'on' == shopp_setting('shipping')) {
         return $this->shiprates();
     }
     if ($term_recount) {
         $taxonomy = ProductCategory::$taxon;
         $terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
         if (!empty($terms)) {
             wp_update_term_count_now($terms, $taxonomy);
         }
     }
     $carrierdata = Lookup::shipcarriers();
     $serviceareas = array('*', ShoppBaseLocale()->code());
     foreach ($carrierdata as $c => $record) {
         if (!in_array($record->areas, $serviceareas)) {
             continue;
         }
         $carriers[$c] = $record->name;
     }
     unset($carrierdata);
     $shipping_carriers = shopp_setting('shipping_carriers');
     if (empty($shipping_carriers)) {
         $shipping_carriers = array_keys($carriers);
     }
     $imperial = 'imperial' == ShoppBaseLocale()->units();
     $weights = $imperial ? array('oz' => Shopp::__('ounces (oz)'), 'lb' => Shopp::__('pounds (lbs)')) : array('g' => Shopp::__('gram (g)'), 'kg' => Shopp::__('kilogram (kg)'));
     $weightsmenu = menuoptions($weights, shopp_setting('weight_unit'), true);
     $dimensions = $imperial ? array('in' => Shopp::__('inches (in)'), 'ft' => Shopp::__('feet (ft)')) : array('cm' => Shopp::__('centimeters (cm)'), 'm' => Shopp::__('meters (m)'));
     $dimsmenu = menuoptions($dimensions, shopp_setting('dimension_unit'), true);
     $rates = shopp_setting('shipping_rates');
     if (!empty($rates)) {
         ksort($rates);
     }
     $lowstock = shopp_setting('lowstock_level');
     if (empty($lowstock)) {
         $lowstock = 0;
     }
     include $this->ui('shipping.php');
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:70,代码来源:System.php

示例7: carrier

 function carrier()
 {
     if (isset($this->Carrier)) {
         return;
     }
     $carriers = Lookup::shipcarriers();
     $this->Carrier = $carriers[$this->carrier];
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:8,代码来源:events.php


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