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


PHP Lookup::country_zones方法代码示例

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


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

	/**
	 * Provides ecart('checkout') template API functionality
	 * 
	 * @since 1.0
	 *
	 * @return mixed
	 **/
	function tag ($property,$options=array()) {
		global $Ecart,$wp;

		$pages = $Ecart->Settings->get('pages');
		$base = $Ecart->Settings->get('base_operations');
		$countries = $Ecart->Settings->get('target_markets');
		$process = get_query_var('ecart_proc');

		$select_attrs = array('title','required','class','disabled','required','size','tabindex','accesskey');
		$submit_attrs = array('title','class','value','disabled','tabindex','accesskey');

		if (!isset($options['mode'])) $options['mode'] = "input";

		switch ($property) {
			case "url":
				$link = ecarturl(false,'checkout',$this->security());

				// Pass any arguments along
				$args = $_GET;
				unset($args['page_id'],$args['acct']);
				$link = esc_url(add_query_arg($args,$link));
				if ($process == "confirm-order") $link = apply_filters('ecart_confirm_url',$link);
				else $link = apply_filters('ecart_checkout_url',$link);
				return $link;
				break;
			case "function":
				if (!isset($options['shipcalc'])) $options['shipcalc'] = '<img src="'.ECART_ADMIN_URI.'/icons/updating.gif" alt="'.__('Updating','Ecart').'" width="16" height="16" />';
				$regions = Lookup::country_zones();
				$base = $Ecart->Settings->get('base_operations');

				$js = "var regions = ".json_encode($regions).",".
									"SHIPCALC_STATUS = '".$options['shipcalc']."',".
									"d_pm = '".sanitize_title_with_dashes($this->paymethod)."',".
									"pm_cards = {};";

				foreach ($this->payoptions as $handle => $option) {
					if (empty($option->cards)) continue;
					$js .= "pm_cards['".$handle."'] = ".json_encode($option->cards).";";
				}
				add_storefrontjs($js,true);

				if (!empty($options['value'])) $value = $options['value'];
				else $value = "process";
				$output = '<div><input type="hidden" name="checkout" value="'.$value.'" /></div>';
				if ($value == "confirmed") $output = apply_filters('ecart_confirm_form',$output);
				else $output = apply_filters('ecart_checkout_form',$output);
				return $output;
				break;
			case "errors":
			case "error":
				$Errors = &EcartErrors();
				if (!$Errors->exist(ECART_COMM_ERR)) return false;
				$errors = $Errors->get(ECART_COMM_ERR);
				$defaults = array(
					'before' => '<li>',
					'after' => '</li>'
				);
				$options = array_merge($defaults,$options);
				extract($options);

				$result = "";
				foreach ((array)$errors as $error)
					if (!$error->blank()) $result .= $before.$error->message(true).$after;
				return $result;
				break;
			case "cart-summary":
				ob_start();
				include(ECART_TEMPLATES."/summary.php");
				$content = ob_get_contents();
				ob_end_clean();

				// If inside the checkout form, strip the extra <form> tag so we don't break standards
				// This is ugly, but necessary given the different markup contexts the cart summary is used in
				$Storefront =& EcartStorefront();
				if ($Storefront !== false && $Storefront->checkout)
					$content = preg_replace('/<\/?form.*?>/','',$content);

				return $content;
				break;
			case "loggedin": return $this->Customer->login; break;
			case "notloggedin": return (!$this->Customer->login && $Ecart->Settings->get('account_system') != "none"); break;
			case "email-login":  // Deprecating
			case "loginname-login":  // Deprecating
			case "account-login":
				if (!isset($options['autocomplete'])) $options['autocomplete'] = "off";
				if (!empty($_POST['account-login']))
					$options['value'] = $_POST['account-login'];
				return '<input type="text" name="account-login" id="account-login"'.inputattrs($options).' />';
				break;
			case "password-login":
				if (!isset($options['autocomplete'])) $options['autocomplete'] = "off";
				if (!empty($_POST['password-login']))
					$options['value'] = $_POST['password-login'];
//.........这里部分代码省略.........
开发者ID:robbiespire,项目名称:paQui,代码行数:101,代码来源:Order.php

示例3: checkout_function

 /**
  * Provides hidden checkout inputs required for proper checkout processing
  *
  * @api `shopp('checkout.function')`
  * @since 1.0
  *
  * @param string     $result  The output
  * @param array      $options The options
  * @param ShoppOrder $O       The working object
  * @return string The generated hidden inputs
  **/
 public static function checkout_function($result, $options, $O)
 {
     $Payments = $O->Payments;
     $defaults = array('updating' => '<div class="shoppui-spinfx-align"><span class="shoppui-spinner shoppui-spinfx shoppui-spinfx-steps8"></span></div>');
     $options = array_merge($defaults, $options);
     extract($options);
     $regions = Lookup::country_zones();
     $js = "var regions=" . json_encode($regions) . "," . "c_upd='" . $updating . "'," . "d_pm='" . $Payments->selected()->slug . "'," . "pm_cards={};";
     foreach ($Payments as $slug => $option) {
         if (empty($option->cards)) {
             continue;
         }
         $js .= "pm_cards['" . $slug . "'] = " . json_encode($option->cards) . ";";
     }
     add_storefrontjs($js, true);
     if (!empty($options['value'])) {
         $value = $options['value'];
     } else {
         $value = 'process';
     }
     $output = '<div><input id="shopp-checkout-function" type="hidden" name="checkout" value="' . $value . '" /></div>';
     if ('confirmed' == $value) {
         $output = apply_filters('shopp_confirm_form', $output);
     } else {
         $output = apply_filters('shopp_checkout_form', $output);
     }
     return $output;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:39,代码来源:checkout.php

示例4: setup

 /**
  * Displays the General Settings screen and processes updates
  *
  * @author Jonathan Davis
  * @since 1.0
  *
  * @return void
  **/
 public function setup()
 {
     if (!current_user_can('shopp_settings')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     // Welcome screen handling
     if (!empty($_POST['setup'])) {
         $_POST['settings']['display_welcome'] = 'off';
         shopp_set_formsettings();
     }
     $country = isset($_POST['settings']) && isset($_POST['settings']['base_operations']) ? $_POST['settings']['base_operations']['country'] : '';
     $countries = array();
     $countrydata = Lookup::countries();
     $country_zones = Lookup::country_zones();
     foreach ($countrydata as $iso => $c) {
         if ($country == $iso) {
             $base_region = $c['region'];
         }
         $countries[$iso] = $c['name'];
     }
     // Save settings
     if (!empty($_POST['save']) && isset($_POST['settings'])) {
         check_admin_referer('shopp-setup');
         if (isset($_POST['settings']['base_operations'])) {
             $baseop =& $_POST['settings']['base_operations'];
             $zone = isset($baseop['zone']) && isset($country_zones[$country]) && isset($country_zones[$country][$baseop['zone']]) ? $baseop['zone'] : false;
             if (isset($countrydata[$country])) {
                 $baseop = $countrydata[$country];
             }
             $baseop['country'] = $country;
             $baseop['zone'] = $zone;
             $baseop['currency']['format'] = scan_money_format($baseop['currency']['format']);
             if (is_array($baseop['currency']['format'])) {
                 $fields = array_keys($baseop['currency']['format']);
                 foreach ($fields as $field) {
                     if (isset($baseop['currency'][$field])) {
                         $baseop['currency']['format'][$field] = $baseop['currency'][$field];
                     }
                 }
             }
             shopp_set_setting('tax_inclusive', in_array($country, Lookup::country_inclusive_taxes()) ? 'on' : 'off');
         }
         if (!isset($_POST['settings']['target_markets'])) {
             asort($_POST['settings']['target_markets']);
         }
         shopp_set_formsettings();
         $updated = __('Shopp settings saved.', 'Shopp');
     }
     $operations = shopp_setting('base_operations');
     if (isset($country_zones[$operations['country']])) {
         $zones = $country_zones[$operations['country']];
     }
     $targets = shopp_setting('target_markets');
     if (is_array($targets)) {
         $targets = array_map('stripslashes', $targets);
     }
     if (!$targets) {
         $targets = array();
     }
     include $this->ui('setup.php');
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:69,代码来源:Setup.php

示例5: taxrates

 public function taxrates()
 {
     if (!current_user_can('shopp_settings_taxes')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $edit = false;
     if (isset($_REQUEST['id'])) {
         $edit = (int) $_REQUEST['id'];
     }
     $localerror = false;
     $rates = shopp_setting('taxrates');
     if (!is_array($rates)) {
         $rates = array();
     }
     if (isset($_GET['delete'])) {
         check_admin_referer('shopp_delete_taxrate');
         $delete = (int) $_GET['delete'];
         if (isset($rates[$delete])) {
             array_splice($rates, $delete, 1);
         }
         shopp_set_setting('taxrates', $rates);
     }
     if (isset($_POST['editing'])) {
         $rates[$edit] = $_POST['settings']['taxrates'][$edit];
     }
     if (isset($_POST['addrule'])) {
         $rates[$edit]['rules'][] = array('p' => '', 'v' => '');
     }
     if (isset($_POST['deleterule'])) {
         check_admin_referer('shopp-settings-taxrates');
         list($rateid, $row) = explode(',', $_POST['deleterule']);
         if (isset($rates[$rateid]) && isset($rates[$rateid]['rules'])) {
             array_splice($rates[$rateid]['rules'], $row, 1);
             shopp_set_setting('taxrates', $rates);
         }
     }
     if (isset($rates[$edit]['haslocals'])) {
         $rates[$edit]['haslocals'] = $rates[$edit]['haslocals'] == 'true' || $rates[$edit]['haslocals'] == '1';
     }
     if (isset($_POST['add-locals'])) {
         $rates[$edit]['haslocals'] = true;
     }
     if (isset($_POST['remove-locals'])) {
         $rates[$edit]['haslocals'] = false;
         $rates[$edit]['locals'] = array();
     }
     $upload = $this->taxrate_upload();
     if ($upload !== false) {
         if (isset($upload['error'])) {
             $localerror = $upload['error'];
         } else {
             $rates[$edit]['locals'] = $upload;
         }
     }
     if (isset($_POST['editing'])) {
         // Re-sort taxes from generic to most specific
         usort($rates, array($this, 'taxrates_sorting'));
         $rates = stripslashes_deep($rates);
         shopp_set_setting('taxrates', $rates);
     }
     if (isset($_POST['addrate'])) {
         $edit = count($rates);
     }
     if (isset($_POST['submit'])) {
         $edit = false;
     }
     $base = shopp_setting('base_operations');
     $specials = array(ShoppTax::ALL => Shopp::__('All Markets'));
     if (ShoppTax::euvat(false, $base['country'], ShoppTax::EUVAT)) {
         $specials[ShoppTax::EUVAT] = Shopp::__('European Union');
     }
     $countries = array_merge($specials, (array) shopp_setting('target_markets'));
     $zones = Lookup::country_zones();
     include $this->ui('taxrates.php');
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:75,代码来源:System.php

示例6: editor

	/**
	 * Interface processor for the customer editor
	 *
	 * Handles rendering the interface, processing updated customer details
	 * and handing saving them back to the database
	 * 
	 * @return void
	 **/
	function editor () {
		global $Ecart,$Customer;
		$db =& DB::get();

		if ( !(is_ecart_userlevel() || current_user_can('ecart_customers')) )
			wp_die(__('You do not have sufficient permissions to access this page.'));


		if ($_GET['id'] != "new") {
			$Customer = new Customer($_GET['id']);
			$Customer->Billing = new Billing($Customer->id,'customer');
			$Customer->Shipping = new Shipping($Customer->id,'customer');
			if (empty($Customer->id))
				wp_die(__('The requested customer record does not exist.','Ecart'));
		} else $Customer = new Customer();

		if (empty($Customer->info->meta)) remove_meta_box('customer-info','ecart_page_ecart-customers','normal');

		$purchase_table = DatabaseObject::tablename(Purchase::$table);
		$r = $db->query("SELECT count(id) AS purchases,SUM(total) AS total FROM $purchase_table WHERE customer='$Customer->id' LIMIT 1");

		$Customer->orders = $r->purchases;
		$Customer->total = $r->total;


		$countries = array(''=>'&nbsp;');
		$countrydata = Lookup::countries();
		foreach ($countrydata as $iso => $c) {
			if (isset($_POST['settings']) && $_POST['settings']['base_operations']['country'] == $iso)
				$base_region = $c['region'];
			$countries[$iso] = $c['name'];
		}
		$Customer->countries = $countries;

		$regions = Lookup::country_zones();
		$Customer->billing_states = array_merge(array(''=>'&nbsp;'),(array)$regions[$Customer->Billing->country]);
		$Customer->shipping_states = array_merge(array(''=>'&nbsp;'),(array)$regions[$Customer->Shipping->country]);

		include(ECART_ADMIN_PATH."/customers/editor.php");
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:48,代码来源:Account.php

示例7: tag

	function tag ($property,$options=array()) {
		global $Ecart;

		$Order =& $Ecart->Order;
		$checkout = false;
		if (isset($Ecart->Flow->Controller->checkout))
			$checkout = $Ecart->Flow->Controller->checkout;

		// Return strings with no options
		switch ($property) {
			case "url":
				return ecarturl(array('acct'=>null),'account',$Ecart->Gateways->secure); break;
			case "action":
				$action = null;
				if (isset($this->pages[$_GET['acct']])) $action = $_GET['acct'];
				return ecarturl(array('acct'=>$action),'account');
				break;

			case "accounturl": return ecarturl(false,'account'); break;
			case "recover-url": return add_query_arg('acct','recover',ecarturl(false,'account'));
			case "registration-form":
				$regions = Lookup::country_zones();
				add_storefrontjs("var regions = ".json_encode($regions).";",true);
				return $_SERVER['REQUEST_URI'];
				break;
			case "registration-errors":
				$Errors =& EcartErrors();
				if (!$Errors->exist(ECART_ERR)) return false;
				ob_start();
				include(ECART_TEMPLATES.'/errors.php');
				$markup = ob_get_contents();
				ob_end_clean();
				return $markup;
				break;
			case "register":
				return '<input type="submit" name="ecart_registration" value="Register" />';
				break;
			case "process":
				if (!empty($_GET['acct']) && isset($this->pages[$_GET['acct']])) return $_GET['acct'];
				return false;

			case "loggedin": return $Ecart->Order->Customer->login; break;
			case "notloggedin": return (!$Ecart->Order->Customer->login && $Ecart->Settings->get('account_system') != "none"); break;
			case "login-label":
				$accounts = $Ecart->Settings->get('account_system');
				$label = __('Email Address','Ecart');
				if ($accounts == "wordpress") $label = __('Login Name','Ecart');
				if (isset($options['label'])) $label = $options['label'];
				return $label;
				break;
			case "email-login":
			case "loginname-login":
			case "account-login":
				$id = "account-login".($checkout?"-checkout":'');
				if (!empty($_POST['account-login']))
					$options['value'] = $_POST['account-login'];
				if (!isset($options['autocomplete'])) $options['autocomplete'] = "off";
				return '<input type="text" name="account-login" id="'.$id.'"'.inputattrs($options).' />';
				break;
			case "password-login":
				if (!isset($options['autocomplete'])) $options['autocomplete'] = "off";
				$id = "password-login".($checkout?"-checkout":'');

				if (!empty($_POST['password-login']))
					$options['value'] = $_POST['password-login'];
				return '<input type="password" name="password-login" id="'.$id.'"'.inputattrs($options).' />';
				break;
			case "recover-button":
				if (!isset($options['value'])) $options['value'] = __('Get New Password','Ecart');
 					return '<input type="submit" name="recover-login" id="recover-button"'.inputattrs($options).' />';
				break;
			case "submit-login": // Deprecating
			case "login-button":
				if (!isset($options['value'])) $options['value'] = __('Login','Ecart');
				$string = "";
				$id = "submit-login";

				$request = $_GET;
				if (isset($request['acct']) && $request['acct'] == "logout") unset($request['acct']);

				if ($checkout) {
					$id .= "-checkout";
					$string .= '<input type="hidden" name="process-login" id="process-login" value="false" />';
					$string .= '<input type="hidden" name="redirect" value="checkout" />';
				} else $string .= '<input type="hidden" name="process-login" value="true" /><input type="hidden" name="redirect" value="'.ecarturl($request,'account',$Order->security()).'" />';
				$string .= '<input type="submit" name="submit-login" id="'.$id.'"'.inputattrs($options).' />';
				return $string;
				break;
			case "profile-saved":
				$saved = (isset($this->_saved) && $this->_saved);
				unset($this->_saved);
				return $saved;
			case "password-changed":
				$change = (isset($this->_password_change) && $this->_password_change);
				unset($this->_password_change);
				return $change;
			case "errors-exist": return true;
				$Errors = &EcartErrors();
				return ($Errors->exist(ECART_AUTH_ERR));
				break;
//.........这里部分代码省略.........
开发者ID:robbiespire,项目名称:paQui,代码行数:101,代码来源:Customer.php

示例8: state

 /**
  * Provides the billing address state/province name
  *
  * @api `shopp('purchase.state')`
  * @since 1.0
  *
  * @param string        $result  The output
  * @param array         $options The options
  * @param ShoppPurchase $O       The working object
  * @return string The billing address state name
  **/
 public static function state($result, $options, $O)
 {
     $state = esc_html($O->state);
     if (strlen($O->state) > 2) {
         return $state;
     }
     $regions = Lookup::country_zones();
     if (isset($regions[$O->country])) {
         $states = $regions[$O->country];
         if (isset($states[$O->state])) {
             return esc_html($states[$O->state]);
         }
     }
     return $state;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:26,代码来源:purchase.php

示例9: taxes

	function taxes () {
		if ( !(current_user_can('manage_options') && current_user_can('ecart_settings_taxes')) )
			wp_die(__('You do not have sufficient permissions to access this page.'));

		if (!empty($_POST['save'])) {
			check_admin_referer('ecart-settings-taxes');
			$this->settings_save();
			$updated = __('Ecart taxes settings saved.','Ecart');
		}

		$rates = $this->Settings->get('taxrates');
		$base = $this->Settings->get('base_operations');

		$countries = array_merge(array('*' => __('All Markets','Ecart')),
			$this->Settings->get('target_markets'));


		$zones = Lookup::country_zones();

		include(ECART_ADMIN_PATH."/settings/taxes.php");
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:21,代码来源:Setup.php

示例10: location_menu

 public function location_menu($destination = false, $row = 0, $module = false)
 {
     if (!$module) {
         $module = $this->module;
     }
     $menuarrow = ' &#x25be;';
     $tab = str_repeat('&sdot;', 3) . '&nbsp;';
     $regions = Lookup::regions();
     $countries = Lookup::countries();
     $regional_countries = array();
     $country_areas = array();
     $country_zones = array();
     $postcode = false;
     $subregions = isset($_POST[$module]['table'][$row]['subregions']);
     $selection = array();
     $selected = array('region' => '*', 'country' => '', 'area' => '', 'zone' => '');
     if (strpos($destination, ',') !== false) {
         $selection = explode(',', $destination);
     } else {
         $selection = array($destination);
     }
     if ($subregions && isset($_POST[$module]['table'][$row]['destination'])) {
         $selection = explode(',', $_POST[$module]['table'][$row]['destination']);
     }
     if (!is_array($selection)) {
         $selection = array($selection);
     }
     $keys = array_slice(array_keys($selected), 0, count($selection));
     $selected = array_merge($selected, array_combine($keys, $selection));
     $regional_countries = array_filter($countries, create_function('$c', 'return (\'' . $selected['region'] . '\' === (string)$c[\'region\']);'));
     if (!empty($selected['country'])) {
         $ca = Lookup::country_areas();
         if (isset($ca[$selected['country']])) {
             $country_areas = $ca[$selected['country']];
         }
         $cz = Lookup::country_zones();
         if (isset($cz[$selected['country']])) {
             $country_zones = $cz[$selected['country']];
         }
     }
     $options = array('*' => __('Anywhere', 'Shopp'));
     foreach ($regions as $index => $region) {
         if ($index == $selected['region'] && !empty($regional_countries) && ($subregions || !empty($selected['country']))) {
             $options[$index] = $region . $menuarrow;
             foreach ($regional_countries as $country => $country_data) {
                 $country_name = $country_data['name'];
                 if ($country == $selected['country']) {
                     $postcodes = Lookup::postcodes();
                     $postcode = isset($postcodes[$selected['country']]);
                     if (!empty($country_areas) && ($subregions || !empty($selected['area']))) {
                         $options["{$index},{$country}"] = $country_name . $menuarrow;
                         $areas = array_keys($country_areas);
                         foreach ($areas as $area => $area_name) {
                             if ((string) $area == (string) $selected['area']) {
                                 $zones = array_flip($country_areas[$area_name]);
                                 $zones = array_intersect_key($country_zones, $zones);
                                 $group_name = $area_name . $menuarrow;
                                 $options[$group_name] = array();
                                 // Setup option group for area zones
                                 if (empty($selected['zone'])) {
                                     $selected['zone'] = key($zones);
                                 }
                                 foreach ($zones as $zone => $zone_name) {
                                     $options[$group_name]["{$index},{$country},{$area},{$zone}"] = $zone_name . ', ' . substr($country, 0, 2);
                                 }
                                 // end foreach($country_zones)
                             } else {
                                 $options["{$index},{$country},{$area}"] = str_repeat('&nbsp;', 2) . $area_name;
                             }
                         }
                         // end foreach($areas)
                     } elseif (!empty($country_zones) && ($subregions || !empty($selected['area']))) {
                         $options[$country_name] = array();
                         if (empty($selected['area'])) {
                             $selected['area'] = key($country_zones);
                         }
                         foreach ($country_zones as $zone => $zone_name) {
                             $options[$country_name]["{$index},{$country},{$zone}"] = $zone_name . ', ' . substr($country, 0, 2);
                         }
                         // end foreach($country_zones)
                     } else {
                         $options["{$index},{$country}"] = $country_name;
                     }
                 } else {
                     $options["{$index},{$country}"] = $tab . $country_name;
                 }
             }
             // end foreach ($regional_countries)
         } else {
             $options[$index] = $region;
         }
     }
     // end foreach ($regions)
     $selected = array_filter($selected, create_function('$i', 'return (\'\' != $i);'));
     $selection = join(',', $selected);
     return array('options' => $options, 'selection' => $selection, 'postcode' => $postcode);
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:97,代码来源:Shipping.php

示例11: editor

 /**
  * Interface processor for the customer editor
  *
  * Handles rendering the interface, processing updated customer details
  * and handing saving them back to the database
  *
  * @author Jonathan Davis
  * @return void
  **/
 public function editor()
 {
     if (!current_user_can('shopp_customers')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     if ($_GET['id'] != "new") {
         $Customer = new ShoppCustomer($_GET['id']);
         $Customer->Billing = new BillingAddress($Customer->id, 'customer');
         $Customer->Shipping = new ShippingAddress($Customer->id, 'customer');
         if (empty($Customer->id)) {
             wp_die(__('The requested customer record does not exist.', 'Shopp'));
         }
     } else {
         $Customer = new ShoppCustomer();
     }
     if (empty($Customer->info->meta)) {
         remove_meta_box('customer-info', 'shopp_page_shopp-customers', 'normal');
     }
     if ($Customer->id > 0) {
         $purchase_table = ShoppDatabaseObject::tablename(ShoppPurchase::$table);
         $r = sDB::query("SELECT count(id) AS purchases,SUM(total) AS total FROM {$purchase_table} WHERE customer='{$Customer->id}' LIMIT 1");
         $Customer->orders = $r->purchases;
         $Customer->total = $r->total;
     }
     $countries = array('' => '&nbsp;');
     $countrydata = Lookup::countries();
     foreach ($countrydata as $iso => $c) {
         if (isset($_POST['settings']) && $_POST['settings']['base_operations']['country'] == $iso) {
             $base_region = $c['region'];
         }
         $countries[$iso] = $c['name'];
     }
     $Customer->countries = $countries;
     $regions = Lookup::country_zones();
     $Customer->billing_states = array_merge(array('' => '&nbsp;'), (array) $regions[$Customer->Billing->country]);
     $Customer->shipping_states = array_merge(array('' => '&nbsp;'), (array) $regions[$Customer->Shipping->country]);
     include $this->ui('editor.php');
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:47,代码来源:Account.php

示例12: country_zones

 public function country_zones()
 {
     check_admin_referer('wp_ajax_shopp_country_zones');
     $zones = Lookup::country_zones();
     if (isset($_GET['country']) && isset($zones[$_GET['country']])) {
         echo json_encode($zones[$_GET['country']]);
     } else {
         echo json_encode(false);
     }
     exit;
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:11,代码来源:Ajax.php

示例13: 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

示例14: behaviors

 /**
  * Queues Shopp storefront javascript and styles as needed
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 public function behaviors()
 {
     $Shopp = Shopp::object();
     if (is_ssl()) {
         $urls = array('option_siteurl', 'option_home', 'option_url', 'option_wpurl', 'option_stylesheet_url', 'option_template_url', 'script_loader_src');
         foreach ($urls as $filter) {
             add_filter($filter, 'force_ssl');
         }
     }
     // Replace the WordPress canonical link
     remove_action('wp_head', 'rel_canonical');
     add_action('wp_head', array($this, 'header'));
     add_action('wp_footer', array($this, 'footer'));
     wp_enqueue_style('shopp.catalog', SHOPP_ADMIN_URI . '/styles/catalog.css', array(), 20110511, 'screen');
     wp_enqueue_style('shopp.icons', SHOPP_ADMIN_URI . '/styles/icons.css', array(), 20110511, 'screen');
     wp_enqueue_style('shopp', Shopp::template_url('shopp.css'), array(), 20110511, 'screen');
     wp_enqueue_style('shopp.colorbox', SHOPP_ADMIN_URI . '/styles/colorbox.css', array(), 20110511, 'screen');
     $orderhistory = is_account_page() && isset($_GET['id']) && !empty($_GET['id']);
     if (is_thanks_page() || $orderhistory) {
         wp_enqueue_style('shopp.printable', SHOPP_ADMIN_URI . '/styles/printable.css', array(), 20110511, 'print');
     }
     $loading = shopp_setting('script_loading');
     if (!$loading || 'global' == $loading || !empty($page)) {
         shopp_enqueue_script('colorbox');
         shopp_enqueue_script('shopp');
         shopp_enqueue_script('catalog');
         shopp_enqueue_script('cart');
         if (is_catalog_page()) {
             shopp_custom_script('catalog', "var pricetags = {};\n");
         }
     }
     if (is_checkout_page()) {
         shopp_enqueue_script('address');
         shopp_enqueue_script('checkout');
     }
     if (is_confirm_page()) {
         shopp_enqueue_script('checkout');
     }
     if (is_account_page()) {
         shopp_enqueue_script('address');
         $regions = Lookup::country_zones();
         $js = 'var regions=' . json_encode($regions);
         add_storefrontjs($js, true);
     }
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:53,代码来源:Storefront.php

示例15: tag

	function tag ($property,$options=array()) {
		global $Ecart;

		$taxes = isset($options['taxes'])?$options['taxes']:false;
		$taxrate = 0;
		if ($property == "item-unitprice" || $property == "item-total")
			$taxrate = ecart_taxrate($taxes);

		// Return strings with no options
		switch ($property) {
			case "receipt":
				// Skip the receipt processing when sending order notifications in admin without the receipt
				if (defined('WP_ADMIN') && isset($_POST['receipt']) && $_POST['receipt'] == "no") return;
				if (isset($options['template']) && is_readable(ECART_TEMPLATES."/".$options['template']))
					return $this->receipt($template);
				else return $this->receipt();
				break;
			case "url": return ecarturl(false,'account'); break;
			case "id": return $this->id; break;
			case "customer": return $this->customer; break;
			case "date":
				if (empty($options['format'])) $options['format'] = get_option('date_format').' '.get_option('time_format');
				return _d($options['format'],((is_int($this->created))?$this->created:mktimestamp($this->created)));
				break;
			case "card": return (!empty($this->card))?sprintf("%'X16d",$this->card):''; break;
			case "cardtype": return $this->cardtype; break;
			case "txnid":
			case "transactionid": return $this->txnid; break;
			case "firstname": return esc_html($this->firstname); break;
			case "lastname": return esc_html($this->lastname); break;
			case "company": return esc_html($this->company); break;
			case "email": return esc_html($this->email); break;
			case "phone": return esc_html($this->phone); break;
			case "address": return esc_html($this->address); break;
			case "xaddress": return esc_html($this->xaddress); break;
			case "city": return esc_html($this->city); break;
			case "state":
				if (strlen($this->state > 2)) return esc_html($this->state);
				$regions = Lookup::country_zones();
				$states = $regions[$this->country];
				return $states[$this->state];
				break;
			case "postcode": return esc_html($this->postcode); break;
			case "country":
				$countries = $Ecart->Settings->get('target_markets');
				return $countries[$this->country]; break;
			case "shipaddress": return esc_html($this->shipaddress); break;
			case "shipxaddress": return esc_html($this->shipxaddress); break;
			case "shipcity": return esc_html($this->shipcity); break;
			case "shipstate":
				if (strlen($this->shipstate > 2)) return esc_html($this->shipstate);
				$regions = Lookup::country_zones();
				$states = $regions[$this->country];
				return $states[$this->shipstate];
				break;
			case "shippostcode": return esc_html($this->shippostcode); break;
			case "shipcountry":
				$countries = $Ecart->Settings->get('target_markets');
				return $countries[$this->shipcountry]; break;
			case "shipmethod": return esc_html($this->shipmethod); break;
			case "totalitems": return count($this->purchased); break;
			case "has-items":
			case "hasitems":
				if (empty($this->purchased)) $this->load_purchased();
				return (count($this->purchased) > 0);
				break;
			case "items":
				if (!isset($this->_items_loop)) {
					reset($this->purchased);
					$this->_items_loop = true;
				} else next($this->purchased);

				if (current($this->purchased) !== false) return true;
				else {
					unset($this->_items_loop);
					return false;
				}
			case "item-id":
				$item = current($this->purchased);
				return $item->id; break;
			case "item-product":
				$item = current($this->purchased);
				return $item->product; break;
			case "item-price":
				$item = current($this->purchased);
				return $item->price; break;
			case "item-name":
				$item = current($this->purchased);
				return $item->name; break;
			case "item-description":
				$item = current($this->purchased);
				return $item->description; break;
			case "item-options":
				if (!isset($options['after'])) $options['after'] = "";
				$item = current($this->purchased);
				return (!empty($item->optionlabel))?$options['before'].$item->optionlabel.$options['after']:''; break;
			case "item-sku":
				$item = current($this->purchased);
				return $item->sku; break;
			case "item-download":
//.........这里部分代码省略.........
开发者ID:robbiespire,项目名称:paQui,代码行数:101,代码来源:Purchase.php


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