示例#1
0
		public function SetPanelSettings()
		{
			$GLOBALS['ISC_CLASS_CATEGORY'] = GetClass('ISC_CATEGORY');

			// Output breadcrumb trail
			$GLOBALS['SNIPPETS']['CatTrail'] = "";

			if ($GLOBALS['EnableSEOUrls'] == 1) {
				$baseLink = sprintf("%s/categories", $GLOBALS['ShopPath']);
			} else {
				$baseLink = sprintf("%s/categories.php?category=", $GLOBALS['ShopPath']);
			}

			$count = 0;
			$catPath = '';

			foreach($GLOBALS['CatTrail'] as $trail) {
				// if it's the root category and not friendly url, don't add / in front
				if ($count==0 && $GLOBALS['EnableSEOUrls'] != 1) {
					$baseLink .= MakeURLSafe($trail[1]);
				} else {
					$baseLink .= "/" . MakeURLSafe($trail[1]);
				}
				$catPath = MakeURLSafe($trail[1]);
				$GLOBALS['CatTrailName'] = isc_html_escape($trail[1]);
				$GLOBALS['CatTrailLink'] = $baseLink."/";

				if($count++ == count($GLOBALS['CatTrail'])-1) {
					$GLOBALS['SNIPPETS']['CatTrail'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItemCurrent");
				}
				else {
					$GLOBALS['SNIPPETS']['CatTrail'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItem");
				}
			}
		}
示例#2
0
 /**
  * @desc Create Brand links
  * @params Brandname
  */
 function LeftBrandLink($BrandName)
 {
     $NewLink = '';
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $NewLink = sprintf("%s/%s", GetConfig('ShopPath'), MakeURLSafe(strtolower($BrandName)));
     } else {
         $NewLink = sprintf("%s/search.php?search_query=%s", GetConfig('ShopPath'), MakeURLSafe($BrandName));
     }
     return $NewLink;
 }
示例#3
0
 public function SetPanelSettings()
 {
     // Output breadcrumb trail
     $GLOBALS['SNIPPETS']['CatTrail'] = "";
     $baseLink = sprintf("%s/categories", $GLOBALS['ShopPath']);
     $count = 0;
     foreach ($GLOBALS['CatTrail'] as $trail) {
         $baseLink .= "/" . MakeURLSafe($trail[1]);
         $GLOBALS['CatTrailName'] = $trail[1];
         $GLOBALS['CatTrailLink'] = $baseLink;
         $GLOBALS['SNIPPETS']['CatTrail'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItem");
     }
 }
示例#4
0
 function SetPanelSettings()
 {
     // Do we need to show paging?
     if ($GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() > GetConfig('CategoryProductsPerPage')) {
         // Workout the paging data
         $GLOBALS['SNIPPETS']['PagingData'] = "";
         $num_pages_either_side_of_current = 5;
         $start = max($GLOBALS['ISC_CLASS_BRANDS']->GetPage() - $num_pages_either_side_of_current, 1);
         $end = min($GLOBALS['ISC_CLASS_BRANDS']->GetPage() + $num_pages_either_side_of_current, $GLOBALS['ISC_CLASS_BRANDS']->GetNumPages());
         for ($page = $start; $page <= $end; $page++) {
             if ($page == $GLOBALS['ISC_CLASS_BRANDS']->GetPage()) {
                 $snippet = "CategoryPagingItemCurrent";
             } else {
                 $snippet = "CategoryPagingItem";
             }
             $GLOBALS['PageLink'] = BrandLink($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName(), array('page' => $page, 'sort' => $GLOBALS['ISC_CLASS_BRANDS']->GetSort()));
             $GLOBALS['PageNumber'] = $page;
             $GLOBALS['SNIPPETS']['PagingData'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);
         }
         // Parse the paging snippet
         if ($GLOBALS['ISC_CLASS_BRANDS']->GetPage() > 1) {
             // Do we need to output a "Previous" link?
             $GLOBALS['PrevLink'] = BrandLink($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName(), array('page' => $GLOBALS['ISC_CLASS_BRANDS']->GetPage() - 1, 'sort' => $GLOBALS['ISC_CLASS_BRANDS']->GetSort()));
             $GLOBALS['SNIPPETS']['CategoryPagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingPrevious");
         }
         if ($GLOBALS['ISC_CLASS_BRANDS']->GetPage() < $GLOBALS['ISC_CLASS_BRANDS']->GetNumPages()) {
             // Do we need to output a "Next" link?
             $GLOBALS['NextLink'] = BrandLink($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName(), array('page' => $GLOBALS['ISC_CLASS_BRANDS']->GetPage() + 1, 'sort' => $GLOBALS['ISC_CLASS_BRANDS']->GetSort()));
             $GLOBALS['SNIPPETS']['CategoryPagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPagingNext");
         }
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryPaging");
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
         $GLOBALS['SNIPPETS']['BrandPaging'] = $output;
     }
     // Should we show the compare button?
     if (GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() < 2) {
         $GLOBALS['HideCompareItems'] = "none";
     }
     // Parse the sort select box snippet
     if ($GLOBALS['ISC_CLASS_BRANDS']->GetNumProducts() > 1) {
         // Parse the sort select box snippet
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $GLOBALS['URL'] = BrandLink($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName());
         } else {
             $GLOBALS['URL'] = $GLOBALS['ShopPath'] . "/brands.php";
             $GLOBALS['HiddenSortField'] = "<input type=\"hidden\" name=\"brand\" value=\"" . MakeURLSafe($GLOBALS['ISC_CLASS_BRANDS']->GetBrandName()) . "\" />";
         }
         $GLOBALS['SNIPPETS']['CategorySortBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategorySortBox");
     }
 }
示例#5
0
 /**
  *	Show the search page. If there are results, show them too. If we're in advanced mode then
  *	show the advanced search options as well.
  */
 function ShowSearchPage()
 {
     if (isset($_GET['category'])) {
         $selected_cats = $_GET['category'];
     } else {
         $selected_cats = 0;
     }
     if (isset($_GET['mode']) && $_GET['mode'] == "advanced") {
         $GLOBALS['HideAdvancedLink'] = "none";
     }
     include_once dirname(__FILE__) . "/class.brands.php";
     $GLOBALS['CompareLink'] = CompareLink();
     $GLOBALS['ISC_CLASS_BRANDS'] = GetClass('ISC_BRANDS');
     $GLOBALS['BrandNameOptions'] = $GLOBALS['ISC_CLASS_BRANDS']->GetBrandsAsOptions(@$this->_searchterms['brand']);
     $GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY');
     $GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions($selected_cats, "<option %s value='%d'>%s</option>", 'selected="selected"', "", false, 1);
     if (isset($_GET['searchsubs']) && $_GET['searchsubs'] == "ON" || @$this->_searchterms['search_query'] == "") {
         $GLOBALS['IsSearchSubs'] = 'checked="checked"';
     }
     if (isset($this->_searchterms['price_from']) && is_numeric($this->_searchterms['price_from'])) {
         $GLOBALS['PriceFrom'] = $this->_searchterms['price_from'];
     }
     if (isset($this->_searchterms['price_to']) && is_numeric($this->_searchterms['price_to'])) {
         $GLOBALS['PriceTo'] = $this->_searchterms['price_to'];
     }
     if (isset($this->_searchterms['featured'])) {
         $GLOBALS["Featured" . $this->_searchterms['featured']] = 'selected="selected"';
     }
     if (isset($this->_searchterms['shipping'])) {
         $GLOBALS["Shipping" . $this->_searchterms['shipping']] = 'selected="selected"';
     }
     if (@$this->_searchterms['search_query'] != "") {
         $GLOBALS['SNIPPETS']['RelatedSearches'] = "";
         $has_suggestion = false;
         $changed_words = array();
         $query = $this->Suggest($this->_searchterms['search_query'], $has_suggestion, $changed_words);
         // Are we on a particular page?
         if (isset($_REQUEST['page'])) {
             $page = (int) $_REQUEST['page'];
             $this->_currentpage = $page;
             if ($page == 1) {
                 $start = 0;
             } else {
                 $start = ($page - 1) * GetConfig('CategoryProductsPerPage');
             }
         } else {
             $start = 0;
         }
         // Did pSpell make a suggestion?
         if ($query != $this->_searchterms['search_query']) {
             // pSpell made a suggestion
             $words = explode(" ", $this->_searchterms['search_query']);
             /* ---- the below below lines are commented for not showing as alternate names are shown instead - start ---- */
             /*foreach ($words as $k=>$word) {
             						foreach ($changed_words as $changed_word) {
             							if ($word == $changed_word[0]) {
             								$words[$k] = "<strong>" . $changed_word[1] . "</strong>";
             							}
             						}
             					}
             
             					$GLOBALS['SuggestQuery'] = implode(" ", $words);
             					$GLOBALS['SuggestQueryEscaped'] = urlencode($query);*/
             /* ------------ ends ---------- */
             /* --- this below patch is for getting alternate keywords as per client request ---- starts ---*/
             $GLOBALS['NewSuggestQuery'] = "";
             foreach ($changed_words as $key => $value) {
                 $words = explode(",", $value);
                 for ($i = 0; $i < count($words); $i++) {
                     $words[$i] = trim($words[$i]);
                     $GLOBALS['NewSuggestQuery'][] = "<a href='" . $GLOBALS['ShopPathNormal'] . "/search.php?search_query=" . urlencode($words[$i]) . "&search_key=1'>" . $words[$i] . "</a>";
                 }
             }
             if (!empty($GLOBALS['NewSuggestQuery'])) {
                 $GLOBALS['NewSuggestQuery'] = implode(" , ", $GLOBALS['NewSuggestQuery']);
             }
             /* ------ ends ----- */
             $GLOBALS['ShowSearchSuggestion'] = "";
         } else {
             // No search suggestion
             $GLOBALS['ShowSearchSuggestion'] = "none";
         }
         // Load up a list of results which the panel will take care of displaying
         $this->DoSearch($start, $GLOBALS['SearchResults'], $this->_numresults);
         //NI CLOUD
         //filter for single cat or brand
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['SearchResults']) == 1) {
             $sresult = $GLOBALS['ISC_CLASS_DB']->Query($GLOBALS['DoSearchQuery']);
             $row = $GLOBALS['ISC_CLASS_DB']->Fetch($sresult);
             if (!isset($row["prodcode"])) {
                 if (isset($row["parentcatname"])) {
                     $query = "SELECT b.* FROM [|PREFIX|]brands b, [|PREFIX|]brand_series bs  WHERE b.brandid = bs.brandid and bs.seriesid = " . $row["brandseriesid"];
                     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
                     if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
                         $crow = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
                         if ($crow["displayproducts"] == '1') {
                             header("Location:" . $GLOBALS["ShopPath"] . $_SERVER["REQUEST_URI"] . "/series/" . MakeURLSafe($row["seriesname"]));
                         }
                     }
                 } else {
                     $query = "SELECT * FROM [|PREFIX|]categories c WHERE c.categoryid = (SELECT catparentid FROM [|PREFIX|]categories where categoryid = " . $row["categoryid"] . ")";
                     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
                     if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
                         $crow = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
                         if (strtolower($crow["displayproducts"]) == 'on') {
                             header("Location:" . $GLOBALS["ShopPath"] . $_SERVER["REQUEST_URI"] . "/subcategory/" . MakeURLSafe($row["catname"]));
                         }
                     } else {
                         $query = "(SELECT * FROM [|PREFIX|]categories where categoryid = " . $row["categoryid"] . ")";
                         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
                         $crow = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
                         if (strtolower($crow["displayproducts"]) == 'on') {
                             header("Location:" . $GLOBALS["ShopPath"] . $_SERVER["REQUEST_URI"] . "/subcategory/" . MakeURLSafe($row["catname"]));
                         }
                     }
                 }
             }
         }
         // Log the search result
         if ($start == 0) {
             //wirror_20100913: filter the request from yahoo,google,msn & baidu
             if (isset($_SERVER['HTTP_USER_AGENT'])) {
                 $userAgent = $_SERVER['HTTP_USER_AGENT'];
                 $webSpiders = array('Yahoo! Slurp', 'Baiduspider', 'Googlebot', 'msnbot');
                 $noSpider = true;
                 foreach ($webSpiders as $spider) {
                     if (strpos($userAgent, $spider) !== false) {
                         $noSpider = false;
                         break;
                     }
                 }
             }
             // lguan_20100520: Only do the log if smart search flag is on, means we only log the search terms user input in smart search box
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 $url_array = split('/', strtolower($_SERVER['REQUEST_URI']));
                 $is_smart_search = $url_array[array_search('is_smart_search', $url_array, true) + 1];
                 if (isset($is_smart_search) && $is_smart_search == 1 && isset($this->_searchterms['search_query']) && strlen($this->_searchterms['search_query']) > 0 && $noSpider) {
                     $GLOBALS['SearchId'] = $this->LogSearch($this->_searchterms['search_query'], $this->_numresults);
                 }
             } else {
                 if (isset($_GET['is_smart_search']) && $_GET['is_smart_search'] == 1 && isset($this->_searchterms['search_query']) && strlen($this->_searchterms['search_query']) > 0 && $noSpider) {
                     $GLOBALS['SearchId'] = $this->LogSearch($this->_searchterms['search_query'], $this->_numresults);
                 }
             }
         }
         // Load up a list of related searches
         $related_searches = $this->GetRelatedSearchTerms($this->_searchterms['search_query']);
         if (!empty($related_searches)) {
             foreach ($related_searches as $related_search) {
                 $GLOBALS['RelatedSearchQuery'] = urlencode($related_search);
                 $GLOBALS['RelatedSearchText'] = isc_html_escape($related_search);
                 $GLOBALS['SNIPPETS']['RelatedSearches'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("RelatedSearchItem");
             }
             $GLOBALS['SNIPPETS']['RelatedSearches'] = trim($GLOBALS['SNIPPETS']['RelatedSearches'], ", ");
         } else {
             $GLOBALS['HideRelatedSearches'] = "none";
         }
         /* this below patch has been added to hide the below 3 sections as per client requirements */
         if ($this->_numresults == 0) {
             $GLOBALS['HideRelatedSearches'] = "none";
             if (!empty($GLOBALS['NewSuggestQuery'])) {
                 $GLOBALS['ShowSearchSuggestion'] = "";
             } else {
                 $GLOBALS['ShowSearchSuggestion'] = "none";
             }
             $GLOBALS['SearchTitle'] = "";
         } else {
             $GLOBALS['ShowSearchSuggestion'] = "none";
         }
         // How many pages of results are there?
         $this->_numpages = ceil($this->_numresults / GetConfig('CategoryProductsPerPage'));
     } else {
         // Show the advanced mode box instead and hide everything else if there's no search term
         if (@$this->_searchterms['search_query'] == "") {
             $GLOBALS['HideRelatedSearches'] = "none";
             $GLOBALS['ShowSearchSuggestion'] = "none";
             $GLOBALS['HideSearchResults'] = "none";
             $GLOBALS['HideNoResults'] = "none";
         }
     }
     /* Re-writing the search keywords as per the selection in the search field */
     $originalsearchquery = isset($GLOBALS['OriginalSearchQuery']) ? $GLOBALS['OriginalSearchQuery'] : '';
     $GLOBALS['OriginalSearchQuery'] = "";
     $searchquerystring = array();
     $ymmTitle = array();
     // This variable is used to get YMM and add it to title tag.
     if (isset($GLOBALS['ISC_SRCH_BRAND_NAME'])) {
         $searchquerystring[] = $GLOBALS['ISC_SRCH_BRAND_NAME'];
     }
     if (isset($this->_searchterms['partnumber'])) {
         $searchquerystring[] = $this->_searchterms['partnumber'];
     }
     if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) {
         $searchquerystring[] = $GLOBALS['ISC_SRCH_CATG_NAME'];
     }
     if (isset($this->_searchterms['year'])) {
         $searchquerystring[] = $this->_searchterms['year'];
         $ymmTitle[] = $this->_searchterms['year'];
     }
     if (isset($this->_searchterms['make'])) {
         $searchquerystring[] = strtoupper($this->_searchterms['make']);
         $ymmTitle[] = ucwords(strtolower($this->_searchterms['make']));
     }
     if (isset($_REQUEST['model']) && !empty($_REQUEST['model'])) {
         $searchquerystring[] = $_REQUEST['model'];
         $ymmTitle[] = ucwords(strtolower($_REQUEST['model']));
     }
     if (isset($this->_searchterms['submodel'])) {
         $searchquerystring[] = ucwords(strtolower($this->_searchterms['submodel']));
     }
     if (!empty($this->_searchterms['dynfilters'])) {
         $searchquerystring[] = implode(" ", $this->_searchterms['dynfilters']);
     }
     if (empty($searchquerystring) && $originalsearchquery != 'categories' && $originalsearchquery != 'brands' && !isset($_REQUEST['change'])) {
         // when none of the above selection is made, need to show the search keyword entered
         $searchquerystring[] = $originalsearchquery;
     }
     $GLOBALS['OriginalSearchQuery'] = implode(" ", $searchquerystring);
     $GLOBALS['FormattedSearchQuery'] = $GLOBALS['OriginalSearchQuery'];
     /* ----------------------------------------------------------------------- */
     /*---- The below two variables are added to set the search title and page title again after resetting ----*/
     //$GLOBALS['SearchTitle'] = $this->_numresults." ".sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']);
     //if( isset($this->_searchterms['partnumber']) || (isset($this->_searchterms['flag_srch_category']) && $this->_searchterms['flag_srch_category'] == 1 ) || ( isset($this->_searchterms['flag_srch_category']) && isset($GLOBALS['BRAND_SERIES_FLAG']) && $GLOBALS['BRAND_SERIES_FLAG'] == 1 ))
     if ($GLOBALS['results_page_flag'] == 2) {
         $GLOBALS['SearchTitle'] = $this->GetSearchResultMessage();
         //$GLOBALS['SearchTitle'] = $this->_numresults." ".sprintf(GetLang('SpecificResultsFor'), "Parts",  $GLOBALS['OriginalSearchQuery']);
     } else {
         if ($GLOBALS['results_page_flag'] == 1) {
             $GLOBALS['SearchTitle'] = $this->_numresults . " " . sprintf(GetLang('SpecificResultsFor'), "Series", $GLOBALS['OriginalSearchQuery']);
         } else {
             $GLOBALS['SearchTitle'] = $this->GetSearchResultMessage();
         }
     }
     /*
     			else {
         if(isset($this->_searchterms['srch_category']) || !isset($GLOBALS['BRAND_SERIES_FLAG']))  
         {
     					$GLOBALS['SearchTitle'] = $this->GetSearchResultMessage();
             //$GLOBALS['SearchTitle'] = $this->_numresults." ".sprintf(GetLang('SpecificResultsFor'), "Subcategories",  $GLOBALS['OriginalSearchQuery']);  
         }
         else
         {
             $GLOBALS['SearchTitle'] = $this->_numresults." ".sprintf(GetLang('SpecificResultsFor'), "Series", $GLOBALS['OriginalSearchQuery']);            
         }
     }
     */
     if ($this->_numresults == 0) {
         $GLOBALS['RedefinedSearchQuery'] = $GLOBALS['OriginalSearchQuery'];
         if ($GLOBALS['OriginalSearchQuery'] == '') {
             $GLOBALS['SearchTitle'] = '';
         } else {
             $GLOBALS['SearchTitle'] = $this->_numresults . " " . sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']);
         }
     }
     if (trim($this->_pagetitle) == "") {
         $this->_pagetitle = sprintf(GetLang('SearchSimpleTitle'), GetConfig('StoreName'), strip_tags($GLOBALS['SearchTitle']));
     }
     /*-- Prefixing YMM to actual title tag --*/
     if (!empty($ymmTitle)) {
         $ymmTitle[] = $this->_pagetitle;
         $this->_pagetitle = implode($ymmTitle, " ");
     }
     if ($this->_numresults == 0 && isset($this->_searchterms['searchtext'])) {
         $GLOBALS['RedefinedSearchQuery'] = $GLOBALS['OriginalSearchQuery'];
     }
     $GLOBALS['OriginalSearchQuery'] = '';
     if (isset($this->_searchterms['searchtext'])) {
         //$searchquerystring = array();
         $GLOBALS['OriginalSearchQuery'] = $this->_searchterms['searchtext'];
     }
     if (isset($this->_searchterms['search'])) {
         //$searchquerystring = array();
         $GLOBALS['OriginalSearchQuery'] = $this->_searchterms['search'];
         $GLOBALS['RedefinedSearchQuery'] = $GLOBALS['OriginalSearchQuery'];
     }
     // Hide the search form if we have just performed a search
     if (!empty($this->_searchterms)) {
         $GLOBALS['AutoHideSearchForm'] = "true";
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($this->_pagetitle);
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("search");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
 function SearchStatsPerformanceGrid()
 {
     $query = sprintf("select distinct(searchtext), searchurl, UPPER(ifnull( prodmaker , '' )) AS maker, ifnull( prodyear , '' ) AS year, UPPER(ifnull( prodmodel , '' )) AS model, max(numresults) as numresults, count(searchid) as numsearches, max(searchdate) as lastperformed\n\t\t\t\t\t\t\t\tfrom [|PREFIX|]searches_extended\n\t\t\t\t\t\t\t\twhere numresults > 0\n\t\t\t\t\t\t\t\tand clickthru='%d'\n\t\t\t\t\t\t\t\tand searchdate >= '%d' and searchdate <= '%d'\n\t\t\t\t\t\t\t\tgroup by searchtext, searchurl, maker, year, model\n\t\t\t\t\t\t\t\torder by numsearches desc", $this->clickwhere, $this->from_date, $this->to_date);
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     header("Content-Type: text/csv");
     if ($this->clickwhere == 1) {
         header("Content-Disposition: attachment; filename=SearchStatsBestPerformingKeywords.csv");
     } else {
         header("Content-Disposition: attachment; filename=SearchStatsWorstPerformingKeywords.csv");
     }
     header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
     header('Expires:0');
     header('Pragma:public');
     if ($this->clickwhere == 1) {
         echo 'Search statistics for best performing keywords';
     } else {
         echo 'Search statistics for worst performing keywords';
     }
     echo "\n\n";
     if (isset($this->from_date) && $this->from_date != 0) {
         echo 'Start Date:,' . date("Y-m-d H:i:s", $this->from_date) . ', ,';
     }
     if (isset($this->to_date) && $this->to_date != 0) {
         echo 'End Date:,' . date("Y-m-d H:i:s", $this->to_date) . "\n\n";
     }
     if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
         echo "Search Terms,Search Text,Year,Make,Model,Number of Searches,Number of Results,Search Last Performed \n";
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             echo (isset($row['searchurl']) && $row['searchurl'] !== '' ? $GLOBALS["ShopPath"] . $row['searchurl'] : $GLOBALS["ShopPath"] . "/search/" . MakeURLSafe($row['searchtext']) . (isset($row['year']) && $row['year'] != "" ? "/year/" . $row['year'] : '') . (isset($row['maker']) && $row['maker'] != "" ? "/make/" . MakeURLSafe($row['maker']) : '') . (isset($row['model']) && $row['model'] != "" ? "/model/" . MakeURLSafe($row['model']) : '')) . ',' . isc_html_escape($row['searchtext']) . ',' . $row['year'] . ',' . $row['maker'] . ',' . $row['model'] . ',' . number_format($row['numsearches'], 0, '', '') . ',' . number_format($row['numresults'], 0, '', '') . ',' . isc_date(GetConfig('DisplayDateFormat'), $row['lastperformed']);
             echo "\n";
         }
         echo "\nTotal Results: " . $GLOBALS['ISC_CLASS_DB']->CountResult($result);
     } else {
         echo "Total Results: 0";
     }
 }
 private function _generalYMM($prodIds)
 {
     $prodIds = implode(',', $prodIds);
     $arrYears = range(1995, 2010);
     $arrMakes = array('Chevrolet', 'GMC', 'Ford', 'Dodge', 'Toyota', 'Nissan', 'Honda', 'Jeep', 'Hyundai', 'Chrysler', 'Infiniti', 'Lexus');
     $arrYMM = array();
     foreach ($arrYears as $year) {
         foreach ($arrMakes as $make) {
             $ymm_qry = "SELECT distinct prodmodel \n\t\t\t\t\t\tFROM [|PREFIX|]products p \n\t\t\t\t\t\tLEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid \n\t\t\t\t\t\tWHERE p.prodvisible='1'\n\t\t\t\t\t\tAND p.productid IN({$prodIds}) \n\t\t\t\t\t\tAND('{$year}' between prodstartyear and prodendyear OR prodstartyear = 'all' )\n\t\t\t\t\t\t";
             //AND prodmake='$make'
             $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
             while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
                 if ($GLOBALS['EnableSEOUrls'] == 1) {
                     $yearTmp = "/year/{$year}";
                     $makeTmp = "/make/" . strtolower($make);
                     $modelTmp = "/model/" . MakeURLSafe(strtolower($ymm_row['prodmodel']));
                 } else {
                     $yearTmp = "&year={$year}";
                     $makeTmp = "&make=" . strtolower($make);
                     $modelTmp = "&model=" . MakeURLSafe(strtolower($ymm_row['prodmodel']));
                 }
                 $arrYMM[] = "{$yearTmp}{$makeTmp}{$modelTmp}";
             }
         }
     }
     return $arrYMM;
 }
