private function ManageCheckoutSettings($messages = array())
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['CheckoutJavaScript'] = "";
     $GLOBALS['CheckoutProviders'] = $this->GetCheckoutProvidersAsOptions();
     // Which checkout modules are enabled?
     $checkouts = GetEnabledCheckoutModules();
     $GLOBALS['CheckoutTabs'] = "";
     $GLOBALS['CheckoutDivs'] = "";
     $count = 1;
     // Setup each shipping module with its own tab
     foreach ($checkouts as $checkout) {
         $GLOBALS['CheckoutTabs'] .= sprintf('<li><a href="#" id="tab%d" onclick="ShowTab(%d)">%s</a></li>', $count, $count, $checkout['name']);
         $GLOBALS['CheckoutDivs'] .= sprintf('<div id="div%d" style="padding-top: 10px;">%s</div>', $count, $checkout['object']->getpropertiessheet($count));
         $count++;
     }
     // Get a list of order statuses for the status change notifications
     $statuses = explode(",", GetConfig('OrderStatusNotifications'));
     $GLOBALS['OrderStatusEmailList'] = '';
     $query = "SELECT * FROM [|PREFIX|]order_status ORDER BY statusorder ASC";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         if (in_array($row['statusid'], $statuses)) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         $GLOBALS['OrderStatusEmailList'] .= sprintf("<option value='%s' %s>%s</option>", $row['statusid'], $sel, sprintf(GetLang('OrderStatusChangedTo'), $row['statusdesc']));
     }
     if (GetConfig('UpdateInventoryLevels') == 1) {
         $GLOBALS['UpdateInventorySuccessfulSelected'] = 'selected="selected"';
     } else {
         $GLOBALS['UpdateInventoryCompletedSelected'] = 'selected="selected"';
     }
     if (GetConfig('CurrencyLocation') == 'right') {
         $GLOBALS['RightCurrencyToken'] = GetConfig('CurrencyToken');
     } else {
         $GLOBALS['LeftCurrencyToken'] = GetConfig('CurrencyToken');
     }
     if (GetConfig('CheckoutType') == 'single') {
         $GLOBALS['CheckoutTypeSingleSelected'] = 'selected="selected"';
     } else {
         $GLOBALS['CheckoutTypeMultiSelected'] = 'selected="selected"';
     }
     if (GetConfig('GuestCheckoutEnabled')) {
         $GLOBALS['GuestCheckoutChecked'] = 'checked="checked"';
     } else {
         $GLOBALS['HideGuestCheckoutCreateAccounts'] = 'display: none';
     }
     if (GetConfig('GuestCheckoutCreateAccounts')) {
         $GLOBALS['GuestCheckoutCreateAccountsCheck'] = 'checked="checked"';
     }
     if (GetConfig('DigitalOrderHandlingFee') > 0) {
         $GLOBALS['DigitalOrderHandlingFeeChecked'] = 'checked="checked"';
         $GLOBALS['DigitalOrderHandlingFee'] = GetConfig('DigitalOrderHandlingFee');
     } else {
         $GLOBALS['HideDigitalOrderHandlingFee'] = 'display: none';
     }
     if (GetConfig('EnableOrderComments')) {
         $GLOBALS['IsEnableOrderComments'] = "checked=\"checked\"";
     }
     if (GetConfig('EnableOrderTermsAndConditions')) {
         $GLOBALS['IsEnableOrderTermsAndConditions'] = "checked=\"checked\"";
     } else {
         $GLOBALS['IsEnableOrderTermsAndConditions'] = "";
         $GLOBALS['HideOrderTermsAndConditions'] = 'display:none;';
     }
     if (GetConfig('OrderTermsAndConditionsType') != "textarea") {
         $GLOBALS['HideOrderTermsAndConditionsTextarea'] = 'display: none';
     } else {
         $GLOBALS['IsEnableOrderTermsAndConditionsTextarea'] = "checked=\"checked\"";
         $GLOBALS['OrderTermsAndConditions'] = GetConfig('OrderTermsAndConditions');
     }
     if (GetConfig('OrderTermsAndConditionsType') != "link") {
         $GLOBALS['HideOrderTermsAndConditionsLink'] = 'display: none';
         $GLOBALS['OrderTermsAndConditionsLink'] = "http://";
     } else {
         $GLOBALS['IsEnableOrderTermsAndConditionsLink'] = "checked=\"checked\"";
         $GLOBALS['OrderTermsAndConditionsLink'] = GetConfig('OrderTermsAndConditionsLink');
     }
     if (GetConfig('MultipleShippingAddresses') && gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS['IsMultipleShippingAddressesEnabled'] = "checked=\"checked\"";
     } else {
         if (!gzte11(ISC_MEDIUMPRINT)) {
             $GLOBALS['HideMultiShipping'] = 'display: none';
         }
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.checkout.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
	private function ManageCheckoutSettings($messages=array())
	{
		$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('paymentMethods', GetConfig('GettingStartedCompleted')) && !GetConfig('DisableGettingStarted')) {
			$GLOBALS['GettingStartedTitle'] = GetLang('WizardPaymentMethods');
			$GLOBALS['GettingStartedContent'] = GetLang('WizardPaymentMethodsDesc');
			$GLOBALS['GettingStartedStep'] = $this->template->render('Snippets/GettingStartedModal.html');
		}

		$GLOBALS['CheckoutJavaScript'] = "";
		$GLOBALS['CheckoutProviders'] = $this->GetCheckoutProvidersAsOptions();

		// Which checkout modules are enabled?
		$checkouts = GetEnabledCheckoutModules();
		$GLOBALS['CheckoutTabs'] = "";
		$GLOBALS['CheckoutDivs'] = "";
		$count = 1;
		$builtInGateway = null;

		if (GetConfig('EnableBuiltInGateway')) {
			GetModuleById('checkout', $builtInGateway, GetConfig('BuiltInGateway'));
		}

		if(GetConfig('EnableBuiltInGateway') && !is_null($builtInGateway)) {
			$GLOBALS['BuiltInGateway'] = $builtInGateway->GetId();
			$GLOBALS['UseBuiltInGateway'] = GetLang('UseBuiltInGateway', array(
				'gatewayName' => $builtInGateway->GetName()
			));
			$GLOBALS['BuiltInGatewayProperties'] = $builtInGateway->GetPropertiesSheet(0, false, 'builtin');
			$GLOBALS['BuiltInGatewayIntro'] = $builtInGateway->GetHelpText();
			$GLOBALS['CheckoutProviderClass'] = 'CheckoutProviderListIndent';
			$errors = array();
			if($builtInGateway->IsSupported() == false) {
				foreach($builtInGateway->GetErrors() as $error) {
					$errors[] = MessageBox($error, MSG_ERROR);
				}
			}
			$GLOBALS['BuiltInGatewayErrors'] = implode('', $errors);
		}
		else {
			$this->template->Assign('HideBuiltInGateway', 'display: none');
		}

		// Setup each checkout module with its own tab
		if(GetConfig('EnableBuiltInGateway') && !is_null($builtInGateway) && (GetConfig('CheckoutMethods') == 'checkout_'.GetConfig('BuiltInGateway') || !GetConfig('CheckoutMethods'))) {
			$this->template->Assign('UseBuiltInGatewayChecked', 'checked="checked"');
		}
		else {
			$this->template->Assign('UseCustomGatewayChecked', 'checked="checked"');
			foreach ($checkouts as $checkout) {
				$GLOBALS['CheckoutTabs'] .= sprintf('<li><a href="#" id="tab%d" onclick="ShowTab(%d)">%s</a></li>', $count, $count, $checkout['name']);
				$GLOBALS['CheckoutDivs'] .= sprintf('<div id="div%d" style="padding-top: 10px;">%s</div>', $count, $checkout['object']->getpropertiessheet($count));
				$count++;
			}
		}

		// Get a list of order statuses for the status change notifications
		$statuses = explode(",", GetConfig('OrderStatusNotifications'));
		$GLOBALS['OrderStatusEmailList'] = '';
		$query = "SELECT * FROM [|PREFIX|]order_status ORDER BY statusorder ASC";
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			if (in_array($row['statusid'], $statuses)) {
				$sel = 'selected="selected"';
			} else {
				$sel = '';
			}

			$GLOBALS['OrderStatusEmailList'] .= sprintf("<option value='%s' %s>%s</option>", $row['statusid'], $sel, sprintf(GetLang('OrderStatusChangedTo'), $row['statusdesc']));
		}

		if (GetConfig('UpdateInventoryLevels') == 1) {
			$GLOBALS['UpdateInventorySuccessfulSelected'] = 'selected="selected"';
		}
		else {
			$GLOBALS['UpdateInventoryCompletedSelected'] = 'selected="selected"';
		}

		if (GetConfig('CurrencyLocation') == 'right') {
			$GLOBALS['RightCurrencyToken'] = GetConfig('CurrencyToken');
		} else {
			$GLOBALS['LeftCurrencyToken'] = GetConfig('CurrencyToken');
		}

		if(GetConfig('CheckoutType') == 'single') {
			$GLOBALS['CheckoutTypeSingleSelected'] = 'selected="selected"';
		}
		else {
			$GLOBALS['CheckoutTypeMultiSelected'] = 'selected="selected"';
		}

		if(GetConfig('GuestCheckoutEnabled')) {
			$GLOBALS['GuestCheckoutChecked'] = 'checked="checked"';
		}
		else {
			$GLOBALS['HideGuestCheckoutCreateAccounts'] = 'display: none';
		}

		if(GetConfig('GuestCheckoutCreateAccounts')) {
			$GLOBALS['GuestCheckoutCreateAccountsCheck'] = 'checked="checked"';
		}

		if(GetConfig('DigitalOrderHandlingFee') > 0) {
			$GLOBALS['DigitalOrderHandlingFeeChecked'] = 'checked="checked"';
			$GLOBALS['DigitalOrderHandlingFee'] = GetConfig('DigitalOrderHandlingFee');
		}
		else {
			$GLOBALS['HideDigitalOrderHandlingFee'] = 'display: none';
		}

		if(GetConfig('EnableOrderComments')) {
			$GLOBALS['IsEnableOrderComments'] = "checked=\"checked\"";
		}

		if(GetConfig('EnableOrderTermsAndConditions')) {
			$GLOBALS['IsEnableOrderTermsAndConditions'] = "checked=\"checked\"";
		}
		else {
			$GLOBALS['IsEnableOrderTermsAndConditions'] = "";
			$GLOBALS['HideOrderTermsAndConditions'] = 'display:none;';
		}

		if(GetConfig('OrderTermsAndConditionsType') != "textarea") {
			$GLOBALS['HideOrderTermsAndConditionsTextarea'] = 'display: none';
		} else {
			$GLOBALS['IsEnableOrderTermsAndConditionsTextarea'] = "checked=\"checked\"";
			$GLOBALS['OrderTermsAndConditions'] = GetConfig('OrderTermsAndConditions');
		}

		if(GetConfig('OrderTermsAndConditionsType') != "link") {
			$GLOBALS['HideOrderTermsAndConditionsLink'] = 'display: none';
			$GLOBALS['OrderTermsAndConditionsLink'] = "http://";
		} else {
			$GLOBALS['IsEnableOrderTermsAndConditionsLink'] = "checked=\"checked\"";
			$GLOBALS['OrderTermsAndConditionsLink'] = GetConfig('OrderTermsAndConditionsLink');
		}

		if(GetConfig('MultipleShippingAddresses') && gzte11(ISC_MEDIUMPRINT)) {
			$GLOBALS['IsMultipleShippingAddressesEnabled'] = "checked=\"checked\"";
		}
		else if(!gzte11(ISC_MEDIUMPRINT)) {
			$GLOBALS['HideMultiShipping'] = 'display: none';
		}

		$this->template->display('settings.checkout.manage.tpl');
	}