Example #1
0
		public function SetPanelSettings()
		{
			if (ISC_CATEGORY::areCategoryFlyoutsEnabled()) {
				$GLOBALS['SideCategoryListTypeClass'] = 'SideCategoryListFlyout';
				$output = $this->_generateFlyoutOutput();
			} else {
				$GLOBALS['SideCategoryListTypeClass'] = 'SideCategoryListClassic';
				$output = $this->_generateClassicOutput();
			}

			if (!$output) {
				$this->DontDisplay = true;
				return;
			}

			$GLOBALS['SNIPPETS']['SideCategoryList'] = $output;
		}
Example #2
0
		public function SetPanelSettings()
		{
			if (!$GLOBALS["ISC_CLASS_SEARCH"]->searchIsLoaded()) {
				return;
			}

			// Do we have any categories
			$GLOBALS["SearchResultsCategory"] = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("category") > 0) {
				$GLOBALS["SearchResultsCategory"] = ISC_CATEGORY::buildSearchResultsHTML();
			}

			if (trim($GLOBALS["SearchResultsCategory"]) !== "") {
				$GLOBALS["HideSearchResultsCategory"] = "";
			} else {
				$GLOBALS["HideSearchResultsCategory"] = "none";
			}

			// Do we have any brands
			$GLOBALS["SearchResultsBrand"] = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("brand") > 0) {
				$GLOBALS["SearchResultsBrand"] = ISC_BRANDS::buildSearchResultsHTML();
			}

			if (trim($GLOBALS["SearchResultsBrand"]) !== "") {
				$GLOBALS["HideSearchResultsBrand"] = "";
			} else {
				$GLOBALS["HideSearchResultsBrand"] = "none";
			}

			// Now for the products
			$GLOBALS["SearchResultsProduct"] = "";
			$productSearchResults = "";

			if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("product") > 0) {
				$productSearchResults = ISC_PRODUCT::buildSearchResultsHTML();
			}

			if (GetConfig("SearchProductDisplayMode") == "list") {
				$displayMode = "List";
			} else {
				$displayMode = "Grid";
			}

			if (trim($productSearchResults) !== "") {
				$GLOBALS["SectionResults"] = $productSearchResults;
				$GLOBALS["SectionType"] = "ProductList";
				$GLOBALS["SectionExtraClass"] = "";
				$GLOBALS["HideAddButton"] = "none";
				$GLOBALS["CompareButton"] = "";
				$GLOBALS["CompareButtonTop"] = "";

				$totalPages = $GLOBALS['ISC_CLASS_SEARCH']->GetNumPages("product");
				$totalRecords = $GLOBALS['ISC_CLASS_SEARCH']->GetNumResults("product");

				$page = (int)@$_REQUEST['page'];
				if ($page < 1) {
					$page = 1;
				} else if ($page > $totalPages) {
					$page = $totalPages;
				}

				if (GetConfig("SearchProductDisplayMode") == "list") {
					$GLOBALS["SectionExtraClass"] = "List";
					$GLOBALS["HideAddButton"] = "";
					$GLOBALS["ListJS"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ListCheckForm");
					$GLOBALS["CompareButton"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton" . $displayMode);

					if ($totalPages > 1) {
						$GLOBALS["CompareButtonTop"] = $GLOBALS["CompareButton"];
					}
				} else {
					$GLOBALS["CompareButton"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton");
				}

				// generate url with all current GET params except page, ajax and section
				$url = array();
				foreach ($_GET as $key => $value) {
					if ($key == 'page' || $key == 'ajax' || $key == 'section') {
						continue;
					}
					if (is_array($value)) {
						foreach ($value as $subvalue) {
							$url[] = urlencode($key . '[]') . '=' . urlencode($subvalue);
						}
					} else {
						$url[] = urlencode($key) . '=' . urlencode($value);
					}
				}
				$url[] = "page={page}";
				$url[] = "section=product";
				$url = 'search.php?' . implode('&', $url) . '#results';

				$GLOBALS['SectionPaging'] = '';

				$maxPagingLinks = 5;
				if($GLOBALS['ISC_CLASS_TEMPLATE']->getIsMobileDevice()) {
					$maxPagingLinks = 3;
				}

				$start = max($page - $maxPagingLinks, 1);
				$end = min($page + $maxPagingLinks, $totalPages);

				for ($i = $start; $i <= $end; $i++) {
					if($i == $page) {
						$snippet = "CategoryPagingItemCurrent";
					}
					else {
						$snippet = "CategoryPagingItem";
					}

					$GLOBALS['PageLink'] = str_replace('{page}', $i, $url);
					$GLOBALS['PageNumber'] = $i;
					$GLOBALS['SectionPaging'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);
				}

				// Parse the paging snippet
				if($page > 1) {
					$prevPage = $page - 1;
					$GLOBALS['PrevLink'] = str_replace('{page}', $prevPage, $url);
					$GLOBALS['SectionPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious");
				}

				if($page < $totalPages) {
					$prevPage = $page + 1;
					$GLOBALS['NextLink'] = str_replace('{page}', $prevPage, $url);
					$GLOBALS['SectionPagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingNext");
				}

				if ($totalPages > 1) {
					$GLOBALS["HideSectionPaging"] = "";
				} else {
					$GLOBALS["HideSectionPaging"] = "none";
				}

				if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("product") <= 1) {
					$GLOBALS["HideSectionSorting"] = "none";
				} else {
					$GLOBALS["HideSectionSorting"] = "";
				}

				$GLOBALS["SectionSortingOptions"] = getAdvanceSearchSortOptions("product");
				$GLOBALS["SectionSearchResults"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultGrid");
				$GLOBALS["SearchResultsProduct"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultSectionProduct");
				$GLOBALS["HideSearchResultsProduct"] = "none";

				if(!getProductReviewsEnabled()) {
					$GLOBALS["HideProductRating"] = "display: none";
				}

			} else {
				$GLOBALS["HideSearchResultsProduct"] = "";
			}

			// If no results then show the 'no results found' div
			if (trim($GLOBALS["SearchResultsBrand"]) == "" && trim($GLOBALS["SearchResultsCategory"]) == "" && trim($GLOBALS["SearchResultsProduct"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "none";
				$GLOBALS["HideSearchResultsProduct"] = "none";
				$GLOBALS["HideSearchResultsNoResult"] = "";

			// Else if we just have no categories or brands then do not show the top containing div
			} else if (trim($GLOBALS["SearchResultsBrand"]) == "" && trim($GLOBALS["SearchResultsCategory"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "none";
				$GLOBALS["HideSearchResultsProduct"] = "";
				$GLOBALS["HideSearchResultsNoResult"] = "none";

			// Else if we have categories or brands BUT no products then display the 'no results found' div
			} else if ((trim($GLOBALS["SearchResultsBrand"]) == "" || trim($GLOBALS["SearchResultsCategory"]) !== "") && trim($GLOBALS["SearchResultsProduct"]) == "") {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "";
				$GLOBALS["HideSearchResultsProduct"] = "none";
				$GLOBALS["HideSearchResultsNoResult"] = "";
			} else {
				$GLOBALS["HideSearchResultsCategoryAndBrand"] = "";
				$GLOBALS["HideSearchResultsProduct"] = "";
				$GLOBALS["HideSearchResultsNoResult"] = "none";
			}

			/*
			 * if the "Enable Product Search Feeds?" is ticked in Store
			 * Settings -> Display and we are searching add the link
			 */
			if (isset($GLOBALS['ISC_CLASS_SEARCH']) && GetConfig('RSSProductSearches')) {
				$GLOBALS['RSSURL'] = SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);
				$GLOBALS['SnippetSearchResultsFeed'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SearchResultsFeed');
			}
		}
Example #3
0
		public function SetPanelSettings()
		{
			$GLOBALS['FooterScripts'] = '';

			$GLOBALS['HideLogoutLink'] = 'display: none';
			if(CustomerIsSignedIn()) {
				$GLOBALS['HideLogoutLink'] = '';
			}

			if($_SERVER['REQUEST_METHOD'] == 'POST') {
				$baseURL = getConfig('ShopPathNormal');
			}
			else {
				$baseURL = getCurrentLocation();
			}

			if(strpos($baseURL, '?') === false) {
				$baseURL .= '?';
			}
			else {
				$baseURL .= '&';
			}

			$fullSiteLink = $baseURL.'fullSite=1';
			$GLOBALS['ISC_CLASS_TEMPLATE']->assign('FullSiteLink', $fullSiteLink);

			// Show Mobile Site link
			if(canViewMobileSite()) {
				$mobileSiteURL = preg_replace('/(&)?fullSite=\d*/i', '', $baseURL);
				$GLOBALS['MobileSiteURL'] = $mobileSiteURL.'fullSite=0';
				$GLOBALS['MobileSiteLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('MobileSiteLink');
			}

			// Show "All prices are in [currency code]"
			$currency = GetCurrencyById($GLOBALS['CurrentCurrency']);
			if(is_array($currency) && $currency['currencycode']) {
				$GLOBALS['AllPricesAreInCurrency'] = sprintf(GetLang('AllPricesAreInCurrency'), isc_html_escape($currency['currencyname']), isc_html_escape($currency['currencycode']));
			}

			if(GetConfig('DebugMode') == 1) {
				$end_time = microtime_float();
				$GLOBALS['ScriptTime'] = number_format($end_time - ISC_START_TIME, 4);
				$GLOBALS['QueryCount'] = $GLOBALS['ISC_CLASS_DB']->NumQueries;
				if (function_exists('memory_get_peak_usage')) {
					$GLOBALS['MemoryPeak'] = "Memory usage peaked at ".Store_Number::niceSize(memory_get_peak_usage(true));
				} else {
					$GLOBALS['MemoryPeak'] = '';
				}

				if (isset($_REQUEST['debug'])) {
					$GLOBALS['QueryList'] = "<ol class='QueryList' style='font-size: 13px;'>\n";
					foreach($GLOBALS['ISC_CLASS_DB']->QueryList as $query) {
						$GLOBALS['QueryList'] .= "<li style='line-height: 1.4; margin-bottom: 4px;'>".isc_html_escape($query['Query'])." &mdash; <em>".number_format($query['ExecutionTime'], 4)."seconds</em></li>\n";
					}
					$GLOBALS['QueryList'] .= "</ol>";
				}
				$GLOBALS['DebugDetails'] = "<p>Page built in ".$GLOBALS['ScriptTime']."s with ".$GLOBALS['QueryCount']." queries. ".$GLOBALS['MemoryPeak']."</p>";
			}
			else {
				$GLOBALS['DebugDetails'] = '';
			}

			// Do we have any live chat service code to show in the footer
			$modules = GetConfig('LiveChatModules');
			if(!empty($modules)) {
				$liveChatClass = GetClass('ISC_LIVECHAT');
				$GLOBALS['LiveChatFooterCode'] = $liveChatClass->GetPageTrackingCode('footer');
			}

			// Load our whitelabel file for the front end
			require_once ISC_BASE_PATH.'/includes/whitelabel.php';

			// Load the configuration file for this template
			$poweredBy = 0;
			require_once ISC_BASE_PATH.'/templates/'.GetConfig('template').'/config.php';
			if(isset($GLOBALS['TPL_CFG']['PoweredBy'])) {
				if(!isset($GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$GLOBALS['TPL_CFG']['PoweredBy']])) {
					$GLOBALS['TPL_CFG']['PoweredBy'] = 0;
				}
				$poweredBy = $GLOBALS['TPL_CFG']['PoweredBy'];
			}

			// Showing the powered by?
			$GLOBALS['PoweredBy'] = '';
			if($GLOBALS['ISC_CFG']['DisableFrontEndPoweredBy'] == false && isset($GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$poweredBy])) {
				$GLOBALS['PoweredBy'] = $GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$poweredBy];
			}

			if(empty($GLOBALS['OptimizerConversionScript']) && empty($GLOBALS['OptimizerTrackingScript']) && empty($GLOBALS['OptimizerControlScript'])) {
				$this->setGwoCookieCrossDomain();
			}

			$GLOBALS['SitemapURL_HTML'] = isc_html_escape(SitemapLink());
			$GLOBALS['SNIPPETS']['SitemapLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SitemapLink');

			if (Interspire_TaskManager::hasTasks()) {
				// hasTasks is only implemented for Internal so this will (should) never run for Resque-based task manager
				$GLOBALS['FooterScripts'] .= Interspire_TaskManager::getTriggerHtml('json');
			}

			if (ISC_CATEGORY::areCategoryFlyoutsEnabled()) {
				// this needs to be output from php into the body since it's based on config vars
				// @todo use the stuff gaston is working on instead

				// bgiframe fixes some IE-related issues with CSS menus (like hovering over SELECT elements)
				$GLOBALS['FooterScripts'] .= '<script type="text/javascript" src="'
					. GetConfig('AppPath') . '/javascript/superfish/js/jquery.bgiframe.min.js?'
					. GetConfig('JSCacheToken') . '"></script>' . "\n";
				$GLOBALS['FooterScripts'] .= '<script type="text/javascript" src="'
					. GetConfig('AppPath') . '/javascript/superfish/js/superfish.js?'
					. GetConfig('JSCacheToken') . '"></script>' . "\n";
				$GLOBALS['FooterScripts'] .= '<script type="text/javascript">
	$(function(){
		if (typeof $.fn.superfish == "function") {
			$("ul.sf-menu").superfish({
				delay: ' . ((float)GetConfig('categoryFlyoutMouseOutDelay') * 1000) . ',
				dropShadows: ' . isc_json_encode(GetConfig('categoryFlyoutDropShadow')) . ',
				speed: "fast"
			})
			.find("ul")
			.bgIframe();
		}
	})
</script>
';
			}

			if (GetConfig('FastCartAction') == 'popup' && GetConfig('ShowCartSuggestions')) {
				$GLOBALS['SNIPPETS']['FastCartThickBoxJs'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('FastCartThickBoxJs');
			}
		}
Example #4
0
	public function SetPanelSettings()
	{
		// Do we have any live chat service code to show in the header?
		$modules = GetConfig('LiveChatModules');
		if(!empty($modules)) {
			$liveChatClass = GetClass('ISC_LIVECHAT');
			$GLOBALS['LiveChatCode'] = $liveChatClass->GetPageTrackingCode('header');
			$GLOBALS['LiveChatCodeEnabled'] = '';
		} else {
			$GLOBALS['LiveChatCodeEnabled'] = 'display:none';
		}

		$GLOBALS['TrackingCode'] = '';

		// Get the visitor tracking Javascript
		$tracker = GetClass('ISC_VISITOR');
		$GLOBALS['TrackingCode'] .= $tracker->GetTrackingJavascript();

		$GLOBALS['CharacterSet'] = GetConfig('CharacterSet');

		// Are quick searches enabled?
		if(GetConfig('QuickSearch') != 0) {
			$GLOBALS['QuickSearchJS'] = sprintf("<script type=\"text/javascript\" src=\"%s/javascript/quicksearch.js\"></script>", GetConfig('ShopPath'));
		}

		$activeTemplate = $GLOBALS['ISC_CLASS_TEMPLATE']->getActiveTemplateName();
		$activeColorScheme = $GLOBALS['ISC_CLASS_TEMPLATE']->getActiveColorScheme();

		if(isset($GLOBALS['TPL_CFG']['HeaderImageElement'])) {
			$headerImageLocation = '';

			$headerImages = array(
				GetConfig('ImageDirectory') . '/header_images/' . $activeTemplate . '_headerImage.jpg',
				GetConfig('ImageDirectory') . '/header_images/' . $activeTemplate . '_headerImage.png',
				'templates/'.$activeTemplate . '/images/' . $activeColorScheme . '/headerImage.jpg',
				'templates/'.$activeTemplate . '/images/' . $activeColorScheme . '/headerImage.png'
			);
			foreach($headerImages as $path) {
				if(file_exists(ISC_BASE_PATH . '/' . $path)) {
					$headerImageLocation = GetConfig('ShopPath') . '/' . $path;
					break;
				}
			}

			if(!empty($headerImageLocation)) {
				$GLOBALS['HeaderImageStyle'] = '<style type="text/css"> ' .$GLOBALS['TPL_CFG']['HeaderImageElement'] . ' { background-image: url("' . $headerImageLocation . '"); } </style>';
			}
		}

		if (GetConfig('FastCartAction') == 'popup' && GetConfig('ShowCartSuggestions')) {
			$GLOBALS['AdditionalScripts'][] = GetConfig('AppPath').'/javascript/jquery/plugins/imodal/imodal.js';
			$GLOBALS['AdditionalStylesheets'][] = GetConfig('AppPath').'/javascript/jquery/plugins/imodal/imodal.css';
		}

		// Any additional stylesheets to include?
		$GLOBALS['Stylesheets'] = '';

		if(!empty($GLOBALS['TPL_CFG']['Stylesheets'])) {
			$stylesheets = $GLOBALS['TPL_CFG']['Stylesheets'];
		}
		else {
			$stylesheets = array(
				array(
					'stylesheet' => 'Styles/styles.css',
				),
				array(
					'stylesheet' => 'Styles/iselector.css'
				)
			);

			// Color overrides
			$colorCSS = 'Styles/'.$activeColorScheme.'.css';
			if(file_exists(ISC_BASE_PATH.'/templates/'.$activeTemplate.'/'.$colorCSS)) {
				$stylesheets[] = array(
					'stylesheet' => $colorCSS
				);
			}

			// Generic Internet Explorer stylesheet
			$genericIE = 'Styles/ie.css';
			if(file_exists(ISC_BASE_PATH.'/templates/'.$activeTemplate.'/'.$genericIE)) {
				$stylesheets[] = array(
					'stylesheet' => $genericIE,
					'condition' => 'IE'
				);
			}

			if(!empty($GLOBALS['TPL_CFG']['AdditionalStylesheets'])) {
				$stylesheets = array_merge($stylesheets, $GLOBALS['TPL_CFG']['AdditionalStylesheets']);
			}
		}

		$GLOBALS['Stylesheets'] = '';

		// Global/common front-end stylesheet
		$masterStylesheet = getConfig('ShopPath') . '/templates/__master/Styles/styles.css?' . getConfig('JSCacheToken');
		$GLOBALS['Stylesheets'] .= '<link href="' . $masterStylesheet . '" type="text/css" rel="stylesheet" />';

		$styleRoot = GetConfig('ShopPath').'/templates/'.$activeTemplate;
		foreach($stylesheets as $stylesheet) {
			if(empty($stylesheet['media'])) {
				$stylesheet['media'] = 'all';
			}

			// Add caching token
			if(strpos($stylesheet['stylesheet'], '?') === false) {
				$stylesheet['stylesheet'] .= '?';
			}
			else {
				$stylesheet['stylesheet'] .= '&';
			}
			$stylesheet['stylesheet'] .= getConfig('JSCacheToken');

			$link = '<link href="'.$styleRoot.'/'.$stylesheet['stylesheet'].'" media="'.$stylesheet['media'].'" type="text/css" rel="stylesheet" />';
			if(!empty($stylesheet['condition'])) {
				$link = '<!--[if '.$stylesheet['condition'].']>'.$link.'<![endif]-->';
			}
			$GLOBALS['Stylesheets'] .= $link."\n";
		}

		// @todo this check should be a method of it's which determines if flyout css is required since flyout support
		// may be disabled by the selected template, and there may be other, non-category flyout menus added in future
		if (ISC_CATEGORY::areCategoryFlyoutsEnabled()) {
			// css for fly-out menus
			if (!isset($GLOBALS['AdditionalStylesheets']) || !is_array($GLOBALS['AdditionalStylesheets'])) {
				$GLOBALS['AdditionalStylesheets'] = array();
			}
			$GLOBALS['AdditionalStylesheets'][] = GetConfig('AppPath') . '/javascript/superfish/css/store.css';
		}

		if(!empty($GLOBALS['AdditionalStylesheets']) && is_array($GLOBALS['AdditionalStylesheets'])) {
			$GLOBALS['AdditionalStylesheets'] = array_unique($GLOBALS['AdditionalStylesheets']);
			$replacements = array(
				':template' => $activeTemplate,
				':color' => $activeColorScheme
			);
			foreach($GLOBALS['AdditionalStylesheets'] as $stylesheet) {
				$stylesheet = strtr($stylesheet, $replacements);

				// Add caching token
				if(strpos($stylesheet, '?') === false) {
					$stylesheet .= '?';
				}
				else {
					$stylesheet .= '&';
				}
				$stylesheet .= getConfig('JSCacheToken');

				$GLOBALS['Stylesheets'] .= '<link href="'.$stylesheet.'" type="text/css" rel="stylesheet" />';
			}
		}


		$GLOBALS['AdditionalScriptTags'] = '';

		if(!empty($GLOBALS['AdditionalScripts']) && is_array($GLOBALS['AdditionalScripts'])) {
			$GLOBALS['AdditionalScripts'] = array_unique($GLOBALS['AdditionalScripts']);
			foreach($GLOBALS['AdditionalScripts'] as $script) {
				// Add caching token
				if(strpos($script, '?') === false) {
					$script .= '?';
				}
				else {
					$script .= '&';
				}
				$script .= getConfig('JSCacheToken');

				$GLOBALS['AdditionalScriptTags'] .= '<script type="text/javascript" src="'.$script.'"></script>';
			}
		}

		// Are site wide RSS feeds enabled?
		if(!isset($GLOBALS['HeadRSSLinks'])) {
			$GLOBALS['HeadRSSLinks'] = '';
		}

		if(GetConfig('RSSLatestBlogEntries') != 0) {
			$GLOBALS['HeadRSSLinks'] .= GenerateRSSHeaderLink($GLOBALS['ShopPathNormal']."/rss.php?action=newblogs", GetLang('HeadRSSLatestNews'));
		}

		if(GetConfig('RSSNewProducts') != 0) {
			$GLOBALS['HeadRSSLinks'] .= GenerateRSSHeaderLink($GLOBALS['ShopPathNormal']."/rss.php", GetLang('HeadRSSNewProducts'));
		}

		if(GetConfig('RSSPopularProducts') != 0) {
			$GLOBALS['HeadRSSLinks'] .= GenerateRSSHeaderLink($GLOBALS['ShopPathNormal']."/rss.php?action=popularproducts", GetLang('HeadRSSPopularProducts'));
		}

		/*
		 * if the "Enable Product Search Feeds?" is ticked in Store
		 * Settings -> Display and we are searching add the link
		 */
		if (isset($GLOBALS['ISC_CLASS_SEARCH']) && GetConfig('RSSProductSearches')) {
			$rssUri = $GLOBALS['ShopPathNormal']
					. '/rss.php?action=searchproducts&amp;type=rss'
					. SearchLink($GLOBALS['ISC_CLASS_SEARCH']->GetQuery(), 0, false);

			$GLOBALS['HeadRSSLinks'] .= GenerateRSSHeaderLink($rssUri, GetLang('HeadRSSProductSearchFeeds'));
		}

		// Do we need to include the script for design mode?
		if(!empty($_COOKIE['designModeToken']) || !empty($_POST['designModeToken'])) {
			if(GetClass('ISC_ADMIN_AUTH')->isDesignModeAuthenticated()) {
				$GLOBALS['DesignModeStyleSheet'] = sprintf("<link href=\"%s/lib/designmode/designmode.css\" type=\"text/css\" rel=\"stylesheet\" />", $GLOBALS['AppPath']);

				// If the control panel is accessibly only via SSL, we need to send design mode
				// updates to that URL instead.
				if(GetConfig('ForceControlPanelSSL')) {
					$GLOBALS['DesignModeUpdateUrl'] = GetConfig('ShopPathSSL');
				}
				else {
					$GLOBALS['DesignModeUpdateUrl'] = GetConfig('AppPath');
				}
				$GLOBALS['DesignModeUpdateUrl'] .= '/admin/designmode.php';

				$GLOBALS['DesignModeCurrentTemplate'] = $GLOBALS['ISC_CLASS_TEMPLATE']->_tplName.'.html';
				$GLOBALS['DesignModeIdleTime'] = (int)GetConfig('PCILoginIdleTimeMin') * 60 * 1000;
				$GLOBALS['DesignModeScriptTag'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('DesignModeFooter');
			}
		}

		// Include the tracking code for each analytics module
		$GLOBALS['TrackingCode'] .= GetTrackingCodeForAllPackages();

		// Define the favicon link
		$GLOBALS['Favicon'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . GetConfig('Favicon');

		if(!isset($GLOBALS['OptimizerControlScript'])) {
			$GLOBALS['OptimizerControlScript'] = '';
		}
		if(!isset($GLOBALS['OptimizerTrackingScript'])) {
			$GLOBALS['OptimizerTrackingScript'] = '';
		}
		if(!isset($GLOBALS['OptimizerConversionScript'])) {
			$GLOBALS['OptimizerConversionScript'] = '';
		}
		$runStorewideTesting = true;
		//this is product/category/page based optimizer test page, turn off storewide test on this page.
		if ((isset($GLOBALS['PerPageOptimizerEnabled']) && $GLOBALS['PerPageOptimizerEnabled'] == 1)) {
			$runStorewideTesting=false;
		}
		unset($GLOBALS['PerPageOptimizerEnabled']);
		$enabledOptimizerTests = GetConfig('OptimizerMethods');
		//the optimizer methods in the config.php file is not an array. set it to an empty array.
		if(!is_array($enabledOptimizerTests)) {
			$enabledOptimizerTests = array();
		}
		foreach ($enabledOptimizerTests as $moduleId => $date) {

			//if "optimizer" is in the URL, that means this is a request from Google to validate the scripts installed on the page for a paticular test, in this case, we should only insert the scripts for the particular test.
			if(isset($_GET['optimizer']) && 'optimizer_'.$_GET['optimizer'] != $moduleId && $_GET['optimizer'] != 'singlemulticheckout') {
				continue;
			}

			if(getModuleById('optimizer', $module, $moduleId)){
				if($runStorewideTesting) {
					$module->insertControlScript();
					$module->insertTrackingScript();
				}
				$module->insertConversionScript();
			}

			//we are here when optimizer is set, that means the needed optimizer scripts for google to validate have already installed on the page, so get out from the loop.
			if(isset($_GET['optimizer']) && $_GET['optimizer'] != 'singlemulticheckout'){
				break;
			}
		}


		//insert perpage based optimizer conversion script
		$perPageOptimizer = getClass('ISC_OPTIMIZER_PERPAGE');
		$perPageOptimizer->insertConversionScript();

		if(isset($_SESSION['JustAddedProduct'])) {
			$_SESSION['JustAddedProduct'] = '';
		}

		$GLOBALS['ProductThumbImageWidth'] = GetConfig('ProductImagesStorewideThumbnail_width');
		$GLOBALS['ProductThumbImageHeight'] = GetConfig('ProductImagesStorewideThumbnail_height');
	}