示例#8
0
		public function SetPanelSettings()
		{
			$GLOBALS['ISC_CLASS_CATEGORY'] = GetClass('ISC_CATEGORY');

			// Output breadcrumb trail
			$GLOBALS['SNIPPETS']['CatTrail'] = "";

			if ($GLOBALS['EnableSEOUrls'] == 1) {
				$baseLink = sprintf("%s/categories", $GLOBALS['ShopPath']);
			} else {
				$baseLink = sprintf("%s/categories.php?category=", $GLOBALS['ShopPath']);
			}

			$count = 0;
			$catPath = '';
			if (isset($GLOBALS['CatTrail']) && is_array($GLOBALS['CatTrail'])) {
				foreach($GLOBALS['CatTrail'] as $trail) {
					$baseLink .= "/" . MakeURLSafe($trail[1]);
					$catPath .= MakeURLSafe($trail[1])."/";

					$GLOBALS['CatTrailName'] = isc_html_escape($trail[1]);
					$GLOBALS['CatTrailLink'] = $baseLink;

					if($count++ == count($GLOBALS['CatTrail'])-1) {
						$GLOBALS['SNIPPETS']['CatTrail'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItemCurrent");
					}
					else {
						$GLOBALS['SNIPPETS']['CatTrail'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItem");
					}
				}
			}

			$catPath = rtrim($catPath, "/");

			// Output sub-categories
			$GLOBALS['SNIPPETS']['SubCategories'] = "";
			$query = sprintf("select * from [|PREFIX|]categories where catparentid='%d' and catvisible=1 order by catsort asc, catname asc", $GLOBALS['ISC_CLASS_DB']->Quote($GLOBALS['CatId']));
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

			if($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {

				// Check to see if we need to add in place holder images or if we are just displaying text
				if (!($rtn = $GLOBALS['ISC_CLASS_DB']->Fetch($GLOBALS['ISC_CLASS_DB']->Query("SELECT COUNT(*) AS Total FROM [|PREFIX|]categories WHERE catparentid='" . (int)$GLOBALS['CatId'] . "' AND catimagefile != ''"))) || !$rtn['Total']) {
					$useImages = false;
				} else {
					$useImages = true;
					if (GetConfig('CategoryDefaultImage') !== '') {
						$defaultImage = GetConfig('ShopPath') . '/' . GetConfig('CategoryDefaultImage');
					} else {
						$defaultImage = $GLOBALS['IMG_PATH'].'/CategoryDefault.gif';
					}
				}

				$i = 0;
				while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
					$i++;
					if (!CustomerGroupHasAccessToCategory($row['categoryid'])) {
						continue;
					}

					$GLOBALS['SubCatName'] = isc_html_escape($row['catname']);
					$GLOBALS['SubCatLink'] = CatLink($row['categoryid'], $row['catname']);
					if ($useImages) {
						if ($row['catimagefile'] !== '') {
							$GLOBALS['SubCatImage'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $row['catimagefile'];
						} else {
							$GLOBALS['SubCatImage'] = $defaultImage;
						}

						$GLOBALS['ISC_CLASS_TEMPLATE']->assign('width', getConfig('CategoryImageWidth'));
						$GLOBALS['ISC_CLASS_TEMPLATE']->assign('height', getConfig('CategoryImageHeight') + 50);

						$GLOBALS['SNIPPETS']['SubCategories'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCatItemImage");

						if ($i % GetConfig('CategoryPerRow') == 0) {
							$GLOBALS['SNIPPETS']['SubCategories'] .= '<li class="RowDivider" style="float:none; clear:both;"></li>';
						}

					} else {
						$GLOBALS['SNIPPETS']['SubCategories'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCatItem");
					}
				}

				if ($useImages) {
					if ($i % GetConfig('CategoryPerRow') > 0) {
						$GLOBALS['SNIPPETS']['SubCategories'] .= '<li style="float: none; clear: both;"/>';
					}
					$output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategoriesGrid");
				} else {
					$output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SubCategories");
				}

				$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
				$GLOBALS['SNIPPETS']['SubCategories'] = $output;
			}

			if($GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() > 1) {
				// Parse the sort select box snippet
				$queryStringAppend = array();
				if(!empty($_GET['price_min'])) {
					$queryStringAppend['price_min'] = (float)$_GET['price_min'];
				}

				if(!empty($_GET['price_max'])) {
					$queryStringAppend['price_max'] = (float)$_GET['price_max'];
				}


				if($GLOBALS['EnableSEOUrls'] == 1) {
					$GLOBALS['URL'] = CatLink($GLOBALS['CatId'], $GLOBALS['ISC_CLASS_CATEGORY']->GetName(), false);
				}
				else {
					$GLOBALS['URL'] = $GLOBALS['ShopPath']."/categories.php";
					$queryStringAppend['category'] = $catPath;
				}

				$GLOBALS['HiddenSortField'] = '';
				foreach($queryStringAppend as $k => $v) {
					$GLOBALS['HiddenSortField'] .= "<input type=\"hidden\" name=\"".$k."\" value=\"".isc_html_escape($v)."\" />";
				}

				$GLOBALS['SNIPPETS']['CategorySortBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategorySortBox");
			}

			// Is the category empty?
			if($GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() == 0) {
				$GLOBALS['ExtraCategoryClass'] = "Wide WideWithLeft";
				if($GLOBALS['SNIPPETS']['SubCategories'] != '') {
					$GLOBALS['CategoryProductListing'] = '';
				}
				$GLOBALS['HideRightColumn'] = "none";
			}
		}
 /**
  * @desc Create filters below paramters into links
  * @params search paramsters, qualifier title
  * $mmy = 1 -> clear all filters below other than mmy
  * $mmy = 0 -> clear mmy filters
  */
 function GetClearFilterlink($params, $mmy)
 {
     $NewLink = '';
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         if ($mmy == 1) {
             if (isset($params['make']) && !empty($params['make'])) {
                 $NewLink .= "/make/" . MakeURLSafe(strtolower($params['make']));
             }
             if (isset($params['model']) && !empty($params['model'])) {
                 $NewLink .= "/model/" . MakeURLSafe(strtolower($params['model']));
             }
             if (isset($params['model_flag']) && $params['model'] == 0) {
                 $NewLink .= "/model_flag/" . $params['model_flag'];
             }
             if (isset($params['year']) && !empty($params['year'])) {
                 $NewLink .= "/year/" . $params['year'];
             }
             if ($NewLink == "") {
                 $NewLink = "/";
             }
         } else {
             // for clear mmy filters
             /*if(isset($GLOBALS['ISC_SRCH_CATG_NAME']))
             			$NewLink .= "/".MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME']));
             		else if(isset($GLOBALS['ISC_SRCH_BRAND_NAME']))
             			$NewLink .= "/".MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME']));*/
             $NewLink .= "/" . MakeURLSafe(strtolower($GLOBALS['PathInfo'][1]));
             if (isset($params['brand']) && $params['brand'] != "" && $NewLink != $params['brand']) {
                 $NewLink .= "/brand/" . MakeURLSafe(strtolower($params['brand']));
             }
             if (isset($params['series']) && $params['series'] != "") {
                 $NewLink .= "/series/" . MakeURLSafe(strtolower($params['series']));
             }
             if (isset($params['subcategory']) && $params['subcategory'] != "") {
                 $NewLink .= "/subcategory/" . MakeURLSafe(strtolower($params['subcategory']));
             }
             if ($NewLink != "") {
                 $NewLink .= "";
             } else {
                 $NewLink .= "/";
             }
         }
     } else {
         if ($mmy == 1) {
             $addLink = "/search.php?search_query=categories";
             if (isset($params['make']) && !empty($params['make'])) {
                 $NewLink .= "&make=" . MakeURLSafe(strtolower($params['make']));
             }
             if (isset($params['model']) && !empty($params['model'])) {
                 $NewLink .= "&model=" . MakeURLSafe(strtolower($params['model']));
             }
             if (isset($params['model_flag']) && $params['model'] == 0) {
                 $NewLink .= "&model_flag=" . $params['model_flag'];
             }
             if (isset($params['year']) && !empty($params['year'])) {
                 $NewLink .= "&year=" . $params['year'];
             }
             if ($NewLink != "") {
                 $NewLink = $addLink . $NewLink;
             } else {
                 $NewLink = "/";
             }
         } else {
             // for clear mmy filters
             $addLink = "/search.php?search_query=";
             if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) {
                 $NewLink .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME']));
             } else {
                 if (isset($GLOBALS['ISC_SRCH_BRAND_NAME'])) {
                     $NewLink .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME']));
                 }
             }
             if (isset($params['brand']) && $params['brand'] != "" && $NewLink != $params['brand']) {
                 $NewLink .= "&brand=" . MakeURLSafe($params['brand']);
             }
             if (isset($params['series']) && $params['series'] != "") {
                 $NewLink .= "&series=" . MakeURLSafe($params['series']);
             }
             if (isset($params['subcategory']) && $params['subcategory'] != "") {
                 $NewLink .= "&subcategory=" . MakeURLSafe($params['subcategory']);
             }
             if ($NewLink != "") {
                 $NewLink .= "";
                 $NewLink = $addLink . $NewLink;
             } else {
                 $NewLink .= "/";
             }
         }
     }
     return $NewLink;
 }
示例#10
0
 /**
  * Generate the link to a product audio.
  *
  * @param string The name of the product to generate the link to.
  * @return string The generated link to the product.
  */
 function ProdAudioLink($prod)
 {
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         return sprintf("%s/%s/%s.html", GetConfig('ShopPath'), PRODUCTAUDIO_LINK_PART, MakeURLSafe($prod));
     } else {
         return sprintf("%s/productaudio.php?product_id=%s", GetConfig('ShopPath'), MakeURLSafe($prod));
     }
 }
示例#11
0
function PageLink($pageid, $pagetitle, $vendor = array())
{
    $link = GetConfig('ShopPathNormal') . '/';
    if (!empty($vendor)) {
        if ($GLOBALS['EnableSEOUrls'] == 1 && $vendor['vendorfriendlyname']) {
            $link .= 'vendors/' . $vendor['vendorfriendlyname'] . '/' . MakeURLSafe($pagetitle) . '.html';
        } else {
            $link .= 'vendors.php?vendorid=' . (int) $vendor['vendorid'] . '&pageid=' . (int) $pageid;
        }
    } else {
        if ($GLOBALS['EnableSEOUrls'] == 1) {
            $link .= 'pages/' . MakeURLSafe($pagetitle) . '.html';
        } else {
            $link .= 'pages.php?pageid=' . (int) $pageid;
        }
    }
    return $link;
}
示例#12
0
 /**
  * @desc Create YMM links
  * @params search paramsters
  */
 function GetYMMLinks($params)
 {
     $NewLink = '';
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         if (isset($params['make']) && !empty($params['make'])) {
             $NewLink .= "/make/" . MakeURLSafe(strtolower($params['make']));
         }
         if (isset($params['model']) && !empty($params['model'])) {
             $NewLink .= "/model/" . MakeURLSafe(strtolower($params['model']));
         }
         if (isset($params['model_flag']) && $params['model_flag'] == 0) {
             $NewLink .= "/model_flag/" . $params['model_flag'];
         }
         if (isset($params['submodel']) && !empty($params['submodel'])) {
             $NewLink .= "/submodel/" . MakeURLSafe(strtolower($params['submodel']));
         }
         if (isset($params['year']) && !empty($params['year'])) {
             $NewLink .= "/year/" . $params['year'];
         }
     } else {
         if (isset($params['make']) && !empty($params['make'])) {
             $NewLink .= "&make=" . MakeURLSafe($params['make']);
         }
         if (isset($params['model']) && !empty($params['model'])) {
             $NewLink .= "&model=" . MakeURLSafe($params['model']);
         }
         if (isset($params['model_flag']) && $params['model_flag'] == 0) {
             $NewLink .= "&model_flag=" . $params['model_flag'];
         }
         if (isset($params['submodel']) && !empty($params['submodel'])) {
             $NewLink .= "&submodel=" . MakeURLSafe($params['submodel']);
         }
         if (isset($params['year']) && !empty($params['year'])) {
             $NewLink .= "&year=" . $params['year'];
         }
     }
     return $NewLink;
 }
示例#13
0
 public function SetPanelSettings()
 {
     $_SESSION['you_save'] = 0;
     //blessen
     $GLOBALS['SNIPPETS']['CartItems'] = "";
     $count = 0;
     $subtotal = 0;
     $_SESSION['CHECKOUT'] = array();
     // Get a list of all products in the cart
     $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
     $GLOBALS['ISC_CLASS_CART']->api->RemoveGoogleCheckoutCouponFlag();
     // Added for google cehckout remove link
     $product_array = $GLOBALS['ISC_CLASS_CART']->api->GetProductsInCart();
     $GLOBALS['AdditionalCheckoutButtons'] = '';
     // Go through all the checkout modules looking for one with a GetSidePanelCheckoutButton function defined
     $ShowCheckoutButton = false;
     if (!empty($product_array)) {
         foreach (GetAvailableModules('checkout', true, true) as $module) {
             if (isset($module['object']->_showBothButtons) && $module['object']->_showBothButtons) {
                 $ShowCheckoutButton = true;
                 $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetCheckoutButton();
             } elseif (method_exists($module['object'], 'GetCheckoutButton')) {
                 $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetCheckoutButton();
             } else {
                 $ShowCheckoutButton = true;
             }
         }
     }
     $GLOBALS['HideMultipleAddressShipping'] = 'display: none';
     if (gzte11(ISC_MEDIUMPRINT) && $GLOBALS['ISC_CLASS_CART']->api->GetNumPhysicalProducts() > 1 && $ShowCheckoutButton && GetConfig("MultipleShippingAddresses")) {
         $GLOBALS['HideMultipleAddressShipping'] = '';
     }
     $GLOBALS['HideCheckoutButton'] = '';
     if (!$ShowCheckoutButton) {
         $GLOBALS['HideCheckoutButton'] = 'display: none';
         $GLOBALS['HideMultipleAddressShippingOr'] = 'display: none';
     }
     $wrappingOptions = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('GiftWrapping');
     if (empty($wrappingOptions)) {
         $publicWrappingOptions = false;
     } else {
         $publicWrappingOptions = true;
     }
     if (!GetConfig('ShowThumbsInCart')) {
         $GLOBALS['HideThumbColumn'] = 'display: none';
         $GLOBALS['ProductNameSpan'] = 2;
     } else {
         $GLOBALS['HideThumbColumn'] = '';
         $GLOBALS['ProductNameSpan'] = 1;
     }
     $wrappingAdjustment = 0;
     $itemTotal = 0;
     $comptotal = 0;
     # To get all the complementary product total -- Baskaran
     $compprice = 0;
     foreach ($product_array as $k => $product) {
         $GLOBALS['CartItemId'] = (int) $product['cartitemid'];
         // If the item in the cart is a gift certificate, we need to show a special type of row
         if (isset($product['type']) && $product['type'] == "giftcertificate") {
             $GLOBALS['GiftCertificateName'] = isc_html_escape($product['data']['prodname']);
             $GLOBALS['GiftCertificateAmount'] = CurrencyConvertFormatPrice($product['giftamount']);
             $GLOBALS['GiftCertificateTo'] = isc_html_escape($product['certificate']['to_name']);
             $GLOBALS["Quantity" . $product['quantity']] = 'selected="selected"';
             $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product['giftamount']);
             $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($product['giftamount'] * $product['quantity']);
             $itemTotal += $product['giftamount'] * $product['quantity'];
             $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemGiftCertificate");
         } else {
             //					$GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']);
             //                    echo $GLOBALS['ProductLink'];exit;
             if ($GLOBALS['EnableSEOUrls'] == 1) {
                 $symbol = '/';
                 $make = '';
                 $model = '';
                 $year = '';
                 if ($product['make'] != '' or $product['make'] != '' or $product['make'] != '') {
                     if ($product['make'] != '') {
                         $make = "make=" . MakeURLSafe($product['make']) . $symbol;
                     }
                     if ($product['model'] != '') {
                         $model = "model=" . MakeURLSafe($product['model']);
                     }
                     if ($product['year'] != '') {
                         $year = "year=" . $product['year'] . $symbol;
                     }
                     $GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']) . $symbol . "refer=true" . $symbol . $year . $make . $model;
                 } else {
                     $GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']);
                 }
             } else {
                 $symbol = '&';
                 $make = '';
                 $model = '';
                 $year = '';
                 if ($product['make'] != '' or $product['make'] != '' or $product['make'] != '') {
                     if ($product['make'] != '') {
                         $make = "make=" . MakeURLSafe($product['make']) . $symbol;
                     }
                     if ($product['model'] != '') {
                         $model = "model=" . MakeURLSafe($product['model']);
                     }
                     if ($product['year'] != '') {
                         $year = "year=" . $product['year'] . $symbol;
                     }
                     $GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']) . $symbol . "refer=true" . $symbol . $year . $make . $model;
                 } else {
                     $GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']);
                 }
             }
             $GLOBALS['ProductAvailability'] = isc_html_escape($product['data']['prodavailability']);
             $GLOBALS['ItemId'] = (int) $product['data']['productid'];
             $GLOBALS['VariationId'] = (int) $product['variation_id'];
             $GLOBALS['ProductQuantity'] = (int) $product['quantity'];
             //blessen
             $GLOBALS['prodretailprice'] = CurrencyConvertFormatPrice($product['data']['prodretailprice']);
             if ($product['data']['prodretailprice'] > $product['data']['prodcalculatedprice']) {
                 $_SESSION['you_save'] += ($product['data']['prodretailprice'] - $product['data']['prodcalculatedprice']) * $product['quantity'];
             }
             //$GLOBALS['saveprice'] =  CurrencyConvertFormatPrice($product['data']['prodretailprice'] - $product['data']['prodcalculatedprice']);
             //blessen
             // Should we show thumbnails in the cart?
             if (GetConfig('ShowThumbsInCart')) {
                 $GLOBALS['ProductImage'] = $this->ImageThumb($product['data']['imagefile'], ProdLink($product['data']['prodname']));
             }
             $GLOBALS['UpdateCartQtyJs'] = "Cart.UpdateQuantity(this.options[this.selectedIndex].value);";
             $GLOBALS['HideCartProductFields'] = 'display:none;';
             $GLOBALS['CartProductFields'] = '';
             $this->GetProductFieldDetails($product['product_fields'], $k);
             $GLOBALS['EventDate'] = '';
             if (isset($product['event_date'])) {
                 $GLOBALS['EventDate'] = '<div style="font-style: italic; font-size:10px; color:gray">(' . $product['event_name'] . ': ' . isc_date('M jS Y', $product['event_date']) . ')</div>';
             }
             // Can this product be wrapped?
             $GLOBALS['GiftWrappingName'] = '';
             $GLOBALS['HideGiftWrappingAdd'] = '';
             $GLOBALS['HideGiftWrappingEdit'] = 'display: none';
             $GLOBALS['HideGiftWrappingPrice'] = 'display: none';
             $GLOBALS['GiftWrappingPrice'] = '';
             $GLOBALS['GiftMessagePreview'] = '';
             $GLOBALS['HideGiftMessagePreview'] = 'display: none';
             $GLOBALS['HideWrappingOptions'] = 'display: none';
             if ($product['data']['prodtype'] == PT_PHYSICAL && $product['data']['prodwrapoptions'] != -1 && $publicWrappingOptions == true) {
                 $GLOBALS['HideWrappingOptions'] = '';
                 if (isset($product['wrapping'])) {
                     $GLOBALS['GiftWrappingName'] = isc_html_escape($product['wrapping']['wrapname']);
                     $GLOBALS['HideGiftWrappingAdd'] = 'display: none';
                     $GLOBALS['HideGiftWrappingEdit'] = '';
                     $GLOBALS['HideGiftWrappingPrice'] = '';
                     $wrappingAdjustment += $product['wrapping']['wrapprice'] * $product['quantity'];
                     $GLOBALS['GiftWrappingPrice'] = CurrencyConvertFormatPrice($product['wrapping']['wrapprice']);
                     if (isset($product['wrapping']['wrapmessage'])) {
                         if (isc_strlen($product['wrapping']['wrapmessage']) > 30) {
                             $product['wrapping']['wrapmessage'] = substr($product['wrapping']['wrapmessage'], 0, 27) . '...';
                         }
                         $GLOBALS['GiftMessagePreview'] = isc_html_escape($product['wrapping']['wrapmessage']);
                         if ($product['wrapping']['wrapmessage']) {
                             $GLOBALS['HideGiftMessagePreview'] = '';
                         }
                     }
                 }
             }
             $subtotalPrice = 0;
             if (isset($product['discount_price'])) {
                 $subtotalPrice = $product['discount_price'];
             } else {
                 $subtotalPrice = $product['product_price'];
             }
             $GLOBALS['ShowOnSaleImage'] = '';
             if (isset($product['discount_price']) && $product['discount_price'] != $product['original_price'] && GetConfig('ShowOnSale')) {
                 $GLOBALS['ProductPrice'] = sprintf("<s class='CartStrike'>%s</s> %s", CurrencyConvertFormatPrice($product['original_price']), CurrencyConvertFormatPrice($subtotalPrice));
                 if (isset($product['discount']) && isset($product['couponcode'])) {
                     $GLOBALS['ShowOnSaleImage'] = "Coupon Applied";
                 } else {
                     $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                 }
             } else {
                 $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($subtotalPrice);
             }
             // Add if by NI_20100830_Jack
             $GLOBALS['CGC_ShowOnSaleImage'] = '';
             if (count($product['appliedcgc'])) {
                 //$GLOBALS['ProductTotal'] = sprintf("<s class='CartStrike'>%s</s> %s", CurrencyConvertFormatPrice(($subtotalPrice * $product['quantity'])), CurrencyConvertFormatPrice(($subtotalPrice * $product['quantity'])));
                 $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($subtotalPrice * $product['quantity']);
                 $GLOBALS['CGC_ShowOnSaleImage'] = "CGC Applied";
             } else {
                 $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($subtotalPrice * $product['quantity']);
             }
             $itemTotal += $subtotalPrice * $product['quantity'];
             // If we're using a cart quantity drop down, load that
             if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
                 $GLOBALS["Quantity" . $product['quantity']] = "selected=\"selected\"";
                 if (isset($GLOBALS["Quantity0"])) {
                     $GLOBALS['QtyOptionZero'] = "<option " . $GLOBALS["Quantity0"] . " value='0'>0</option>";
                 } else {
                     $GLOBALS['QtyOptionZero'] = "<option value='0'>0</option>";
                 }
                 // Fixes products being displayed with '0' quantity when the quantity is greater than 30 (hard coded limit in snippet)
                 if ($product['quantity'] > 30) {
                     $GLOBALS["QtyOptionSelected"] = "<option " . $GLOBALS["Quantity" . $product['quantity']] . " value='" . $product['quantity'] . "'>" . $product['quantity'] . "</option>";
                 }
                 $GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect");
             } else {
                 $GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText");
             }
             // Is this product a variation?
             $GLOBALS['ProductOptions'] = '';
             if (isset($product['options']) && !empty($product['options'])) {
                 $GLOBALS['ProductOptions'] .= "<br /><small>(";
                 $comma = '';
                 foreach ($product['options'] as $name => $value) {
                     if (!trim($name) || !trim($value)) {
                         continue;
                     }
                     $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value);
                     $comma = ', ';
                 }
                 $GLOBALS['ProductOptions'] .= ")</small>";
             }
             //temp script to shortern the product name
             $pid = $product['data']['productid'];
             $pcode = $product['data']['prodcode'];
             $querytemp = "SELECT prodbrandid FROM  [|PREFIX|]products where productid = " . $pid . "  ";
             $resulttemp = $GLOBALS['ISC_CLASS_DB']->Query($querytemp);
             $brand = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp);
             if ($brand['prodbrandid'] == 37) {
                 $querytemp1 = "SELECT c.catname, c.catcombine FROM [|PREFIX|]categories \tc left join [|PREFIX|]categoryassociations ca on c.categoryid = ca.categoryid  left join [|PREFIX|]products p on ca.productid = p.productid where p.productid =  '" . $pid . "' ";
                 $resulttemp1 = $GLOBALS['ISC_CLASS_DB']->Query($querytemp1);
                 $cat = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp1);
                 if ($cat['catcombine'] != "") {
                     $GLOBALS['ProductName'] = $cat['catcombine'] . " Part Number " . $pcode;
                 } else {
                     $GLOBALS['ProductName'] = $cat['catname'] . " Part Number " . $pcode;
                 }
             } else {
                 $GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']);
             }
             //temp script to shortern the product name
             //temp script to shortern the product name
             $GLOBALS['complementaryrow'] = '';
             $compitem = $product['compitem'];
             if ($compitem == 1) {
                 for ($y = 0; $y < count($product['complementary']); $y++) {
                     /* Added for to display the complementary product in the cart -- Baskaran */
                     $compproductid = $product['complementary'][$y]['comp_productid'];
                     $compmainproductid = $product['complementary'][$y]['comp_mainproductid'];
                     $mainproductid = $product['product_id'];
                     $GLOBALS['CompCartItemId'] = $y;
                     if ($mainproductid == $compmainproductid) {
                         $GLOBALS['CompProdName'] = $compprodname = isc_html_escape($product['complementary'][$y]['comp_product_name']);
                         $compsku = isc_html_escape($product['complementary'][$y]['comp_product_code']);
                         $compprice = $product['complementary'][$y]['comp_original_price'];
                         $GLOBALS['CompProductPrice'] = $comppriceformat = CurrencyConvertFormatPrice($product['complementary'][$y]['comp_original_price']);
                         $query = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT imagefile FROM [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' where p.productid = '{$compproductid}' AND p.prodvisible = '1' ");
                         $path = '';
                         if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($query)) {
                             $path = $row['imagefile'];
                         }
                         if ($path != '') {
                             //$GLOBALS['ProdImage'] = GetConfig('ShopPath')."/product_images/$path";
                             $GLOBALS['ProdImage'] = $this->ImageThumb($path);
                         } else {
                             $GLOBALS['ProdImage'] = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
                         }
                         //Added for complementary products - By Simha..
                         // If we're using a cart quantity drop down, load that
                         if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
                             $GLOBALS["CompQuantity" . $product['complementary'][$y]['quantity']] = "selected=\"selected\"";
                             if (isset($GLOBALS["Quantity0"])) {
                                 $GLOBALS['CompCartQtyOptionZero'] = "<option " . $GLOBALS["Quantity0"] . " value='0'>0</option>";
                             } else {
                                 $GLOBALS['CompCartQtyOptionZero'] = "<option value='0'>0</option>";
                             }
                             //alandy_2011-8-10 modify.comp limit.
                             if (isset($_SESSION['complementary'][$product['complementary'][$y]['comp_productid']]['limit']) && $_SESSION['complementary'][$product['complementary'][$y]['comp_productid']]['limit'] > 0) {
                                 $limitcomp = $_SESSION['complementary'][$product['complementary'][$y]['comp_productid']]['limit'];
                             } else {
                                 $limitcomp = 10;
                             }
                             $str = "";
                             for ($i = 1; $i <= $limitcomp; $i++) {
                                 if ($i == $product['complementary'][$y]['quantity']) {
                                     $str .= "<option selected value=" . $i . ">" . $i . "</option>";
                                 } else {
                                     $str .= "<option value=" . $i . ">" . $i . "</option>";
                                 }
                             }
                             $GLOBALS['Compoption'] = $str;
                             // Fixes products being displayed with '0' quantity when the quantity is greater than 30 (hard coded limit in snippet)
                             if ($product['quantity'] > 10) {
                                 //Needed to be changed for the complementary
                                 $GLOBALS["CompCartQtyOptionSelected"] = "<option " . $GLOBALS["Quantity" . $product['complementary'][$y]['quantity']] . " value='" . $product['complementary'][$y]['quantity'] . "'>" . $product['complementary'][$y]['quantity'] . "</option>";
                             }
                             $GLOBALS['CompCartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompItemQtySelect");
                         } else {
                             $GLOBALS['CompCartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompItemQtyText");
                         }
                         //Added for complementary products Ends - By Simha..
                         $GLOBALS['CompProductTotal'] = CurrencyConvertFormatPrice($compprice * $product['complementary'][$y]['quantity']);
                         $GLOBALS['complementaryrow'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ComplementaryItem");
                         $comptotal += $compprice * $product['complementary'][$y]['quantity'];
                     }
                     $GLOBALS["CompQuantity" . $product['complementary'][$y]['quantity']] = "";
                 }
             }
             /* Code Ends */
             //$GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']);
             //blessen
             $withoutdollar = str_replace("\$", "", $GLOBALS['prodretailprice']);
             if (intval($withoutdollar) <= 0) {
                 $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
             } else {
                 $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem1");
             }
             //blessen
             // original $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
         }
         $GLOBALS["Quantity" . $product['quantity']] = "";
     }
     if ($wrappingAdjustment > 0) {
         $GLOBALS['GiftWrappingTotal'] = CurrencyConvertFormatPrice($wrappingAdjustment);
     } else {
         $GLOBALS['HideGiftWrappingTotal'] = 'display: none';
     }
     $GLOBALS['HideAdjustedTotal'] = "none";
     $GLOBALS['AdjustedCartSubTotal'] = $GLOBALS['CartSubTotal'] - $GLOBALS['CartSubTotalDiscount'];
     $itemTotal += $comptotal;
     # Baskaran
     $GLOBALS['CartItemTotal'] = CurrencyConvertFormatPrice($itemTotal);
     $GLOBALS['SNIPPETS']['Coupons'] = '';
     $coupons = $GLOBALS['ISC_CLASS_CART']->api->GetAppliedCouponCodes();
     if (count($coupons)) {
         foreach ($coupons as $coupon) {
             $GLOBALS['CouponId'] = $coupon['couponid'];
             $GLOBALS['CouponCode'] = $coupon['couponcode'];
             //zcs=>append && show coupon-name
             $query = "\n\t\t\t\t\t\tSELECT couponname\n\t\t\t\t\t\tFROM [|PREFIX|]coupons\n\t\t\t\t\t\tWHERE couponid='" . $coupon['couponid'] . "'\n\t\t\t\t\t";
             $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
             $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
             $GLOBALS['CouponName'] = $row['couponname'];
             //<=zcs
             // percent coupon
             if ($coupon['coupontype'] == 1) {
                 $discount = $coupon['discount'] . "%";
             } else {
                 $discount = CurrencyConvertFormatPrice($coupon['discount']);
             }
             $GLOBALS['CouponDiscount'] = $discount;
             $GLOBALS['SNIPPETS']['Coupons'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartCoupon");
         }
     }
     $GLOBALS['SNIPPETS']['CompanyGiftCertificates'] = '';
     // Add by NI_20100826_Jack
     // Has the customer chosen one or more Company gift certificates to apply to this order? We need to show them
     if (isset($_SESSION['CART']['COMPANYGIFTCERTIFICATES']) && is_array($_SESSION['CART']['COMPANYGIFTCERTIFICATES']) && count($_SESSION['CART']['COMPANYGIFTCERTIFICATES'])) {
         $certificates = $_SESSION['CART']['COMPANYGIFTCERTIFICATES'];
         $hash_producttotal = array();
         foreach ($product_array as $k => $product) {
             $hash_producttotal[$k] = (isset($product['discount_price']) ? $product['discount_price'] : $product['product_price']) * $product['quantity'];
             if (isset($product['complementary'])) {
                 foreach ($product['complementary'] as $compitemtmp) {
                     $hash_producttotal[$k] += $compitemtmp['comp_original_price'] * $compitemtmp['quantity'];
                 }
             }
         }
         uasort($certificates, "CompanyGiftCertificateSort");
         foreach ($certificates as $certificate) {
             $cgcproductused = 0;
             $cgcproductremain = $certificate['cgcbalance'];
             foreach ($product_array as $k => $product) {
                 if ($product['appliedcgc'][$certificate['cgcid']]) {
                     if ($cgcproductremain > $hash_producttotal[$k]) {
                         $cgcproductused += $hash_producttotal[$k];
                         $cgcproductremain -= $hash_producttotal[$k];
                         $hash_producttotal[$k] = 0;
                     } else {
                         $cgcproductused += $cgcproductremain;
                         $hash_producttotal[$k] = $hash_producttotal[$k] - $cgcproductremain;
                         $cgcproductremain = 0;
                         break;
                     }
                 }
             }
             $GLOBALS['CompanyGiftCertificateCode'] = isc_html_escape($certificate['cgccode']);
             $GLOBALS['CompanyGiftCertificateId'] = $certificate['cgcid'];
             $GLOBALS['CompanyGiftCertificateBalance'] = $certificate['cgcbalance'];
             //					if ($GLOBALS['CompanyGiftCertificateBalance'] > $GLOBALS['AdjustedCartSubTotal']) {
             //						$GLOBALS['CompanyGiftCertificateRemaining'] = $certificate['cgcbalance'] - $GLOBALS['AdjustedCartSubTotal'];
             //						$GLOBALS['CompanyCertificateAmountUsed'] = $certificate['cgcbalance'] - $GLOBALS['CompanyGiftCertificateRemaining'];
             //					} else {
             //						$GLOBALS['CompanyCertificateAmountUsed'] = $certificate['cgcbalance'];
             //						$GLOBALS['CompanyGiftCertificateRemaining'] = 0;
             //					}
             $GLOBALS['CompanyGiftCertificateRemaining'] = $cgcproductremain;
             $GLOBALS['CompanyCertificateAmountUsed'] = $cgcproductused;
             // Subtract this amount from the adjusted total
             //$GLOBALS['AdjustedCartSubTotal'] -= $GLOBALS['CompanyGiftCertificateBalance'];
             $GLOBALS['AdjustedCartSubTotal'] -= $cgcproductused;
             if ($GLOBALS['AdjustedCartSubTotal'] <= 0) {
                 $GLOBALS['AdjustedCartSubTotal'] = 0;
             }
             $GLOBALS['CompanyGiftCertificateBalance'] = CurrencyConvertFormatPrice($GLOBALS['CompanyGiftCertificateBalance']);
             $GLOBALS['CompanyGiftCertificateRemaining'] = CurrencyConvertFormatPrice($GLOBALS['CompanyGiftCertificateRemaining']);
             $GLOBALS['CompanyCertificateAmountUsed'] = CurrencyConvertFormatPrice($GLOBALS['CompanyCertificateAmountUsed']);
             $GLOBALS['SNIPPETS']['CompanyGiftCertificates'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartCompanyGiftCertificate");
         }
         if ($GLOBALS['SNIPPETS']['CompanyGiftCertificates']) {
             $GLOBALS['HideAdjustedTotal'] = '';
             if ($GLOBALS['AdjustedCartSubTotal'] == 0) {
                 $GLOBALS['HidePanels'][] = "SideCompanyGiftCertificateCodeBox";
             }
         }
     }
     $GLOBALS['SNIPPETS']['GiftCertificates'] = '';
     // Has the customer chosen one or more gift certificates to apply to this order? We need to show them
     if (isset($_SESSION['CART']['GIFTCERTIFICATES']) && is_array($_SESSION['CART']['GIFTCERTIFICATES'])) {
         $certificates = $_SESSION['CART']['GIFTCERTIFICATES'];
         uasort($certificates, "GiftCertificateSort");
         foreach ($certificates as $certificate) {
             $GLOBALS['GiftCertificateCode'] = isc_html_escape($certificate['giftcertcode']);
             $GLOBALS['GiftCertificateId'] = $certificate['giftcertid'];
             $GLOBALS['GiftCertificateBalance'] = $certificate['giftcertbalance'];
             if ($GLOBALS['GiftCertificateBalance'] > $GLOBALS['AdjustedCartSubTotal']) {
                 $GLOBALS['GiftCertificateRemaining'] = $certificate['giftcertbalance'] - $GLOBALS['AdjustedCartSubTotal'];
                 $GLOBALS['CertificateAmountUsed'] = $certificate['giftcertbalance'] - $GLOBALS['GiftCertificateRemaining'];
             } else {
                 $GLOBALS['CertificateAmountUsed'] = $certificate['giftcertbalance'];
                 $GLOBALS['GiftCertificateRemaining'] = 0;
             }
             // Subtract this amount from the adjusted total
             $GLOBALS['AdjustedCartSubTotal'] -= $GLOBALS['GiftCertificateBalance'];
             if ($GLOBALS['AdjustedCartSubTotal'] <= 0) {
                 $GLOBALS['AdjustedCartSubTotal'] = 0;
             }
             $GLOBALS['GiftCertificateBalance'] = CurrencyConvertFormatPrice($GLOBALS['GiftCertificateBalance']);
             $GLOBALS['GiftCertificateRemaining'] = CurrencyConvertFormatPrice($GLOBALS['GiftCertificateRemaining']);
             $GLOBALS['CertificateAmountUsed'] = CurrencyConvertFormatPrice($GLOBALS['CertificateAmountUsed']);
             $GLOBALS['SNIPPETS']['GiftCertificates'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartGiftCertificate");
         }
         if ($GLOBALS['SNIPPETS']['GiftCertificates']) {
             $GLOBALS['HideAdjustedTotal'] = '';
             if ($GLOBALS['AdjustedCartSubTotal'] == 0) {
                 $GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
             }
         }
     }
     if ($GLOBALS['AdjustedCartSubTotal'] != $GLOBALS['CartSubTotal']) {
         $GLOBALS['HideAdjustedTotal'] = "";
         $GLOBALS['AdjustedCartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['AdjustedCartSubTotal']);
     }
     //            $GLOBALS['CartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['CartSubTotal']);
     $GLOBALS['CartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['CartSubTotal'] + $comptotal);
     # To add the subtotal in the cart -- Baskaran
     $GLOBALS['HideCartSavedTotalText'] = "display";
     $GLOBALS['CartSaveTotal'] = CurrencyConvertFormatPrice($_SESSION['you_save']);
     //blessen
     if ($_SESSION['you_save'] <= 0) {
         $GLOBALS['HideCartSavedTotalText'] = "none";
     }
     if (!gzte11(ISC_LARGEPRINT)) {
         $GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
         // Add by 20100826_Jack
         $GLOBALS['HidePanels'][] = "SideCompanyGiftCertificateCodeBox";
     }
     // Are there any products in the cart?
     if ($GLOBALS['ISC_CLASS_CART']->api->GetNumProductsInCart() == 0) {
         $GLOBALS['HideShoppingCartGrid'] = "none";
     } else {
         $GLOBALS['HideShoppingCartEmptyMessage'] = "none";
     }
 }
示例#14
0
 public function GetYmmsForMiddleInPage()
 {
     $ymmtype = strtolower(MakeURLNormal(isset($_GET['ymmtype']) ? $_GET['ymmtype'] : ""));
     $year = strtolower(MakeURLNormal(isset($_GET['year']) ? $_GET['year'] : ""));
     $make = strtolower(MakeURLNormal(isset($_GET['make']) ? $_GET['make'] : ""));
     $model = strtolower(MakeURLNormal(isset($_GET['model']) ? $_GET['model'] : ""));
     $productId = isset($_GET['productId']) ? (int) $_GET['productId'] : 0;
     $isProductDetail = isset($_GET['isProductDetail']) ? (int) $_GET['isProductDetail'] : 0;
     $output = "";
     $array_str = $impvaritions = array();
     if ($productId) {
         $impvaritions = ISC_PRODUCT::GetImpVariationForYMM($productId, $ymmtype, $year, $make, $model);
     }
     foreach (array('make', 'model', 'year') as $column) {
         $array_str[$column] .= "<option value='' selected>--select {$column}--</option>";
         $ymms_array = $this->getResultArray($column, $year, $make, $model);
         if ($column == 'model' and empty($ymms_array)) {
             $ymms_array = $this->getResultArray($column, "", $make, $model);
         }
         //alandy_2012-2-16 add.unique model.
         if ($column == 'model' && !empty($ymms_array)) {
             $ymms_array = array_unique(array_map('strtoupper', $ymms_array));
         }
         foreach ($ymms_array as $value) {
             $selected = "";
             if (${$column} == strtolower($value)) {
                 $selected = "selected";
             }
             if (!empty($impvaritions) && !ISC_PRODUCT::CheckYMMUseVariation($value, $impvaritions, $column)) {
                 continue;
             }
             $array_str[$column] .= "<option value='" . MakeURLSafe(strtolower($value)) . "' {$selected}>{$value}</option>";
         }
         // KATE CHANGE: 2/29/2012
         //alandy_2012-2-20 add redirct option.
         if ($isProductDetail == 1) {
             $array_str[$column] .= "<option value=1>My " . ucwords($column) . " Not Showing Here</option>";
         }
     }
     if ($ymmtype == "make") {
         $output = $array_str['model'] . '~' . $array_str['year'];
     } elseif ($ymmtype == "year") {
         $output = $array_str['make'] . '~' . $array_str['model'];
     } elseif ($ymmtype == "model") {
         $output = $array_str['year'];
     } else {
     }
     return $output;
 }
示例#15
0
 $field = array();
 $query2 = "select qn.qid,qn.column_name  from isc_qualifier_associations qa join isc_qualifier_names qn  on qn.qid  = qa.qualifierid where categoryid = " . $categoryid . " ";
 $result2 = mysql_query($query2);
 while ($row2 = mysql_fetch_array($result2)) {
     if ($row2['column_name'] != "") {
         $pqvqlist .= "iv." . $row2['column_name'] . ",";
         $header .= ucfirst($row2['column_name']) . ",";
         $field[$row2['qid']] = $row2['column_name'];
     }
 }
 $header = "Start Year,End Year,Make,Model,Submodel, SKU,Price,Brand , Series , Category , Subcategory , Product URL ," . $header . " Bedsize Generalname, Cabsize Generalname \n";
 $query = " select p.prodname , iv.prodstartyear,iv.prodendyear,iv.prodmake,iv.prodmodel,iv.prodsubmodel," . $pqvqlist . " iv.bedsize_generalname, iv.cabsize_generalname,b.brandname,\niv.prodcode,pf.prodfinalprice,b.brandname , c.catname ,bs.seriesname\nfrom isc_products p \nleft join isc_product_finalprice pf on pf.productid = p.productid \nleft join isc_brands b on p.prodbrandid = b.brandid\nleft join isc_brand_series bs on bs.brandid = b.brandid\nleft join isc_categoryassociations ca on ca.productid = p.productid \nleft join isc_categories c on ca.categoryid = c.categoryid \nleft join isc_import_variations iv on iv.productid = p.productid \nwhere  " . $brandquery . " c.categoryid IN ({$subids})";
 $result = mysql_query($query);
 while ($row = mysql_fetch_array($result)) {
     $data .= $row['prodstartyear'] . "," . $row['prodendyear'] . "," . $row['prodmake'] . "," . $row['prodmodel'] . "," . $row['prodsubmodel'] . ",";
     $data .= $row['prodcode'] . "," . $row['prodfinalprice'] . "," . $row['brandname'] . "," . $row['seriesname'] . "," . $parentname . "," . $row['catname'] . " , " . $theurltype . MakeURLSafe($row['prodname']) . ".html, ";
     foreach ($field as $k => $v) {
         $query2 = "select displayname  from isc_qualifier_associations  where categoryid = " . $categoryid . " and qualifierid =  " . $k;
         $result2 = mysql_query($query2);
         $row2 = mysql_fetch_array($result2);
         $displayname = $row2['displayname'];
         if ($displayname == "" and $catparentid != 0) {
             $query2 = "select displayname  from isc_qualifier_associations  where categoryid = " . $catparentid . " and qualifierid =  " . $k;
             $result2 = mysql_query($query2);
             $row2 = mysql_fetch_array($result2);
             $displayname = $row2['displayname'];
         }
         if ($displayname == "") {
             $displayname = substr($row[$v], 0, 2) . strtolower(substr($row[$v], 2));
         }
         $data .= $displayname . ",";
 private function _CommitCustomProducts($ItemID = 0)
 {
     $itemdesc = '';
     if (isset($_POST["wysiwyg"])) {
         $itemdesc = ISC_ADMIN_PRODUCT::FormatWYSIWYGHTML($_POST['wysiwyg']);
     }
     $visiturl = GetConfig('ShopPath') . '/';
     if (isset($_POST["categorybox"]) && $_POST["categorybox"] != 0) {
         $visiturl .= MakeURLSafe(strtolower($_POST["categoryname"])) . '/';
     } else {
         $_POST["categoryname"] = '';
     }
     if (isset($_POST["subcategorybox"]) && $_POST["subcategorybox"] != 0) {
         $visiturl .= 'subcategory/' . MakeURLSafe(strtolower($_POST["subcategoryname"])) . '/';
     } else {
         $_POST["subcategoryname"] = '';
     }
     if (isset($_POST["brandbox"]) && $_POST["brandbox"] != 0) {
         $visiturl .= 'brand/' . MakeURLSafe(strtolower($_POST["brandname"])) . '/';
     } else {
         $_POST["brandname"] = '';
     }
     if (isset($_POST["seriesbox"]) && $_POST["seriesbox"] != 0) {
         $visiturl .= 'series/' . MakeURLSafe(strtolower($_POST["seriesname"])) . '/';
     } else {
         $_POST["seriesname"] = '';
     }
     if (isset($_POST['ISSelectReplacement_productResults']) && is_array($_POST['ISSelectReplacement_productResults'])) {
         if (count($_POST['ISSelectReplacement_productResults']) > 0) {
             $productIds = implode(',', $_POST['ISSelectReplacement_productResults']);
         } else {
             $productIds = '-1';
         }
     } else {
         $productIds = '0';
     }
     $enabled = $_POST["enabled"] == 'on' ? true : false;
     $customItem = array('pageid' => (int) $_POST['pid'], 'itemtitle' => $_POST['itemTitle'], 'productids' => $productIds, 'description' => $itemdesc, 'enabled' => $enabled, 'contentid' => $_POST['contentId'], 'visiturl' => $visiturl, 'catename' => $_POST["categoryname"], 'subcatename' => $_POST["subcategoryname"], 'brandname' => $_POST["brandname"], 'seriesname' => $_POST["seriesname"], 'categoryid' => $_POST["categorybox"], 'subcategoryid' => $_POST["subcategorybox"], 'brandid' => $_POST["brandbox"], 'seriesid' => $_POST["seriesbox"]);
     if ($ItemID == 0) {
         $ItemID = $this->createCustomProducts($customItem);
         if ($ItemID) {
             $GLOBALS['NewComtentPageId'] = $ItemID;
         }
     } else {
         $this->updateCustomProducts($ItemID, $customItem);
     }
     return true;
 }
示例#17
0
 private function ManageBannersGrid(&$numBanners)
 {
     $GLOBALS['BannerGrid'] = '';
     $GLOBALS['Nav'] = '';
     $searchURL = '';
     if (isset($_GET['searchQuery'])) {
         $query = $_GET['searchQuery'];
         $GLOBALS['Query'] = isc_html_escape($query);
         $searchURL .= '&amp;searchQuery=' . urlencode($query);
     } else {
         $query = "";
         $GLOBALS['Query'] = "";
     }
     if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
         $sortOrder = 'desc';
     } else {
         $sortOrder = "asc";
     }
     $sortLinks = array("Name" => "name", "Location" => "page", "Date" => "datecreated", "Status" => "status");
     if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
         $sortField = $_GET['sortField'];
         SaveDefaultSortField("ManageBanners", $_REQUEST['sortField'], $sortOrder);
     } else {
         list($sortField, $sortOrder) = GetDefaultSortField("ManageBanners", "name", $sortOrder);
     }
     if (isset($_GET['page'])) {
         $page = (int) $_GET['page'];
     } else {
         $page = 1;
     }
     $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
     $GLOBALS['SortURL'] = $sortURL;
     // Get the results for the query
     $bannerResult = $this->_GetBannerList($query, $sortField, $sortOrder, $numBanners);
     if (!$numBanners) {
         return '';
     }
     $GLOBALS['SearchQuery'] = isc_html_escape($query);
     $GLOBALS['SortField'] = $sortField;
     $GLOBALS['SortOrder'] = $sortOrder;
     BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewBanners&amp;" . $searchURL . "&amp;page=" . $page, $sortField, $sortOrder);
     $GLOBALS['NameSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=name&sortOrder=asc", $query);
     $GLOBALS['NameSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=name&sortOrder=desc", $query);
     $GLOBALS['LocationSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=page&sortOrder=asc", $query);
     $GLOBALS['LocationSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=page&sortOrder=desc", $query);
     $GLOBALS['DateSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=datecreated&sortOrder=asc", $query);
     $GLOBALS['DateSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=datecreated&sortOrder=desc", $query);
     $GLOBALS['StatusSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=status&sortOrder=asc", $query);
     $GLOBALS['StatusSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=status&sortOrder=desc", $query);
     while ($banner = $GLOBALS["ISC_CLASS_DB"]->Fetch($bannerResult)) {
         $GLOBALS['BannerId'] = (int) $banner['bannerid'];
         $GLOBALS['Name'] = isc_html_escape($banner['name']);
         $GLOBALS['Location'] = "";
         switch ($banner['page']) {
             case "entire_site":
                 $GLOBALS['Location'] = sprintf("<a target='_blank' href='../'>%s</a>", GetLang('BannerEntireSite'));
                 break;
             case "home_page":
                 $GLOBALS['Location'] = sprintf("<a target='_blank' href='../'>%s</a>", GetLang('BannerHomePage'));
                 break;
             case "category_page":
                 $GLOBALS['Location'] = sprintf("<a target='_blank' href='%s'>%s %s</a>", CatLink($banner['catorbrandid'], $banner["location_name"]), $banner['name'], GetLang('BannerCategory'));
                 break;
             case "brand_page":
                 $brand = $banner['location_name'];
                 if ($GLOBALS['EnableSEOUrls'] == 1) {
                     $link = sprintf("%s/%s/%s", $GLOBALS['ShopPathNormal'], BRAND_LINK_PART, MakeURLSafe($brand));
                 } else {
                     $link = sprintf("%s/brands.php?brand=%s", $GLOBALS['ShopPathNormal'], MakeURLSafe($brand));
                 }
                 $GLOBALS['Location'] = sprintf("<a target='_blank' href='%s'>%s %s</a>", $link, $banner["name"], GetLang('BannerBrand'));
                 break;
             case "search_page":
                 $GLOBALS['Location'] = sprintf("<a target='_blank' href='../search.php?mode=advanced'>%s</a>", GetLang('SearchResultsPage'));
                 break;
         }
         if ($banner['location'] == "top") {
             $GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerTopOfPage'));
         } else {
             $GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerBottomOfPage'));
         }
         $GLOBALS['Date'] = isc_date(GetConfig('ExportDateFormat'), $banner['datecreated']);
         if ($banner['status'] == 1) {
             $GLOBALS['Visible'] = sprintf("<a title='%s' href='index.php?ToDo=editBannerVisibility&amp;bannerId=%d&amp;visible=0'><img border='0' src='images/tick.gif'></a>", GetLang('ClickToHideBanner'), $banner['bannerid']);
         } else {
             $GLOBALS['Visible'] = sprintf("<a title='%s' href='index.php?ToDo=editBannerVisibility&amp;bannerId=%d&amp;visible=1'><img border='0' src='images/cross.gif'></a>", GetLang('ClickToShowBanner'), $banner['bannerid']);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("banner.manage.row");
         $GLOBALS['BannerGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("banners.manage.grid");
     return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
 }
示例#18
0
 /**
  * Generate the link to a product.
  *
  * @param string The name of the product to generate the link to.
  * @return string The generated link to the product.
  */
 function InsVideoLink($prod)
 {
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         return sprintf("%s/%s/%s.html", GetConfig('ShopPath'), INSTALLVIDEO_LINK_PART, MakeURLSafe($prod));
     } else {
         return sprintf("%s/installvideo.php?product_id=%s", GetConfig('ShopPath'), MakeURLSafe($prod));
     }
 }
示例#19
0
 function YMMSelectors($params)
 {
     if (isset($params['model']) && !isset($params['make'])) {
         unset($params['model']);
     }
     $GLOBALS['UniversalCat'] = isset($params['catuniversal']) ? $params['catuniversal'] : 0;
     $changeYMM = false;
     if (isset($_COOKIE["last_search_selection"]) && isset($_COOKIE["last_search_selection"]["changeymm"]) && $_COOKIE["last_search_selection"]["changeymm"] == 1) {
         $changeYMM = true;
     }
     $setYmm = false;
     if (isset($_COOKIE["last_search_selection"]) && isset($_COOKIE["last_search_selection"]["setymm"]) && $_COOKIE["last_search_selection"]["setymm"] == 1) {
         $setYmm = true;
     }
     if ($setYmm) {
         $changeYMM = false;
         $number_of_days = -1;
         $date_of_expiry = time() + 60 * 60 * 24 * $number_of_days;
         setcookie("last_search_selection[changeymm]", 0, $date_of_expiry, "/");
         setcookie("last_search_selection[setymm]", 0, $date_of_expiry, "/");
         $GLOBALS["HasSetYMM"] = true;
     }
     //
     //if($changeYMM ||(!isset($params['year']) && !isset($params['make']) && !isset($params['model']))){
     if (!isset($params['year']) && !isset($params['make']) && !isset($params['model'])) {
         $GLOBALS['YearOption'] = '<select name="searchyear" id="searchyear_left" onchange="getYmmOptions(\'year\',' . $GLOBALS['UniversalCat'] . ')">' . $this->getYMMOptions($params, 'year') . '</select>';
         $GLOBALS['MakeOption'] = '<select name="searchmake" id="searchmake_left" onchange="getYmmOptions(\'make\',' . $GLOBALS['UniversalCat'] . ')">' . $this->getYMMOptions($params, 'make') . '</select>';
         $GLOBALS['ModelOption'] = '<select name="searchmodel" id="searchmodel_left" onchange="getYmmOptions(\'model\',' . $GLOBALS['UniversalCat'] . ')">' . $this->getYMMOptions($params, 'model') . '</select>';
         $GLOBALS['YmmButtons'] = '<p id="fit">Guaranteed to Fit Your Vehicle!</p><input name="setvehicle" type="image" onclick="setLeftYMM()" value="Set Vehicle" src="/images/left-menu-tc/button-set-vehicle.gif" alt="Submit button" />';
         if (isset($GLOBALS['MyVehicleArea'])) {
             $GLOBALS['YmmButtons'] .= $GLOBALS['MyVehicleArea'];
         }
     } else {
         $GLOBALS['SelectedOption'] = isset($params['year']) ? $params['year'] : 'Select Year';
         if (isset($params['year'])) {
             $GLOBALS["HiddenControlId"] = "hidden_left_year";
             $GLOBALS["HiddenControlValue"] = isset($params['year']) ? MakeURLSafe(strtolower($params['year'])) : '';
             $GLOBALS['YearOption'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaYmmOption");
         } else {
             $GLOBALS['YearOption'] = '<select name="searchyear" id="searchyear_left" onchange="getYmmOptions(\'year\',' . $GLOBALS['UniversalCat'] . ')">' . $this->getYMMOptions($params, 'year') . '</select>';
         }
         $GLOBALS['SelectedOption'] = isset($params['make']) ? strtoupper($params['make']) : 'Select Make';
         if (isset($params['make'])) {
             $GLOBALS["HiddenControlId"] = "hidden_left_make";
             $GLOBALS["HiddenControlValue"] = isset($params['make']) ? MakeURLSafe(strtolower($params['make'])) : '';
             $GLOBALS['MakeOption'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaYmmOption");
         } else {
             $GLOBALS['MakeOption'] = '<select name="searchmake" id="searchmake_left" onchange="getYmmOptions(\'make\',' . $GLOBALS['UniversalCat'] . ')">' . $this->getYMMOptions($params, 'make') . '</select>';
         }
         $GLOBALS['SelectedOption'] = isset($params['model']) ? strtoupper($params['model']) : 'Select Model';
         if (isset($params['model'])) {
             $GLOBALS["HiddenControlId"] = "hidden_left_model";
             $GLOBALS["HiddenControlValue"] = isset($params['model']) ? MakeURLSafe(strtolower($params['model'])) : '';
             $GLOBALS['ModelOption'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaYmmOption");
         } else {
             $GLOBALS['ModelOption'] = '<select name="searchmodel" id="searchmodel_left" onchange="getYmmOptions(\'model\',' . $GLOBALS['UniversalCat'] . ')">' . $this->getYMMOptions($params, 'model') . '</select>';
         }
         $GLOBALS['YmmButtons'] = "<ul id='modifyvehicle'><li><a href='javascript:deleteMMYcookies()'>Clear My Vehicle</a></li></ul>";
         if (isset($GLOBALS['MyVehicleArea'])) {
             $GLOBALS['YmmButtons'] .= $GLOBALS['MyVehicleArea'];
         }
     }
 }
示例#20
0
 public function ManageTestingGrid(&$numMake)
 {
     // Show a list of news in a table
     $page = 0;
     $start = 0;
     $numMake = 0;
     $numPages = 0;
     $GLOBALS['TestingGrid'] = "";
     $GLOBALS['Nav'] = "";
     $max = 0;
     $searchURL = '';
     if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
         $sortOrder = 'desc';
     } else {
         $sortOrder = "asc";
     }
     $sortLinks = array("PageTitle" => "p.pagetitle", "PageType" => "p.pagetype");
     if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
         $sortField = $_GET['sortField'];
         SaveDefaultSortField("ManagePages", $_REQUEST['sortField'], $sortOrder);
     } else {
         list($sortField, $sortOrder) = GetDefaultSortField("ManagePages", "p.pageid", $sortOrder);
     }
     if (isset($_GET['page'])) {
         $page = (int) $_GET['page'];
     } else {
         $page = 1;
     }
     $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
     $GLOBALS['SortURL'] = $sortURL;
     if ($page == 1) {
         $start = 1;
     } else {
         $start = $page * ISC_TESTING_PER_PAGE - (ISC_TESTING_PER_PAGE - 1);
     }
     $start = $start - 1;
     // Get the results for the query
     $TestingResult = $this->_GetTestingList($start, $sortField, $sortOrder, $numMake);
     //, &$where
     $numPages = ceil($numMake / ISC_TESTING_PER_PAGE);
     // Workout the paging navigation
     if ($numMake > ISC_TESTING_PER_PAGE) {
         $GLOBALS['Nav'] = sprintf("(%s %d of %d) &nbsp;&nbsp;&nbsp;", GetLang('Page'), $page, $numPages);
         $GLOBALS['Nav'] .= BuildPagination($numMake, ISC_TESTING_PER_PAGE, $page, sprintf("index.php?ToDo=viewABTesting%s", $sortURL));
     } else {
         $GLOBALS['Nav'] = "";
     }
     $GLOBALS['SortField'] = $sortField;
     $GLOBALS['SortOrder'] = $sortOrder;
     BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewABTesting&amp;" . $searchURL . "&amp;page=" . $page, $sortField, $sortOrder);
     // Workout the maximum size of the array
     $max = $start + ISC_TESTING_PER_PAGE;
     if ($max > count($TestingResult)) {
         $max = count($TestingResult);
     }
     //            echo $numMake;exit;
     if ($numMake > 0) {
         while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($TestingResult)) {
             $GLOBALS['PageTitle'] = $row['pagetitle'];
             $GLOBALS['PageId'] = (int) $row['pageid'];
             $GLOBALS['Url'] = $GLOBALS['ShopPath'] . "/a-b-testing/" . MakeURLSafe(strtolower($row['pagename']));
             $type = '';
             if ($row['pagetype'] == '1') {
                 $type = "Static Page";
             } else {
                 if ($row['pagetype'] == '2') {
                     $type = "Category Page";
                 } else {
                     $type = "Sub Category Page";
                 }
             }
             $GLOBALS['PageType1'] = $type;
             $pageid = $row['pageid'];
             if ($row['pagestatus'] == 1) {
                 $GLOBALS['Status'] = "<a id='Active_" . $pageid . "' title='" . GetLang('ClickToNotUniversal') . "' href='index.php?ToDo=editactiveabtesting&amp;pid=" . $pageid . "&amp;active=0' onclick=\"quickToggle(this); return false;\"><img border='0' src='images/tick.gif' alt='Active'></a>";
             } else {
                 $GLOBALS['Status'] = "<a id='Active_" . $pageid . "' title='" . GetLang('ClickToUniversal') . "' href='index.php?ToDo=editactiveabtesting&amp;pid=" . $pageid . "&amp;active=1' onclick=\"quickToggle(this); return false;\"><img border='0' src='images/cross.gif' alt='InActive'></a>";
             }
             $GLOBALS['PreviewTestingLink'] = sprintf("<a title='%s' href='javascript:PreviewPage(%s)'>%s</a>", GetLang('PreviewPage'), $pageid, GetLang('Preview'));
             $GLOBALS['EditTestingLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editabtesting&amp;pid=%d'>%s</a>", GetLang('SweepstakesEdit'), $pageid, GetLang('Edit'));
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("abtesting.manage.row");
             $GLOBALS['TestingGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("abtesting.manage.grid");
         return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
 }
示例#21
0
 function GetQueryString($params)
 {
     $qry_string = $_SERVER['QUERY_STRING'];
     if (isset($_GET['page'])) {
         $page = "&page=" . $_GET['page'];
         $qry_string = str_ireplace($page, '', $qry_string);
     }
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         if (isset($_GET['search_key'])) {
             $qry_string = str_ireplace('&search_key=' . $_GET['search_key'], '', $qry_string);
         }
         if (isset($params['search_query']) && !strstr($qry_string, 'search_query=')) {
             $qry_string .= "search_query=" . MakeURLSafe($params['search_query']);
         }
         if (isset($params['make']) && !strstr($qry_string, 'make=')) {
             $qry_string .= "&make=" . MakeURLSafe($params['make']);
         }
         if (isset($params['model']) && !strstr($qry_string, 'model=')) {
             $qry_string .= "&model=" . MakeURLSafe($params['model']);
         }
         if (isset($params['year']) && !strstr($qry_string, 'year=')) {
             $qry_string .= "&year=" . MakeURLSafe($params['year']);
         }
         if (isset($params['make']) && !strstr($qry_string, 'make=')) {
             $qry_string .= "&make=" . MakeURLSafe($params['make']);
         }
         if (isset($params['model_flag']) && !strstr($qry_string, 'model_flag=')) {
             $qry_string .= "&model_flag=" . MakeURLSafe($params['model_flag']);
         }
         if (isset($params['submodel']) && !strstr($qry_string, 'submodel=')) {
             $qry_string .= "&submodel=" . MakeURLSafe($params['submodel']);
         }
     }
     return $qry_string;
 }
示例#22
0
 function getYMMOptions($params, $ymm_type)
 {
     switch ($ymm_type) {
         case 'year':
             $options = "<option value=''>--select year--</option>";
             $filter_array = array();
             //$ymm_qry = "select group_concat(v.prodstartyear separator '~') as prodstartyear , group_concat(v.prodendyear separator '~') as prodendyear from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
             $ymm_qry = " select min(v.prodstartyear) as prodstartyear , max(v.prodendyear)  as prodendyear from isc_products p LEFT JOIN isc_import_variations AS v ON v.productid = p.productid where p.prodvisible='1' and v.prodstartyear is not null and v.prodstartyear !='' and v.prodstartyear !='all'  and v.prodendyear is not null and v.prodendyear !='' and v.prodendyear !='all'  ";
             if (isset($params['make']) && $GLOBALS['UniversalCat'] == 0) {
                 $ymm_qry .= " and prodmake = '" . $params['make'] . "' ";
             }
             if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1) && $GLOBALS['UniversalCat'] == 0) {
                 $ymm_qry .= " and prodmodel = '" . $params['model'] . "' ";
             }
             //$ymm_qry .= " group by p.productid ";
             $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
             if ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
                 if (empty($ymm_row["prodstartyear"]) || !isnumeric($ymm_row["prodstartyear"])) {
                     $startyear = 1950;
                 }
                 if (empty($ymm_row["prodendyear"]) || !isnumeric($ymm_row["prodendyear"])) {
                     $endyear = date('Y');
                 }
                 $startyear = $ymm_row["prodstartyear"];
                 $endyear = $ymm_row["prodendyear"];
                 //2011-2-3 Ronnie add,year range 1900~2050
                 $YMMMinYear = 1900;
                 $YMMMaxYear = 2050;
                 if ($startyear < $YMMMinYear) {
                     $startyear = $YMMMinYear;
                 }
                 if ($startyear > $YMMMaxYear) {
                     $startyear = $YMMMaxYear;
                 }
                 if ($endyear < $YMMMinYear) {
                     $endyear = $YMMMinYear;
                 }
                 if ($endyear > $YMMMaxYear) {
                     $endyear = $YMMMaxYear;
                 }
                 //$endyear=$YMMMaxYear;
                 for ($i = $startyear; $i <= $endyear; $i++) {
                     if (!in_array($i, $filter_array)) {
                         $filter_array[] = $i;
                     }
                 }
                 /*$grp_startyear = explode("~",$ymm_row['prodstartyear']);
                 					$grp_endyear = explode("~",$ymm_row['prodendyear']);
                 					for($g=0;$g<count($grp_startyear);$g++)
                 					{
                 						$prod_start_year = $grp_startyear[$g];
                 						$prod_end_year = $grp_endyear[$g];
                 
                 						if(is_numeric($prod_start_year) && is_numeric($prod_end_year))
                 						{
                 							$prod_year_diff = $prod_end_year - $prod_start_year;
                 							for($i=0;$i<=$prod_year_diff;$i++)
                 							{
                 								$actual_year = $prod_start_year + $i;
                 								if(in_array($actual_year,$filter_array)) {
                 									$count_filter_array[$actual_year]++;
                 								}  else {
                 									$filter_array[] = $actual_year;
                 									$count_filter_array[$actual_year] = 1;
                 								}
                 							}
                 						}
                 					}*/
             }
             rsort($filter_array);
             foreach ($filter_array as $key => $value) {
                 $selected = "";
                 if (isset($params['year']) && strcasecmp($params['year'], $value) == 0) {
                     $selected = " selected";
                 }
                 $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>";
             }
             break;
         case 'make':
             $filter_array = array();
             $GLOBALS['ISC_YMMS'] = GetClass('ISC_YMMS');
             $result = $GLOBALS['ISC_YMMS']->getResultArray("make", "", "", "");
             $options = "<option value=''>--select make--</option>";
             //$ymm_qry = "select group_concat(DISTINCT v.prodmake separator '~') as prodmake from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
             //$ymm_qry = "select DISTINCT v.prodmake  as prodmake from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
             //$ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
             //while($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res))
             //{
             /*$filters = explode('~',$ymm_row['prodmake']);
             		for($j=0;$j<count($filters);$j++) 
             	    {
             			$filter_value = $filters[$j]; 
             			if(strtoupper($filter_value) != "NON-SPEC VEHICLE" && strtolower($filter_value) != "all" && $filter_value != "")
             			{
             				if(in_array($filter_value,$filter_array))   {
             					$count_filter_array[$filter_value]++;
             				} else {
             					$filter_array[] = $filter_value;
             					$count_filter_array[$filter_value] = 1;
             				}
             			}
             	    }*/
             //if(strtoupper($ymm_row['prodmake']) != "NON-SPEC VEHICLE" && strtolower($ymm_row['prodmake']) != "all" && $ymm_row['prodmake'] != "")
             //{
             //	$filter_array[] = $ymm_row['prodmake'];
             //}
             //}
             foreach ($result as $key => $value) {
                 if (strtoupper($value) != "NON-SPEC VEHICLE" && strtolower($value) != "all" && $value != "") {
                     $filter_array[] = $value;
                 }
             }
             sort($filter_array);
             $all_makes = array('CHEVROLET', 'GMC', 'FORD', 'DODGE', 'TOYOTA', 'NISSAN', 'HONDA', 'JEEP', 'HYUNDAI', 'CHRYSLER', 'INFINITI', 'LEXUS');
             //$temp_arr =  array_diff($filter_array,$all_makes);	// commented as client told to include the above makes in other list also
             $temp_arr = $filter_array;
             foreach ($all_makes as $key => $value) {
                 $selected = "";
                 if (isset($params['make']) && strcasecmp($params['make'], $value) == 0) {
                     $selected = " selected";
                 }
                 $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>";
             }
             $options .= "<option value=''>------------</option>";
             foreach ($temp_arr as $key => $value) {
                 $selected = "";
                 if (isset($params['make']) && strcasecmp($params['make'], $value) == 0) {
                     $selected = " selected";
                 }
                 $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>";
             }
             break;
         case 'model':
             $options = "<option value=''>--select model--</option>";
             if (isset($params['make'])) {
                 $filter_array = array();
                 $ymm_qry = "select distinct prodmodel from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
                 if (isset($params['make'])) {
                     $ymm_qry .= " and prodmake = '" . $params['make'] . "' ";
                 }
                 if (isset($params['year']) && $GLOBALS['UniversalCat'] == 0) {
                     $ymm_qry .= " and " . $params['year'] . " between prodstartyear and prodendyear ";
                 }
                 //$ymm_qry .= " group by p.productid ";
                 $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
                 while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
                     if (!empty($ymm_row['prodmodel']) && $ymm_row['prodmodel'] != '~') {
                         $filters = explode('~', $ymm_row['prodmodel']);
                         for ($j = 0; $j < count($filters); $j++) {
                             $filter_value = ucwords(strtolower($filters[$j]));
                             if (strtolower($filter_value) != "all") {
                                 if (in_array($filter_value, $filter_array)) {
                                 } else {
                                     $filter_array[] = $filter_value;
                                 }
                             }
                         }
                     }
                 }
                 sort($filter_array);
                 foreach ($filter_array as $key => $value) {
                     $selected = "";
                     if (isset($params['model']) && strcasecmp($params['model'], $value) == 0) {
                         $selected = " selected";
                     }
                     $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>";
                 }
             }
             break;
     }
     return $options;
 }
示例#23
0
 /**
  * @desc Create Category links
  * @params Rootcatname
  */
 function LeftCatLink($mmy_link, $property, $RootCatName)
 {
     $NewLink = '';
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $NewLink = sprintf("%s%s/%s/%s", GetConfig('ShopPath'), $mmy_link, $property, MakeURLSafe(strtolower($RootCatName)));
     } else {
         $NewLink = sprintf("%s/search.php?search_query=%s&%s=%s", GetConfig('ShopPath'), $mmy_link, $property, MakeURLSafe($RootCatName));
     }
     return $NewLink;
 }
示例#24
0
 private function CheckProductAttribute($productid = 0)
 {
     //first compare cookie YMM WITH product YMM.
     $data = array();
     $tmp = array();
     $catuniversal = 0;
     $query_string = "";
     $search_string = "";
     $search_prefix = $GLOBALS['ShopPathNormal'] . '/';
     $year = "";
     $make = "";
     $model = "";
     $product_string = " productid = " . $productid;
     $url = $_SERVER['REQUEST_URI'];
     $url = ltrim($url, '/');
     $url_arr = explode("/", $url);
     $catname_link = $GLOBALS['ShopPathNormal'];
     $data['showApplication'] = false;
     //fetch product attribute.
     $result = $this->get_product_attribute($productid);
     //fetch product catgory name.
     $catname = $this->getCategoryNameByProductid($productid);
     $categorySearchLink = $this->getCategorySearchLinkByProductid($productid);
     if ($catname) {
         $data['categoryname'] = $catname;
         $data['catname'] = MakeURLSafe($catname);
         $catname_link .= '/' . $data['catname'];
         //$data['catname_link'] = $GLOBALS['ShopPathNormal'].'/'.$data['catname'];
     }
     if ($categorySearchLink) {
         //join category search.ex:categoryname/subcategory/subcategoryname
         $search_prefix .= $categorySearchLink;
     }
     $data['cartURL'] = NewCartLink($productid, 1);
     $data['productid'] = $productid;
     $data['popup'] = '';
     //Firstly,fetch this product attibute.
     if (!empty($result)) {
         $data['prodname'] = $result['prodname'];
         $data['brandname'] = $result['brandname'];
         $data['seriesname'] = $result['seriesname'];
         $search_string .= "/brand/" . MakeURLSafe($result['brandname']);
         $search_string .= "/series/" . MakeURLSafe($result['seriesname']);
     } else {
         $data['prodname'] = '';
         $data['brandname'] = '';
         $data['seriesname'] = '';
     }
     //search prefix.
     if (!empty($search_string)) {
         $search_prefix .= $search_string;
     }
     $data['search_prefix'] = $search_prefix;
     //fetch cookie year.
     if (isset($_COOKIE['last_search_selection']['year'])) {
         $year = $_COOKIE['last_search_selection']['year'];
         if ($year != 'ALL' && (int) $year > 1950) {
             $query_string .= " and prodstartyear <= '" . $year . "' and prodendyear >= '" . $year . "'";
             $search_string .= "/year/" . $year;
             $catname_link .= "/year/" . $year;
         }
     }
     //fetch cookie make.
     if (isset($_COOKIE['last_search_selection']['make'])) {
         $make = $_COOKIE['last_search_selection']['make'];
         if ($make != 'NON-SPEC VEHICLE' && !empty($make)) {
             $query_string .= " and prodmake = '" . $make . "'";
             $search_string .= "/make/" . $make;
             $catname_link .= "/make/" . $make;
         }
     }
     //fetch cookie model.
     if (isset($_COOKIE['last_search_selection']['model'])) {
         $model = $_COOKIE['last_search_selection']['model'];
         if ($model != 'ALL' && !empty($model)) {
             $query_string .= " and prodmodel = '" . $model . "'";
             $search_string .= "/model/" . $model;
             $catname_link .= "/model/" . $model;
         }
     }
     if ($year && $make && $model) {
         $data['detailimg'] = 1;
     }
     $data['catname_link'] = $catname_link;
     if (!$year != 'ALL' && (int) ($year > 1950)) {
         $data['year'] = $year;
     }
     if ($make != 'NON-SPEC VEHICLE' && !empty($make)) {
         $data['make'] = $make;
     }
     if ($model != 'ALL' && !empty($model)) {
         $data['model'] = $model;
     }
     //return ymm selecter.
     $impv = $this->get_product_importVariation($productid);
     if (!empty($impv)) {
         foreach ($impv as $row) {
             if ($row['prodstartyear'] > 0) {
                 $tmp['prodstartyear'][] = $row['prodstartyear'];
             }
             if ($row['prodendyear'] > 0) {
                 $tmp['prodendyear'][] = $row['prodendyear'];
             }
             if ($row['prodmake'] != 'ALL' && !empty($row['prodmake'])) {
                 $tmp['prodmake'][] = $row['prodmake'];
             }
             if ($row['prodmodel'] != 'ALL' && !empty($row['prodmodel'])) {
                 $tmp['prodmodel'][] = $row['prodmodel'];
             }
             //catuniversial.
             if ($row['prodstartyear'] == 'All' || $row['prodendyear'] == 'All' || $row['prodmake'] == 'NON-SPEC VEHICLE' || $row['prodmodel'] == 'All') {
                 $catuniversal = 1;
                 break;
             }
         }
         if ($catuniversal == 0) {
             //alandy_2012-3-6 modify.
             if (isset($tmp['prodstartyear']) && !empty($tmp['prodstartyear'])) {
                 $tmp['prodstartyear'] = min(array_unique($tmp['prodstartyear']));
             } else {
                 $tmp['prodstartyear'] = 0;
             }
             if (isset($tmp['prodendyear']) && !empty($tmp['prodendyear'])) {
                 $tmp['prodendyear'] = max(array_unique($tmp['prodendyear']));
             } else {
                 $tmp['prodendyear'] = 0;
             }
             //auto select model by year+make.
             //2012-3-19 add.
             if (!empty($year) && !empty($make)) {
                 $where = "prodstartyear <='" . $year . "' and prodendyear >='" . $year . "' and prodmake='" . $make . "' ";
                 $ymm = $this->get_product_importVariation($productid, $where);
                 if (!empty($ymm)) {
                     unset($tmp['prodmodel']);
                     foreach ($ymm as $row) {
                         $tmp['prodmodel'][] = $row['prodmodel'];
                     }
                 }
             }
             $tmp['prodmake'] = array_unique($tmp['prodmake']);
             $tmp['prodmodel'] = array_unique($tmp['prodmodel']);
             sort($tmp['prodmake']);
             sort($tmp['prodmodel']);
             $data['year_option'][0] = "<option value=''>--select year--</option>";
             for ($i = $tmp['prodendyear']; $i >= $tmp['prodstartyear']; $i--) {
                 $selected = "";
                 if ($i == $year) {
                     $selected = "selected";
                 }
                 $data['year_option'][] = "<option value='" . $i . "' " . $selected . ">" . $i . "</option>";
             }
             $data['make_option'][0] = "<option value=''>--select make--</option>";
             foreach ($tmp['prodmake'] as $val) {
                 $selected = "";
                 if (strtolower($val) == strtolower($make)) {
                     $selected = "selected";
                 }
                 $data['make_option'][] = "<option value='" . MakeURLSafe(strtolower($val)) . "' {$selected} >" . $val . "</option>";
             }
             $data['model_option'][0] = "<option value=''>--select model--</option>";
             foreach ($tmp['prodmodel'] as $val) {
                 $selected = "";
                 if (strtolower($val) == strtolower($model)) {
                     $selected = "selected";
                 }
                 $data['model_option'][] = "<option value='" . strtoupper($val) . "' " . $selected . ">" . $val . "</option>";
             }
         } else {
             //universial product.
             $data['year_option'][0] = "<option value=''>ALL</option>";
             $data['make_option'][0] = "<option value=''>NON-SPEC VEHICLE</option>";
             $data['model_option'][0] = "<option value=''>ALL</option>";
         }
     }
     $GLOBALS['ISC_CLASS_PRODUCT_PQVQ'] = GetClass('ISC_PRODUCT');
     $data['vehicle_research'] = $GLOBALS['ShopPathNormal'] . '/' . $search_string;
     // dada.wang 2012-03-14 where ymm is complete then show pq/vq
     if (isset($_COOKIE['last_search_selection']) && !empty($_COOKIE['last_search_selection']['make']) && !empty($_COOKIE['last_search_selection']['year']) && !empty($_COOKIE['last_search_selection']['model'])) {
         $data['pqvq'] = $GLOBALS['ISC_CLASS_PRODUCT_PQVQ']->GetProductPQVQHtml($productid, $query_string);
     } else {
         $data['pqvq'] = '';
     }
     $data['query_string'] = $query_string;
     //$product_string .= $query_string;
     $subcategory = isset($_SESSION['searchterms']['subcategory']) ? $_SESSION['searchterms']['subcategory'] : '';
     $model = $_COOKIE['last_search_selection']['model'];
     if ($catuniversal == 0) {
         //non catuniversial.
         $data['vehicle'] = trim($year . " " . ucwords($make) . " " . ucwords($model));
         if (!empty($product_string)) {
             //first,look if this product has variations
             $sql = "select id from [|PREFIX|]import_variations where " . $product_string;
             $query = $GLOBALS['ISC_CLASS_DB']->Query($sql);
             $result = $GLOBALS['ISC_CLASS_DB']->Fetch($query);
             if ($result && !empty($result)) {
                 //has variations.
                 //second,look productid+ymm is exist.
                 $product_string .= $query_string;
                 $sql = "select id from [|PREFIX|]import_variations where " . $product_string;
                 $query = $GLOBALS['ISC_CLASS_DB']->Query($sql);
                 $result = $GLOBALS['ISC_CLASS_DB']->Fetch($query);
                 if ($result && !empty($result)) {
                     if (empty($year) || empty($make) || empty($model)) {
                         //ymm not complete.
                         $data['popup'] = "2";
                     } else {
                         if (empty($qpvq_search)) {
                             $data['popup'] = '4';
                         }
                     }
                 } else {
                     //Scenario 1: not match product attribute.
                     $data['popup'] = "1";
                 }
             } else {
                 $data['ymmisselect'] = '1';
                 unset($data['popup']);
             }
         } else {
             //return '';
         }
     } else {
         $data['popup'] = '4';
         $data['vehicle'] = "This is a Universal Part and fits all vehicles.";
         //KATE CHANGE: "Universal Vehicle.";
     }
     //if product don't have ymm or  was catuniversal product,didn't show application dialog.
     if (!empty($impv) && $catuniversal == 0) {
         $data['showApplication'] = true;
     }
     return $data;
 }
示例#25
0
 function fn_getYMMOptions($params, $ymm_type)
 {
     switch ($ymm_type) {
         case 'year':
             $options = "<option value=''>--select year--</option>";
             $filter_array = array();
             $ymm_qry = "select group_concat(v.prodstartyear separator '~') as prodstartyear , group_concat(v.prodendyear separator '~') as prodendyear from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
             if (isset($params['make']) && $GLOBALS['UniversalCat'] == 0) {
                 $ymm_qry .= " and prodmake = '" . $params['make'] . "' ";
             }
             if (isset($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1) && $GLOBALS['UniversalCat'] == 0) {
                 $ymm_qry .= " and prodmodel = '" . $params['model'] . "' ";
             }
             $ymm_qry .= " group by p.productid ";
             $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
             while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
                 $grp_startyear = explode("~", $ymm_row['prodstartyear']);
                 $grp_endyear = explode("~", $ymm_row['prodendyear']);
                 for ($g = 0; $g < count($grp_startyear); $g++) {
                     $prod_start_year = $grp_startyear[$g];
                     $prod_end_year = $grp_endyear[$g];
                     if (is_numeric($prod_start_year) && is_numeric($prod_end_year)) {
                         $prod_year_diff = $prod_end_year - $prod_start_year;
                         for ($i = 0; $i <= $prod_year_diff; $i++) {
                             $actual_year = $prod_start_year + $i;
                             if (in_array($actual_year, $filter_array)) {
                                 $count_filter_array[$actual_year]++;
                             } else {
                                 $filter_array[] = $actual_year;
                                 $count_filter_array[$actual_year] = 1;
                             }
                         }
                     }
                 }
             }
             rsort($filter_array);
             foreach ($filter_array as $key => $value) {
                 $selected = "";
                 if (isset($params['year']) && strcasecmp($params['year'], $value) == 0) {
                     $selected = " selected";
                 }
                 $options .= "\n<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>\n";
             }
             break;
         case 'make':
             $options = "\n<option value=''>--select make--</option>\n";
             $filter_array = array();
             $ymm_qry = "select group_concat(DISTINCT v.prodmake separator '~') as prodmake from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
             $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
             while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
                 $filters = explode('~', $ymm_row['prodmake']);
                 for ($j = 0; $j < count($filters); $j++) {
                     $filter_value = $filters[$j];
                     if (strtoupper($filter_value) != "NON-SPEC VEHICLE" && strtolower($filter_value) != "all") {
                         if (in_array($filter_value, $filter_array)) {
                             $count_filter_array[$filter_value]++;
                         } else {
                             $filter_array[] = $filter_value;
                             $count_filter_array[$filter_value] = 1;
                         }
                     }
                 }
             }
             sort($filter_array);
             $all_makes = array('CHEVROLET', 'GMC', 'FORD', 'DODGE', 'TOYOTA', 'NISSAN', 'HONDA', 'JEEP', 'HYUNDAI', 'CHRYSLER', 'INFINITI', 'LEXUS');
             $temp_arr = array_diff($filter_array, $all_makes);
             foreach ($all_makes as $key => $value) {
                 $selected = "";
                 if (isset($params['make']) && strcasecmp($params['make'], $value) == 0) {
                     $selected = " selected";
                 }
                 $options .= "\n<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>\n";
             }
             foreach ($temp_arr as $key => $value) {
                 $selected = "";
                 if (isset($params['make']) && strcasecmp($params['make'], $value) == 0) {
                     $selected = " selected";
                 }
                 $options .= "\n<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>\n";
             }
             break;
         case 'model':
             $options = "\n<option value=''>--select model--</option>\n";
             if (isset($params['make'])) {
                 $filter_array = array();
                 $ymm_qry = "select distinct prodmodel from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
                 if (isset($params['make'])) {
                     $ymm_qry .= " and prodmake = '" . $params['make'] . "' ";
                 }
                 if (isset($params['year']) && $GLOBALS['UniversalCat'] == 0) {
                     $ymm_qry .= " and " . $params['year'] . " between prodstartyear and prodendyear ";
                 }
                 //$ymm_qry .= " group by p.productid ";
                 $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
                 while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
                     if (!empty($ymm_row['prodmodel']) && $ymm_row['prodmodel'] != '~') {
                         $filters = explode('~', $ymm_row['prodmodel']);
                         for ($j = 0; $j < count($filters); $j++) {
                             $filter_value = ucwords(strtolower($filters[$j]));
                             if (strtolower($filter_value) != "all") {
                                 if (in_array($filter_value, $filter_array)) {
                                 } else {
                                     $filter_array[] = $filter_value;
                                 }
                             }
                         }
                     }
                 }
                 sort($filter_array);
                 foreach ($filter_array as $key => $value) {
                     $selected = "";
                     if (isset($params['model']) && strcasecmp($params['model'], $value) == 0) {
                         $selected = " selected";
                     }
                     $options .= "\n<option value='" . MakeURLSafe(strtolower($value)) . "'{$selected}>{$value}</option>\n";
                 }
             }
             break;
     }
     return $options;
 }
 /**
  * Fetch a data grid of either the best or worst performing search keywords.
  */
 public function SearchStatsPerformanceGrid()
 {
     $GLOBALS['ResultsGrid'] = "";
     if (isset($_GET['From']) && isset($_GET['To'])) {
         $from_stamp = (int) $_GET['From'];
         $to_stamp = (int) $_GET['To'];
         // How many records per page?
         if (isset($_GET['Show'])) {
             $per_page = (int) $_GET['Show'];
         } else {
             $per_page = 20;
         }
         $GLOBALS['ResultsPerPage'] = $per_page;
         $GLOBALS["IsShowPerPage" . $per_page] = 'selected="selected"';
         // Should we limit the records returned?
         if (isset($_GET['Page'])) {
             $page = (int) $_GET['Page'];
         } else {
             $page = 1;
         }
         // Showing the worst performing (no clicks)?
         if (isc_strtolower($_REQUEST['ToDo']) == "searchstatsworstperforminggrid") {
             $clickwhere = 0;
             $pagingFunction = "ChangeWorstPerformingKeywordsPage";
             $GLOBALS['Anchor'] = "worstPerformingKeywordsAnchor";
             $GLOBALS['ChangePerPageFunction'] = "ChangeWorstPerformingKeywordsPerPage";
             $GLOBALS['SortGridFunction'] = "SortWorstPerformingKeywords";
             $NoResultsError = "StatsNoSearchesWithoutClickthru";
             $SortSave = "SearchStatsWorstPerforming";
         } else {
             $clickwhere = 1;
             $pagingFunction = "ChangeBestPerformingKeywordsPage";
             $GLOBALS['ChangePerPageFunction'] = "ChangeBestPerformingKeywordsPerPage";
             $GLOBALS['Anchor'] = "bestPerformingKeywordsAnchor";
             $GLOBALS['SortGridFunction'] = "SortBestPerformingKeywords";
             $NoResultsError = "StatsNoSearchesWithClickthru";
             $SortSave = "SearchStatsBestPerforming";
         }
         $GLOBALS['PerformingCurrentPage'] = $page;
         // Workout the start and end records
         $start = $per_page * $page - $per_page;
         $end = $start + ($per_page - 1);
         // How many searches with results are there in total?
         $query = sprintf("select distinct(searchtext), searchurl, UPPER(ifnull( prodmaker , '' )) AS maker, ifnull( prodyear , '' ) AS year, UPPER(ifnull( prodmodel , '' )) AS model, max(numresults) as numresults, count(searchid) as numsearches, max(searchdate) as lastperformed\n\t\t\t\t\t\t\t\tfrom [|PREFIX|]searches_extended\n\t\t\t\t\t\t\t\twhere numresults > 0\n\t\t\t\t\t\t\t\tand clickthru='%d'\n\t\t\t\t\t\t\t\tand searchdate >= '%d' and searchdate <= '%d'\n\t\t\t\t\t\t\t\tgroup by searchtext, searchurl, maker, year, model", $clickwhere, $from_stamp, $to_stamp);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         //$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
         $total_results = $GLOBALS['ISC_CLASS_DB']->CountResult($result);
         if ($total_results == 0) {
             $GLOBALS['HidePagingLinks'] = "display: none";
         }
         // Workout the paging
         $num_pages = ceil($total_results / $per_page);
         $paging = sprintf(GetLang('PageXOfX'), $page, $num_pages);
         $paging .= "&nbsp;&nbsp;&nbsp;&nbsp;";
         // Is there more than one page? If so show the &laquo; to jump back to page 1
         if ($num_pages > 1) {
             $paging .= sprintf("<a href='javascript:void(0)' onclick='%s(1)'>&laquo;</a> | ", $pagingFunction);
         } else {
             $paging .= "&laquo; | ";
         }
         // Are we on page 2 or above?
         if ($page > 1) {
             $paging .= sprintf("<a href='javascript:void(0)' onclick='%s(%d)'>%s</a> | ", $pagingFunction, $page - 1, GetLang('Prev'));
         } else {
             $paging .= sprintf("%s | ", GetLang('Prev'));
         }
         for ($i = 1; $i <= $num_pages; $i++) {
             // Only output paging -5 and +5 pages from the page we're on
             if ($i >= $page - 6 && $i <= $page + 5) {
                 if ($page == $i) {
                     $paging .= sprintf("<strong>%d</strong> | ", $i);
                 } else {
                     $paging .= sprintf("<a href='javascript:void(0)' onclick='%s(%d)'>%d</a> | ", $pagingFunction, $i, $i);
                 }
             }
         }
         // Are we on page 2 or above?
         if ($page < $num_pages) {
             $paging .= sprintf("<a href='javascript:void(0)' onclick='%s(%d)'>%s</a> | ", $pagingFunction, $page + 1, GetLang('Next'));
         } else {
             $paging .= sprintf("%s | ", GetLang('Next'));
         }
         // Is there more than one page? If so show the &raquo; to go to the last page
         if ($num_pages > 1) {
             $paging .= sprintf("<a href='javascript:void(0)' onclick='%s(%d)'>&raquo;</a> | ", $pagingFunction, $num_pages);
         } else {
             $paging .= "&raquo; | ";
         }
         $paging = rtrim($paging, ' |');
         $GLOBALS['Paging'] = $paging;
         if (isset($_GET['SortOrder']) && $_GET['SortOrder'] == "asc") {
             $sortOrder = 'asc';
         } else {
             $sortOrder = 'desc';
         }
         $sortFields = array('searchtext', 'numresults', 'numsearches', 'searchdate');
         if (isset($_GET['SortBy']) && in_array($_GET['SortBy'], $sortFields)) {
             $sortField = $_GET['SortBy'];
             SaveDefaultSortField($SortSave, $_REQUEST['SortBy'], $sortOrder);
         } else {
             list($sortField, $sortOrder) = GetDefaultSortField($SortSave, "numsearches", $sortOrder);
         }
         $sortLinks = array("SearchTerms" => "searchtext", "NumberOfSearches" => "numsearches", "NumberOfResults" => "numresults", "LastPerformed" => "searchdate");
         BuildAdminSortingLinks($sortLinks, "javascript:" . $GLOBALS['SortGridFunction'] . "('%%SORTFIELD%%', '%%SORTORDER%%');", $sortField, $sortOrder);
         // Should we set focus to the grid?
         if (isset($_GET['FromLink']) && $_GET['FromLink'] == "true") {
             $GLOBALS['JumpTo'] = sprintf("<script type=\"text/javascript\">document.location.href='#%s';</script>", $GLOBALS['Anchor']);
         }
         $query = sprintf("select distinct(searchtext), searchurl, UPPER(ifnull( prodmaker , '' )) AS maker, ifnull( prodyear , '' ) AS year, UPPER(ifnull( prodmodel , '' )) AS model, max(numresults) as numresults, count(searchid) as numsearches, max(searchdate) as lastperformed\n\t\t\t\t\t\t\t\tfrom [|PREFIX|]searches_extended\n\t\t\t\t\t\t\t\twhere numresults > 0\n\t\t\t\t\t\t\t\tand clickthru='%d'\n\t\t\t\t\t\t\t\tand searchdate >= '%d' and searchdate <= '%d'\n\t\t\t\t\t\t\t\tgroup by searchtext, searchurl, maker, year, model\n\t\t\t\t\t\t\t\torder by %s %s", $clickwhere, $from_stamp, $to_stamp, $sortField, $sortOrder);
         // Add the Limit
         $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, $per_page);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
             while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
                 $GLOBALS['ResultsGrid'] .= sprintf("\n\t\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t\t\t<td nowrap height=\"22\" class=\"" . $GLOBALS['SortedFieldSearchTermsClass'] . "\">\n\t\t\t\t\t\t\t\t%s<br /><a href=\"..%s\" target=\"_blank\">%s</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td align='left'>\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td align='left'>\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td align='left'>\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap align='right' class=\"" . $GLOBALS['SortedFieldNumberOfSearchesClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap align='right' class=\"" . $GLOBALS['SortedFieldNumberOfResultsClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap align='right' class=\"" . $GLOBALS['SortedFieldLastPerformedClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t", isc_html_escape($row['searchtext']), isset($row['searchurl']) && $row['searchurl'] !== '' ? $row['searchurl'] : "/search/" . MakeURLSafe($row['searchtext']) . (isset($row['year']) && $row['year'] != "" ? "/year/" . $row['year'] : '') . (isset($row['maker']) && $row['maker'] != "" ? "/make/" . MakeURLSafe($row['maker']) : '') . (isset($row['model']) && $row['model'] != "" ? "/model/" . MakeURLSafe($row['model']) : ''), isset($row['searchurl']) && $row['searchurl'] !== '' ? $GLOBALS["ShopPath"] . $row['searchurl'] : $GLOBALS["ShopPath"] . "/search/" . MakeURLSafe($row['searchtext']) . (isset($row['year']) && $row['year'] != "" ? "/year/" . $row['year'] : '') . (isset($row['maker']) && $row['maker'] != "" ? "/make/" . MakeURLSafe($row['maker']) : '') . (isset($row['model']) && $row['model'] != "" ? "/model/" . MakeURLSafe($row['model']) : ''), $row['year'], $row['maker'], $row['model'], number_format($row['numsearches']), number_format($row['numresults']), isc_date(GetConfig('DisplayDateFormat'), $row['lastperformed']));
             }
         } else {
             $GLOBALS['HideStatsRows'] = "none";
             $GLOBALS['ResultsGrid'] .= sprintf("\n\t\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t\t\t<td nowrap height=\"22\" colspan=\"1\">\n\t\t\t\t\t\t\t\t<em>%s</em>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t", GetLang($NoResultsError));
         }
         // NI cloud 2010-06-08 export search statistic to csv file
         if ($clickwhere == 1) {
             $GLOBALS['ResultsGrid'] .= '<br /><input type="button" value="Export to Microsoft Excel (CSV)" onclick=" window.open( \' ' . $GLOBALS["ShopPath"] . '/admin/index.php?ToDo=exsearchstats&FromDate=' . $from_stamp . '&ToDate=' . $to_stamp . '&Search_Type=SearchStatsBestPerformanceGrid \'); " />';
         } else {
             $GLOBALS['ResultsGrid'] .= '<br /><input type="button" value="Export to Microsoft Excel (CSV)" onclick=" window.open( \' ' . $GLOBALS["ShopPath"] . '/admin/index.php?ToDo=exsearchstats&FromDate=' . $from_stamp . '&ToDate=' . $to_stamp . '&Search_Type=SearchStatsWorstPerformanceGrid \'); " />';
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("stats.search.performancegrid");
         $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     }
 }
 public function ExportRows()
 {
     $where = $this->where;
     $allvendor = array();
     $query1 = "select vendorid , vendorname from [|PREFIX|]vendors  ";
     $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
     while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
         $allvendor[$row1['vendorid']] = $row1['vendorname'];
     }
     $allseries = array();
     $query1 = "select seriesid , seriesname from [|PREFIX|]brand_series   ";
     $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
     while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
         $allseries[$row1['seriesid']] = $row1['seriesname'];
     }
     $dummy = $this->CreateDummyRow($this->fields);
     $vendorid = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId();
     //$where = $_SESSION['mywhere'];
     $query = $this->GetQuery($this->ConstructFieldList(), $where, $vendorid);
     if ($vendorid) {
         if ($where) {
             $where .= " AND ";
         }
         $where .= "p.prodvendorid = '" . $vendorid . "'";
     }
     if ($where) {
         $where = " WHERE " . $where;
     }
     // mysql not holding more than 5000 records at time. so i made a split in a fetch query . blessen
     $query2 = "SELECT count(*) as count FROM [|PREFIX|]products  p LEFT JOIN [|PREFIX|]import_variations iv ON p.productid = iv.productid " . $_SESSION['searchjoin'] . "\t" . $where;
     $result2 = $GLOBALS['ISC_CLASS_DB']->Query($query2);
     $row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result2);
     $count = $row['count'];
     if ($count < 5000) {
         $pages = 0;
         $increment = 0;
         $last = $count;
     } else {
         $increment = 5000;
         $last = $count % $increment;
         $pages = intval($count / $increment);
     }
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $theurltype = GetConfig('ShopPath') . "/products/";
         $ext = ".html";
     } else {
         $theurltype = GetConfig('ShopPath') . "/products.php?product=";
         $ext = "";
     }
     for ($i = 0; $i <= $pages; $i++) {
         $SL = $i * $increment;
         if ($i == $pages) {
             $increment = $last;
         }
         //zcs=>alter: add (judgement) to determine whether use limit
         $new_query = $query;
         if ($count && $increment) {
             $new_query .= ' LIMIT ' . $SL . ' , ' . $increment . '';
         }
         //<=zcs
         $this->result = $GLOBALS['ISC_CLASS_DB']->Query($new_query);
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($this->result)) {
             // map the data from the db row to the dummy row
             $new_row = $this->MapRow($row, $dummy);
             // perform any custom work on the row and write it the export method
             $new_row = $this->HandleRow($new_row);
             if (isset($new_row['article_file']) and !empty($new_row['article_file'])) {
                 $pos2 = stripos($new_row['article_file'], "http://");
                 if ($pos2 === false) {
                     $new_row['article_file'] = GetConfig('ShopPath') . "/article_file/" . $new_row['article_file'];
                 }
             }
             $filename_temp = "";
             if (isset($new_row['ArticleFile'])) {
                 $query1 = "SELECT articlefile  ,isdownloaded , systemarticlefile FROM [|PREFIX|]article_files WHERE  articleprodid  = " . $new_row['ArticleFile'];
                 $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
                 while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
                     if ($row1['isdownloaded'] == 2) {
                         $filename_temp .= GetConfig('ShopPath') . "/" . $row1['systemarticlefile'] . ";";
                     } else {
                         $filename_temp .= $row1['articlefile'] . ";";
                     }
                 }
                 $new_row['ArticleFile'] = rtrim($filename_temp, ";");
             }
             $filename_temp = "";
             if (isset($new_row['InstructionFile'])) {
                 $query1 = "SELECT instructionfile  ,isdownloaded , systeminstructionfile FROM [|PREFIX|]instruction_files WHERE  instructionprodid  = " . $new_row['InstructionFile'];
                 $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
                 while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
                     if ($row1['isdownloaded'] == 2) {
                         $filename_temp .= GetConfig('ShopPath') . "/" . $row1['systeminstructionfile'] . ";";
                     } else {
                         $filename_temp .= $row1['instructionfile'] . ";";
                     }
                 }
                 $new_row['InstructionFile'] = rtrim($filename_temp, ";");
             }
             $new_row = $this->RemoveExtraFields($new_row);
             //blessen
             if (isset($new_row['productCategories'])) {
                 //zcs=add (judgement),To blessen:please don't make a component to that can't be shared!!!!
                 $subCat = $this->HandleCategories($new_row['productCategories']);
             }
             $strArr = array();
             foreach ($subCat as $val) {
                 array_push($strArr, $val);
             }
             if (isset($new_row['SeriesName'])) {
                 if (isset($allseries[$new_row['SeriesName']])) {
                     $new_row['SeriesName'] = $allseries[$new_row['SeriesName']];
                 }
                 if ($new_row['SeriesName'] == "0") {
                     $new_row['SeriesName'] = "";
                 }
             }
             if (isset($new_row['Vendor'])) {
                 $new_row['Vendor'] = $allvendor[$new_row['Vendor']];
             }
             $filename_temp = "";
             if (isset($new_row['ProductImages'])) {
                 $query1 = "SELECT imagefile  FROM [|PREFIX|]product_images   WHERE imageisthumb = 0 and imageprodid  = " . $new_row['ProductImages'];
                 $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
                 while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
                     $filename_temp .= GetConfig('ShopPath') . "/product_images/" . $row1['imagefile'] . ";";
                 }
                 $new_row['ProductImages'] = rtrim($filename_temp, ";");
             }
             $filename_temp = "";
             if (isset($new_row['InstallVideos'])) {
                 $query1 = "SELECT videofile  ,isdownloaded FROM [|PREFIX|]install_videos    WHERE  videoprodid  = " . $new_row['InstallVideos'];
                 $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
                 while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
                     if ($row1['isdownloaded'] == 1) {
                         $filename_temp .= GetConfig('ShopPath') . "/install_videos/" . $row1['videofile'] . ";";
                     } else {
                         $filename_temp .= $row1['videofile'] . ";";
                     }
                 }
                 $new_row['InstallVideos'] = rtrim($filename_temp, ";");
             }
             $filename_temp = "";
             if (isset($new_row['ProductVideos'])) {
                 $query1 = "SELECT videofile  ,isdownloaded FROM [|PREFIX|]product_videos   WHERE  videoprodid  = " . $new_row['ProductVideos'];
                 $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
                 while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
                     if ($row1['isdownloaded'] == 1) {
                         $filename_temp .= GetConfig('ShopPath') . "/product_videos/" . $row1['videofile'] . ";";
                     } else {
                         $filename_temp .= $row1['videofile'] . ";";
                     }
                 }
                 $new_row['ProductVideos'] = rtrim($filename_temp, ";");
             }
             $filename_temp = "";
             if (isset($new_row['AudioClips'])) {
                 $query1 = "SELECT audiofile  ,isdownloaded FROM [|PREFIX|]audio_clips    WHERE  audioprodid  = " . $new_row['AudioClips'];
                 $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
                 while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
                     if ($row1['isdownloaded'] == 1) {
                         $filename_temp .= GetConfig('ShopPath') . "/audio_clips/" . $row1['audiofile'] . ";";
                     } else {
                         $filename_temp .= $row1['audiofile'] . ";";
                     }
                 }
                 $new_row['AudioClips'] = rtrim($filename_temp, ";");
             }
             $filename_temp = "";
             if (isset($new_row['InstallImages'])) {
                 $query1 = "SELECT imagefile  FROM [|PREFIX|]install_images    WHERE imageisthumb = 0 and imageprodid  = " . $new_row['InstallImages'];
                 $result1 = $GLOBALS['ISC_CLASS_DB']->Query($query1);
                 while ($row1 = $GLOBALS['ISC_CLASS_DB']->Fetch($result1)) {
                     $filename_temp .= GetConfig('ShopPath') . "/install_images/" . $row1['imagefile'] . ";";
                 }
                 $new_row['InstallImages'] = rtrim($filename_temp, ";");
             }
             if (isset($new_row['ProductDetailPageURL'])) {
                 $new_row['ProductDetailPageURL'] = $theurltype . MakeURLSafe($new_row['productName']) . $ext;
             }
             $new_row['subcategory'] = $strArr[0]['productCategoryPath'];
             $new_row['category'] = $strArr[0]['productCategoryName'];
             unset($new_row['productCategories']);
             // format the data
             $this->FormatColumns($new_row);
             // write the row using the export method
             $this->exportmethod->WriteRow($new_row);
         }
         mysql_free_result($this->result);
     }
 }
