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";
     }
 }
Esempio n. 2
0
 /**
  * Test the shipping method by displaying a simple HTML form
  */
 public function TestQuoteForm()
 {
     // Load up the module variables
     $this->SetCustomVars();
     // Which countries has the user chosen to ship orders to?
     $GLOBALS['Countries'] = GetCountryList(GetConfig('CompanyCountry'));
     $GLOBALS['StateList'] = GetStatesByCountryNameAsOptions(GetConfig('CompanyCountry'), $numStates);
     $GLOBALS['WeightMeasurement'] = GetConfig('WeightMeasurement');
     if (!$GLOBALS['StateList']) {
         $GLOBALS['StateNameAppend'] = '2';
         $GLOBALS['HideStatesList'] = 'display: none';
     }
     $GLOBALS['Image'] = $this->GetImage();
     $this->ParseTemplate("module.upsonline.test");
 }
 /**
  *	Create a view for customers. Uses the same form as searching but puts the
  *	name of the view at the top and it's mandatory instead of optional.
  */
 private function CreateView()
 {
     if (GetConfig('CurrencyLocation') == 'right') {
         $GLOBALS['CurrencyTokenLeft'] = '';
         $GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
     } else {
         $GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
         $GLOBALS['CurrencyTokenRight'] = '';
     }
     $GLOBALS['CountryList'] = GetCountryList("", false);
     $GLOBALS['HideStateList'] = "none";
     if (gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS['CustomerGroups'] = $this->GetCustomerGroupsAsOptions();
     } else {
         $GLOBALS['HideCustomerGroups'] = "none";
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("customers.view");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
 private function _getCurrencyOriginOptions($countryid = null, $regionid = null)
 {
     $html = '<optgroup id="currencyorigintype-region" label="' . isc_html_escape(GetLang('CurrencyRegions')) . '">';
     $html .= GetRegionList($regionid, false, "AllRegions", 0, true);
     $html .= '</optgroup>';
     $html .= '<optgroup id="currencyorigintype-country" label="' . isc_html_escape(GetLang('CurrencyCountries')) . '">';
     $html .= GetCountryList($countryid, false, "AllCountries", 0, true);
     $html .= '</optgroup>';
     return $html;
 }
Esempio n. 5
0
 /**
  * Test the shipping method by displaying a simple HTML form
  */
 public function TestQuoteForm()
 {
     $GLOBALS['DeliveryTypes'] = "";
     $del_types = $this->GetValue("deliverytypes");
     if (!is_array($del_types)) {
         $del_types = array($del_types);
     }
     // Load up the module variables
     $this->SetCustomVars();
     foreach ($this->_variables['deliverytypes']['options'] as $k => $v) {
         if (in_array($v, $del_types)) {
             $sel = 'selected="selected"';
         } else {
             $sel = "";
         }
         $GLOBALS['DeliveryTypes'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $v, $k);
     }
     // Which countries has the user chosen to ship orders to?
     $GLOBALS['Countries'] = GetCountryList("Australia");
     $GLOBALS['WeightUnit'] = GetConfig('WeightMeasurement');
     $GLOBALS['Image'] = $this->_image;
     $this->ParseTemplate("module.royalmail.test");
 }
Esempio n. 6
0
	/**
	 * 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());
		}
	}
Esempio n. 7
0
	/**
	* Test the shipping method by displaying a simple HTML form
	*/
	public function TestQuoteForm()
	{
		// Which countries has the user chosen to ship orders to?
		$GLOBALS['Countries'] = GetCountryList($this->_origin_country['country_name']);
		$GLOBALS['WeightMeasurement'] = GetConfig('WeightMeasurement');
		$GLOBALS['Image'] = $this->GetImage();

		$this->ParseTemplate("module.usps.test");
	}
Esempio n. 8
0
		/**
		 * GetVariables
		 * This is step 1 of the installation process. It checks all the right files
		 * and folders have write permissions and prompts the user for all install variables.
		 *
		 * @param Boolean $Error defaults to false, if its set to true, something went wrong!
		 *
		 * @return Void
		 */
		private function GetVariables($Error = false, $Message = "")
		{
			if(defined('INSTALL_WARNING_MSG') && INSTALL_WARNING_MSG) {
				$GLOBALS['InstallWarning'] = INSTALL_WARNING_MSG;
			}
			else {
				$GLOBALS['HideInstallWarning'] = 'display: none';
			}

			// Check the prerequisites
			$this->CheckInstallationPrerequisites();

			if($Error) {
				$GLOBALS['Message'] = "<h3 style='padding-bottom:10px; color:red'>" . GetLang("Oops") . "</h3>" . $Message;
				$GLOBALS['LicenseKey'] = $_POST['LK'];
				$GLOBALS['ShopPath'] = $_POST['ShopPath'];
				$GLOBALS['StoreCountryLocationId'] = $_POST['StoreCountryLocationId'];
				$GLOBALS['StoreCurrencyCode'] = $_POST['StoreCurrencyCode'];

				$GLOBALS['InstallSampleData'] = '';
				if(isset($_POST['installSampleData'])) {
					$GLOBALS['InstallSampleData'] = 'checked="checked"';
				}
				$GLOBALS['UserEmail'] = $_POST['UserEmail'];
				$GLOBALS['UserPass'] = $_POST['UserPass'];
				$GLOBALS['dbUser'] = $_POST['dbUser'];
				$GLOBALS['dbPass'] = $_POST['dbPass'];
				$GLOBALS['dbServer'] = $_POST['dbServer'];
				$GLOBALS['dbDatabase'] = $_POST['dbDatabase'];
				$GLOBALS['tablePrefix'] = $_POST['tablePrefix'];
				$GLOBALS['AutoJS'] = "window.setTimeout(\"$('#dbChoice1').click(); $('.DBDetails').show();\", 100);";
			}
			else {

				$GLOBALS['Message'] = "<h3 style='padding-bottom:10px'>" . GetLang("InstallInterspireShoppingCart") . "</h3>" . GetLang("InstallIntro");
				$GLOBALS['InstallSampleData'] = 'checked="checked"';
				$GLOBALS['StoreCountryLocationId'] = 0;
			}

			if(isset($GLOBALS['LicenseKey']) && isset($GLOBALS['LE'])) {
				$GLOBALS['serverStamp'] = $GLOBALS['LicenseKey'];
				getClass('ISC_ADMIN_AUTH')->SavePerms("");
				if(isset($GLOBALS['KM'])) {
					$GLOBALS['Message'] = "<h3 style='padding-bottom:10px; color:red'>" . GetLang("Oops") . "</h3>" . $Message;
				}
			}

			if (!isset($GLOBALS['dbServer']) || $GLOBALS['dbServer'] == "") {
				if (isset($_ENV['DATABASE_SERVER'])) {
					// mediatemple.net kindly sets an environment variable with the
					// correct mysql host, so if it exists, lets make use of it!
					$GLOBALS['dbServer'] = isc_html_escape($_ENV['DATABASE_SERVER']);
				} else {
					$GLOBALS['dbServer'] = "localhost";
				}
			}

			if(!isset($GLOBALS['tablePrefix']) || $GLOBALS['tablePrefix'] == "") {
				$GLOBALS['tablePrefix'] = "isc_";
			}

			$app_path = dirname(dirname($_SERVER['PHP_SELF']))."/";
			if(!isset($GLOBALS['ShopPath']) || $GLOBALS['ShopPath'] == "" || $GLOBALS['ShopPath'] == "http://") {
				$GLOBALS['ShopPath'] = rtrim("http://" . $_SERVER["HTTP_HOST"] . $app_path, '/').'/';
			}

			$GLOBALS['StoreCountryList'] = GetCountryList($GLOBALS['StoreCountryLocationId'], false, "AllCountries", 0, true, false);

			$this->template->assign('PCIPasswordMinLen', GetConfig('PCIPasswordMinLen'));
			$this->template->display('install.form.tpl');
		}
Esempio n. 9
0
 public function SetupPreCheckoutShipping()
 {
     $subtotal = $GLOBALS['CartSubTotal'];
     $_SESSION['CHECKOUT']['SUBTOTAL_COST'] = $GLOBALS['CartSubTotal'];
     // Hide everything by default
     $GLOBALS['HideCartFreeShippingPanel'] = 'none';
     $GLOBALS['HideCartDiscountRulePanel'] = 'none';
     $GLOBALS['HideShoppingCartShippingCost'] = 'none';
     $GLOBALS['HideShoppingCartHandlingCost'] = 'none';
     $GLOBALS['HideShoppingCartShippingEstimator'] = 'display: none';
     $GLOBALS['HideShoppingCartImmediateDownload'] = 'none';
     // All products in the cart are digital downloads so the shipping doesn't apply
     if ($this->api->AllProductsInCartAreIntangible()) {
         // Show the 'immediate download' text
         $GLOBALS['HideShoppingCartImmediateDownload'] = '';
         // If we have a handling fee set up for digital orders then we need to show it too
         if (GetConfig('DigitalOrderHandlingFee') > 0) {
             $_SESSION['CHECKOUT']['HANDLING_COST'] = GetConfig('DigitalOrderHandlingFee');
             $GLOBALS['HandlingCost'] = CurrencyConvertFormatPrice(GetConfig('DigitalOrderHandlingFee'));
             $GLOBALS['CartSubTotal'] += GetConfig('DigitalOrderHandlingFee');
             $GLOBALS['HideShoppingCartHandlingCost'] = '';
         }
         return;
     }
     $freeShippingQualified = false;
     $cartProducts = $this->api->GetProductsInCart();
     $freeShippingProductCount = 0;
     foreach ($cartProducts as $product) {
         if ($product['data']['prodtype'] == PT_PHYSICAL && $product['data']['prodfreeshipping'] == 1) {
             ++$freeShippingProductCount;
         }
     }
     $discountMessages = $this->api->Get('DISCOUNT_MESSAGES');
     if (!is_array($discountMessages)) {
         $discountMessages = array();
     }
     $GLOBALS['CartRuleMessage'] = '';
     foreach ($discountMessages as $message) {
         $GLOBALS['CartRuleMessage'] .= '<p class="InfoMessage">' . GetLang('DiscountCongratulations') . ' ';
         $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;
     //			}
 }
Esempio n. 10
0
 /**
  * Test the shipping method by displaying a simple HTML form
  */
 public function TestQuoteForm()
 {
     // Which countries has the user chosen to ship orders to?
     $GLOBALS['Countries'] = GetCountryList("United States");
     $GLOBALS['Image'] = $this->_image;
     $GLOBALS['WeightUnit'] = GetConfig('WeightMeasurement');
     $GLOBALS['LengthUnit'] = GetConfig('LengthMeasurement');
     $this->ParseTemplate("module.usps.test");
 }
Esempio n. 11
0
		/**
		* Test the shipping method by displaying a simple HTML form
		*/
		public function TestQuoteForm()
		{

			$GLOBALS['Carriers'] = "";
			$carriers = $this->GetValue("carriers");

			if(!is_array($carriers)) {
				$carriers = array($carriers);
			}

			// Load up the module variables
			$this->SetCustomVars();

			foreach($this->_variables['carriers']['options'] as $k => $v) {
				if(in_array($v, $carriers)) {
					$sel = 'selected="selected"';
				} else {
					$sel = "";
				}

				$GLOBALS['Carriers'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $v, $k);
			}

			// Which countries has the user chosen to ship orders to?
			$GLOBALS['Countries'] = GetCountryList("United States");

			$GLOBALS['Measurement'] = isc_strtolower(GetConfig('WeightMeasurement'));
			$GLOBALS['Image'] = $this->_image;

			$this->ParseTemplate("module.intershipper.test");
		}
Esempio n. 12
0
 /**
  * Test the shipping method by displaying a simple HTML form
  */
 public function TestQuoteForm()
 {
     $GLOBALS['ServiceTypes'] = "";
     $service_types = $this->GetValue("service");
     if (!is_array($service_types)) {
         $service_types = array($service_types);
     }
     // Load up the module variables
     $this->SetCustomVars();
     foreach ($this->_variables['service']['options'] as $k => $v) {
         if (in_array($v, $service_types)) {
             $sel = 'selected="selected"';
         } else {
             $sel = "";
         }
         $GLOBALS['ServiceTypes'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $v, $k);
     }
     $GLOBALS['DeliveryTypes'] = "";
     $del_types = $this->GetValue("carriercode");
     if (!is_array($del_types)) {
         $del_types = array($del_types);
     }
     foreach ($this->_variables['carriercode']['options'] as $k => $v) {
         if (in_array($v, $del_types)) {
             $sel = 'selected="selected"';
         } else {
             $sel = "";
         }
         $GLOBALS['DeliveryTypes'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $v, $k);
     }
     // Which countries has the user chosen to ship orders to?
     $first_country = "United States";
     $GLOBALS['Countries'] = GetCountryList("United States");
     $GLOBALS['WeightUnit'] = GetConfig('WeightMeasurement');
     $num_states = 0;
     $GLOBALS['StateList'] = $state_options = GetStatesByCountryNameAsOptions($first_country, $num_states);
     $GLOBALS['Image'] = $this->_image;
     $this->ParseTemplate("module.fedex.test");
 }
Esempio n. 13
0
 /**
  * ShowPaymentForm
  * Show a payment form for this particular gateway if there is one.
  * This is useful for gateways that require things like credit card details
  * to be submitted and then processed on the site.
  */
 public function ShowPaymentForm()
 {
     $GLOBALS['PayflowProMonths'] = "";
     $GLOBALS['PayflowProYears'] = "";
     for ($i = 1; $i <= 12; $i++) {
         $stamp = mktime(0, 0, 0, $i, 15, isc_date("Y"));
         $i = str_pad($i, 2, "0", STR_PAD_LEFT);
         if (@$_POST['PayflowPro_ccexpm'] == $i) {
             $sel = "SELECTED";
         } else {
             $sel = "";
         }
         $GLOBALS['PayflowProMonths'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $i, isc_date("M", $stamp));
     }
     for ($i = isc_date("Y"); $i < isc_date("Y") + 10; $i++) {
         if (@$_POST['PayflowPro_ccexpy'] == substr($i, 2, 2)) {
             $sel = 'selected="selected"';
         } else {
             $sel = "";
         }
         $GLOBALS['PayflowProYears'] .= sprintf("<option %s value='%s'>%s</option>", $sel, substr($i, 2, 2), $i);
     }
     $requireCVV2 = $this->GetValue("requirecvv2");
     if ($requireCVV2 == "YES") {
         if (isset($_POST['PayflowPro_cccode'])) {
             $GLOBALS['PayflowProCCV2'] = (int) $_POST['PayflowPro_cccode'];
         }
         $GLOBALS['PayflowProHideCVV2'] = '';
     } else {
         $GLOBALS['PayflowProHideCVV2'] = 'none';
     }
     // Grab the billing details for the order
     $billingDetails = $this->GetBillingDetails();
     $GLOBALS['PayflowProName'] = isc_html_escape($billingDetails['ordbillfirstname'] . ' ' . $billingDetails['ordbilllastname']);
     $GLOBALS['PayflowProBillingAddress'] = isc_html_escape($billingDetails['ordbillstreet1']);
     if ($billingDetails['ordbillstreet2'] != "") {
         $GLOBALS['PayflowProBillingAddress'] .= " " . isc_html_escape($billingDetails['ordbillstreet2']);
     }
     $GLOBALS['PayflowProCity'] = isc_html_escape($billingDetails['ordbillsuburb']);
     if ($billingDetails['ordbillstateid'] != 0 && GetStateISO2ById($billingDetails['ordbillstateid'])) {
         $GLOBALS['PayflowProState'] = GetStateISO2ById($billingDetails['ordbillstateid']);
     } else {
         $GLOBALS['PayflowProState'] = isc_html_escape($billingDetails['ordbillstate']);
     }
     $GLOBALS['PayflowProCountry'] = GetCountryList($billingDetails['ordbillcountry'], false);
     $GLOBALS['PayflowProBillingZip'] = $billingDetails['ordbillzip'];
     // Format the amount that's going to be going through the gateway
     $GLOBALS['OrderAmount'] = FormatPrice($this->GetGatewayAmount());
     // Was there an error validating the payment? If so, pre-fill the form fields with the already-submitted values
     if ($this->HasErrors()) {
         $GLOBALS['PayflowProName'] = isc_html_escape($_POST['PayflowPro_name']);
         $GLOBALS['PayflowProNum'] = isc_html_escape($_POST['PayflowPro_ccno']);
         $GLOBALS['PayflowProBillingAddress'] = isc_html_escape($_POST['PayflowPro_ccaddress']);
         $GLOBALS['PayflowProCity'] = isc_html_escape($_POST['PayflowPro_cccity']);
         $GLOBALS['PayflowProState'] = isc_html_escape($_POST['PayflowPro_ccstate']);
         $GLOBALS['PayflowProBillingZip'] = isc_html_escape($_POST['PayflowPro_zip']);
         $GLOBALS['PayflowProErrorMessage'] = implode("<br />", $this->GetErrors());
         $GLOBALS['PayflowProCountry'] = GetCountryList(isc_html_escape($_POST['PayflowPro_country']), false);
     } else {
         // Hide the error message box
         $GLOBALS['HidePayflowProError'] = "none";
     }
     // Collect their details to send through to Payflow Pro
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("payflowpro");
     return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
 }
Esempio n. 14
0
 /**
  * Show the form to update an existing tax rate.
  */
 private function EditTaxRate()
 {
     $GLOBALS['FormAction'] = "SettingsSaveUpdatedTaxRate";
     $GLOBALS['TaxRateTitle'] = GetLang('EditTaxRate');
     $GLOBALS['CancelMessage'] = GetLang('CancelAddTaxRate');
     if (isset($_GET['taxRateId'])) {
         $taxRateId = (int) $_GET['taxRateId'];
         $query = sprintf("select * from [|PREFIX|]tax_rates where taxrateid='%d'", $taxRateId);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='taxrateid' value='%d' />", $taxRateId);
         if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $GLOBALS['TaxRateName'] = isc_html_escape($row['taxratename']);
             if ($row['taxratebasedon'] == "subtotal") {
                 $GLOBALS['BasedOnSubTotal'] = 'selected="selected"';
             } else {
                 $GLOBALS['BasedOnSubTotalAndShipping'] = 'selected="selected"';
             }
             if ($row['taxaddress'] == 'shipping') {
                 $GLOBALS['TaxAddressShipping'] = 'selected="selected"';
             } else {
                 $GLOBALS['TaxAddressBilling'] = 'selected="selected"';
             }
             $GLOBALS['CountryList'] = GetCountryList($row['taxratecountry'], true, "AllCountries", 0, true);
             $row['taxratestates'] = trim($row['taxratestates'], ',');
             if ($row['taxratestates'] == "0") {
                 $sel_first = true;
             } else {
                 $sel_first = false;
             }
             // If there's at least one state for this country in the database, show the list
             if (GetNumStatesInCountry($row['taxratecountry']) > 0) {
                 $GLOBALS['StateList'] = GetStateListAsOptions($row['taxratecountry'], explode(",", $row['taxratestates']), true, "AllStates", "0", $sel_first);
             } else {
                 $GLOBALS['HideStateList'] = "none";
             }
             if ($row['taxratestatus'] == 1) {
                 $GLOBALS['TaxEnabled'] = 'checked="checked"';
             }
             $GLOBALS['TaxRatePercent'] = FormatPrice($row['taxratepercent'], false, false);
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("tax.form");
             $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
         } else {
             $this->ManageTaxSettings();
         }
     } else {
         $this->ManageTaxSettings();
     }
 }
Esempio n. 15
0
		/**
		*	Create a view for customers. Uses the same form as searching but puts the
		*	name of the view at the top and it's mandatory instead of optional.
		*/
		private function CreateView()
		{
			if (GetConfig('CurrencyLocation') == 'right') {
				$GLOBALS['CurrencyTokenLeft'] = '';
				$GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
			} else {
				$GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
				$GLOBALS['CurrencyTokenRight'] = '';
			}

			$GLOBALS['CountryList'] = GetCountryList("", false);
			$GLOBALS['HideStateList'] = "none";

			if (gzte11(ISC_MEDIUMPRINT)) {
				$GLOBALS['CustomerGroups'] = $this->GetCustomerGroupsAsOptions();
			}
			else {
				$GLOBALS['HideCustomerGroups'] = "none";
			}

			$this->template->display('customers.view.tpl');
		}
Esempio n. 16
0
	/**
	 * Show the "Edit Vendor" form.
	 */
	private function EditVendor()
	{
		$GLOBALS['Message'] = GetFlashMessageBoxes();
		$vendor = $this->GetVendorData($_REQUEST['vendorId']);

		// If the vendor doesn't exist, show an error message
		if(!isset($vendor['vendorid'])) {
			FlashMessage(GetLang('InvalidVendor'), MSG_ERROR, 'index.php?ToDo=viewVendors');
		}

		// Set up the form title and action
		$GLOBALS['FormAction']	= 'SaveUpdatedVendor';
		if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Vendors)) {
			$GLOBALS['Title']		= GetLang('EditVendor');
		}
		else {
			$GLOBALS['Title']		= GetLang('VendorProfile');
		}
		$GLOBALS['Intro']		= GetLang('EditVendorIntro');

		// Set the form values
		$GLOBALS['VendorId']		= (int)$vendor['vendorid'];
		$GLOBALS['VendorName']		= isc_html_escape($vendor['vendorname']);
		$GLOBALS['VendorPhone']		= isc_html_escape($vendor['vendorphone']);
		$GLOBALS['VendorAddress']	= isc_html_escape($vendor['vendoraddress']);
		$GLOBALS['VendorCity']		= isc_html_escape($vendor['vendorcity']);
		$GLOBALS['VendorZip']		= isc_html_escape($vendor['vendorzip']);
		$GLOBALS['CountryList']		= GetCountryList($vendor['vendorcountry']);
		$GLOBALS['VendorEmail']		= isc_html_escape($vendor['vendoremail']);
		$GLOBALS['VendorState']		= isc_html_escape($vendor['vendorstate']);

		$vendorLogoSize = GetConfig('VendorLogoSize');
		if(!$vendorLogoSize) {
			$GLOBALS['HideLogoUpload'] = 'display: none';
		}
		else {
			$GLOBALS['HideCurrentVendorLogo'] = 'display: none';
			if($vendor['vendorlogo']) {
				$GLOBALS['HideCurrentVendorLogo'] = '';
				$GLOBALS['CurrentVendorLogoLink'] = GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.isc_html_escape($vendor['vendorlogo']);
				$GLOBALS['CurrentVendorLogo'] = isc_html_escape($vendor['vendorlogo']);
			}
		}

		$vendorPhotoSize = GetConfig('VendorPhotoSize');
		if(!$vendorPhotoSize) {
			$GLOBALS['HidePhotoUpload'] = 'display: none';
		}
		else {
			$GLOBALS['HideCurrentVendorPhoto'] = 'display: none';
			if($vendor['vendorphoto']) {
				$GLOBALS['HideCurrentVendorPhoto'] = '';
				$GLOBALS['CurrentVendorPhotoLink'] = GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.isc_html_escape($vendor['vendorphoto']);
				$GLOBALS['CurrentVendorPhoto'] = isc_html_escape($vendor['vendorphoto']);
			}
		}

		if($vendor['vendororderemail'] != '') {
			$GLOBALS['VendorForwardInvoices'] = 'checked="checked"';
			$GLOBALS['VendorOrderEmail'] = isc_html_escape($vendor['vendororderemail']);
		}
		else {
			$GLOBALS['HideForwardInvoiceEmails'] = 'display: none';
		}

		$GLOBALS['VendorProfitMargin'] = number_format($vendor['vendorprofitmargin'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), '');

		// Vendor has configured shipping
		if($vendor['vendorshipping'] == 1) {
			$GLOBALS['VendorShippingCustom'] = 'checked="checked"';
			$GLOBALS['HideStoreMethodsList'] = 'display: none';

			// Fetch any shipping methods set up
			$GLOBALS['HideShippingNotConfigured'] = 'display: none';

			// Fetch any shipping zones, place them in the data grid
			$GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING'] = GetClass('ISC_ADMIN_SETTINGS_SHIPPING');
			$GLOBALS['ShippingZonesGrid'] = $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING']->ManageShippingZonesGrid($numZones);

			// No shipping zones have been configured yet
			if($numZones == 0) {
				$GLOBALS['DisableDeleteZones'] = 'disabled="disabled"';
				$GLOBALS['DisplayZoneGrid'] = "none";
				$GLOBALS['NoZonesMessage'] = MessageBox(GetLang('NoShippingZones'), MSG_SUCCESS);
			}

		}
		// Using store shipping
		else {
			$GLOBALS['VendorShippingDefault'] = 'checked="checked"';
			$GLOBALS['HideShippingZonesGrid'] = 'display: none';
		}

		// Fetch a list of the shipping methods available for the entire store
		$GLOBALS['StoreShippingMethods'] = $this->GetStoreShippingMethods();

		if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() > 0) {
			$GLOBALS['HidePermissions'] = 'display: none';
		}
		// Showing the permissions table, so generate the list for that
		else {
			$GLOBALS['HidePermissions'] = '';

			$accessibleCategories = '';
			if($vendor['vendoraccesscats']) {
				$accessibleCategories = explode(',', $vendor['vendoraccesscats']);
				$accessibleCategories = array_map('intval', $accessibleCategories);
			}

			if(empty($accessibleCategories)) {
				$GLOBALS['AccessAllCategories'] = 'checked="checked"';
				$GLOBALS['HideAccessCategories'] = 'display: none';
			}

			$categoryClass = GetClass('ISC_ADMIN_CATEGORY');
			$GLOBALS['AccessCategoryOptions'] = $categoryClass->GetCategoryOptions($accessibleCategories,  "<option %s value='%d'>%s</option>", 'selected="selected"', "", false);
		}

		$stateOptions = GetStatesByCountryNameAsOptions($vendor['vendorcountry'], $numStates, $vendor['vendorstate']);

		if ($numStates > 0) {
			// Show the states dropdown list
			$GLOBALS['StateList'] = $stateOptions;
			$GLOBALS['HideStateBox'] = 'display: none';
		}
		else {
			// Show the states text box
			$GLOBALS['HideStateList'] = 'display: none';
		}
		// Initialize the WYSIWYG editor
		$wysiwygOptions = array(
			'id'		=> 'wysiwyg',
			'width'		=> '100%',
			'height'	=> '500px',
			'value'		=> $vendor['vendorbio']
		);
		$GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);

		$GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing');
		$this->template->display('vendor.form.tpl');
	}
