private function ManageSettings($messages=array()) { if(!gzte11(ISC_HUGEPRINT)) { $GLOBALS['HideVendorOptions'] = 'display: none'; } $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('settings', GetConfig('GettingStartedCompleted')) && !GetConfig('DisableGettingStarted')) { $GLOBALS['GettingStartedTitle'] = GetLang('ConfigureStoreSettings'); $GLOBALS['GettingStartedContent'] = GetLang('ConfigureStoreSettingsDesc'); $GLOBALS['GettingStartedStep'] = $this->template->render('Snippets/GettingStartedModal.html'); } if (GetConfig('UseWYSIWYG')) { $GLOBALS['IsWYSIWYGEnabled'] = 'checked="checked"'; } if (GetConfig('ShowThumbsInControlPanel')) { $GLOBALS['IsProductThumbnailsEnabled'] = 'checked="checked"'; } if (GetConfig('DesignMode')) { $GLOBALS['IsDesignMode'] = 'checked="checked"'; } if (GetConfig('ForceControlPanelSSL')) { $GLOBALS['IsControlPanelSSLEnabled'] = 'checked="checked"'; } if (GetConfig('DownForMaintenance')) { $GLOBALS['IsDownForMaintenance'] = 'checked="checked"'; } $GLOBALS["CharacterSet"] = GetConfig('CharacterSet'); if(in_array(GetConfig('CharacterSet'), $this->validCharacterSets)) { $selectedCharset = GetConfig('CharacterSet'); $selectedCharset = isc_strtolower($selectedCharset); $selectedCharset = str_replace(array("-", "_"), "", $selectedCharset); $GLOBALS["CharacterSet_Selected_" . $selectedCharset] = 'selected="selected"'; } else { $GLOBALS["CharacterSet_Selected_utf8"] = 'selected="selected"'; } /* if (GetConfig('UseSSL')) { $GLOBALS['IsSSLEnabled'] = 'checked="checked"'; } */ switch (GetConfig('UseSSL')) { case SSL_NORMAL: $SSLOption = "UseNormalSSL"; break; case SSL_SHARED: $SSLOption = "UseSharedSSL"; break; case SSL_SUBDOMAIN: $SSLOption = "UseSubdomainSSL"; break; default: $SSLOption = "NoSSL"; } $GLOBALS[$SSLOption . 'Checked'] = 'checked="checked"'; if(GetConfig('AllowPurchasing')) { $GLOBALS['IsPurchasingEnabled'] = 'checked="checked"'; } switch(GetConfig('WeightMeasurement')) { case 'LBS': $GLOBALS['IsPounds'] = 'selected="selected"'; break; case 'Ounces': $GLOBALS['IsOunces'] = 'selected="selected"'; break; case 'KGS': $GLOBALS['IsKilos'] = 'selected="selected"'; break; case 'Grams': $GLOBALS['IsGrams'] = 'selected="selected"'; break; case 'Tonnes': $GLOBLAS['IsTonnes'] = 'selected="selected"'; } if (GetConfig('LengthMeasurement') == "Inches") { $GLOBALS['IsInches'] = 'selected="selected"'; } else { $GLOBALS['IsCentimeters'] = 'selected="selected"'; } $GLOBALS['ShippingFactoringDimensionDepthSelected'] = ''; $GLOBALS['ShippingFactoringDimensionHeightSelected'] = ''; $GLOBALS['ShippingFactoringDimensionWidthSelected'] = ''; switch (GetConfig('ShippingFactoringDimension')) { case 'height': $GLOBALS['ShippingFactoringDimensionHeightSelected'] = 'selected="selected"'; break; case 'width': $GLOBALS['ShippingFactoringDimensionWidthSelected'] = 'selected="selected"'; break; case 'depth': default: $GLOBALS['ShippingFactoringDimensionDepthSelected'] = 'selected="selected"'; break; } if (GetConfig('TagCartQuantityBoxes') == 'dropdown') { $GLOBALS['IsDropdown'] = 'selected="selected"'; } else { $GLOBALS['IsTextbox'] = 'selected="selected"'; } // Product breadcrumbs dropdown $GLOBALS['ProductBreadcrumbs'] = GetConfig('ProductBreadcrumbs'); $GLOBALS['ProductBreadcrumbOptions'] = array( "showall" => GetLang('ShowAll'), "showone" => GetLang('ShowOneOnly'), "shownone" => GetLang('DontShow'), ); if (GetConfig('FastCartAction') == 'popup') { $GLOBALS['IsShowPopWindow'] = 'selected="selected"'; } else { $GLOBALS['IsShowCartPage'] = 'selected="selected"'; } if (GetConfig('TagCloudsEnabled')) { $GLOBALS['IsTagCloudsEnabled'] = 'checked="checked"'; } if (GetConfig('BulkDiscountEnabled')) { $GLOBALS['IsBulkDiscountEnabled'] = 'checked="checked"'; } if (GetConfig('EnableProductTabs')) { $GLOBALS['IsProductTabsEnabled'] = 'checked="checked"'; } if (GetConfig('ShowAddToCartQtyBox')) { $GLOBALS['IsShownAddToCartQtyBox'] = 'checked="checked"'; } if (GetConfig('CaptchaEnabled')) { $GLOBALS['IsCaptchaEnabled'] = 'checked="checked"'; } if(GetConfig('StoreDSTCorrection')) { $GLOBALS['IsDSTCorrectionEnabled'] = "checked=\"checked\""; } if (GetConfig('ShowCartSuggestions')) { $GLOBALS['IsShowCartSuggestions'] = 'checked="checked"'; } if (GetConfig('ShowThumbsInCart')) { $GLOBALS['IsShowThumbsInCart'] = 'checked="checked"'; } if (GetConfig('TagCloudsEnabled')) { $GLOBALS['IsTagCloudsEnabled'] = 'checked="checked"'; } if (GetConfig('ShowAddToCartQtyBox')) { $GLOBALS['IsShownAddToCartQtyBox'] = 'checked="checked"'; } if (GetConfig('AutoApproveReviews')) { $GLOBALS['IsAutoApproveReviews'] = 'checked="checked"'; } if (GetConfig('SearchSuggest')) { $GLOBALS['IsSearchSuggest'] = 'checked="checked"'; } if (GetConfig('QuickSearch')) { $GLOBALS['IsQuickSearch'] = 'checked="checked"'; } if (GetConfig('ShowInventory')) { $GLOBALS['IsShowInventory'] = 'checked="checked"'; } if (GetConfig('ShowPreOrderInventory')) { $GLOBALS['IsShowPreOrderInventory'] = 'checked="checked"'; } // Bulk Discount Settings if (GetConfig('BulkDiscountEnabled')) { $GLOBALS['IsBulkDiscountEnabled'] = 'checked="checked"'; } if (GetConfig('EnableProductTabs')) { $GLOBALS['IsProductTabsEnabled'] = 'checked="checked"'; } // RSS Settings if (GetConfig('RSSNewProducts')) { $GLOBALS['IsRSSNewProductsEnabled'] = 'checked="checked"'; } if (GetConfig('RSSPopularProducts')) { $GLOBALS['IsRSSPopularProductsEnabled'] = 'checked="checked"'; } if (GetConfig('RSSFeaturedProducts')) { $GLOBALS['IsRSSFeaturedProductsEnabled'] = 'checked="checked"'; } if (GetConfig('RSSCategories')) { $GLOBALS['IsRSSCategoriesEnabled'] = 'checked="checked"'; } if (GetConfig('RSSProductSearches')) { $GLOBALS['IsRSSProductSearchesEnabled'] = 'checked="checked"'; } if (GetConfig('RSSLatestBlogEntries')) { $GLOBALS['IsRSSLatestBlogEntriesEnabled'] = 'checked="checked"'; } if (GetConfig('RSSSyndicationIcons')) { $GLOBALS['IsRSSSyndicationIconsEnabled'] = 'checked="checked"'; } if(GetConfig('EnableCustomersAlsoViewed')) { $GLOBALS['IsCustomersAlsoViewedEnabled'] = 'checked="checked"'; } // Product Images if (GetConfig('ProductImagesTinyThumbnailsEnabled')) { $GLOBALS['IsProductImagesTinyThumbnailsEnabled'] = 'checked="checked"'; } if(GetConfig('ProductImagesImageZoomEnabled')) { $GLOBALS['IsProductImagesImageZoomEnabled'] = 'checked="checked"'; } if((int)GetConfig('ProductImagesStorewideThumbnail_width') < 1) { $GLOBALS['ISC_CFG']['ProductImagesStorewideThumbnail_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_THUMBNAIL; } if((int)GetConfig('ProductImagesStorewideThumbnail_height') < 1) { $GLOBALS['ISC_CFG']['ProductImagesStorewideThumbnail_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_THUMBNAIL; } if((int)GetConfig('ProductImagesProductPageImage_width') < 1) { $GLOBALS['ISC_CFG']['ProductImagesProductPageImage_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_STANDARD; } if((int)GetConfig('ProductImagesProductPageImage_height') < 1) { $GLOBALS['ISC_CFG']['ProductImagesProductPageImage_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_STANDARD; } if((int)GetConfig('ProductImagesGalleryThumbnail_width') < 1) { $GLOBALS['ISC_CFG']['ProductImagesGalleryThumbnail_width'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_TINY; } if((int)GetConfig('ProductImagesGalleryThumbnail_height') < 1) { $GLOBALS['ISC_CFG']['ProductImagesGalleryThumbnail_height'] = ISC_PRODUCT_DEFAULT_IMAGE_SIZE_TINY; } // Backup Settings if (GetConfig('BackupsLocal')) { $GLOBALS['IsBackupsLocalEnabled'] = 'checked="checked"'; } if (GetConfig('BackupsRemoteFTP')) { $GLOBALS['IsBackupsRemoteFTPEnabled'] = 'checked="checked"'; } if (GetConfig('BackupsAutomatic')) { $GLOBALS['IsBackupsAutomaticEnabled'] = 'checked="checked"'; } if (GetConfig('HTTPSSLVerifyPeer')) { $GLOBALS['IsHTTPSSLVerifyPeerEnabled'] = 'checked="checked"'; } if (strpos(strtolower(PHP_OS), 'win') === 0) { $binary = 'php.exe'; $path_to_php = Which($binary); } else { // Check if there is a separate PHP 5 binary first foreach(array('php5', 'php') as $phpBin) { $path_to_php = Which($phpBin); if($path_to_php !== '') { break; } } } if ($path_to_php === '' && strpos(strtolower(PHP_OS), 'win') === 0) { $path_to_php = 'php.exe'; } elseif ($path_to_php === '') { $path_to_php = 'php'; } $GLOBALS['BackupsAutomaticPath'] = $path_to_php.' -f ' . realpath(ISC_BASE_PATH . "/admin")."/cron-backup.php"; if (GetConfig('BackupsAutomaticMethod') == "ftp") { $GLOBALS['IsBackupsAutomaticMethodFTP'] = 'selected="selected"'; } else { $GLOBALS['IsBackupsAutomaticMethodLocal'] = 'selected="selected"'; } if (GetConfig('BackupsAutomaticDatabase')) { $GLOBALS['IsBackupsAutomaticDatabaseEnabled'] = 'checked="checked"'; } if (GetConfig('BackupsAutomaticImages')) { $GLOBALS['IsBackupsAutomaticImagesEnabled'] = 'checked="checked"'; } if (GetConfig('BackupsAutomaticDownloads')) { $GLOBALS['IsBackupsAutomaticDownloadsEnabled'] = 'checked="checked"'; } $GLOBALS['LanguageOptions'] = $this->GetLanguageOptions(GetConfig('Language')); if (!function_exists('ftp_connect')) { $GLOBALS['FTPBackupsHide'] = "none"; } $GLOBALS['TimeZoneOptions'] = $this->GetTimeZoneOptions(GetConfig('StoreTimeZone')); $query = sprintf("select version() as version"); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result); $GLOBALS['dbVersion'] = $row['version']; // Logging Settings if (GetConfig('SystemLogging')) { $GLOBALS['IsSystemLoggingEnabled'] = "checked=\"checked\""; } if(GetConfig('DebugMode')) { $GLOBALS['IsDebugModeEnabled'] = "checked=\"checked\""; } if (GetConfig('SystemLogTypes')) { $types = explode(",", GetConfig('SystemLogTypes')); if (in_array('general', $types)) { $GLOBALS['IsGeneralLoggingEnabled'] = "selected=\"selected\""; } if (in_array('payment', $types)) { $GLOBALS['IsPaymentLoggingEnabled'] = "selected=\"selected\""; } if (in_array('shipping', $types)) { $GLOBALS['IsShippingLoggingEnabled'] = "selected=\"selected\""; } if (in_array('notification', $types)) { $GLOBALS['IsNotificationLoggingEnabled'] = "selected=\"selected\""; } if (in_array('sql', $types)) { $GLOBALS['IsSQLLoggingEnabled'] = "selected=\"selected\""; } if (in_array('php', $types)) { $GLOBALS['IsPHPLoggingEnabled'] = "selected=\"selected\""; } if (in_array('accounting', $types)) { $GLOBALS['IsAccountingLoggingEnabled'] = "selected=\"selected\""; } if (in_array('emailintegration', $types)) { $GLOBALS['IsEmailIntegrationLoggingEnabled'] = "selected=\"selected\""; } if (in_array('ebay', $types)) { $GLOBALS['IsEbayLoggingEnabled'] = "selected=\"selected\""; } if (in_array('shoppingcomparison', $types)) { $GLOBALS['IsShoppingComparisonLoggingEnabled'] = "selected=\"selected\""; } } if (GetConfig('SystemLogSeverity')) { $severities = explode(",", GetConfig('SystemLogSeverity')); if (in_array('errors', $severities)) { $GLOBALS['IsLoggingSeverityErrors'] = "selected=\"selected\""; } if (in_array('warnings', $severities)) { $GLOBALS['IsLoggingSeverityWarnings'] = "selected=\"selected\""; } if (in_array('notices', $severities)) { $GLOBALS['IsLoggingSeverityNotices'] = "selected=\"selected\""; } if (in_array('success', $severities)) { $GLOBALS['IsLoggingSeveritySuccesses'] = "selected=\"selected\""; } if (in_array('debug', $severities)) { $GLOBALS['IsLoggingSeverityDebug'] = "selected=\"selected\""; } } if (GetConfig('EnableSEOUrls') == 2) { $GLOBALS['IsEnableSEOUrlsAuto'] = "selected=\"selected\""; } else if (GetConfig('EnableSEOUrls') == 1) { $GLOBALS['IsEnableSEOUrlsEnabled'] = "selected=\"selected\""; } else { $GLOBALS['IsEnableSEOUrlsDisabled'] = "selected=\"selected\""; } if (!gzte11(ISC_MEDIUMPRINT)) { $GLOBALS['HideBackupSettings'] = "none"; } if (GetConfig('AdministratorLogging')) { $GLOBALS['IsAdministratorLoggingEnabled'] = "checked=\"checked\""; } if(GetConfig('HidePHPErrors')) { $GLOBALS['IsHidePHPErrorsEnabled'] = "checked=\"checked\""; } if(GetConfig('EnableWishlist')) { $GLOBALS['IsWishlistEnabled'] = "checked=\"checked\""; } if(GetConfig('EnableAccountCreation')) { $GLOBALS['IsEnableAccountCreation'] = "checked=\"checked\""; } if (!getProductReviewsEnabled()) { $GLOBALS['HideIfReviewsDisabled'] = 'display: none;'; } if(GetConfig('EnableProductComparisons')) { $GLOBALS['IsEnableProductComparisons'] = "checked=\"checked\""; } // Product display settings if(GetConfig('ShowProductPrice')) { $GLOBALS['IsProductPriceShown'] = 'CHECKED'; } if(GetConfig('ShowProductSKU')) { $GLOBALS['IsProductSKUShown'] = 'CHECKED'; } if(GetConfig('ShowProductWeight')) { $GLOBALS['IsProductWeightShown'] = 'CHECKED'; } if(GetConfig('ShowProductBrand')) { $GLOBALS['IsProductBrandShown'] = 'CHECKED'; } if(GetConfig('ShowProductShipping')) { $GLOBALS['IsProductShippingShown'] = 'CHECKED'; } if(GetConfig('ShowProductRating')) { $GLOBALS['IsProductRatingShown'] = 'CHECKED'; } if(GetConfig('ShowAddToCartLink')) { $GLOBALS['IsAddToCartLinkShown'] = 'CHECKED'; } if (GetConfig('ShowAddThisLink')) { $GLOBALS['IsAddThisLinkShown'] = 'checked="checked"'; } if(GetConfig('LowInventoryNotificationAddress') != '') { $GLOBALS['LowInventoryEmailsEnabledCheck'] = "checked=\"checked\""; } else { $GLOBALS['HideLowInventoryNotification'] = "none"; } if(GetConfig('ForwardInvoiceEmails') != '') { $GLOBALS['ForwardInvoiceEmailsCheck'] = "checked=\"checked\""; } else { $GLOBALS['HideForwardInvoiceEmails'] = 'none'; } if(GetConfig('MailUseSMTP')) { $GLOBALS['HideMailSMTPSettings'] = ''; $GLOBALS['MailUseSMTPChecked'] = "checked=\"checked\""; } else { $GLOBALS['HideMailSMTPSettings'] = 'none'; $GLOBALS['MailUsePHPChecked'] = "checked=\"checked\""; } if (GetConfig('ProductImageMode') == "lightbox") { $GLOBALS['ProductImageModeLightbox'] = 'selected="selected"'; } else { $GLOBALS['ProductImageModePopup'] = 'selected="selected"'; } if (GetConfig('CategoryDisplayMode') == "grid") { $GLOBALS['CategoryDisplayModeGrid'] = 'selected="selected"'; } else { $GLOBALS['CategoryDisplayModeList'] = 'selected="selected"'; } if (GetConfig('CategoryDefaultImage') !== '') { $GLOBALS['CatImageDefaultSettingMessage'] = sprintf(GetLang('CatImageDefaultSettingDesc'), GetConfig('ShopPath') . '/' . GetConfig('CategoryDefaultImage'), GetConfig('CategoryDefaultImage')); } else { $GLOBALS['CatImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingNoDeleteDesc'), $GLOBALS['IMG_PATH'].'/CategoryDefault.gif', $GLOBALS['IMG_PATH'].'CategoryDefault.gif'); } if (GetConfig('BrandDefaultImage') !== '') { $GLOBALS['BrandImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingDesc'), GetConfig('ShopPath') . '/' . GetConfig('BrandDefaultImage'), GetConfig('BrandDefaultImage')); } else { $GLOBALS['BrandImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingNoDeleteDesc'), $GLOBALS['IMG_PATH'].'/BrandDefault.gif', $GLOBALS['IMG_PATH'].'/BrandDefault.gif'); } $GLOBALS['HideCurrentDefaultProductImage'] = 'display: none'; switch(GetConfig('DefaultProductImage')) { case 'template': $GLOBALS['DefaultProductImageTemplateChecked'] = 'checked="checked"'; break; case '': $GLOBALS['DefaultProductImageNoneChecked'] = 'checked="checked"'; break; default: $GLOBALS['DefaultProductImageCustomChecked'] = 'checked="checked"'; $GLOBALS['HideCurrentDefaultProductImage'] = ''; $GLOBALS['DefaultProductImage'] = GetConfig('DefaultProductImage'); } if (GetConfig('CategoryListingMode') == 'children') { $GLOBALS['CategoryListModeChildren'] = "checked=\"checked\""; } else if (GetConfig('CategoryListingMode') == 'emptychildren') { $GLOBALS['CategoryListModeEmptyChildren'] = "checked=\"checked\""; } else { $GLOBALS['CategoryListModeSingle'] = "checked=\"checked\""; } // check if the images need to be resized automatically $GLOBALS['RunImageResize'] = '0'; if(isset($_SESSION['RunImageResize']) && $_SESSION['RunImageResize'] == 'yes') { $GLOBALS['RunImageResize'] = '1'; unset($_SESSION['RunImageResize']); } // Get a list of the customer groups $query = 'SELECT * FROM [|PREFIX|]customer_groups ORDER BY groupname ASC'; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $GLOBALS['CustomerGroupOptions'] = ''; while($group = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { if(GetConfig('GuestCustomerGroup') == $group['customergroupid']) { $sel = 'selected="selected"'; } else { $sel = ''; } $GLOBALS['CustomerGroupOptions'] .= "<option value=\"".$group['customergroupid']."\" ".$sel.">".isc_html_escape($group['groupname'])."</option>"; } // Workout the HTTPS URL $GLOBALS['CompleteStorePath'] = fix_url($_SERVER['PHP_SELF']); $GLOBALS['HTTPSUrl'] = str_replace("http://", "https://", isc_strtolower($GLOBALS['ShopPath'])); $GLOBALS['HideVendorSettings'] = 'display: none'; if(gzte11(ISC_HUGEPRINT)) { $GLOBALS['HideVendorSettings'] = ''; } if(GetConfig('VendorLogoSize')) { $logoDimensions = explode('x', GetConfig('VendorLogoSize')); $GLOBALS['VendorLogoSizeW'] = (int)$logoDimensions[0]; $GLOBALS['VendorLogoSizeH'] = (int)$logoDimensions[1]; $GLOBALS['HideVendorLogoUploading'] = ''; $GLOBALS['VendorLogoUploadingChecked'] = 'checked="checked"'; } else { $GLOBALS['HideVendorLogoUploading'] = 'display: none'; } if(GetConfig('VendorPhotoSize')) { $photoDimensions = explode('x', GetConfig('VendorPhotoSize')); $GLOBALS['VendorPhotoSizeW'] = (int)$photoDimensions[0]; $GLOBALS['VendorPhotoSizeH'] = (int)$photoDimensions[1]; $GLOBALS['HideVendorPhotoUploading'] = ''; $GLOBALS['VendorPhotoUploadingChecked'] = 'checked="checked"'; } else { $GLOBALS['HideVendorPhotoUploading'] = 'display: none'; } foreach ($this->all_vars as $var) { if (is_string(GetConfig($var)) || is_numeric(GetConfig($var))) { $GLOBALS[$var] = isc_html_escape(GetConfig($var)); } } // the current value of auto_increment for the orders table $GLOBALS['StartingOrderNumber'] = ResetStartingOrderNumber(); if(GetConfig('DisableDatabaseDetailFields')) { $GLOBALS['dbType'] = ''; $GLOBALS['dbServer'] = ''; $GLOBALS['dbUser'] = ''; $GLOBALS['dbPass'] = ''; $GLOBALS['dbDatabase'] = ''; $GLOBALS['tablePrefix'] = ''; $GLOBALS['HideDatabaseDetails'] = 'display: none'; } if(GetConfig('DisableLicenseKeyField')) { $GLOBALS['serverStamp'] = 'N/A'; $GLOBALS['HideLicenseKey'] = 'display: none'; } if(GetConfig('DisablePathFields')) { $GLOBALS['HidePathFields'] = 'display: none'; } if(GetConfig('DisableStoreUrlField')) { $GLOBALS['HideStoreUrlField'] = 'display: none'; } if(GetConfig('DisableLoggingSettingsTab')) { $GLOBALS['HideLoggingSettingsTab'] = 'display: none'; } if(GetConfig('DisableProxyFields')) { $GLOBALS['HideProxyFields'] = 'display: none'; } if(GetConfig('DisableBackupSettings')) { $GLOBALS['HideBackupSettings'] = 'none'; } // Advance Search settings\ $GLOBALS['SearchDefaultProductSortOptions'] = getAdvanceSearchSortOptions("product"); $GLOBALS['SearchDefaultContentSortOptions'] = getAdvanceSearchSortOptions("content"); $GLOBALS['SearchProductDisplayModeOptions'] = ''; foreach (array('grid', 'list') as $type) { $GLOBALS['SearchProductDisplayModeOptions'] .= '<option value="' . $type . '"'; if (GetConfig('SearchProductDisplayMode') == $type) { $GLOBALS['SearchProductDisplayModeOptions'] .= ' selected'; } $GLOBALS['SearchProductDisplayModeOptions'] .= '>' . GetLang('SearchProductDisplayMode' . ucfirst($type)) . '</option>'; } $GLOBALS['SearchResultsPerPageOptions'] = ''; foreach (array('5', '10', '20', '50', '100') as $perpage) { $GLOBALS['SearchResultsPerPageOptions'] .= '<option value="' . $perpage . '"'; if (GetConfig('SearchResultsPerPage') == $perpage) { $GLOBALS['SearchResultsPerPageOptions'] .= ' selected'; } $GLOBALS['SearchResultsPerPageOptions'] .= '>' . $perpage . '</option>'; } $GLOBALS['SearchOptimisationOptions'] = ''; foreach (array('fulltext', 'like', 'both') as $mode) { $GLOBALS['SearchOptimisationOptions'] .= '<option value="' . $mode . '"'; if (GetConfig('SearchOptimisation') == $mode) { $GLOBALS['SearchOptimisationOptions'] .= ' selected'; } $GLOBALS['SearchOptimisationOptions'] .= '>' . GetLang('SearchOptimisation' . ucfirst(isc_strtolower($mode))) . '</option>'; } $GLOBALS["AbandonOrderLifetimeOptions"] = ""; foreach (array(1, 7, 14, 21, 30, 60, 90, 120, 150, 180) as $lifetimeType) { $GLOBALS["AbandonOrderLifetimeOptions"] .= "<option value=\"" . $lifetimeType . "\""; if ((int)GetConfig("AbandonOrderLifetime") == $lifetimeType) { $GLOBALS["AbandonOrderLifetimeOptions"] .= " selected=\"selected\""; } $GLOBALS["AbandonOrderLifetimeOptions"] .= ">" . GetLang("AbandonOrderLifetimeOption" . $lifetimeType . "Days") . "</option>\n"; } $GLOBALS['ShopPath'] = GetConfig('ShopPathNormal'); // get the maintenance message $GLOBALS['DownForMaintenanceMessage'] = Store_DownForMaintenance::getDownForMaintenanceMessage(); switch (GetConfig('RedirectWWW')) { case REDIRECT_TO_WWW: $redirectOption = 'RedirectToWWW'; break; case REDIRECT_TO_NO_WWW: $redirectOption = 'RedirectToNoWWW'; break; default: $redirectOption = 'RedirectNoPreference'; } $GLOBALS[$redirectOption . 'Selected'] = 'selected="selected"'; $GLOBALS['ShowPCISettings'] = !GetConfig('HidePCISettings'); $GLOBALS['FacebookLikeButtonEnabled'] = GetConfig('FacebookLikeButtonEnabled'); $GLOBALS['FacebookLikeButtonStyle' . GetConfig('FacebookLikeButtonStyle')] = 'selected="selected"'; $GLOBALS['FacebookLikeButtonPosition' . GetConfig('FacebookLikeButtonPosition')] = 'selected="selected"'; $GLOBALS['FacebookLikeButtonVerb' . GetConfig('FacebookLikeButtonVerb')] = 'selected="selected"'; $GLOBALS['FacebookLikeButtonShowFacesEnabled'] = GetConfig('FacebookLikeButtonShowFaces'); if (!isset($GLOBALS['TPL_CFG']['EnableFlyoutMenuSupport']) || !$GLOBALS['TPL_CFG']['EnableFlyoutMenuSupport']) { // force selection if template does not support flyout $GLOBALS['CategoryListStyle'] = 'static'; } $this->template->display('settings.manage.tpl'); }
public function SetPanelSettings() { if (!$GLOBALS["ISC_CLASS_SEARCH"]->searchIsLoaded()) { return; } // Do we have any pages and news items? $GLOBALS["SearchResultsContent"] = ""; $contentSearchResults = ""; $searchResults = $GLOBALS["ISC_CLASS_SEARCH"]->GetResults("content"); $contentSearchResults = ""; if (!empty($searchResults["results"]) && is_array($searchResults["results"])) { foreach ($searchResults["results"] as $item) { if ($item["nodetype"] == "page") { $contentSearchResults .= ISC_PAGE::buildContentSearchResultHTML($item); } else { $contentSearchResults .= ISC_NEWS::buildContentSearchResultHTML($item); } } } if (trim($contentSearchResults) !== "") { $GLOBALS["SectionResults"] = $contentSearchResults; $GLOBALS["SectionType"] = "ContentList"; $GLOBALS["SectionExtraClass"] = ""; $totalPages = $GLOBALS['ISC_CLASS_SEARCH']->GetNumPages("content"); $totalRecords = $GLOBALS['ISC_CLASS_SEARCH']->GetNumResults("content"); $page = (int)@$_REQUEST['page']; if ($page < 1) { $page = 1; } else if ($page > $totalPages) { $page = $totalPages; } // 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=content"; $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("content") <= 1) { $GLOBALS["HideSectionSorting"] = "none"; } else { $GLOBALS["HideSectionSorting"] = ""; } $GLOBALS["SectionSortingOptions"] = getAdvanceSearchSortOptions("content"); $GLOBALS["SectionSearchResults"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultGrid"); $GLOBALS["SearchResultsContent"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultSectionContent"); } // If no results then show the 'no results found' div if (trim($GLOBALS["SearchResultsContent"]) !== "") { $GLOBALS["HideSearchResultsContent"] = ""; $GLOBALS["HideSearchResultsNoResult"] = "none"; } else { $GLOBALS["HideSearchResultsContent"] = "none"; $GLOBALS["HideSearchResultsNoResult"] = ""; } }
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'); } }
/** * Shows a page of results when requested by an ajax query * */ public function ShowAjaxSearchPage() { $section = isc_strtolower(trim(@$_REQUEST["section"])); if (!$section) { exit; } $GLOBALS["ISC_CLASS_SEARCH"] = GetClass("ISC_SEARCH"); $searchTerms = $GLOBALS["ISC_CLASS_SEARCH"]->readSearchSession(); $sortBy = trim(@$_REQUEST["sortBy"]); $page = (int)@$_REQUEST['page']; if ($page < 1) { $page = 1; } // Do the search $limit = (int)GetConfig("SearchResultsPerPage"); $start = ($page - 1) * $limit; // We have all the details, now we need to load up the ISC_SEARCH class $GLOBALS["ISC_CLASS_SEARCH"]->_SetSearchData($searchTerms); $GLOBALS["ISC_CLASS_SEARCH"]->DoSearch($start, $limit, $section, $sortBy); $GLOBALS["SectionResults"] = ""; if ($section == "content") { $searchResults = $GLOBALS["ISC_CLASS_SEARCH"]->GetResults("content"); if (is_array($searchResults["results"]) && !empty($searchResults["results"])) { foreach ($searchResults["results"] as $item) { if ($item["nodetype"] == "page") { $GLOBALS["SectionResults"] .= ISC_PAGE::buildContentSearchResultHTML($item); } else { $GLOBALS["SectionResults"] .= ISC_NEWS::buildContentSearchResultHTML($item); } } } } else if ($section == "product") { $GLOBALS["SectionResults"] = ISC_PRODUCT::buildSearchResultsHTML(); } else { exit; } $totalPages = $GLOBALS['ISC_CLASS_SEARCH']->GetNumPages($section); $totalRecords = $GLOBALS['ISC_CLASS_SEARCH']->GetNumResults($section); if (GetConfig("SearchProductDisplayMode") == "list") { $GLOBALS["SectionExtraClass"] = 'List'; } else { $GLOBALS["SectionExtraClass"] = ''; } $GLOBALS["SectionType"] = ucfirst($section) . 'List'; $navTitle = GetLang("SearchResultsTab" . ucfirst($section)); // generate url with all current GET params except page and ajax $url = array(); foreach ($_GET as $key => $value) { if ($key == 'page' || $key == 'ajax') { continue; } if (is_array($value)) { foreach ($value as $subvalue) { $url[] = urlencode($key . '[]') . '=' . urlencode($subvalue); } } else { $url[] = urlencode($key) . '=' . urlencode($value); } } $url[] = "page={page}"; $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"; } $GLOBALS["SectionSortingOptions"] = getAdvanceSearchSortOptions($section, $sortBy); print $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SearchResultGrid"); exit; }