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


PHP GetCountryIdByName函数代码示例

本文整理汇总了PHP中GetCountryIdByName函数的典型用法代码示例。如果您正苦于以下问题:PHP GetCountryIdByName函数的具体用法?PHP GetCountryIdByName怎么用?PHP GetCountryIdByName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: SetPanelSettings

 public function SetPanelSettings()
 {
     $selectedCountry = GetConfig('CompanyCountry');
     $selectedState = 0;
     if (isset($GLOBALS['SavedAddress']) && is_array($GLOBALS['SavedAddress'])) {
         $address = $GLOBALS['SavedAddress'];
         $selectedCountry = $address['shipcountry'];
         $addressVars = array('account_email' => 'AccountEmail', 'shipfirstname' => 'AddressFirstName', 'shiplastname' => 'AddressLastName', 'shipcompany' => 'AddressCompany', 'shipaddress1' => 'AddressLine1', 'shipaddress2' => 'AddressLine2', 'shipcity' => 'AddressCity', 'shipstate' => 'AddressState', 'shipzip' => 'AddressZip', 'shipphone' => 'AddressPhone');
         if (isset($address['shipstateid'])) {
             $selectedState = $address['shipstateid'];
         }
         foreach ($addressVars as $addressField => $formField) {
             if (isset($address[$addressField])) {
                 $GLOBALS[$formField] = isc_html_escape($address[$addressField]);
             }
         }
     }
     $country_id = GetCountryIdByName($selectedCountry);
     $GLOBALS['CountryList'] = GetCountryList(GetConfig('CompanyCountry'), true);
     $GLOBALS['StateList'] = GetStateListAsOptions($country_id, $selectedState);
     // If there are no states for the country then
     // hide the dropdown and show the textbox instead
     if (GetNumStatesInCountry($country_id) == 0) {
         $GLOBALS['HideStateList'] = "none";
     } else {
         $GLOBALS['HideStateBox'] = "none";
     }
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:28,代码来源:CheckoutNewAddressForm.php

示例2: GetSalesTaxRate

 /**
  * Get the sales tax information regarding the passed billing & shipping details.
  *
  * @param mixed Either an integer with the billing address or an array of details about the address.
  * @param mixed Either an integer with the shipping address or an array of details about the address.
  * @return array Array of information containing the tax data. (name, rate, based on etc)
  */
 public function GetSalesTaxRate($billingAddress, $shippingAddress = 0)
 {
     // Setup the array which will be returned
     $taxData = array("tax_name" => "", "tax_rate" => 0, "tax_based_on" => "", "tax_id" => 0);
     // If tax is being applied globally, just return that
     if (GetConfig('TaxTypeSelected') == 2) {
         $basedOn = 'subtotal';
         if (GetConfig('DefaultTaxRateBasedOn')) {
             $basedOn = GetConfig('DefaultTaxRateBasedOn');
         }
         $taxData['tax_name'] = GetConfig('DefaultTaxRateName');
         $taxData['tax_rate'] = GetConfig('DefaultTaxRate');
         $taxData['tax_based_on'] = $basedOn;
         return $taxData;
     }
     $GLOBALS['ISC_CLASS_ACCOUNT'] = GetClass('ISC_ACCOUNT');
     $countryIds = array();
     $stateIds = array();
     if (!is_array($billingAddress)) {
         $billingAddress = $GLOBALS['ISC_CLASS_ACCOUNT']->GetShippingAddress($billingAddress);
     }
     if (!is_array($shippingAddress) && $shippingAddress > 0) {
         $shippingAddress = $GLOBALS['ISC_CLASS_ACCOUNT']->GetShippingAddress($shippingAddress);
     }
     // A billing address is required for every order. If we don't have one then there's no point in proceeding
     if (!is_array($billingAddress)) {
         return $taxData;
     }
     if (!isset($billingAddress['shipcountryid'])) {
         $billingAddress['shipcountryid'] = GetCountryIdByName($billingAddress['shipcountry']);
     }
     if (!isset($billingAddress['shipstateid'])) {
         $billingAddress['shipstateid'] = GetStateByName($billingAddress['shipstate'], $billingAddress['shipcountryid']);
     }
     if (is_array($shippingAddress)) {
         if (!isset($shippingAddress['shipcountryid'])) {
             $shippingAddress['shipcountryid'] = GetCountryIdByName($shippingAddress['shipcountry']);
         }
         if (!isset($shippingAddress['shipstateid'])) {
             $shippingAddress['shipstateid'] = GetStateByName($shippingAddress['shipstate'], $shippingAddress['shipcountryid']);
         }
     }
     // Do we have a matching state based tax rule?
     if ($billingAddress['shipstateid'] || is_array($shippingAddress) && $shippingAddress['shipstateid']) {
         $query = "\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM [|PREFIX|]tax_rates\n\t\t\t\t\tWHERE (1=0\n\t\t\t\t";
         if ($billingAddress['shipstateid']) {
             $query .= " OR (taxaddress='billing' AND taxratecountry='" . (int) $billingAddress['shipcountryid'] . "' AND taxratestates LIKE '%%," . (int) $billingAddress['shipstateid'] . ",%%')";
         }
         if (is_array($shippingAddress) && $shippingAddress['shipstateid']) {
             $query .= " OR (taxaddress='shipping' AND taxratecountry='" . (int) $shippingAddress['shipcountryid'] . "' AND taxratestates LIKE '%%," . (int) $shippingAddress['shipstateid'] . ",%%')";
         }
         $query .= ") AND taxratestatus='1'";
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
         if (is_array($row)) {
             $taxData = array('tax_name' => $row['taxratename'], 'tax_rate' => $row['taxratepercent'], 'tax_based_on' => $row['taxratebasedon'], 'tax_id' => $row['taxrateid']);
             return $taxData;
         }
     }
     // Maybe we've got a matching country based rule
     $query = "\n\t\t\t\tSELECT *\n\t\t\t\tFROM [|PREFIX|]tax_rates\n\t\t\t\tWHERE (1=0 OR (taxratecountry='" . (int) $billingAddress['shipcountryid'] . "' AND taxaddress='billing')\n\t\t\t";
     if (is_array($shippingAddress) && $shippingAddress['shipcountryid']) {
         $query .= " OR (taxratecountry='" . (int) $shippingAddress['shipcountryid'] . "' AND taxaddress='shipping')";
     }
     $query .= ") AND taxratestatus='1' AND taxratestates = ',0,'";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
     if (is_array($row)) {
         $taxData = array('tax_name' => $row['taxratename'], 'tax_rate' => $row['taxratepercent'], 'tax_based_on' => $row['taxratebasedon'], 'tax_id' => $row['taxrateid']);
         return $taxData;
     }
     // Otherwise, if we still have nothing, perhaps we have a rule that applies to all countries
     $query = "\n\t\t\t\tSELECT *\n\t\t\t\tFROM [|PREFIX|]tax_rates\n\t\t\t\tWHERE taxratecountry='0' AND taxratestatus='1'\n\t\t\t";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
     if (is_array($row)) {
         $taxData = array('tax_name' => $row['taxratename'], 'tax_rate' => $row['taxratepercent'], 'tax_based_on' => $row['taxratebasedon'], 'tax_id' => $row['taxrateid']);
         return $taxData;
     }
     // Still here? Just return nothing!
     return $taxData;
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:89,代码来源:class.customer.php

示例3: setUpShippingAndHandling

	/**
	 * Set up everything pertaining to the display of the 'Estimate Shipping'
	 * feature, as well as the shipping cost of all items in the cart if it is
	 * known.
	 */
	public function setUpShippingAndHandling()
	{
		$GLOBALS['HideShoppingCartShippingCost'] = 'none';
		$GLOBALS['HideShoppingCartHandlingCost'] = 'none';
		$GLOBALS['HideShoppingCartShippingEstimator'] = 'display: none';

		$this->quote->setIsSplitShipping(false);

		$handling = $this->quote->getHandlingCost($this->displayIncludingTax);
		if($handling > 0) {
			$handlingFormatted = currencyConvertFormatPrice($handling);
			$GLOBALS['HandlingCost'] = $handlingFormatted;
			$GLOBALS['HideShoppingCartHandlingCost'] = '';
		}

		// All products in the cart are digital downloads so the shipping doesn't apply
		if($this->quote->isDigital()) {
			return;
		}

		// If we're still here, shipping applies to this order
		$GLOBALS['HideShoppingCartShippingEstimator'] = '';

		$selectedCountry = GetCountryIdByName(GetConfig('CompanyCountry'));
		$selectedState = 0;
		$selectedStateName = '';

		// Retain the country, stae and zip code selections if we have them
		$shippingAddress = $this->quote->getShippingAddress(0);
		if($shippingAddress->getCountryId()) {
			$selectedCountry = $shippingAddress->getCountryId();
			$selectedState = $shippingAddress->getStateId();
			$GLOBALS['ShippingZip'] = $shippingAddress->getZip();
		}

		$GLOBALS['ShippingCountryList'] = GetCountryList($selectedCountry);
		$GLOBALS['ShippingStateList'] = GetStateListAsOptions($selectedCountry, $selectedState);
		$GLOBALS['ShippingStateName'] = isc_html_escape($selectedStateName);

		// If there are no states for the country then hide the dropdown and show the textbox instead
		if (GetNumStatesInCountry($selectedCountry) == 0) {
			$GLOBALS['ShippingHideStateList'] = "none";
		}
		else {
			$GLOBALS['ShippingHideStateBox'] = "none";
		}

		// Show the stored shipping estimate if we have one
		if($shippingAddress->hasShippingMethod()) {
			$GLOBALS['HideShoppingCartShippingCost'] = '';
			$cost = $shippingAddress->getNonDiscountedShippingCost($this->displayIncludingTax);

			if($cost == 0) {
				$GLOBALS['ShippingCost'] = getLang('Free');
			}
			else {
				$GLOBALS['ShippingCost'] = currencyConvertFormatPrice($cost);
			}

			$GLOBALS['ShippingProvider'] = isc_html_escape($shippingAddress->getShippingProvider());
		}
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:67,代码来源:CartContent.php

示例4: SetupOrderManagementForm


//.........这里部分代码省略.........
         $formSessionId = 0;
         if ($formId == FORMFIELDS_FORM_ACCOUNT) {
             /**
              * We are only using the real custom fields for the account section, so check here
              */
             if (!gzte11(ISC_MEDIUMPRINT)) {
                 continue;
             }
             if (isset($existingCustomer['custformsessionid'])) {
                 $formSessionId = $existingCustomer['custformsessionid'];
             }
         } else {
             if (isset($postData['ordformsessionid'])) {
                 $formSessionId = $postData['ordformsessionid'];
             }
         }
         /**
          * This part here gets all the existing fields
          */
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields($formId, true);
         } else {
             if (isId($formSessionId)) {
                 $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields($formId, false, $formSessionId);
             } else {
                 $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields($formId);
             }
         }
         /**
          * Get any selected country and state. This needs to be separate as we physically
          * print out each form field at a time so we need this information before hand
          */
         if ($formId !== FORMFIELDS_FORM_ACCOUNT) {
             $countryId = GetCountryIdByName(GetConfig('CompanyCountry'));
             $stateFieldId = 0;
             foreach (array_keys($fields) as $fieldId) {
                 if (isc_strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'state') {
                     $stateFieldId = $fieldId;
                 } else {
                     if (isc_strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'country') {
                         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                             $country = $fields[$fieldId]->getValue();
                         }
                         if ($formId == FORMFIELDS_FORM_BILLING) {
                             $country = @$order['ordbillcountry'];
                         } else {
                             $country = @$order['ordshipcountry'];
                         }
                         if (trim($country) !== '') {
                             $countryId = GetCountryIdByName($country);
                         }
                     }
                 }
             }
         }
         /**
          * Now we construct and build each form field
          */
         $column = 0;
         foreach (array_keys($fields) as $fieldId) {
             if ($formId == FORMFIELDS_FORM_ACCOUNT) {
                 if ($fields[$fieldId]->record['formfieldprivateid'] !== '' || !gzte11(ISC_MEDIUMPRINT)) {
                     continue;
                 }
                 $fieldHTML = $fields[$fieldId]->loadForFrontend();
                 if ($column % 2 > 0) {
开发者ID:nirvana-info,项目名称:old_bak,代码行数:67,代码来源:class.orders.php

示例5: GetCountryStates

 /**
  * Display a list of states for a given country
  *
  * @return void
  **/
 private function GetCountryStates()
 {
     $country = $_REQUEST['c'];
     if (IsId($country)) {
         $countryId = $country;
     } else {
         $countryId = GetCountryIdByName($country);
     }
     if (isset($_REQUEST['s']) && GetStateByName($_REQUEST['s'], $countryId)) {
         $state = $_REQUEST['s'];
     } else {
         $state = '';
     }
     if (isset($_REQUEST['format']) && $_REQUEST['format'] == 'options') {
         echo GetStateListAsOptions($country, $state, false, '', '', false, true);
     } else {
         echo GetStateList((int) $country);
     }
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:24,代码来源:class.remote_dec04.php

示例6: SetOriginByVendorId

		/**
		* Sets the origin location of the shipping module to the location of the vendor
		*
		* @param int The vendor ID to load the location details for
		*/
		public function SetOriginByVendorId($vendorId)
		{
			if ($vendorId) {
				$query = "SELECT * FROM [|PREFIX|]vendors WHERE vendorid = '" . (int)$vendorId . "'";
				$vendorResult = $GLOBALS['ISC_CLASS_DB']->Query($query);
				if ($vendorData = $GLOBALS['ISC_CLASS_DB']->Fetch($vendorResult)) {
					$this->SetOriginCountry(GetCountryIdByName($vendorData['vendorcountry']));
					$this->SetOriginState($vendorData['vendorstate']);
					$this->SetOriginZip($vendorData['vendorzip']);
					$this->SetOriginCity($vendorData['vendorcity']);
				}
			}
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:18,代码来源:class.shipping.php

示例7: getCountryId

	/**
	 * Get the country ID
	 *
	 * Method will return the country ID if found
	 *
	 * @access protected
	 * @param string $countryName The country name / ISO3 name / ISO2 name
	 * @param string $properCountryName The referenced variable to set the proper country name if the record exists
	 * @return int The country ID on success, FALSE if not found
	 */
	protected function getCountryId($countryName, &$properCountryName=null)
	{
		if (trim($countryName) == '') {
			return false;
		}

		if (strlen($countryName) == 2) {
			$countryId = GetCountryIdByISO2($countryName);
		} else if (strlen($countryName) == 3) {
			$countryId = GetCountryIdByISO3($countryName);
		} else {
			$countryId = GetCountryIdByName($countryName);
		}

		if (!$countryId || trim($countryId) == '') {
			return false;
		}

		$properCountryName = GetCountryById($countryId);

		return (int)$countryId;
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:32,代码来源:service.syncbase.php

示例8: GetStateListAsOptions

/**
 *	Get a list of states as <option> tags
 */
function GetStateListAsOptions($country, $selectedState = 0, $IncludeFirst = true, $FirstText = "ChooseAState", $FirstValue = "0", $FirstSelected = false, $useNamesAsValues = false)
{
    if (!is_numeric($country)) {
        $country = GetCountryIdByName($country);
    }
    $list = "";
    $query = sprintf("select stateid, statename from [|PREFIX|]country_states where statecountry='%d' order by statename asc", $GLOBALS['ISC_CLASS_DB']->Quote($country));
    $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
    // Should we add a blank option?
    if ($IncludeFirst) {
        if ($FirstSelected) {
            $sel = 'selected="selected"';
        } else {
            $sel = "";
        }
        $list = sprintf("<option %s value='%s'>%s</option>", $sel, $FirstValue, GetLang($FirstText));
    }
    while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
        if (is_numeric($selectedState)) {
            // Match $selectedState by country id
            if ($row['stateid'] == $selectedState) {
                $sel = 'selected="selected"';
            } else {
                $sel = "";
            }
        } else {
            if (is_array($selectedState)) {
                // A list has been passed in
                if (in_array($row['stateid'], $selectedState) || in_array($row['statename'], $selectedState)) {
                    $sel = 'selected="selected"';
                } else {
                    $sel = "";
                }
            } else {
                // Just one state has been passed in
                if (strtolower($row['statename']) == strtolower($selectedState)) {
                    $sel = 'selected="selected"';
                } else {
                    $sel = "";
                }
            }
        }
        if ($useNamesAsValues) {
            $value = isc_html_escape($row['statename']);
        } else {
            $value = $row['stateid'];
        }
        $list .= sprintf("<option value='%s' %s>%s</option>", $value, $sel, $row['statename']);
    }
    return $list;
}
开发者ID:nirvana-info,项目名称:old_bak,代码行数:54,代码来源:shipping_24_2.php

示例9: OrderCalculateShipping

 /**
  * Calculate the shipping for an order that's being edited/created.
  */
 private function OrderCalculateShipping()
 {
     if (!isset($_REQUEST['orderSession'])) {
         exit;
     }
     $orderClass = GetClass('ISC_ADMIN_ORDERS');
     $orderClass->GetCartApi($_REQUEST['orderSession']);
     $cartProducts = $orderClass->GetCartApi()->GetProductsInCart();
     $cartClass = GetClass('ISC_CART');
     $address = array('shipzip' => @$_REQUEST['ordshipzip'], 'shipstate' => @$_REQUEST['ordshipstate'], 'shipcountry' => @$_REQUEST['ordshipcountry'], 'shipcountryid' => GetCountryIdByName(@$_REQUEST['ordshipcountry']));
     $address['shipstateid'] = GetStateByName($address['shipstate'], $address['shipcountryid']);
     $shippingMethods = $cartClass->GetAvailableShippingMethodsForProducts($address, $cartProducts, $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId());
     $orderClass->GetCartApi()->Set('SHIPPING_QUOTES', $shippingMethods);
     $existingShippingMethod = $orderClass->GetCartApi()->Get('SHIPPING_METHOD');
     $GLOBALS['ShippingMethods'] = '';
     foreach ($shippingMethods as $quoteId => $quote) {
         $checked = '';
         if (is_array($existingShippingMethod) && $quote['description'] == $existingShippingMethod['methodName']) {
             $hasChecked = true;
             $checked = 'checked="checked"';
         }
         $GLOBALS['MethodChecked'] = $checked;
         $GLOBALS['MethodName'] = isc_html_escape($quote['description']);
         $GLOBALS['MethodCost'] = FormatPrice($quote['price']);
         $GLOBALS['MethodId'] = $quoteId;
         $GLOBALS['ShippingMethods'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderShippingMethodChoice');
     }
     $GLOBALS['HideNoShipingMethods'] = 'display: none';
     if (!empty($shippingMethods)) {
         $GLOBALS['HideNoShippingMethods'] = '';
     }
     $existingOrder = $orderClass->GetCartApi()->Get('EXISTING_ORDER');
     $order = GetOrder($existingOrder);
     if ($existingOrder !== false && $order['ordshipmethod']) {
         $checked = '';
         if (!isset($hasChecked) && (!is_array($existingShippingMethod) || $order['ordshipmethod'] == $existingShippingMethod['methodName'])) {
             $checked = 'checked="checked"';
         }
         $GLOBALS['MethodChecked'] = $checked;
         $GLOBALS['MethodName'] = sprintf(GetLang('ExistingShippingMethod'), isc_html_escape($order['ordshipmethod']));
         $GLOBALS['MethodCost'] = FormatPrice($order['ordshipcost']);
         $GLOBALS['MethodId'] = 'existing';
         $GLOBALS['ShippingMethods'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderShippingMethodChoice') . $GLOBALS['ShippingMethods'];
     }
     $GLOBALS['CustomChecked'] = '';
     $GLOBALS['HideCustom'] = 'display: none';
     if (is_array($existingShippingMethod) && $existingShippingMethod['methodModule'] == 'custom') {
         $GLOBALS['CustomChecked'] = 'checked="checked"';
         $GLOBALS['CustomName'] = isc_html_escape($existingShippingMethod['methodName']);
         $GLOBALS['CustomPrice'] = FormatPrice($existingShippingMethod['methodCost'], false, false);
         $GLOBALS['HideCustom'] = '';
     }
     /* The below patch is added to check the custom shipping if no other shipping method exist - vikas - starts */
     if ($GLOBALS['ShippingMethods'] == "") {
         $GLOBALS['CustomChecked'] = 'checked="checked"';
         $GLOBALS['HideCustom'] = '';
     }
     // below custom name has been added as client told to make it readonly.
     if (!isset($GLOBALS['CustomName'])) {
         $GLOBALS['CustomName'] = "Custom";
     }
     /* - ends -*/
     echo $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderShippingMethodWindow');
     exit;
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:68,代码来源:class.remote.orders_23_Jult_mj.php

示例10: ExpressCheckoutChooseAddress

	/**
	 * Generate the choose an address form for the express checkout for either a billing or shipping address.
	 *
	 * @param string The type of address fields to generate (either billing or shipping)
	 * @return string The generated address form.
	 */
	public function ExpressCheckoutChooseAddress($addressType, $buildRequiredJS=false)
	{
		$templateAddressType = $addressType;
		if($templateAddressType == 'account') {
			$templateAddressType = 'billing';
		}
		$templateUpperAddressType = ucfirst($templateAddressType);

		$GLOBALS['AddressList'] = '';

		$GLOBALS['AddressType'] = $templateAddressType;
		$GLOBALS['UpperAddressType'] = $templateUpperAddressType;
		$GLOBALS['HideCreateAddress'] = 'display: none';
		$GLOBALS['HideChooseAddress'] = 'display: none';

		$GLOBALS['CreateAccountForm'] = '';
		$country_id = GetCountryIdByName(GetConfig('CompanyCountry'));

		$selectedCountry = GetConfig('CompanyCountry');
		$selectedState = 0;

		if ($addressType == 'shipping') {
			$fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_SHIPPING);
		} else if (!CustomerIsSignedIn() && $addressType == 'account') {
			$fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_ACCOUNT);
			$fields += $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_BILLING);
		} else {
			$fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_BILLING);
		}

		// If the customer isn't signed in, then by default we show the create form
		if(!CustomerIsSignedIn() ) {
			$GLOBALS['HideCreateAddress'] = '';
		}
		// If the customer is logged in, load up their existing addresses
		else {
			$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
			$shippingAddresses = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerShippingAddresses();

			// If the customer doesn't have any addresses, show the creation form
			if(empty($shippingAddresses)) {
				$GLOBALS['HideChooseAddress'] = 'display: none';
				$GLOBALS['HideCreateAddress'] = '';
			}
			else {
				$GLOBALS['HideChooseAddress'] = '';
				$addressMap = array(
					'shipfullname',
					'shipcompany',
					'shipaddress1',
					'shipaddress2',
					'shipcity',
					'shipstate',
					'shipzip',
					'shipcountry'
				);

				foreach($shippingAddresses as $address) {
					$formattedAddress = '';
					foreach($addressMap as $field) {
						if(!$address[$field]) {
							continue;
						}
						$formattedAddress .= $address[$field] .', ';
					}
					$GLOBALS['AddressSelected'] = '';

					if(isset($_SESSION['CHECKOUT']['SelectAddress'])) {
						if($_SESSION['CHECKOUT']['SelectAddress'] == $address['shipid']) {
							$GLOBALS['AddressSelected'] = ' selected="selected"';
						}
					} else if(!$GLOBALS['AddressList']) {
						$GLOBALS['AddressSelected'] = ' selected="selected"';
					}

					$GLOBALS['AddressId'] = $address['shipid'];
					$GLOBALS['AddressLine'] = isc_html_escape(trim($formattedAddress, ', '));
					$GLOBALS['AddressList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ExpressCheckoutAddress');
				}
			}
		}

		if($addressType == 'billing') {
			$quoteAddress = getCustomerQuote()->getBillingAddress();
		}
		else {
			$quoteAddress = getCustomerQuote()->setIsSplitShipping(false)
				->getShippingAddress();
		}

		$selectedCountry = $quoteAddress->getCountryName();
		$selectedState = $quoteAddress->getStateName();
		$country_id = $quoteAddress->getCountryId();

//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class.checkout.php

示例11: getTemplateForm


//.........这里部分代码省略.........
		}
		$this->template->assign('hitCounters', $hitCounters);

		// Paid upgrade options

		// Gallery Style
		$availableGalleryOptions = array ('None', 'Gallery', 'Plus', 'Featured');
		$galleryOptions = array();
		foreach ($availableGalleryOptions as $galleryOption) {
			$galleryOptions[$galleryOption] = GetLang('EbayGallery' . $galleryOption);
		}
		$this->template->assign('galleryOptions', $galleryOptions);

		// Listing enhancement
		$listingFeaturesObject = $getEbayDetailsXml->xpath('/GeteBayDetailsResponse/ListingFeatureDetails');
		$supportedListingFeatures = array('BoldTitle','Border','FeaturedFirst','FeaturedPlus','GiftIcon','Highlight','HomePageFeatured','ProPack');
		$listingFeatures = array();
		if (isset($listingFeaturesObject[0])) {
			foreach ($listingFeaturesObject[0] as $featureCode => $availability) {
				//@ToDo add support for PowerSellerOnly and TopRatedSellerOnly options
				if (!in_array($featureCode, $supportedListingFeatures) || $availability != 'Enabled') {
					continue;
				}

				$listingFeatures[$featureCode] = GetLang($featureCode);
			}
		}
		$this->template->assign('listingFeatures', $listingFeatures);

		// any defaults we should set
		$this->template->assign('quantityOption', 'one');
		$this->template->assign('useItemPhoto', true);

		$this->template->assign('locationCountry', GetCountryIdByName(GetConfig('CompanyCountry')));
		$this->template->assign('locationZip', GetConfig('CompanyZip'));
		$this->template->assign('locationCityState', GetConfig('CompanyCity') . ', ' . GetConfig('CompanyState'));

		$this->template->assign('reservePriceOption', 'ProductPrice');
		$this->template->assign('reservePriceCustom', $categoryOptions['minimum_reserve_price']);
		$this->template->assign('startPriceOption', 'ProductPrice');
		$this->template->assign('startPriceCustom', 0.01);
		$this->template->assign('buyItNowPriceOption', 'ProductPrice');
		$this->template->assign('buyItNowPriceCalcPrice', 10);
		$this->template->assign('buyItNowPriceCustom', 0.01);
		$this->template->assign('fixedBuyItNowPriceOption', 'ProductPrice');
		$this->template->assign('fixedBuyItNowPriceCustom', 0.01);

		$this->template->assign('auctionDuration', 'Days_7');
		$this->template->assign('fixedDuration', 'Days_7');

		$this->template->assign('useDomesticShipping', false);
		$this->template->assign('useInternationalShipping', false);
		$this->template->assign('useSalesTax', false);

		$this->template->assign('hitCounter', 'BasicStyle');

		$this->template->assign('galleryOption', 'Gallery');

		$this->template->assign('domesticFlatCount', 0);
		$this->template->assign('domesticCalcCount', 0);
		$this->template->assign('internationalFlatCount', 0);
		$this->template->assign('internationalCalcCount', 0);

		// assign template specific variables
		if ($templateId) {
			$template = new ISC_ADMIN_EBAY_TEMPLATE($templateId);
开发者ID:hungnv0789,项目名称:vhtm,代码行数:67,代码来源:class.ebay.php

示例12: SetupPreCheckoutShipping


//.........这里部分代码省略.........
         $GLOBALS['CartRuleMessage'] .= $message;
         $GLOBALS['CartRuleMessage'] .= '</p>';
     }
     // If all of the products in the cart have free shipping, then we automatically qualify
     if ($freeShippingProductCount == count($cartProducts) || $this->api->GetCartFreeShipping()) {
         $GLOBALS['ShippingCost'] = GetLang('Free');
         $freeShippingQualified = true;
         $GLOBALS['HideCartFreeShippingPanel'] = "";
         $GLOBALS['FreeShippingMessage'] = GetLang('OrderQualifiesForFreeShipping');
         return;
     }
     // Show the estimation box
     $GLOBALS['HideShoppingCartShippingEstimator'] = '';
     // If we have a shipping zone already stored, we can show a little more
     if (isset($_SESSION['OFFERCART']['SHIPPING']['ZONE'])) {
         $zone = GetShippingZoneById($_SESSION['OFFERCART']['SHIPPING']['ZONE']);
         // The zone no longer exists
         if (!isset($zone['zoneid'])) {
             unset($_SESSION['OFFERCART']['SHIPPING']);
             return;
         }
         // If the contents of the cart have changed since their last known values (based off a unique hash of the cart contents)
         // then invalidate the shipping costs
         if (isset($_SESSION['OFFERCART']['SHIPPING']['CART_HASH']) && $this->api->GenerateCartHash() != $_SESSION['OFFERCART']['SHIPPING']['CART_HASH']) {
             // Remove any existing shipping costs
             $this->InvalidateCartShippingCosts();
         }
         // If we have a shipping cost saved, store it too
         if (isset($_SESSION['OFFERCART']['SHIPPING']['SHIPPING_COST'])) {
             $GLOBALS['HideShoppingCartShippingCost'] = '';
             if ($_SESSION['OFFERCART']['SHIPPING']['SHIPPING_COST'] == 0) {
                 $GLOBALS['ShippingCost'] = GetLang('Free');
             } else {
                 $GLOBALS['ShippingCost'] = CurrencyConvertFormatPrice($_SESSION['OFFERCART']['SHIPPING']['SHIPPING_COST']);
                 $subtotal += $_SESSION['OFFERCART']['SHIPPING']['SHIPPING_COST'];
                 $GLOBALS['ShippingProvider'] = isc_html_escape($_SESSION['OFFERCART']['SHIPPING']['SHIPPING_PROVIDER']);
             }
         }
         // If there is a handling fee, we need to show it too
         if (isset($_SESSION['OFFERCART']['SHIPPING']['HANDLING_FEE']) && $_SESSION['OFFERCART']['SHIPPING']['HANDLING_FEE'] > 0) {
             $GLOBALS['HideShoppingCartHandlingCost'] = '';
             $GLOBALS['HandlingCost'] = CurrencyConvertFormatPrice($_SESSION['OFFERCART']['SHIPPING']['HANDLING_FEE']);
             $subtotal += $_SESSION['OFFERCART']['SHIPPING']['HANDLING_FEE'];
         }
         // This zone has free shipping set up. Do we qualify?
         if ($zone['zonefreeshipping'] == 1) {
             $GLOBALS['HideCartFreeShippingPanel'] = "";
             // We don't have enough to qualify - but still show the "spend x more for free shipping" message
             if ($GLOBALS['CartSubTotal'] < $zone['zonefreeshippingtotal']) {
                 $diff = CurrencyConvertFormatPrice($zone['zonefreeshippingtotal'] - $GLOBALS['CartSubTotal']);
                 if ($zone['zonehandlingfee'] > 0 && !$zone['zonehandlingseparate']) {
                     $GLOBALS['FreeShippingMessage'] = sprintf(GetLang('SpendXMoreXShipping'), $diff, CurrencyConvertFormatPrice($zone['zonehandlingfee']));
                 } else {
                     $GLOBALS['FreeShippingMessage'] = sprintf(GetLang('SpendXMoreFreeShipping'), $diff);
                 }
             } else {
                 // Setup the shipping message - if a handling fee is to be applied, then they actually qualify for $X shipping, not free shipping
                 if ($zone['zonehandlingfee'] > 0 && !$zone['zonehandlingseparate']) {
                     $GLOBALS['FreeShippingMessage'] = sprintf(GetLang('OrderQualifiesForXShipping'), CurrencyConvertFormatPrice($zone['zonehandlingfee']));
                 } else {
                     $GLOBALS['FreeShippingMessage'] = GetLang('OrderQualifiesForFreeShipping');
                 }
             }
         }
     }
     $selectedCountry = GetCountryIdByName(GetConfig('CompanyCountry'));
     $selectedState = 0;
     $selectedStateName = '';
     $zipCode = '';
     // Retain the country, stae and zip code selections if we have them
     if (isset($_SESSION['OFFERCART']['SHIPPING']['COUNTRY_ID'])) {
         $selectedCountry = (int) $_SESSION['OFFERCART']['SHIPPING']['COUNTRY_ID'];
         if (isset($_SESSION['OFFERCART']['SHIPPING']['STATE_ID'])) {
             $selectedState = (int) $_SESSION['OFFERCART']['SHIPPING']['STATE_ID'];
         }
         if (isset($_SESSION['OFFERCART']['SHIPPING']['STATE'])) {
             $selectedStateName = $_SESSION['OFFERCART']['SHIPPING']['STATE'];
         }
         if (isset($_SESSION['OFFERCART']['SHIPPING']['ZIP_CODE'])) {
             $GLOBALS['ShippingZip'] = isc_html_escape($_SESSION['OFFERCART']['SHIPPING']['ZIP_CODE']);
         }
     }
     $GLOBALS['ShippingCountryList'] = GetCountryList($selectedCountry);
     $GLOBALS['ShippingStateList'] = GetStateListAsOptions($selectedCountry, $selectedState);
     $GLOBALS['ShippingStateName'] = isc_html_escape($selectedStateName);
     // If there are no states for the country then hide the dropdown and show the textbox instead
     if (GetNumStatesInCountry($selectedCountry) == 0) {
         $GLOBALS['ShippingHideStateList'] = "none";
     } else {
         $GLOBALS['ShippingHideStateBox'] = "none";
     }
     //			if (isset($_SESSION['the_offered_price']))
     //			{
     //				$GLOBALS['CartSubTotal'] = $_SESSION['the_offered_price'];
     //			}
     //			else
     //			{
     $GLOBALS['CartSubTotal'] = $subtotal;
     //			}
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:101,代码来源:class.makeaoffer.php

示例13: ExpressCheckoutChooseAddress

 /**
  * Generate the choose an address form for the express checkout for either a billing or shipping address.
  *
  * @param string The type of address fields to generate (either billing or shipping)
  * @return string The generated address form.
  */
 public function ExpressCheckoutChooseAddress($addressType)
 {
     $templateAddressType = ucfirst($addressType);
     $GLOBALS['AddressList'] = '';
     $GLOBALS['ISC_CLASS_MAKEAOFFER'] = GetClass('ISC_MAKEAOFFER');
     $GLOBALS['AddressType'] = $addressType;
     $GLOBALS['UpperAddressType'] = $templateAddressType;
     $GLOBALS['HideCreateAddress'] = 'display: none';
     $GLOBALS['HideChooseAddress'] = 'display: none';
     $GLOBALS['CreateAccountForm'] = '';
     $country_id = GetCountryIdByName(GetConfig('CompanyCountry'));
     $selectedCountry = GetConfig('CompanyCountry');
     $selectedState = 0;
     if ($addressType == 'shipping') {
         $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_SHIPPING);
         $formId = FORMFIELDS_FORM_SHIPPING;
     } else {
         if (!CustomerIsSignedIn()) {
             $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_ACCOUNT);
             $fields += $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_BILLING);
             $formId = FORMFIELDS_FORM_ACCOUNT;
         } else {
             $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_BILLING);
             $formId = FORMFIELDS_FORM_BILLING;
         }
     }
     // If the customer isn't signed in, then by default we show the create form
     if (!CustomerIsSignedIn()) {
         $GLOBALS['HideCreateAddress'] = '';
         $address = array();
         if ($addressType == 'billing' && isset($_SESSION['CHECKOUT']['BILLING_ADDRESS'])) {
             $address = $_SESSION['CHECKOUT']['BILLING_ADDRESS'];
         } else {
             if ($addressType == 'shipping') {
                 if (isset($_SESSION['CHECKOUT']['SHIPPING_ADDRESS'])) {
                     $address = $_SESSION['CHECKOUT']['SHIPPING_ADDRESS'];
                 } else {
                     if (isset($_SESSION['CHECKOUT']['BILLING_ADDRESS'])) {
                         $address = $_SESSION['CHECKOUT']['BILLING_ADDRESS'];
                     }
                 }
             }
         }
         // if billing address is saved in session, use the session billing address to prefill the address form
         if (!empty($address)) {
             if (isset($address['shipcountry'])) {
                 $selectedCountry = $address['shipcountry'];
             }
             if (isset($address['shipstateid'])) {
                 $selectedState = $address['shipstateid'];
             }
             if (isset($address['shipcountryid'])) {
                 $country_id = $address['shipcountryid'];
             }
             $addressMap = array('EmailAddress' => 'shipemail', 'FirstName' => 'shipfirstname', 'LastName' => 'shiplastname', 'CompanyName' => 'shipcompany', 'AddressLine1' => 'shipaddress1', 'AddressLine2' => 'shipaddress2', 'City' => 'shipcity', 'State' => 'shipstate', 'Zip' => 'shipzip', 'Phone' => 'shipphone');
             $fieldMap = array();
             foreach (array_keys($fields) as $fieldId) {
                 if ($fields[$fieldId]->record['formfieldprivateid'] == '') {
                     continue;
                 }
                 $fieldMap[$fields[$fieldId]->record['formfieldprivateid']] = $fieldId;
             }
             foreach ($addressMap as $formField => $addressField) {
                 if (!isset($address[$addressField]) || !isset($fieldMap[$formField])) {
                     continue;
                 }
                 $fields[$fieldMap[$formField]]->SetValue($address[$addressField]);
             }
         }
         /**
          * Turn off the 'leave password blank' label for the passwords if we are not
          * logged in (creating a new account)
          */
         foreach (array_keys($fields) as $fieldId) {
             if ($fields[$fieldId]->getFieldType() == 'password') {
                 $fields[$fieldId]->setLeaveBlankLabel(false);
             }
         }
     } else {
         $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
         $shippingAddresses = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerShippingAddresses();
         // If the customer doesn't have any addresses, show the creation form
         if (empty($shippingAddresses)) {
             $GLOBALS['HideChooseAddress'] = 'display: none';
             $GLOBALS['HideCreateAddress'] = '';
         } else {
             $GLOBALS['HideChooseAddress'] = '';
             $addressMap = array('shipfullname', 'shipcompany', 'shipaddress1', 'shipaddress2', 'shipcity', 'shipstate', 'shipzip', 'shipcountry');
             foreach ($shippingAddresses as $address) {
                 $formattedAddress = '';
                 foreach ($addressMap as $field) {
                     if (!$address[$field]) {
                         continue;
                     }
//.........这里部分代码省略.........
开发者ID:nirvana-info,项目名称:old_bak,代码行数:101,代码来源:class.finalizeoffer.php


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