示例#28
0
 public function _BuildBreadCrumbs()
 {
     /*
     	Build a list of one or more breadcrumb trails for this
     	product based on which categories it appears in
     */
     // Build the arrays that will contain the category names to build the trails
     $count = 0;
     $GLOBALS['BreadCrumbs'] = "";
     $GLOBALS['FindByCategory'] = "";
     $path = GetConfig('ShopPath');
     // First we need to fetch the parent lists of all of the categories
     $trailCategories = array();
     $crumbList = array();
     $query = sprintf("\n\t\t\t\tSELECT c.categoryid, c.catparentlist\n\t\t\t\tFROM [|PREFIX|]categoryassociations ca\n\t\t\t\tINNER JOIN [|PREFIX|]categories c ON (c.categoryid=ca.categoryid)\n\t\t\t\tWHERE ca.productid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($this->GetProductId()));
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         if ($row['catparentlist'] == '') {
             $row['catparentlist'] = $row['categoryid'];
         }
         $cats = explode(",", $row['catparentlist']);
         $trailCategories = array_merge($trailCategories, $cats);
         $crumbList[$row['categoryid']] = $row['catparentlist'];
     }
     $trailCategories = implode(",", array_unique($trailCategories));
     $categories = array();
     $catparentid = array();
     if ($trailCategories != '') {
         // Now load the names for the parent categories from the database
         $query = sprintf("SELECT categoryid, catparentid, catname FROM [|PREFIX|]categories WHERE categoryid IN (%s)", $trailCategories);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $categories[$row['categoryid']] = $row['catname'];
             $catparentid[$row['categoryid']] = $row['catparentid'];
         }
     }
     // Now we have all of the information we need to build the trails, lets actually build them
     foreach ($crumbList as $productcatid => $trail) {
         $GLOBALS['CatTrailLink'] = $GLOBALS['ShopPath'];
         $GLOBALS['CatTrailName'] = GetLang('Home');
         $GLOBALS['BreadcrumbItems'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItem");
         $GLOBALS['FindByCategoryItems'] = "";
         $cats = explode(",", $trail);
         $breadcrumbitems = "";
         $findbycategoryitems = "";
         $hasAccess = true;
         foreach ($cats as $categoryid) {
             if (!CustomerGroupHasAccessToCategory($categoryid)) {
                 /*
                 if customer doesn't have access to this category and this category is the category of the product,
                 dont print the trail, otherwise just exclude the category from the trail
                 */
                 if ($categoryid == $productcatid) {
                     $hasAccess = false;
                     break;
                 }
                 continue;
             }
             if (isset($categories[$categoryid])) {
                 $catname = $categories[$categoryid];
                 /* this below patch is for passing mmy variable in the breadcrumbs for returning to search page */
                 $mmy_links = "";
                 if ($GLOBALS['EnableSEOUrls'] == 0) {
                     if (isset($_REQUEST['make']) && $_REQUEST['make'] != '') {
                         $mmy_links .= "&make=" . urlencode($_REQUEST['make']);
                         $this->_prodymmselection['make'] = $_REQUEST['make'];
                     }
                     if (isset($_REQUEST['model']) && $_REQUEST['model'] != '') {
                         $mmy_links .= "&model=" . urlencode($_REQUEST['model']);
                         $this->_prodymmselection['model'] = $_REQUEST['model'];
                     }
                     /*if(isset($params['model_flag']) && $params['model_flag'] == 0)
                       $mmy_links .= "&model_flag=".$params['model_flag'];*/
                     if (isset($_REQUEST['year']) && $_REQUEST['year'] != '') {
                         $mmy_links .= "&year=" . $_REQUEST['year'];
                         $this->_prodymmselection['year'] = $_REQUEST['year'];
                     }
                 } else {
                     if (count($GLOBALS['PathInfo']) > 0) {
                         foreach ($GLOBALS['PathInfo'] as $key => $value) {
                             if (eregi('make=', $value)) {
                                 $mmy_links .= "/make/" . substr($value, strpos($value, '=') + 1);
                                 $this->_prodymmselection['make'] = substr($value, strpos($value, '=') + 1);
                             } else {
                                 if (eregi('model=', $value)) {
                                     $mmy_links .= "/model/" . substr($value, strpos($value, '=') + 1);
                                     $this->_prodymmselection['model'] = substr($value, strpos($value, '=') + 1);
                                 } else {
                                     if (eregi('year=', $value)) {
                                         $mmy_links .= "/year/" . substr($value, strpos($value, '=') + 1);
                                         $this->_prodymmselection['year'] = substr($value, strpos($value, '=') + 1);
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($catparentid[$categoryid] == 0) {
                     $GLOBALS['ISC_SRCH_CATG_ID'] = $categoryid;
                     // this is added to show the category when clicked on any product on homepage
                     $_SESSION['catg_name'] = $GLOBALS['ISC_SRCH_CATG_NAME'] = $catname;
                     // this is added to show the category when clicked on any product on homepage
                     $catparentname = MakeURLSafe(strtolower($catname));
                     if ($GLOBALS['EnableSEOUrls'] == 0) {
                         $GLOBALS['CatTrailLink'] = "{$path}/search.php?search_query=" . $catparentname . $mmy_links;
                     } else {
                         $GLOBALS['CatTrailLink'] = "{$path}/" . $catparentname . $mmy_links;
                     }
                 } else {
                     if ($GLOBALS['EnableSEOUrls'] == 0) {
                         $GLOBALS['CatTrailLink'] = "{$path}/search.php?search_query=" . $catparentname . "&sub_category=" . $categoryid . $mmy_links;
                     } else {
                         $GLOBALS['CatTrailLink'] = "{$path}/" . $catparentname . "/subcategory/" . MakeURLSafe(strtolower($catname)) . $mmy_links;
                     }
                 }
                 //$GLOBALS['CatTrailLink'] = CatLink($categoryid, $catname);
                 $GLOBALS['CatTrailName'] = isc_html_escape($catname);
                 $breadcrumbitems .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItem");
                 $findbycategoryitems .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductFindByCategoryItem");
             }
         }
         if ($hasAccess) {
             //temp script to shortern the product name
             $pid = $this->GetProductId();
             $querytemp = "SELECT prodbrandid FROM  [|PREFIX|]products where productid = " . $pid . "  ";
             $resulttemp = $GLOBALS['ISC_CLASS_DB']->Query($querytemp);
             $brand = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp);
             if ($brand['prodbrandid'] == 37) {
                 $query = "SELECT c.catname, c.catcombine FROM [|PREFIX|]categories \tc left join [|PREFIX|]categoryassociations ca on c.categoryid = ca.categoryid  left join [|PREFIX|]products p on ca.productid = p.productid where p.productid =  '" . $this->GetProductId() . "' ";
                 $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
                 $cat = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
                 if ($cat['catcombine'] != "") {
                     $GLOBALS['CatTrailName'] = $cat['catcombine'] . " Part Number " . isc_html_escape($this->GetSKU());
                 } else {
                     $GLOBALS['CatTrailName'] = $cat['catname'] . " Part Number " . isc_html_escape($this->GetSKU());
                 }
             } else {
                 $GLOBALS['CatTrailName'] = isc_html_escape($this->GetProductName());
             }
             //temp script to shorten the product name
             //$GLOBALS['CatTrailName'] = isc_html_escape($this->GetProductName());
             $GLOBALS['BreadcrumbItems'] .= $breadcrumbitems . $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("BreadcrumbItemCurrent");
             $GLOBALS['BreadCrumbs'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductBreadCrumb");
             $GLOBALS['FindByCategory'] .= $findbycategoryitems . $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductFindByCategory");
         }
     }
 }
示例#29
0
 /**
  * FormatLink
  * Format the special Link for sitemap
  *
  */
 public function FormatLink($mmy_link, $propertys)
 {
     $NewLink = '';
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $params = '';
         foreach ($propertys as $key => $val) {
             $params .= '/' . $key . '/' . MakeURLSafe(strtolower($val));
         }
         $NewLink = sprintf("%s/%s%s", GetConfig('ShopPath'), MakeURLSafe(strtolower($mmy_link)), $params);
     } else {
         $params = '';
         foreach ($propertys as $key => $val) {
             $params .= '&' . $key . '=' . MakeURLSafe(strtolower($val));
         }
         $NewLink = sprintf("%s/search.php?search_query=%s%s", GetConfig('ShopPath'), MakeURLSafe(strtolower($mmy_link)), $params);
     }
     return $NewLink;
 }
 /**
  * @desc Create YMM Options
  */
 function _GetYMMOptions()
 {
     $params = $_GET;
     $params['make'] = MakeURLNormal($params['make']);
     $params['model'] = MakeURLNormal($params['model']);
     $params['year'] = MakeURLNormal($params['year']);
     $options = "";
     $filter_array = array();
     if (isset($params['ymmtype']) && $params['ymmtype'] == 'make') {
         /* -------------------- Year Filter ----------------------- */
         $year_filter_array = array();
         $ymm_qry = "select group_concat(v.prodstartyear separator '~') as prodstartyear , group_concat(v.prodendyear separator '~') as prodendyear from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
         if (isset($params['make']) && $params['make'] != "" && $params['universal'] == 0) {
             $ymm_qry .= " and ( prodmake = '" . $params['make'] . "' OR prodmake = 'NON-SPEC VEHICLE' ) ";
         }
         if (isset($params['model']) && $params['model'] != "" && (!isset($params['model_flag']) || $params['model_flag'] == 1) && $params['universal'] == 0) {
             $ymm_qry .= " and ( prodmodel = '" . $params['model'] . "' OR prodmodel = 'all' ) ";
         }
         $ymm_qry .= " group by p.productid ";
         $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
         while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
             $grp_startyear = explode("~", $ymm_row['prodstartyear']);
             $grp_endyear = explode("~", $ymm_row['prodendyear']);
             for ($g = 0; $g < count($grp_startyear); $g++) {
                 $prod_start_year = $grp_startyear[$g];
                 $prod_end_year = $grp_endyear[$g];
                 if (is_numeric($prod_start_year) && is_numeric($prod_end_year)) {
                     $prod_year_diff = $prod_end_year - $prod_start_year;
                     for ($i = 0; $i <= $prod_year_diff; $i++) {
                         $actual_year = $prod_start_year + $i;
                         if (in_array($actual_year, $year_filter_array)) {
                             $count_filter_array[$actual_year]++;
                         } else {
                             $year_filter_array[] = $actual_year;
                             $count_filter_array[$actual_year] = 1;
                         }
                     }
                 }
             }
         }
         rsort($year_filter_array);
         if (isset($params['year']) && !in_array($params['year'], $year_filter_array)) {
             unset($params['year']);
         }
         /* -------------------- Year Filter ends ----------------------- */
         /* -------------------- Model Filter starts ----------------------- */
         $options .= "<option value=''>--select model--</option>";
         $ymm_qry = "select distinct prodmodel from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
         if (isset($params['make'])) {
             $ymm_qry .= " and ( prodmake = '" . $params['make'] . "' OR prodmake = 'NON-SPEC VEHICLE' ) ";
         }
         if (isset($params['year']) && $params['year'] != "" && $params['universal'] == 0) {
             $ymm_qry .= " and ( " . $params['year'] . " between prodstartyear and prodendyear OR prodstartyear = 'all' ) ";
         }
         //$ymm_qry .= " group by p.productid ";
         $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
         while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
             if (!empty($ymm_row['prodmodel']) && $ymm_row['prodmodel'] != '~') {
                 $filters = explode('~', $ymm_row['prodmodel']);
                 for ($j = 0; $j < count($filters); $j++) {
                     $filter_value = ucwords(strtolower($filters[$j]));
                     if (strtolower($filter_value) != "all") {
                         if (in_array($filter_value, $filter_array)) {
                         } else {
                             $filter_array[] = $filter_value;
                         }
                     }
                 }
             }
         }
         sort($filter_array);
         foreach ($filter_array as $key => $value) {
             $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'>{$value}</option>";
         }
         /* -------------------- Model Filter ends ----------------------- */
         /*if($params['year'] == '')
         	 {*/
         $options .= "~<option value=''>--select year--</option>";
         foreach ($year_filter_array as $key => $value) {
             $selected = "";
             if (isset($params['year']) && $params['year'] != '' && $params['year'] == $value) {
                 $selected = "selected";
             }
             $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "' {$selected}>{$value}</option>";
         }
         /*}*/
     } else {
         if (isset($params['ymmtype']) && $params['ymmtype'] == 'model') {
             if ($params['year'] == '') {
                 $filter_array = array();
                 $options .= "<option value=''>--select year--</option>";
                 $ymm_qry = "select group_concat(v.prodstartyear separator '~') as prodstartyear , group_concat(v.prodendyear separator '~') as prodendyear from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
                 if (isset($params['make']) && $params['make'] != "" && $params['universal'] == 0) {
                     $ymm_qry .= " and ( prodmake = '" . $params['make'] . "' OR prodmake = 'NON-SPEC VEHICLE' ) ";
                 }
                 if (isset($params['model']) && $params['model'] != "" && (!isset($params['model_flag']) || $params['model_flag'] == 1) && $params['universal'] == 0) {
                     $ymm_qry .= " and ( prodmodel = '" . $params['model'] . "' OR prodmodel = 'all' ) ";
                 }
                 $ymm_qry .= " group by p.productid ";
                 $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
                 while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
                     $grp_startyear = explode("~", $ymm_row['prodstartyear']);
                     $grp_endyear = explode("~", $ymm_row['prodendyear']);
                     for ($g = 0; $g < count($grp_startyear); $g++) {
                         $prod_start_year = $grp_startyear[$g];
                         $prod_end_year = $grp_endyear[$g];
                         if (is_numeric($prod_start_year) && is_numeric($prod_end_year)) {
                             $prod_year_diff = $prod_end_year - $prod_start_year;
                             for ($i = 0; $i <= $prod_year_diff; $i++) {
                                 $actual_year = $prod_start_year + $i;
                                 if (in_array($actual_year, $filter_array)) {
                                     $count_filter_array[$actual_year]++;
                                 } else {
                                     $filter_array[] = $actual_year;
                                     $count_filter_array[$actual_year] = 1;
                                 }
                             }
                         }
                     }
                 }
                 rsort($filter_array);
                 foreach ($filter_array as $key => $value) {
                     $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "'>{$value}</option>";
                 }
             }
         } else {
             if (isset($params['ymmtype']) && $params['ymmtype'] == 'year') {
                 if (isset($params['make'])) {
                     $options .= "<option value=''>--select model--</option>";
                     $ymm_qry = "select distinct prodmodel from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid where p.prodvisible='1' ";
                     if (isset($params['make'])) {
                         $ymm_qry .= " and ( prodmake = '" . $params['make'] . "' OR prodmake = 'NON-SPEC VEHICLE' ) ";
                     }
                     if (isset($params['year']) && $params['year'] != "" && $params['universal'] == 0) {
                         $ymm_qry .= " and ( " . $params['year'] . " between prodstartyear and prodendyear OR prodstartyear = 'all' ) ";
                     }
                     //$ymm_qry .= " group by p.productid ";
                     $ymm_res = $GLOBALS['ISC_CLASS_DB']->Query($ymm_qry);
                     while ($ymm_row = $GLOBALS['ISC_CLASS_DB']->Fetch($ymm_res)) {
                         if (!empty($ymm_row['prodmodel']) && $ymm_row['prodmodel'] != '~') {
                             $filters = explode('~', $ymm_row['prodmodel']);
                             for ($j = 0; $j < count($filters); $j++) {
                                 $filter_value = ucwords(strtolower($filters[$j]));
                                 if (strtolower($filter_value) != "all") {
                                     if (in_array($filter_value, $filter_array)) {
                                     } else {
                                         $filter_array[] = $filter_value;
                                     }
                                 }
                             }
                         }
                     }
                     sort($filter_array);
                     foreach ($filter_array as $key => $value) {
                         $selected = "";
                         if ($params['model'] != '' && strtolower($params['model']) == strtolower($value)) {
                             $selected = "selected";
                         }
                         $options .= "<option value='" . MakeURLSafe(strtolower($value)) . "' {$selected}>{$value}</option>";
                     }
                 }
             }
         }
     }
     return $options;
 }