Esempio n. 17
0
	/**
	 * Manage the store location settings and show a list of shipping zones for management.
	 */
	private function ManageShippingSettings()
	{
		if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Settings)) {
			$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
			return;
		}

		$GLOBALS['Message'] = GetFlashMessageBoxes();

		// Get the getting started box if we need to
		$GLOBALS['GettingStartedStep'] = '';
		if(empty($GLOBALS['Message']) && (isset($_GET['wizard']) && $_GET['wizard']==1) && !in_array('shippingOptions', GetConfig('GettingStartedCompleted')) && !GetConfig('DisableGettingStarted')) {
			$GLOBALS['GettingStartedTitle'] = GetLang('WizardShippingOptions');
			$GLOBALS['GettingStartedContent'] = GetLang('WizardShippingOptionsDesc');
			$GLOBALS['GettingStartedStep'] = $this->template->render('Snippets/GettingStartedModal.html');
		}

		// Generate the breadcrumb
		$GLOBALS['BreadcrumEntries'][GetLang('Settings')] = "index.php?ToDo=viewSettings";
		$GLOBALS['BreadcrumEntries'][GetLang('ShippingSettings')] = "index.php?ToDo=viewShippingSettings";

		if(isset($_REQUEST['currentTab'])) {
			$GLOBALS['CurrentTab'] = (int)$_REQUEST['currentTab'];
		}

		// Fetch any shipping zones, place them in the data grid
		$GLOBALS['ZoneDataGrid'] = $this->ManageShippingZonesGrid($numZones);

		// Was this an ajax based sort? Return the table now
		if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
			echo $GLOBALS['ZoneDataGrid'];
			return;
		}

		// No shipping zones have been configured yet
		if($numZones == 0) {
			$GLOBALS['DisableDelete'] = 'disabled="disabled"';
			$GLOBALS['DisplayGrid'] = "none";
			$GLOBALS['Message'] = MessageBox(GetLang('NoShippingZones'), MSG_SUCCESS);
		}

		$GLOBALS['CompanyName'] = GetConfig('CompanyName');
		$GLOBALS['CompanyAddress'] = GetConfig('CompanyAddress');
		$GLOBALS['CompanyCity'] = GetConfig('CompanyCity');
		$GLOBALS['CompanyZip'] = GetConfig('CompanyZip');

		$stateOptions = sprintf("<option value=''>%s</option>", GetLang('ChooseState'));
		$stateOptions .= GetStatesByCountryNameAsOptions(GetConfig('CompanyCountry'), $numStates, GetConfig('CompanyState'));

		if (GetConfig('CompanyState') != "") {
			$GLOBALS['HideStateNote'] = "none";
		} else {
			$GLOBALS['HideStateBox'] = "none";
		}

		if ($numStates > 0) {
			// Show the states dropdown list
			$GLOBALS['StateList'] = $stateOptions;
			$GLOBALS['HideStateBox'] = "none";
		}
		else {
			// Show the states text box
			$GLOBALS['CompanyState'] = GetConfig('CompanyState');
			$GLOBALS['HideStateList'] = "none";
		}

		$GLOBALS['CountryList'] = GetCountryList(GetConfig('CompanyCountry'));
		$GLOBALS['ShippingProviders'] = $this->GetShippingCompaniesAsOptions();

		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
		$this->template->display('settings.shipping.manage.tpl');
		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
	}