private function _convertURL() { if ($GLOBALS['EnableSEOUrls'] == 1 && !empty($GLOBALS['PathInfo'])) { // checking seo is enabled and pathinfo is not empty as pathinfo will be set only when redirected to index page $count_pathinfo = count($GLOBALS['PathInfo']); // to get the count of the parameter, i.e if its odd, query string is applied. if ($count_pathinfo % 2 == 0) { $_REQUEST['search_query'] = MakeURLNormal($GLOBALS['PathInfo'][1]); for ($i = 0; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $_REQUEST[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } } else { $_REQUEST['search_query'] = MakeURLNormal($GLOBALS['PathInfo'][0]); for ($i = 1; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $_REQUEST[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } } } else { // this condition is entered when seo is disabled. also in redefine search this will be accessed. foreach ($_GET as $key => $value) { $_GET[$key] = MakeURLNormal($value); $_REQUEST[$key] = MakeURLNormal($value); } } }
/** * Load up the details for the page to be displayed. * * @param integer $PageId The ID number for the current page which should correspond to a row in the database * * @return void Doesn't return anything */ public function _SetPageData($PageId=0) { if((int)$PageId === 0) { if(isset($_REQUEST['pageid'])) { $_REQUEST['page_id'] = $_REQUEST['pageid']; } if(isset($_REQUEST['page_id'])) { $pageid = (int)$_REQUEST['page_id']; $query = sprintf("select * from [|PREFIX|]pages where pageid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($pageid)); } else if(isset($GLOBALS['PathInfo'][1])) { $page = preg_replace('#\.html$#i', '', $GLOBALS['PathInfo'][1]); $page = $GLOBALS['ISC_CLASS_DB']->Quote(MakeURLNormal($page)); $query = sprintf("select * from [|PREFIX|]pages where pagetitle='%s'", $page); } else { $GLOBALS['ISC_CLASS_404'] = GetClass('ISC_404'); $GLOBALS['ISC_CLASS_404']->HandlePage(); exit; } } else { $query = sprintf("select * from [|PREFIX|]pages where pageid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($PageId)); } $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result); if (!is_array($row) || empty($row)) { $GLOBALS['ISC_CLASS_404'] = GetClass('ISC_404'); $GLOBALS['ISC_CLASS_404']->HandlePage(); die(); } $row['pagecontent'] = $this->LoadPredefinedPages($row['pagecontent']); $GLOBALS['ActivePage'] = $row['pageid']; $this->_pagerow = &$row; $this->_pageid = $row['pageid']; $this->_pagetype = $row['pagetype']; $this->_pagetitle = $row['pagetitle']; $this->_pagefeed = $row['pagefeed']; $this->_pagedesc = $row['pagedesc']; $this->_pagesearchkeywords = $row['pagesearchkeywords']; $this->_pagecontent = $row['pagecontent']; $this->_pagekeywords = $row['pagekeywords']; $this->_pagemetatitle = $row['pagemetatitle']; $this->_pageparentlist = $row['pageparentlist']; $this->_page_enable_optimizer = $row['page_enable_optimizer']; $this->setLayoutFile($row['pagelayoutfile']); // If the customer is not logged in and this page is set to customers only, then show an error message $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); if($row['pagecustomersonly'] == 1 && !$GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId()) { $GLOBALS['ErrorMessage'] = sprintf(GetLang('ForbiddenToAccessPage'), $GLOBALS['ShopPathNormal']); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("error"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); exit; } }
public function HandlePage() { $action = ''; /*if ($GLOBALS['EnableSEOUrls'] == 1 and count($GLOBALS['PathInfo']) > 0 ){ if (isset ($GLOBALS['PathInfo'][1])) { $_REQUEST['action'] = $GLOBALS['PathInfo'][1]; } else { $_REQUEST['action'] = $GLOBALS['PathInfo'][0]; } }*/ if (count($GLOBALS['PathInfo']) > 0) { if (isset($GLOBALS['PathInfo'][1])) { $_REQUEST['action'] = $GLOBALS['PathInfo'][1]; } else { $_REQUEST['action'] = $GLOBALS['PathInfo'][0]; } } $params = array(); for ($i = 1; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $params[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } $number_of_days = 730; $date_of_expiry = time() + 60 * 60 * 24 * $number_of_days; if (isset($params['make'])) { setcookie("last_search_selection[make]", $params['make'], $date_of_expiry, "/"); if (isset($params['model'])) { setcookie("last_search_selection[model]", $params['model'], $date_of_expiry, "/"); } } if (isset($params['year'])) { setcookie("last_search_selection[year]", $params['year'], $date_of_expiry, "/"); } if (isset($_REQUEST['action'])) { $action = isc_strtolower($_REQUEST['action']); } switch ($action) { case "savesweepstakes": $this->SaveSweepstakes(); break; case "successsweepstakes": $this->successSweepstakes(); break; default: $this->ClearanceList(); } }
function _SetPageData() { if (isset($_REQUEST['newsid'])) { $newsid = (int) $_REQUEST['newsid']; } else { $newsid = preg_replace('#\\.html$#i', '', $GLOBALS['PathInfo'][1]); $newsid = $GLOBALS['ISC_CLASS_DB']->Quote(MakeURLNormal($newsid)); } $query = sprintf("select * from [|PREFIX|]news where newsid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($newsid)); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $this->_newsid = $row['newsid']; $this->_newstitle = $row['newstitle']; $this->_newscontent = $row['newscontent']; $this->_newsdate = $row['newsdate']; } }
public function _SetOfferData() { $productid = $_GET['product']; if ($productid == 0) { if (isset($_REQUEST['product'])) { $product = $_REQUEST['product']; } else { if (isset($GLOBALS['PathInfo'][1])) { $product = preg_replace('#\\.html$#i', '', $GLOBALS['PathInfo'][1]); } else { $product = ''; } } $product = $GLOBALS['ISC_CLASS_DB']->Quote(MakeURLNormal($product)); $productSQL = sprintf("prodname='%s'", $product); } else { $productSQL = sprintf("productid='%s'", (int) $productid); } // $query = "SELECT * FROM [|PREFIX|]products where $productSQL"; $query = "SELECT p.*, b.brandname FROM [|PREFIX|]products p LEFT JOIN [|PREFIX|]brands b ON ( b.brandid = p.prodbrandid ) WHERE {$productSQL}"; // echo "SELECT * FROM [|PREFIX|]products where $productSQL";exit; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $this->_product = $row; $this->_prodid = $row['productid']; $this->_prodbrand = $row['brandname']; $this->_partnumber = $row['prodcode']; $this->_prodtitle = $row['prodname']; // $this->_prodprice = $GLOBALS['ISC_CLASS_OFFER']->GetCalculatedPrice(); } $tplquery = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]coupon_settings where templateid = 1"); if ($tplrow = $GLOBALS['ISC_CLASS_DB']->Fetch($tplquery)) { $GLOBALS['OfferTitle'] = $tplrow['title_msg']; $GLOBALS['OfferHeader'] = $tplrow['header_msg']; $GLOBALS['OfferFooter'] = $tplrow['footer_msg']; $this->_emailids = $tplrow['emailids']; $this->_message = $tplrow['email_template']; } $GLOBALS['productid'] = $this->_prodid; $GLOBALS['prodbrand'] = $this->_prodbrand . "/" . $this->_partnumber; $GLOBALS['prodtitle'] = $this->_prodtitle; $GLOBALS['prodprice'] = $this->GetCalculatedPrice(); $GLOBALS['formatprice'] = strip_tags($this->GetCalculatedPrice()); $GLOBALS['states'] = $this->states(); }
/** * Show the page containing a web page set up by a particular vendor. */ public function ShowVendorPage() { if (isset($_REQUEST['pageid'])) { $pageWhere = " pageid='" . (int) $_REQUEST['pageid'] . "'"; } else { $page = preg_replace('#\\.html$#i', '', $GLOBALS['PathInfo'][2]); $page = MakeURLNormal($page); $pageWhere = " LOWER(pagetitle)='" . $GLOBALS['ISC_CLASS_DB']->Quote(isc_strtolower($page)) . "'"; } $query = "\n\t\t\tSELECT *\n\t\t\tFROM [|PREFIX|]pages\n\t\t\tWHERE " . $pageWhere . " AND pagevendorid='" . (int) $this->vendor['vendorid'] . "' AND pagestatus='1'\n\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $page = $GLOBALS['ISC_CLASS_DB']->Fetch($result); if (!isset($page['pageid'])) { $GLOBALS['ISC_CLASS_404'] = GetClass('ISC_404'); $GLOBALS['ISC_CLASS_404']->HandlePage(); exit; } // Otherwise show the page $GLOBALS['ISC_CLASS_PAGE'] = new ISC_PAGE($page['pageid'], false, $page); $GLOBALS['ISC_CLASS_PAGE']->HandlePage(); exit; }
<?php include dirname(__FILE__) . "/init.php"; $make = MakeURLNormal($_GET['make']); $model = MakeURLNormal($_GET['model']); $year = $_GET['year']; // echo $make.$model.$year; /*$make = "chevrolet"; $model = "c10 pickup"; $year = "1971"; */ $resultbed = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT DISTINCT bedsize FROM [|PREFIX|]product_mmy pm, [|PREFIX|]cabbed_table cb where pm.make = '" . $make . "' and pm.model = '" . $model . "' and pm.year = '" . $year . "' AND cb.ymm_id = pm.id"); $optionbed = '<select name="bedsize" id="bedsize" onclick=checkYMM()>'; $optionbed .= '<option value="">--Select bed size--</option>'; while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($resultbed)) { $bedsize = $row['bedsize']; $optionbed .= "<option value='{$bedsize}'>" . $bedsize . "</option>"; } $optionbed .= '</select>'; $resultcab = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT DISTINCT cabsize FROM [|PREFIX|]product_mmy pm, [|PREFIX|]cabbed_table cb where pm.make = '" . $make . "' and pm.model = '" . $model . "' and pm.year = '" . $year . "' AND cb.ymm_id = pm.id"); $optioncab = '<select name="cabsize" id="cabsize" onclick=checkYMM()>'; $optioncab .= '<option value="">--Select cab size--</option>'; while ($row1 = $GLOBALS["ISC_CLASS_DB"]->Fetch($resultcab)) { $cabsize = $row1['cabsize']; $optioncab .= "<option value='{$cabsize}'>" . $cabsize . "</option>"; } $optioncab .= '</select>'; echo $optionbed . '~' . $optioncab; exit;
function fn_saveYMMDetails($CustID) { $searchyear = $_REQUEST['searchyear']; $searchmake = MakeURLNormal($_REQUEST['searchmake']); $searchmodel = MakeURLNormal($_REQUEST['searchmodel']); $cabsize = $_REQUEST['cabsize']; $bedsize = $_REQUEST['bedsize']; $query = "SELECT * FROM [|PREFIX|]user_ymm WHERE \n\t\t\t\t\t\t\t\tuser_id='" . $CustID . "' AND \n\t\t\t\t\t\t\t\tyear='" . $searchyear . "' AND \n\t\t\t\t\t\t\t\tmake='" . $searchmake . "' AND \n\t\t\t\t\t\t\t\tmodel='" . $searchmodel . "' AND \n\t\t\t\t\t\t\t\tcab_size='" . $cabsize . "' AND \n\t\t\t\t\t\t\t\tbed_size='" . $bedsize . "'"; $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); $NumGroups = $GLOBALS["ISC_CLASS_DB"]->CountResult($result); if ($NumGroups > 0) { return false; } else { $query = "INSERT INTO [|PREFIX|]user_ymm(user_id,year,make,model,cab_size,bed_size) VALUES('{$CustID}','{$searchyear}','{$searchmake}','{$searchmodel}','{$cabsize}','" . $bedsize . "')"; $GLOBALS["ISC_CLASS_DB"]->Query($query); return true; } }
public function SetPanelSettings() { $prodid = $GLOBALS['ProductId']; # When there is no complementary item, the tab wount be shown. $make = ''; $model = ''; $year = ''; if ($GLOBALS['EnableSEOUrls'] == 0) { if (isset($_REQUEST['make']) && $_REQUEST['make'] != '') { $make = MakeURLNormal($_REQUEST['make']); } if (isset($_REQUEST['model']) && $_REQUEST['model'] != '') { $model = MakeURLNormal($_REQUEST['model']); } if (isset($_REQUEST['year']) && $_REQUEST['year'] != '') { $year = $_REQUEST['year']; } } else { if (count($GLOBALS['PathInfo']) > 0) { foreach ($GLOBALS['PathInfo'] as $key => $value) { if (eregi('make=', $value)) { $make = MakeURLNormal(substr($value, strpos($value, '=') + 1)); } else { if (eregi('model=', $value)) { $model = MakeURLNormal(substr($value, strpos($value, '=') + 1)); } else { if (eregi('year=', $value)) { $year = substr($value, strpos($value, '=') + 1); } } } } } } $where = ''; if ($make != '') { $where .= "and (prodmake = '" . $make . "' or prodmake = 'NON-SPEC VEHICLE')"; } if ($model != '') { $where .= " and (prodmodel = '" . $model . "' or prodmodel = 'ALL')"; } if ($year != '') { $where .= " and (({$year} between prodstartyear and prodendyear) or (prodstartyear = 'ALL'and prodendyear = 'ALL'))"; } $result = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT id,productid FROM [|PREFIX|]import_variations where productid = '" . $prodid . "' {$where} order by id"); $impvariationid = array(); while ($improw = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $impvariationid[] = $improw['id']; } $impid = implode("','", $impvariationid); $impquery = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT complementaryitems FROM [|PREFIX|]application_data where variationid in('" . $impid . "') "); $impquery1 = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT complementaryitems FROM [|PREFIX|]application_data where variationid in('" . $impid . "') and complementaryitems != '' "); $cntoriginal1 = ''; if ($row1 = $GLOBALS["ISC_CLASS_DB"]->Fetch($impquery1)) { $compitems1 = $row1['complementaryitems'] . ","; $comp1 = substr($compitems1, 0, -1); $temp1 = $comp1; $temp1 = htmlspecialchars_decode($temp1); preg_match_all('/\\[([^\\]]+)\\]/', $temp1, $matches1); $compexplode1 = $matches1[1]; $cntproducts1 = count($compexplode1); /*$arraycnt1 = array_count_values($compexplode1); asort($arraycnt1); $compunique1 = array_keys($arraycnt1); rsort($compunique1); $cntproducts1 = count($compunique1);*/ $originalarray1 = array(); $tempArr = array(); $tempArr1 = array(); # Checking whether the SKU are valid and present in the db -- Baskaran for ($i = 0; $i < $cntproducts1; $i++) { $split1 = split(",", $compexplode1[$i]); $sku1 = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT productid, prodname, prodcode, proddescfeature, imagefile, brandname, catname FROM [|PREFIX|]brands b, [|PREFIX|]categories c, [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' WHERE prodcode = '" . $split1[0] . "' AND p.prodbrandid = b.brandid AND p.prodcatids = c.categoryid AND p.prodvisible = '1'"); if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku1) == 1 and $split1[0] != '0') { if (in_array($split1[0], $tempArr)) { continue; } $originalarray1[] = $split1[0] . "," . $split1[1] . "," . $split1[2]; $tempArr[] = $split1[0]; } else { if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku1) != 1 and $split1[0] == '0') { if (in_array($split1[0], $tempArr1)) { continue; } $originalarray1[] = $split1[0] . "," . $split1[1] . "," . $split1[2]; $tempArr1[] = $split1[0]; } } } $cntoriginal1 = count($originalarray1); } if ($cntoriginal1 == 0 or $cntoriginal1 == '') { // if($GLOBALS["ISC_CLASS_DB"]->countResult($impquery) == 0) { $this->DontDisplay = true; return; } else { $compitems = ''; if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($impquery)) { $compitems = $row['complementaryitems'] . ","; $comp = substr($compitems, 0, -1); $temp = $comp; $temp = htmlspecialchars_decode($temp); preg_match_all('/\\[([^\\]]+)\\]/', $temp, $matches); $compexplode = $matches[1]; $cntproducts = count($compexplode); /*$arraycnt = array_count_values($compexplode); asort($arraycnt); $compunique = array_keys($arraycnt); rsort($compunique); $cntproducts = count($compunique);*/ $originalarray = array(); for ($i = 0; $i < $cntproducts; $i++) { $split = split(",", $compexplode[$i]); $sku = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT productid, prodname, prodcode, proddescfeature, imagefile, brandname, catname FROM [|PREFIX|]brands b, [|PREFIX|]categories c, [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' WHERE prodcode = '" . $split[0] . "' AND p.prodbrandid = b.brandid AND p.prodcatids = c.categoryid AND p.prodvisible = '1'"); if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku) == 1 and $split[0] != '0') { $originalarray[] = $split[0] . "," . $split[1] . "," . $split[2]; } else { if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku) != 1 and $split[0] == '0') { $originalarray[] = $split[0] . "," . $split[1] . "," . $split[2]; } } } $cntoriginal = count($originalarray); $comparray = array(); if ($row['complementaryitems'] != '') { for ($i = 0; $i < 1; $i++) { $split = split(",", $originalarray[$i]); $skucode = $split[0]; $comparray[$skucode] = $skucode; } $sku = $comparray[$skucode]; // print_r($comparray);exit; if ($sku != '') { $result = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT proddesc,prodwarranty,proddescfeature,prod_instruction,productid FROM [|PREFIX|]products where prodcode = '" . $sku . "' AND prodvisible = '1'"); $desc = ''; if ($crow = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $compdesc = $crow['proddesc']; $productid = $crow['productid']; $feature = $crow['proddescfeature']; $proddesc = $crow['proddesc']; $warranty = $crow['prodwarranty']; $instruction = $crow['prod_instruction']; $images = $this->complementaryImageView($productid); if ($images != '') { $desc .= "<h3>Product Images</h3>" . $images; } if ($feature != '') { $desc .= "<br><h3>Feature Points</h3>" . $feature; } if ($compdesc != '') { $desc .= "<h3>Complementary Product Description</h3>" . $proddesc; } if ($warranty != '') { $desc .= "<h3>Warranty Information</h3>" . $warranty; } $chart = $this->applicationchart($productid); if ($chart != '') { $desc .= "<h3>Application Guide</h3>" . $chart; } if ($instruction != '') { $desc .= "<h3>Instruction</h3>" . $instruction; } } else { $desc = "No Data found."; } } else { $desc = "No Data found."; } } else { $desc = "No Data found."; } } $GLOBALS['CompDesc'] = $desc; } }
public function SetPanelSettings() { $path = GetConfig('ShopPath'); $params = array(); for ($i = 1; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $params[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } $catg_qry = "select * from [|PREFIX|]categories where catvisible=1 order by catparentid ASC , CHAR_LENGTH(catname) DESC"; $catg_res = $GLOBALS['ISC_CLASS_DB']->Query($catg_qry); $catgoryname = array(); // array for category names while ($catg_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($catg_res)) { $catgoryname[$catg_arr['categoryid']]['catname'] = $catg_arr['catname']; $catgoryname[$catg_arr['categoryid']]['catparentid'] = $catg_arr['catparentid']; } $GLOBALS['categories_all'] = $catgoryname; @($lastSelection = $_COOKIE['last_search_selection']); if (!isset($params['make']) && isset($lastSelection['make']) && $lastSelection['make'] != "") { $params['make'] = $lastSelection['make']; if (!isset($params['model']) && isset($lastSelection['model']) && $lastSelection['model'] != "") { $params['model'] = $lastSelection['model']; } } if (!isset($params['year']) && isset($lastSelection['year']) && $lastSelection['year'] != "") { $params['year'] = $lastSelection['year']; } $where = ''; if (isset($params['make'])) { $where .= "AND ( v.prodmake = '" . $params['make'] . "' OR v.prodmake = 'NON-SPEC VEHICLE' ) "; } if (isset($params['model'])) { $where .= "AND ( v.prodmodel = '" . $params['model'] . "' OR v.prodmodel = 'ALL' ) "; } if (isset($params['year'])) { $year = $params['year']; $where .= "AND ( {$year} between v.prodstartyear and v.prodendyear OR v.prodstartyear = 'ALL' ) "; } /*if( !isset($params['make']) || !isset($params['model']) || !isset($params['year']) ) {*/ $GLOBALS['UniversalCat'] = isset($params['catuniversal']) ? $params['catuniversal'] : 0; $GLOBALS['YearList'] = $this->getYMMOptions($params, 'year'); $GLOBALS['MakeList'] = $this->getYMMOptions($params, 'make'); $GLOBALS['ModelList'] = $this->getYMMOptions($params, 'model'); $GLOBALS['YMMTable'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ClearanceYMMOptions"); //} $GLOBALS['ClearanceResults'] = "<div style='float:left'>" . $GLOBALS['YMMTable'] . "</div>"; $mmy_links = $this->GetYMMLinks($params); $query = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]discounts WHERE discountname = 'Clearance' and discountenabled = 1 LIMIT 0 , 1 "); $flag = '0'; if ($GLOBALS['ISC_CLASS_DB']->CountResult($query) == 1) { $crow = $GLOBALS['ISC_CLASS_DB']->Fetch($query); $catid = unserialize($crow['configdata']); if (array_key_exists("var_catids", $catid)) { $flag = '1'; $category_id = $catid['var_catids']; } else { $flag = '2'; $brand_id = $catid['var_brandids']; $series_id = $catid['var_seriesids']; } } if ($flag == '1') { # For Category -- Baskaran $clearance_qry = "select c.catname , c.categoryid , c.catuniversal , c.catimagealt , c.featurepoints , group_concat(DISTINCT brandname separator '~') as brandname , group_concat(DISTINCT p.brandseriesid separator '~') as seriesids , min(fp.prodfinalprice) as prodminprice , max(fp.prodfinalprice) as prodmaxprice , c.catimagefile as imagefile , c.cathoverimagefile , p.proddesc , prodwarranty , bs.seriesname , p.brandseriesid , count(distinct p.productid) as totalproducts,floor(SUM(p.prodratingtotal)/SUM(p.prodnumratings)) AS prodavgrating from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid LEFT JOIN [|PREFIX|]categoryassociations ca on ca.productid = p.productid LEFT JOIN [|PREFIX|]categories c on c.categoryid = ca.categoryid and c.catvisible = 1 LEFT JOIN [|PREFIX|]brands b on prodbrandid = b.brandid LEFT JOIN [|PREFIX|]brand_series AS bs ON bs.seriesid = p.brandseriesid LEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid AND pi.imageisthumb=1) LEFT JOIN [|PREFIX|]product_finalprice fp ON p.productid = fp.productid WHERE 1=1 AND c.categoryid IN ({$category_id}) AND p.prodvisible='1' {$where} group by c.categoryid ORDER BY c.catdeptid ASC, c.catsort ASC, c.catname ASC"; $catquery = $GLOBALS['ISC_CLASS_DB']->Query($clearance_qry); $cnt = $GLOBALS['ISC_CLASS_DB']->CountResult($catquery); if ($cnt > '0') { while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($catquery)) { $cat_id = $row['categoryid']; $category_rating = 0; $cat_rating_res = $GLOBALS['ISC_CLASS_DB']->Query("SELECT floor(SUM(p.prodratingtotal)/SUM(p.prodnumratings))AS prodavgrating FROM [|PREFIX|]categoryassociations c INNER JOIN [|PREFIX|]products p on c.productid=p.productid where c.categoryid = '{$cat_id}'"); $cat_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($cat_rating_res); if (isset($cat_rating_arr['prodavgrating'])) { $category_rating = (int) $cat_rating_arr['prodavgrating']; } $parentid = $GLOBALS['categories_all'][$row['categoryid']]['catparentid']; if ($parentid != 0) { if (isset($GLOBALS['categories_all'][$parentid])) { // if parent catg is not visible $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$parentid]['catname'])) . $mmy_links; } else { $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$row['categoryid']]['catname'])) . $mmy_links; } } else { $mmy_links_modified = "/" . MakeURLSafe(strtolower($GLOBALS['categories_all'][$row['categoryid']]['catname'])) . $mmy_links; } $subcatg_link = $this->LeftCatLink($mmy_links_modified, 'subcategory', $row['catname']); $link = "<a href='" . $subcatg_link . "'>"; $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>"; $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' title='' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>"; if (isset($row['imagefile']) && !empty($row['imagefile'])) { // $images = explode("~",$row['imagefile']); // for($j=0;$j<count($images);$j++) { // if(!empty($images[$j])) { $imagefile = "{$imagelink}<img src='{$path}/category_images/" . $row['imagefile'] . "' alt='" . isc_html_escape($row['catimagealt']) . "' title='" . isc_html_escape($row['catimagealt']) . "'></a>"; $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>"; // break; // } // } } else { if (empty($row['imagefile']) || empty($imagefile)) { $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>"; $imagefile .= "<span id='span" . $row['categoryid'] . "' style='display:none'>" . $tiplink . "</span>"; } } $GLOBALS['LeftImage'] = $imagefile; $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available"; $row['brandname'] = str_replace('~', ' , ', $row['brandname']); //$GLOBALS['RelatedBrands'] = $row['brandname']; if (!empty($row['seriesname'])) { $row['brandname'] .= "<br>" . $row['seriesname']; } $GLOBALS['CatgSeriesList'] = ""; if ($row['seriesids'] != "") { $seriesids = str_ireplace("~", ",", $row['seriesids']); $seriesids_qry = "select seriesid , brandname , seriesname from [|PREFIX|]brand_series bs left join [|PREFIX|]brands b on bs.brandid = b.brandid where seriesid in (" . $seriesids . ")"; $seriesids_res = $GLOBALS['ISC_CLASS_DB']->Query($seriesids_qry); if ($GLOBALS['ISC_CLASS_DB']->CountResult($seriesids_res) > 0) { while ($seriesids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($seriesids_res)) { if ($GLOBALS['CatgSeriesList'] == "") { $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['categoryid'] . "')\">View Brands ></a><div id='" . $row['categoryid'] . "' style='display:block'>"; } else { $GLOBALS['CatgSeriesList'] .= "<br>"; } $tooltipscript = "onmouseover='createtip(" . $row['categoryid'] . $seriesids_arr['seriesid'] . ")' onmouseout='UnTip()'"; if (!isset($params['brand'])) { if ($GLOBALS['EnableSEOUrls'] == 1) { $series_link = $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/brand/" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } else { $series_link = $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&brand=" . MakeURLSafe(Strtolower($seriesids_arr['brandname'])) . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } } else { if ($GLOBALS['EnableSEOUrls'] == 1) { $series_link = $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "/series/" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } else { $series_link = $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])); $GLOBALS['CatgSeriesList'] .= "<a href='" . $subcatg_link . "&series=" . MakeURLSafe(Strtolower($seriesids_arr['seriesname'])) . "' {$tooltipscript}>" . $seriesids_arr['brandname'] . " " . $seriesids_arr['seriesname'] . "</a>"; } } $GLOBALS['CatgSeriesList'] .= "<span id='span" . $row['categoryid'] . $seriesids_arr['seriesid'] . "' style='display:none'><a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $seriesids_arr['seriesid'] . "&catname=" . MakeURLSafe($row['catname']) . "&url=" . urlencode($series_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>"; } $GLOBALS['CatgSeriesList'] .= "</br></div>"; } } $content = $row['brandname'] . "<br>"; if (!isset($params['category']) && (isset($params['srch_category']) || !isset($GLOBALS['BRAND_SERIES_FLAG']))) { $GLOBALS['CatgDescandBrandImage'] = isset($catg_desc_arr['catdesc']) ? $catg_desc_arr['catdesc'] : ''; // description will be added here to show it at the top of subcatg page. $GLOBALS['CatgBrandSeriesFooter'] = isset($catg_desc_arr['categoryfooter']) ? $catg_desc_arr['categoryfooter'] : ''; $content .= "<h3><a href='" . $path . "/search.php?{$qry_string}&subcategory=" . MakeURLSafe($row['catname']) . "'>" . $row['catname'] . "</a></h3>>"; $GLOBALS['TitleLink'] = "<h2><a href='" . $subcatg_link . "' onmouseover='createtip(" . $row['categoryid'] . ")' onmouseout='UnTip()'>" . $row['catname'] . "</a></h2>"; } /*$ProdStartPrice = GetStartingPrice($row['categoryid'], $row['prodcalculatedprice']); $content .= "Price starting from $".number_format($ProdStartPrice, 2, '.', '')."<br>".$imagefile;*/ $GLOBALS['leftsidecontent'] = $content; if (number_format($row['prodminprice'], 2) < number_format($row['prodmaxprice'], 2)) { $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', ''); } else { $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', ''); } $GLOBALS['Rating'] = isset($row['prodavgrating']) ? $row['prodavgrating'] : 0; $GLOBALS['RatingVisible'] = $GLOBALS['Rating'] == 0 ? 'display:none' : ''; $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty']; $GLOBALS['rightsidecontent'] = $content; $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>"; $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>"; $GLOBALS['ViewDetailsImage'] = "<a href='{$path}/catgbrand.php?categoryid=" . $row['categoryid'] . "&url=" . urlencode($subcatg_link) . "' class='thickbox'><img src='{$path}/templates/default/images/fastlook_red.gif'></a> "; $content = "{$link}<img src='{$path}/templates/default/images/viewproducts.gif'></a>"; $GLOBALS['ViewDetailsImage'] .= $content; if (IsDiscountAvailable('category', $row['categoryid'])) { $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/clearance.gif" alt="">'; } if ($category_rating != 0) { $GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='" . $GLOBALS['TPL_PATH'] . "/images/IcoRating{$category_rating}.gif' alt='' /></h2>"; } $GLOBALS['RatingHide'] = $category_rating == '0' ? 'none' : ''; /*if($this->IsMakeAnOffer('category', $row['categoryid'])=='yes') { $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>"; }*/ $GLOBALS['RelatedBrands'] = $row['featurepoints']; $GLOBALS['lowersidecontent'] = $content; $GLOBALS['ClearanceList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ClearanceCategoryListing"); } $GLOBALS['ClearanceResults'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ClearanceCategoryListingMain"); } else { $GLOBALS['ClearanceResults'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ClearanceNorecords"); } } else { if ($flag == '2') { # For brand and series -- Baskaran $brand_rating = 0; $serquery = $GLOBALS['ISC_CLASS_DB']->Query("select c.catname , c.categoryid , c.catuniversal , group_concat(DISTINCT ca.categoryid separator '~') as subcatgids , pa.catname as parentcatname , group_concat(DISTINCT brandname separator '~') as brandname , min(fp.prodfinalprice) as prodminprice , max(fp.prodfinalprice) as prodmaxprice , bs.seriesphoto as imagefile , p.proddesc , prodwarranty , bs.seriesname, p.brandseriesid , count(distinct p.productid) as totalproducts , bs.feature_points1 , bs.feature_points2 , bs.feature_points3 , bs.feature_points4 , bs.feature_points, b.brandimagefile , b.brandlargefile , b.branddescription , b.brandfooter, bs.serieshoverimagefile from [|PREFIX|]products p LEFT JOIN [|PREFIX|]import_variations AS v ON v.productid = p.productid LEFT JOIN [|PREFIX|]categoryassociations ca on ca.productid = p.productid LEFT JOIN [|PREFIX|]categories c on c.categoryid = ca.categoryid and c.catvisible = 1 LEFT JOIN [|PREFIX|]brands b on prodbrandid = b.brandid LEFT JOIN [|PREFIX|]brand_series AS bs ON bs.seriesid = p.brandseriesid LEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid AND pi.imageisthumb=1) LEFT JOIN [|PREFIX|]product_finalprice fp ON p.productid = fp.productid LEFT JOIN [|PREFIX|]categories pa on pa.categoryid = c.catparentid WHERE 1=1 AND c.categoryid is not null AND p.prodvisible='1' {$where} AND p.prodbrandid IN ({$brand_id}) AND p.brandseriesid IN ({$series_id}) group by p.brandseriesid ORDER BY bs.seriessort ASC , bs.seriesname ASC"); $cnt = $GLOBALS['ISC_CLASS_DB']->CountResult($serquery); if ($cnt > '0') { while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($serquery)) { $brand_rating_qry = "select avg(revrating) as rating from [|PREFIX|]reviews r left join [|PREFIX|]products p on r.revproductid = p.productid left join [|PREFIX|]brands b on p.prodbrandid = b.brandid where r.revstatus = 1 and b.brandname = '" . $row['brandname'] . "'"; $brand_rating_res = $GLOBALS['ISC_CLASS_DB']->Query($brand_rating_qry); $brand_rating_arr = $GLOBALS['ISC_CLASS_DB']->FetchOne($brand_rating_res); if (isset($brand_rating_arr['rating'])) { $brand_rating = (int) $brand_rating_arr['rating']; } $series_link = $this->LeftCatLink($mmy_links, 'series', $row['seriesname']); $link = "<a href='" . $series_link . "'>"; //$imagelink = "<a href='".$path."/catgbrand.php?seriesid=".$row['brandseriesid']."&catname=".MakeURLSafe($row['parentcatname'])."&url=$series_link' class='thickbox' title=''>"; $main_catg_link = ""; $catg_count = array(); $GLOBALS['CatgSeriesList'] = ""; if ($row['subcatgids'] != "") { $subcatgids = str_ireplace("~", ",", $row['subcatgids']); $subcatgids_qry = "select c.categoryid , c.catname as childcatname , p.categoryid as parentid , p.catname as parentcatname from [|PREFIX|]categories c left join [|PREFIX|]categories p on c.catparentid = p.categoryid where c.categoryid in (" . $subcatgids . ")"; $subcatgids_res = $GLOBALS['ISC_CLASS_DB']->Query($subcatgids_qry); //$catg_count = $GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res); if ($GLOBALS['ISC_CLASS_DB']->CountResult($subcatgids_res) > 0) { while ($subcatgids_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($subcatgids_res)) { if ($subcatgids_arr['parentid'] != 0) { $main_catg_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])); $catg_count[$subcatgids_arr['parentid']] = $subcatgids_arr['parentcatname']; } else { $catg_count[$subcatgids_arr['categoryid']] = $subcatgids_arr['childcatname']; } if ($GLOBALS['CatgSeriesList'] == "") { $GLOBALS['CatgSeriesList'] .= "<br><a href='javascript:' onclick=\"checkanimate('" . $row['brandseriesid'] . "')\">View Category ></a><div id='" . $row['brandseriesid'] . "' style='display:none'>"; } else { $GLOBALS['CatgSeriesList'] .= "<br>"; } $tooltipscript = "onmouseover='createtip(" . $subcatgids_arr['categoryid'] . $row['brandseriesid'] . ")' onmouseout='UnTip()'"; if ($GLOBALS['EnableSEOUrls'] == 1) { if ($subcatgids_arr['parentcatname'] == "") { $catgs_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname'])); } else { $catgs_link = $series_link . "/category/" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])) . "/subcategory/" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname'])); } $GLOBALS['CatgSeriesList'] .= "<a href='" . $catgs_link . "' {$tooltipscript}>" . $subcatgids_arr['childcatname'] . "</a>"; } else { if ($subcatgids_arr['parentcatname'] == "") { $catgs_link = $series_link . "&category=" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname'])); } else { $catgs_link = $series_link . "&category=" . MakeURLSafe(Strtolower($subcatgids_arr['parentcatname'])) . "&subcategory=" . MakeURLSafe(Strtolower($subcatgids_arr['childcatname'])); } $GLOBALS['CatgSeriesList'] .= "<a href='" . $catgs_link . "' {$tooltipscript}>" . $subcatgids_arr['childcatname'] . "</a>"; } $GLOBALS['CatgSeriesList'] .= "<span id='span" . $subcatgids_arr['categoryid'] . $row['brandseriesid'] . "' style='display:none'><a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?categoryid=" . $subcatgids_arr['categoryid'] . "&url=" . urlencode($catgs_link) . "' class='' ><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a></span>"; } $GLOBALS['CatgSeriesList'] .= "</br></div>"; } } $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>"; if (count($catg_count) == 1) { $GLOBALS['TitleLink'] = "<h2><a href='" . $main_catg_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>"; } else { if (count($catg_count) > 1) { $GLOBALS['TitleLink'] = "<h2><a href='" . $series_link . "' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()' onclick='return checkcategoryselection()'>" . $row['brandname'] . " " . $row['seriesname'] . " " . $row['parentcatname'] . "</a></h2>"; } } $tiplink = "<a class='thickbox1' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url="; if (count($catg_count) == 1) { $tiplink .= urlencode($main_catg_link) . "'"; } else { if (count($catg_count) > 1) { $tiplink .= "#' "; } else { $tiplink .= urlencode($series_link) . "'"; } } $tiplink .= " title=''><img src='{$path}/templates/default/images/fastlook_red.gif' border=0></a>"; $imagelink = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url="; if (count($catg_count) == 1) { $imagelink .= urlencode($main_catg_link) . "'"; } else { if (count($catg_count) > 1) { $imagelink .= "#' "; } else { $imagelink .= urlencode($series_link) . "'"; } } $imagelink .= " title='' onmouseover='createtip(" . $row['brandseriesid'] . ")' onmouseout='UnTip()'>"; if (isset($row['imagefile']) && !empty($row['imagefile'])) { $images = explode("~", $row['imagefile']); // for($j=0;$j<count($images);$j++) { // if(!empty($images[$j])) { $imagefile = "{$imagelink}<img src='{$path}/series_images/" . $row['imagefile'] . "'></a>"; // break; // } // } } else { if (empty($row['imagefile']) || empty($imagefile)) { $imagefile = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' border=0></a>"; } } $GLOBALS['LeftImage'] = $imagefile; $row['brandname'] = str_replace('~', ' , ', $row['brandname']); $GLOBALS['RelatedBrands'] = $row['brandname']; if (isset($row['seriesname']) && !empty($row['seriesname']) && (!isset($params['srch_category']) || isset($params['category'])) && isset($GLOBALS['BRAND_SERIES_FLAG'])) { if (empty($row['imagefile']) || empty($imagefile)) { $GLOBALS['LeftImage'] = "{$imagelink}<img src='{$path}/templates/default/images/ProductDefault.gif' alt='" . isc_html_escape($row['seriesimagealt']) . "' title='" . isc_html_escape($row['seriesimagealt']) . "'></a>"; $GLOBALS['LeftImage'] .= "<span id='span" . $row['brandseriesid'] . "' style='display:none'>" . $tiplink . "</span>"; } else { $GLOBALS['LeftImage'] = "{$imagelink}<img src='{$path}/series_images/" . $row['imagefile'] . "' width='140px' alt='" . isc_html_escape($row['seriesimagealt']) . "' title='" . isc_html_escape($row['seriesimagealt']) . "'></a>"; $GLOBALS['LeftImage'] .= "<span id='span" . $row['brandseriesid'] . "' style='display:none'>" . $tiplink . "</span>"; } //"<h3>".$row['catname']."</h3> $GLOBALS['ProductsCount'] = "(" . $row['totalproducts'] . ") Products Available"; $GLOBALS['RelatedBrands'] = "<ul class='featurepoints'>"; if (!empty($row['feature_points1'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points1'] . "</li>"; } if (!empty($row['feature_points2'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points2'] . "</li>"; } if (!empty($row['feature_points3'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points3'] . "</li>"; } if (!empty($row['feature_points4'])) { $GLOBALS['RelatedBrands'] .= "<li>" . $row['feature_points4'] . "</li>"; } $GLOBALS['RelatedBrands'] .= "</ul>"; } $GLOBALS['RelatedBrands'] = $row['feature_points']; $GLOBALS['CatgDescandBrandImage'] = $row['branddescription']; $GLOBALS['CatgBrandSeriesFooter'] = $row['brandfooter']; if ($brand_rating != 0) { $GLOBALS['CatgDescandBrandImage'] .= "<br><h2>Rating : <img width='64' height='12' src='" . $GLOBALS['TPL_PATH'] . "/images/IcoRating{$brand_rating}.gif' alt='' /></h2>"; } $GLOBALS['RatingHide'] = $brand_rating == '0' ? 'none' : ''; $content = $row['brandname'] . "<br>"; $content .= $row['catname'] . "<br>"; /*$ProdStartPriceSeries = GetStartingPriceForSeries($row['brandseriesid'], $row['prodcalculatedprice']); $content .= "Price starting from $".number_format($ProdStartPriceSeries, 2, '.', '');*/ $GLOBALS['leftsidecontent'] = $content; //$GLOBALS['PriceRange'] = "Price range from $".number_format($row['prodminprice'], 2, '.', '')." to $".number_format($row['prodmaxprice'], 2, '.', ''); if (number_format($row['prodminprice'], 2) < number_format($row['prodmaxprice'], 2)) { $GLOBALS['PriceRange'] = "Price range from \$" . number_format($row['prodminprice'], 2, '.', '') . " to \$" . number_format($row['prodmaxprice'], 2, '.', ''); } else { $GLOBALS['PriceRange'] = "Available at \$" . number_format($row['prodminprice'], 2, '.', ''); } $GLOBALS['Rating'] = isset($row['prodavgrating']) ? $row['prodavgrating'] : 0; $GLOBALS['RatingVisible'] = $GLOBALS['Rating'] == 0 ? 'display:none' : ''; $content = "<img src='{$path}/templates/default/images/free-shipping2.gif'><br>" . strip_tags($row['proddesc']) . "<br>" . $row['prodwarranty']; $GLOBALS['rightsidecontent'] = $content; $GLOBALS['ShippingImage'] = "<img src='{$path}/templates/default/images/free-shipping2.gif'>"; $GLOBALS['ProductWarranty'] = "<h3>" . $row['prodwarranty'] . "</h3>"; $GLOBALS['ViewDetailsImage'] = "<a class='thickbox' href='" . $GLOBALS['ShopPath'] . "/catgbrand.php?seriesid=" . $row['brandseriesid'] . "&catname=" . MakeURLSafe($row['parentcatname']) . "&url="; if (count($catg_count) > 1) { $GLOBALS['ViewDetailsImage'] .= "#'"; } else { if (count($catg_count) == 1) { $GLOBALS['ViewDetailsImage'] .= urlencode($main_catg_link) . "'"; } else { $GLOBALS['ViewDetailsImage'] .= urlencode($series_link) . "'"; } } $GLOBALS['ViewDetailsImage'] .= "><img src='{$path}/templates/default/images/fastlook_red.gif'></a> "; $content = "{$link}"; if (count($catg_count) == 1) { $content = "<a href='" . $main_catg_link . "'>"; } else { if (count($catg_count) > 1) { $content = "<a href='" . $series_link . "' onclick='return checkcategoryselection()'>"; } } $content .= "<img src='{$path}/templates/default/images/viewproducts.gif'></a>"; $GLOBALS['ViewDetailsImage'] .= $content; if (IsDiscountAvailable('series', $row['brandseriesid'])) { $GLOBALS['ViewDetailsImage'] .= '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/clearance" alt="">'; } /* if($this->IsMakeAnOffer('series', $row['brandseriesid'])=='yes') { $GLOBALS['ViewDetailsImage'] .= "<h3>Qualifies for Make an Offer!</h3>"; } */ $GLOBALS['lowersidecontent'] = $content; $GLOBALS['ClearanceList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ClearanceCategoryListing"); $GLOBALS['HideCompareItems'] = "none"; } $GLOBALS['ClearanceResults'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ClearanceCategoryListingMain"); } else { $GLOBALS['ClearanceResults'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ClearanceNorecords"); } } else { $GLOBALS['ClearanceResults'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ClearanceNorecords"); } } }
public function SetCategoryData() { // Retrieve the query string variables. Can't use the $_GET array // because of SEO friendly links in the URL SetPGQVariablesManually(); // Grab the page sort details if (isset($_REQUEST['category'])) { $GLOBALS['CategoryPath'] = isc_html_escape($_REQUEST['category']); $path = explode("/", $_REQUEST['category']); } else { $GLOBALS['URL'] = implode("/", $GLOBALS['PathInfo']); $path = $GLOBALS['PathInfo']; array_shift($path); } $this->SetSort(); $this->SetCatPath($path); $arrCats = $this->_catpath; for ($i = 0; $i < count($arrCats); $i++) { $arrCats[$i] = MakeURLNormal($arrCats[$i]); } if (!isset($arrCats[0])) { $arrCats[0] = ''; } // The first category *MUST* have a parent ID of 0 or it's invalid $parentCat = 0; // Because of the way SEO friendly links work at the moment, we need to loop through // the category path to check each level is valid. Ideally we'd store the built category // URL in the database and check based on that. for($i = 0; $i < count($arrCats); ++$i) { if(empty($arrCats[$i])) { continue; } $query = " SELECT * FROM [|PREFIX|]categories WHERE catname = '".$GLOBALS['ISC_CLASS_DB']->quote($arrCats[$i])."' AND catparentid = '".(int)$parentCat."' AND catvisible = 1 "; $result = $GLOBALS['ISC_CLASS_DB']->query($query); $category = $GLOBALS['ISC_CLASS_DB']->fetch($result); // Supplied category could not be found. They've followed an incorrect link so show the 404 page. if(!$category) { $GLOBALS['ISC_CLASS_404'] = GetClass('ISC_404'); $GLOBALS['ISC_CLASS_404']->HandlePage(); exit; } // Add this category to the breadcrumb/trail $this->SetTrail(array($category['categoryid'], $category['catname'])); $parentCat = $category['categoryid']; } if (!empty($category)) { // $category contains the details of the actual category we're viewing $this->Data = $category; $this->SetId($category['categoryid']); $this->SetName($category['catname']); $this->SetDesc($category['catdesc']); $this->SetLayoutFile($category['catlayoutfile']); $this->SetCatPageTitle($category['catpagetitle']); $this->SetMetaKeywords($category['catmetakeywords']); $this->SetMetaDesc($category['catmetadesc']); $this->SetSearchKeywords($category['catsearchkeywords']); $this->SetEnableOptimizer($category['cat_enable_optimizer']); } else { // Reached /categories/ directly with no additional path. // This is the root category } // Do we have permission to access this category? if(!CustomerGroupHasAccessToCategory($this->_catid)) { $noPermissionsPage = GetClass('ISC_403'); $noPermissionsPage->HandlePage(); exit; } $GLOBALS['CatTrail'] = $this->GetTrail(); // Find the number of products in the category $this->loadCats = $this->GetId(); // This product should show products from this category, but if there are none // show them from any child categories too if(GetConfig('CategoryListingMode') == 'emptychildren') { // Load up how many products there are in the current category, if none, load from children too $this->SetNumProducts(); if($this->_catnumproducts == 0) { $cats = $this->GetChildCategories(); // Add in the current category too- which helps out shop by price etc $cats[] = $this->getId(); $group = GetClass('ISC_CUSTOMER')->GetCustomerGroup(); if(is_array($group) && $group['categoryaccesstype'] == 'specific') { $cats = array_intersect($cats, $group['accesscategories']); } $this->loadCats = trim(implode(',', array_unique($cats)), ','); } } // Otherwise, this category shows products from itself + children else if(GetConfig('CategoryListingMode') == 'children') { $cats = $this->GetChildCategories(); $cats[] = $this->GetId(); $group = GetClass('ISC_CUSTOMER')->GetCustomerGroup(); if(is_array($group) && $group['categoryaccesstype'] == 'specific') { $cats = array_intersect($cats, $group['accesscategories']); } $this->loadCats = trim(implode(',', array_unique($cats)), ','); } $this->SetNumProducts(); // Setup paging details $this->SetPage(); $this->SetStart(); $this->SetNumPages(); // Load the products for the categories page $this->LoadProductsForPage(); }
function SetPanelSettings() { $path = GetConfig('ShopPath'); $output = ""; $GLOBALS['SITEPATH'] = $path; $GLOBALS['ProductMMYHeader1'] = "Make"; $GLOBALS['ProductMMYHeader2'] = "Model"; $GLOBALS['ProductMMYHeader'] = "Year"; $model_srch_param = "search_query="; $year_srch_param = "search_query="; // Here this was applied earlier "search_query=&year=&column=year" $make_srch_param = "search_query="; $GLOBALS['mousedefaultpointer'] = "mousedefaultpointer"; $GLOBALS['ModelJS'] = ""; $GLOBALS['FLAGCLEARANCE'] = 0; //wirror_20101124: show the ymm options by searching condition $GLOBALS['ISC_CLASS_NEWSEARCH'] = GetClass('ISC_NEWSEARCH'); $params = $GLOBALS['ISC_CLASS_NEWSEARCH']->_searchterms; if (!empty($_COOKIE['last_search_selection']['year'])) { $params['year'] = $_COOKIE['last_search_selection']['year']; } if (!empty($_COOKIE['last_search_selection']['make'])) { $params['make'] = $_COOKIE['last_search_selection']['make']; } if (!empty($_COOKIE['last_search_selection']['model'])) { $params['model'] = $_COOKIE['last_search_selection']['model']; } if ($GLOBALS['ProductIds']) { $this->productImpVariations = ISC_PRODUCT::GetImpVariationForYMM($GLOBALS['ProductIds'], '', $params['year'], $params['make'], $params['model']); } //$GLOBALS['FLAGCLEARANCE'] = 2; //$params = array(); // johnny change '$i=1' to '$i=0' for ($i = 0; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $params[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } if (isset($params['make'])) { $_COOKIE['last_search_selection']['make'] = $params['make']; if (isset($params['model'])) { $_COOKIE['last_search_selection']['model'] = $params['model']; } } if (isset($params['year'])) { $_COOKIE['last_search_selection']['year'] = $params['year']; } $GLOBALS['REMOVEURL'] = $GLOBALS['ShopPath'] . "/clearance/"; $this->YMMSelectors($params); $GLOBALS['REMOVEURL'] = $this->GetRemoveUrl(); if (!empty($_COOKIE['last_search_selection']['year']) || !empty($params['year'])) { $GLOBALS['YearName'] = empty($_COOKIE['last_search_selection']['year']) ? $params['year'] : $_COOKIE['last_search_selection']['year']; $model_srch_param .= "&year=" . $GLOBALS['YearName']; $make_srch_param .= "&year=" . $GLOBALS['YearName']; } if (!empty($_COOKIE['last_search_selection']['make']) || !empty($params['make'])) { $GLOBALS['MakeName'] = strtoupper(empty($_COOKIE['last_search_selection']['make']) ? $params['make'] : $_COOKIE['last_search_selection']['make']); $year_srch_param .= "&make=" . MakeURLSafe(strtolower($GLOBALS['MakeName'])); $model_srch_param .= "&make=" . MakeURLSafe(strtolower($GLOBALS['MakeName'])); $make_srch_param .= "&make=&column=make"; if (isset($GLOBALS['ISC_CLASS_CLEARANCE'])) { $make_srch_param .= "&clearance=1"; } $make_srch_param .= "&getymms=1"; $GLOBALS['MakeJS'] = "getvalueswithajax('prod_make','{$make_srch_param}');"; $model_srch_param .= "&column=model"; if (isset($GLOBALS['ISC_CLASS_CLEARANCE'])) { $model_srch_param .= "&clearance=1"; } $model_srch_param .= "&getymms=1"; $GLOBALS['ModelJS'] .= "getvalueswithajax('prod_model','{$model_srch_param}');checkanimate('prod_model')"; $GLOBAL['mousedefaultpointer'] = ""; if (!empty($_COOKIE['last_search_selection']['model']) || !empty($params['model'])) { $GLOBALS['ModelName'] = strtoupper(empty($_COOKIE['last_search_selection']['model']) ? $params['model'] : $_COOKIE['last_search_selection']['model']); $year_srch_param .= "&model=" . MakeURLSafe(strtolower($GLOBALS['ModelName'])); } } else { $make_srch_param .= "&make=&column=make"; if (isset($GLOBALS['ISC_CLASS_CLEARANCE'])) { $make_srch_param .= "&clearance=1"; } $make_srch_param .= "&getymms=1"; $GLOBALS['MakeJS'] = "getvalueswithajax('prod_make','{$make_srch_param}');"; } $year_srch_param .= "&column=year"; if (isset($GLOBALS['ISC_CLASS_CLEARANCE'])) { $year_srch_param .= "&clearance=1"; } $year_srch_param .= "&getymms=1"; $GLOBALS['YearJS'] = "getvalueswithajax('prod_year','{$year_srch_param}');"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; //$GLOBALS['dynid'] = "prod_year"; $GLOBALS['id'] = "prod_year"; $GLOBALS['yearid'] = "mmy_year"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); //$GLOBALS['dynid'] = "prod_make"; $GLOBALS['id1'] = "prod_make"; $GLOBALS['makeid'] = "mmy_make"; $GLOBALS['DynFilterArrow1'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); //$GLOBALS['dynid'] = "prod_model"; $GLOBALS['id2'] = "prod_model"; $GLOBALS['modelid'] = "mmy_model"; $GLOBALS['DynFilterArrow2'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['ProductMMY'] = $output; $output .= "Results Fit Your Vehicle, Guaranteed !"; /*$changeYMM = false; if(isset($_COOKIE["last_search_selection"]) && isset($_COOKIE["last_search_selection"]["changeymm"]) && $_COOKIE["last_search_selection"]["changeymm"] == 1) { $changeYMM = true; } if(isset($GLOBALS["HasSetYMM"]) && $GLOBALS["HasSetYMM"] == true) { $changeYMM = true; } if(!$changeYMM) { //wirror_20101124: modify the clear words if((isset($GLOBALS['YearName']) || isset($GLOBALS['MakeName'])) && !isset($GLOBALS['MyVehicleArea'])) { $GLOBALS['DeleteCookie'] = "<ul id='modifyvehicle'><li><a href='javascript:deleteMMYcookies()'>Change My Vehicle</a></li></ul>"; } }*/ if (!$output) { $this->DontDisplay = true; return; } $GLOBALS['SNIPPETS']['MyVehicleArea'] = $output; }
public function GetYmmsForDialogPage() { $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; $isDialogPQVQ = isset($_GET['isDialogPQVQ']) ? (int) $_GET['isDialogPQVQ'] : 0; $output = ""; $array_str = $impvaritions = array(); if ($productId) { $impvaritions = ISC_PRODUCT::GetImpVariationForYMM($productId, $ymmtype, '', '', ''); } foreach (array('make', 'model', 'year') as $column) { $tmp = ''; $array_str[$column] = "<option value=''>--select {$column}--</option>"; $ymms_array = $this->getResultArray($column, $year, $make, $model, $productId); if ($column == 'model' and empty($ymms_array)) { $ymms_array = $this->getResultArray($column, "", $make, $model, $productId); } switch ($column) { case 'year': $tmp = $year; break; case 'make': $tmp = $make; break; default: $tmp = $model; break; } foreach ($ymms_array as $value) { $selected = ""; if ($tmp == strtolower($value)) { $selected = "selected"; } if (empty($impvaritions) && !ISC_PRODUCT::CheckYMMUseVariation($value, $impvaritions, $column)) { continue; } $array_str[$column] .= "<option value='" . strtoupper($value) . "' {$selected}>{$value}</option>"; } //alandy_2012-2-20 add redirct option. if ($isDialogPQVQ == 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; }
public function _SetProductData($productid=0) { if ($productid == 0) { // Retrieve the query string variables. Can't use the $_GET array // because of SEO friendly links in the URL SetPGQVariablesManually(); if (isset($_REQUEST['product'])) { $product = $_REQUEST['product']; } else if(isset($GLOBALS['PathInfo'][1])) { $product = preg_replace('#\.html$#i', '', $GLOBALS['PathInfo'][1]); } else { $product = ''; } $product = $GLOBALS['ISC_CLASS_DB']->Quote(MakeURLNormal($product)); $productSQL = sprintf("p.prodname='%s'", $product); } else { $productSQL = sprintf("p.productid='%s'", (int)$productid); } $query = " SELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, pi.*, ".GetProdCustomerGroupPriceSQL().", (SELECT COUNT(fieldid) FROM [|PREFIX|]product_customfields WHERE fieldprodid=p.productid) AS numcustomfields, (SELECT COUNT(reviewid) FROM [|PREFIX|]reviews WHERE revstatus='1' AND revproductid=p.productid AND revstatus='1') AS numreviews, (SELECT brandname FROM [|PREFIX|]brands WHERE brandid=p.prodbrandid) AS prodbrandname, (SELECT COUNT(imageid) FROM [|PREFIX|]product_images WHERE imageprodid=p.productid) AS numimages, (SELECT COUNT(discountid) FROM [|PREFIX|]product_discounts WHERE discountprodid=p.productid) AS numbulkdiscounts FROM [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images pi ON (pi.imageisthumb=1 AND p.productid=pi.imageprodid) WHERE ".$productSQL; if(!isset($_COOKIE['STORESUITE_CP_TOKEN'])) { // ISC-1073: don't check visibility if we are on control panel $query .= " AND p.prodvisible='1'"; } $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result); if (!$row) { return; } $this->_product = $row; $this->_prodid = $row['productid']; $this->_prodname = $row['prodname']; $this->_prodsku = $row['prodcode']; $this->_prodthumb = $row['imagefile']; $this->_proddesc = $row['proddesc']; $this->_prodimages = $row['numimages']; $this->_prodprice = $row['prodprice']; $this->_prodretailprice = $row['prodretailprice']; $this->_prodsaleprice = $row['prodsaleprice']; $this->_prodfixedshippingcost = $row['prodfixedshippingcost']; $this->_prodbrandname = $row['prodbrandname']; $this->_prodweight = $row['prodweight']; $this->_prodavgrating = (int)$row['prodavgrating']; $this->_prodcalculatedprice = $row['prodcalculatedprice']; $this->_prodoptionsrequired = $row['prodoptionsrequired']; $this->_prodnumreviews = $row['numreviews']; $this->_prodavailability = $row['prodavailability']; $this->_prodnumcustomfields = $row['numcustomfields']; $this->_prodnumbulkdiscounts = $row['numbulkdiscounts']; $this->_prodeventdatelimited = $row['prodeventdatelimited']; $this->_prodeventdaterequired = $row['prodeventdaterequired']; $this->_prodeventdatefieldname = $row['prodeventdatefieldname']; $this->_prodeventdatelimitedtype = $row['prodeventdatelimitedtype']; $this->_prodeventdatelimitedstartdate = $row['prodeventdatelimitedstartdate']; $this->_prodeventdatelimitedenddate = $row['prodeventdatelimitedenddate']; $this->_prodcondition = $row['prodcondition']; $this->_prodshowcondition = $row['prodshowcondition']; $this->_prodoptimizerenabled = $row['product_enable_optimizer']; $this->_prodvariationid = $row['prodvariationid']; $this->_prodminqty = $row['prodminqty']; $this->_prodmaxqty = $row['prodmaxqty']; $this->_upc = $row['upc']; $this->_disable_google_checkout = $row['disable_google_checkout']; $videoQuery = 'select * from `[|PREFIX|]product_videos` where video_product_id=' . (int)$this->_prodid . ' order by `video_sort_order` asc'; $videoResource = $GLOBALS['ISC_CLASS_DB']->Query($videoQuery); $this->_prodvideos = array(); while($videoRow = $GLOBALS['ISC_CLASS_DB']->Fetch($videoResource)) { $this->_prodvideos[] = $videoRow; } $this->_prodrelatedproducts = $row['prodrelatedproducts']; $this->setLayoutFile($row['prodlayoutfile']); $this->_prodpagetitle = $row['prodpagetitle']; $this->_prodmetakeywords = $row['prodmetakeywords']; $this->_prodmetadesc = $row['prodmetadesc']; $this->_prodinvtrack = $row['prodinvtrack']; $this->_prodcurrentinv = $row['prodcurrentinv']; if ($row['prodtype'] == 1) { $this->_prodtype = PT_PHYSICAL; } else { $this->_prodtype = PT_DIGITAL; } if ($row['prodfreeshipping'] == 0) { $this->_prodfreeshipping = false; } else { $this->_prodfreeshipping = true; } $this->_prodallowpurchases = $row['prodallowpurchases']; $this->_prodhideprice = $row['prodhideprice']; $this->_prodcallforpricinglabel = $row['prodcallforpricinglabel']; // If there are product variations, set them up if($row['prodvariationid'] > 0) { $this->SetupProductVariations(); } $this->_prodpreorder = true; if ($row['prodpreorder'] == 0) { $this->_prodpreorder = false; } $this->_prodpreordermessage = $row['prodpreordermessage']; $this->_prodreleasedate = $row['prodreleasedate']; $this->_prodreleasedateremove = true; if ($row['prodreleasedateremove'] == 0) { $this->_prodreleasedateremove = false; } $this->_opengraph_type = $row['opengraph_type']; if ($row['opengraph_use_product_name']) { $this->_opengraph_title = $row['prodname']; } else { $this->_opengraph_title = $row['opengraph_title']; } if ($row['opengraph_use_meta_description']) { $this->_opengraph_description = $row['prodmetadesc']; } else { $this->_opengraph_description = $row['opengraph_description']; } if ($row['opengraph_use_image'] != '') { try { $productImage = new ISC_PRODUCT_IMAGE; $productImage->populateFromDatabaseRow($row); $this->_opengraph_image = $productImage->getResizedUrl(ISC_PRODUCT_IMAGE_SIZE_STANDARD, true); } catch (Exception $exception) { // nothing } } $GLOBALS['CurrentProductLink'] = ProdLink($this->_prodname); }
/** * Add a product to the order that's being created/edited. */ private function OrderAddProduct() { if (!isset($_REQUEST['cartItemId']) && !isset($_REQUEST['productId']) || !isset($_REQUEST['orderSession'])) { exit; } $cartOptions = array('updateQtyIfExists' => false); if (isset($_REQUEST['EventDate'])) { $cartOptions['EventDate'] = isc_gmmktime(0, 0, 0, $_REQUEST['EventDate']['Mth'], $_REQUEST['EventDate']['Day'], $_REQUEST['EventDate']['Yr']); } if (isset($_REQUEST['ordcustid']) && $_REQUEST['ordcustid'] != 0) { $customerClass = GetClass('ISC_CUSTOMER'); $customer = $customerClass->GetCustomerInfo($_REQUEST['ordcustid']); if (isset($customer['custgroupid'])) { $cartOptions['customerGroup'] = $customer['custgroupid']; } } else { if (isset($_REQUEST['custgroupid']) && $_REQUEST['custgroupid'] != 0) { $cartOptions['customerGroup'] = (int) $_REQUEST['custgroupid']; } } if (isset($_REQUEST['variationId'])) { $variationId = $_REQUEST['variationId']; } else { $variationId = 0; } if (isset($_REQUEST['customerGroup'])) { $orderDetails['customerGroup'] = (int) $_REQUEST['customerGroup']; } /* -- Added below condition to check if YMM values coming from dropdown, then need to decode - starts */ if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] == 0) { if (isset($_REQUEST['ymmmake'])) { $_REQUEST['ymmmake'] = MakeURLNormal($_REQUEST['ymmmake']); } if (isset($_REQUEST['ymmmodel'])) { $_REQUEST['ymmmodel'] = MakeURLNormal($_REQUEST['ymmmodel']); } } /* -- ends -- */ $productFields = $this->BuildProductConfigurableFieldData(); $orderClass = GetClass('ISC_ADMIN_ORDERS'); $rowId = $orderClass->GetCartApi($_REQUEST['orderSession'])->AddItem($_REQUEST['productId'], $_REQUEST['quantity'], $variationId, $productFields, $_REQUEST['cartItemId'], $cartOptions); if ($rowId === false) { $errors = implode("\n", $orderClass->GetCartApi()->GetErrors()); if (!$errors) { $errors = GetLang('ErrorAddingProductToOrder'); } $response = array('error' => $errors); } else { $product = $orderClass->GetCartApi()->GetProductInCart($rowId); $catquery = " SELECT DISTINCT c.categoryid, p.brandseriesid\n FROM isc_categories c \n LEFT JOIN isc_categoryassociations ca ON c.categoryid = ca.categoryid \n LEFT JOIN isc_products p ON ca.productid = p.productid AND p.prodvisible='1'\n WHERE p.productid= " . $product['product_id'] . ""; $relcats = array(); $brandseries = 0; $catresult = $GLOBALS['ISC_CLASS_DB']->Query($catquery); while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catresult)) { $relcats[] = $catrow['categoryid']; $brandseries = $catrow['brandseriesid']; } if ($product['data']['prodsaleprice'] > 0 && $product['data']['prodsaleprice'] < $product['product_price']) { $product['product_price'] = $product['data']['prodsaleprice']; } else { $product['discount_price'] = CalculateDiscountPrice($product['product_price'], $product['product_price'], $relcats[0], $brandseries); $orderClass->GetCartApi()->SetItemValue($rowId, 'discount_price', $product['discount_price']); // $product['product_price'] = CalculateDiscountPrice($product['product_price'], $product['product_price'], $relcats[0], $brandseries); } $product['vendorprefix'] = $orderClass->GetProductVendorprefix($product['product_id']); $orderClass->GetCartApi()->SetItemValue($rowId, 'product_price', $product['product_price']); $response = array('productRow' => $orderClass->GenerateOrderItemRow($rowId, $product), 'orderSummary' => $orderClass->GenerateOrderSummaryTable(), 'productRowId' => $rowId); if ($_REQUEST['cartItemId'] != $rowId) { $response['removeRow'] = (string) $_REQUEST['cartItemId']; } } if (isset($_REQUEST['ajaxFormUpload'])) { echo '<textarea>' . isc_json_encode($response) . '</textarea>'; exit; } echo isc_json_encode($response); exit; }
/** * @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; }
function SetPanelSettings() { $output = ""; $all_makes = array('CHEVROLET', 'GMC', 'FORD', 'DODGE', 'TOYOTA', 'NISSAN', 'HONDA', 'JEEP', 'HYUNDAI', 'CHRYSLER', 'INFINITI', 'LEXUS'); $colours = array('Red', 'Navy', 'Green', 'Brown', 'Black', 'Silver', 'Dark Gray', 'Tan', 'White'); $prod_make = array(); $prod_model = array(); $prod_submodel = array(); $prod_year = array(); $prod_price = array(); $prod_categoryid = array(); $count_categoryid = array(); $brand_id = array(); $make_link = ""; $model_link = ""; $model_flag_link = 0; $submodel_link = ""; $year_link = ""; $sub_modelrow = array(); $GLOBALS['SITEPATH'] = GetConfig('ShopPath'); // Get the link to the "all brands" page $GLOBALS['AllBrandsLink'] = BrandLink(); $params = $this->searchterms; if (empty($params)) { $params['dynfilters'] = array(); } /*--- Here when brand series is searched directly , brand series is set in seesion to be accessed in other pages --- */ if (isset($params['series']) && !empty($params['series'])) { $_SESSION['absearchterms']['series'] = $params['series']; } // Build the search query using our terms & the fields we want $column_concat = " p.productid , p.prodcode , group_concat(DISTINCT c.categoryid separator '~') as categoryid, group_concat(DISTINCT prodbrandid separator '~') as prodbrandid "; $column_concat .= " , group_concat(DISTINCT v.prodmake separator '~') as prodmake , group_concat(DISTINCT v.prodmodel separator '~') as prodmodel , group_concat(DISTINCT v.prodsubmodel separator '~') as prodsubmodel , group_concat(v.prodstartyear separator '~') as prodstartyear , group_concat(v.prodendyear separator '~') as prodendyear "; if (isset($params['catuniversal']) && $params['catuniversal'] == 1) { // this condition has been added as universal category shd be shown only PQ's $column_names = $GLOBALS['p_cols']; for ($j = 0; $j < count($column_names); $j++) { if (isset($GLOBALS['visible_pqvq'][$column_names[$j]]) && $GLOBALS['visible_pqvq'][$column_names[$j]] == 1) { $column_concat .= " , group_concat(DISTINCT " . $column_names[$j] . " separator '~') as " . $column_names[$j]; } } } else { if (isset($params['make']) && !empty($params['make']) && (isset($params['model']) && !empty($params['model']) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) && isset($params['year']) && !empty($params['year']) && isset($GLOBALS['ISC_SRCH_CATG_ID'])) { $column_names = array_merge($GLOBALS['v_cols'], $GLOBALS['p_cols']); for ($j = 0; $j < count($column_names); $j++) { if (stristr($column_names[$j], 'VQbedsize')) { $column_names[$j] = 'VQbedsize'; } if (stristr($column_names[$j], 'VQcabsize')) { $column_names[$j] = 'VQcabsize'; } if (isset($GLOBALS['visible_pqvq'][$column_names[$j]]) && $GLOBALS['visible_pqvq'][$column_names[$j]] == 1) { if (eregi('^(vq)', $column_names[$j])) { // the below 2 cases are added for checking only in bedsize and cabsize if ($column_names[$j] == 'VQbedsize' or $column_names[$j] == 'VQcabsize') { if (strcasecmp($column_names[$j], 'VQbedsize') == 0) { $column_concat .= " , group_concat( DISTINCT if( v.bedsize_generalname != '', v.bedsize_generalname, v.VQbedsize ) separator '~' ) as " . $column_names[$j]; } else { $column_concat .= " , group_concat( DISTINCT if( v.cabsize_generalname != '', v.cabsize_generalname, v.VQcabsize ) separator '~' ) as " . $column_names[$j]; } } else { $column_concat .= " , group_concat(DISTINCT v." . $column_names[$j] . " separator '~') as " . $column_names[$j]; } } else { if (eregi('^(pq)', $column_names[$j])) { $column_concat .= " , group_concat(DISTINCT " . $column_names[$j] . " separator '~') as " . $column_names[$j]; } } } } } } $searchQueries = BuildProductSearchQuery($this->searchterms); $searchQueries['query'] = str_replace('USE INDEX (categoryid)', 'USE INDEX (PRIMARY)', $searchQueries['query']); //$searchQueries['query'] = str_replace('temp.*',$column_concat,$searchQueries['query']); $searchQueries['query'] = str_replace($GLOBALS['srch_where'], $column_concat, $searchQueries['query']); // lguan_20100513: If in product detail page, and search terms is empty, should use product id to limit the queries for brand, the original // query was killing the performance $showOtherBrandForDetail = false; if ($this->searchterms == '') { $searchQueries['query'] .= isset($GLOBALS['ISC_CLASS_PRODUCT']) && $GLOBALS['ISC_CLASS_PRODUCT']->_product['prodcatids'] ? ' AND c.categoryid IN (' . $GLOBALS['ISC_CLASS_PRODUCT']->_product['prodcatids'] . ')' : ''; $showOtherBrandForDetail = true; } $searchQueries['query'] .= " group by p.productid "; $searchQueries['query'] .= $GLOBALS['having_query']; $Search_Result1 = $GLOBALS['ISC_CLASS_DB']->Query($searchQueries['query']); $numrows = @(int) $GLOBALS['ISC_CLASS_DB']->CountResult($Search_Result1); $flag = 0; // this flag is used to avoid executing query again and again for submodels $filterdata = array(); $countfilterdata = array(); $sku = array(); $count_model = array(); $count_submodel['all']['count'] = 0; $sub_model_flag = 0; $sub_catg = ""; if (!isset($params['model_flag']) || isset($params['model_flag']) && $params['model_flag'] == 1) { $model_flag_link = 1; } $strtocheck = '^(vq|pq)'; if (isset($params['subcategory'])) { $sub_catg = "&subcategory=" . MakeURLSafe(strtolower($params['subcategory'])); } if (isset($params['series'])) { $sub_catg .= "&series=" . MakeURLSafe(strtolower($params['series'])); } if (isset($params['category'])) { $sub_catg .= "&category=" . MakeURLSafe(strtolower($params['category'])); } while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($Search_Result1)) { $temp_prod_year = array(); $grp_make = explode("~", $row['prodmake']); $grp_model = explode("~", $row['prodmodel']); if ($row['prodsubmodel'] != '~') { $grp_submodel = explode("~", $row['prodsubmodel']); } else { $grp_submodel = array(); } $grp_startyear = explode("~", $row['prodstartyear']); $grp_endyear = explode("~", $row['prodendyear']); $grp_brandid = explode("~", $row['prodbrandid']); $grp_categoryid = explode("~", $row['categoryid']); $columns = array_keys($row); foreach ($row as $key => $qval) { if (eregi($strtocheck, $key)) { $qval = trim($qval, '~'); $qval = strtolower($qval); $grp_dyn = preg_split('/[~;]+/', $qval); $grp_dyn = array_unique($grp_dyn); $grp_dyn = array_values($grp_dyn); for ($g = 0; $g < count($grp_dyn); $g++) { $val = settype($val, "string"); $val = strtolower($grp_dyn[$g]); if ($val == '') { //Added by Simha $val = "Others"; } if (!empty($val)) { /*$filter_value = explode(";",$val); for($k=0;$k<count($filter_value);$k++) {*/ //$val = $filter_value[$k]; if ($val != "") { if (!isset($filterdata[$key])) { $filterdata[$key][] = $val; $countfilterdata[$key][$val]['count'] = 1; } else { if (!in_array($val, $filterdata[$key], true)) { $filterdata[$key][] = $val; $countfilterdata[$key][$val]['count'] = 1; } else { $countfilterdata[$key][$val]['count']++; } } } //} } } } } $prod_id[] = $row['productid']; for ($g = 0; $g < count($grp_brandid); $g++) { if ($grp_brandid[$g] != 0) { $brand_id[] = $grp_brandid[$g]; } } for ($g = 0; $g < count($grp_categoryid); $g++) { if ($grp_categoryid[$g] != "") { if (!in_array($grp_categoryid[$g], $prod_categoryid)) { $prod_categoryid[] = $grp_categoryid[$g]; $count_categoryid[$grp_categoryid[$g]]['count'] = 1; } else { $count_categoryid[$grp_categoryid[$g]]['count']++; } } } for ($g = 0; $g < count($grp_make); $g++) { if ($grp_make[$g] != '') { $product_make = strtoupper($grp_make[$g]); if ($product_make != "NON-SPEC VEHICLE") { // this condition is addded not to show "NON-SPEC VEHICLE" in list if (!in_array($product_make, $prod_make)) { $prod_make[] = $product_make; $count_make[$product_make]['count'] = 1; } else { $count_make[$product_make]['count']++; } } } } for ($g = 0; $g < count($grp_model); $g++) { if (strtolower($grp_model[$g]) != 'all') { // this condition is added not to show "All" in list $sub_model_flag = 1; $grp_model[$g] = strtoupper($grp_model[$g]); if (!in_array($grp_model[$g], $prod_model)) { $prod_model[] = $grp_model[$g]; $count_model[$grp_model[$g]]['count'] = 1; } else { $count_model[$grp_model[$g]]['count']++; } } } if (count($grp_submodel) > 0) { for ($g = 0; $g < count($grp_submodel); $g++) { if (!empty($grp_submodel[$g])) { $sub_model_flag = 1; $grp_submodel[$g] = ucwords(strtolower($grp_submodel[$g])); if (!in_array($grp_submodel[$g], $prod_submodel)) { $prod_submodel[] = $grp_submodel[$g]; $count_submodel[$grp_submodel[$g]]['count'] = 1; } else { $count_submodel[$grp_submodel[$g]]['count']++; } } } } else { if (!in_array('all', $prod_submodel)) { $count_submodel['all']['count'] = 1; } else { $count_submodel['all']['count']++; } } for ($g = 0; $g < count($grp_startyear); $g++) { $prod_start_year = $grp_startyear[$g]; $prod_end_year = $grp_endyear[$g]; if (empty($prod_end_year)) { $prod_end_year = $prod_start_year; } if (strtolower($prod_start_year) != "all") { // this condition is addded not to show "All" in list if (is_numeric($prod_start_year) && is_numeric($prod_end_year)) { $prod_year_diff = $prod_end_year - $prod_start_year; } if (!is_numeric($prod_start_year) && !is_numeric($prod_end_year)) { if (!in_array($prod_start_year, $temp_prod_year)) { $temp_prod_year[] = $prod_start_year; } } else { if (isset($params['year']) && !empty($params['year'])) { if (in_array($params['year'], $prod_year)) { $count_year[$params['year']]['count']++; } else { $prod_year[] = $params['year']; $count_year[$params['year']]['count'] = 1; } } else { for ($i = 0; $i <= $prod_year_diff; $i++) { $actual_year = $prod_start_year + $i; if (!in_array($actual_year, $temp_prod_year)) { $temp_prod_year[] = $actual_year; } } } } } } for ($k = 0; $k < count($temp_prod_year); $k++) { if (!in_array($temp_prod_year[$k], $prod_year)) { $prod_year[] = $temp_prod_year[$k]; $count_year[$temp_prod_year[$k]]['count'] = 1; } else { $count_year[$temp_prod_year[$k]]['count']++; } } } //Added by Simha // for removing if it has only others in qualifier values foreach ($countfilterdata as $key => $value) { if (isset($value['Others']) && count($value) == 1 && !isset($params['dynfilters'][$key])) { unset($countfilterdata[$key]); unset($filterdata[$key]); } } foreach ($filterdata as $key => $num) { $keys = array_keys($num, 'Others'); if (isset($keys) && count($keys) == 1) { unset($num[$keys[0]]); $num[] = 'Others'; } $num = array_values($num); $filterdata[$key] = $num; } //Added by Simha Ends $prod_make_new = array_unique($prod_make); asort($prod_make_new); $prod_model_new = array_unique($prod_model); asort($prod_model_new); $prod_submodel_new = array_unique($prod_submodel); sort($prod_submodel_new); $prod_year_new = array_unique($prod_year); arsort($prod_year_new); $srch_qry = isset($params['search_query']) ? $params['search_query'] : (isset($params['search_query_adv']) ? $params['search_query_adv'] : ''); $srch_qry = MakeURLSafe($srch_qry); $brand_id = array_unique($brand_id); $brand_id = array_values($brand_id); $GLOBALS['SearchBrands'] = $brand_id; // This variable is used in searchpage.php for displaying brands. $GLOBALS['SearchCategories'] = $prod_categoryid; // This variable is used in searchpage.php for displaying categories. if (isset($params['make']) && !empty($params['make'])) { $make_link = "&make=" . MakeURLSafe($params['make']); } if (isset($params['year']) && !empty($params['year'])) { $year_link = "&year=" . $params['year']; } if (isset($params['model']) && !empty($params['model'])) { $model_link = "&model=" . MakeURLSafe($params['model']); } if (isset($params['model_flag']) && $params['model_flag'] == 0) { $model_link .= "&model_flag=0"; } if (isset($params['submodel']) && !empty($params['submodel'])) { $submodel_link = "&submodel=" . MakeURLSafe($params['submodel']); } if (isset($params['partnumber'])) { $_GET['partnumber'] = $params['partnumber']; } $query_string_array = $_GET; if (isset($params['make'])) { $query_string_array['make'] = $params['make']; } if (isset($params['model'])) { $query_string_array['model'] = $params['model']; } if (isset($params['model_flag']) && $params['model_flag'] == 0) { $query_string_array['model_flag'] = $params['model_flag']; } if (isset($params['submodel'])) { $query_string_array['submodel'] = $params['submodel']; } if (isset($params['year'])) { $query_string_array['year'] = $params['year']; } if (isset($params['brand'])) { $query_string_array['brand'] = $params['brand']; } if (isset($params['series'])) { $query_string_array['series'] = $params['series']; } if (isset($params['subcategory'])) { $query_string_array['subcategory'] = $params['subcategory']; } if (isset($params['category'])) { $query_string_array['category'] = $params['category']; } if (isset($params['search'])) { $query_string_array['searchtext'] = $params['search']; } if (isset($params['searchtext'])) { $query_string_array['searchtext'] = $params['searchtext']; } if (isset($params['vqsbedsize'])) { $query_string_array['vqsbedsize'] = $params['vqsbedsize']; } if (isset($params['vqscabsize'])) { $query_string_array['vqscabsize'] = $params['vqscabsize']; } foreach ($params['dynfilters'] as $key => $value) { $key = strtolower($key); $query_string_array[$key] = $value; } $query_string_array['search_query'] = $srch_qry; unset($query_string_array['page'], $query_string_array['search_key'], $query_string_array['x'], $query_string_array['y'], $query_string_array['sortby'], $query_string_array['orderby'], $query_string_array['change'], $query_string_array['product'], $query_string_array['refer']); $mmy_string_array = $query_string_array; unset($mmy_string_array['make'], $mmy_string_array['model'], $mmy_string_array['submodel'], $mmy_string_array['year'], $mmy_string_array['search_query']); $mmy_string_new1 = ""; foreach ($mmy_string_array as $mmy_key => $mmy_val) { $mmy_string_new1 .= "&" . $mmy_key . "=" . $mmy_val; } $dyn_filter = ""; // this is the main variable which is used for assigning to the global variable $dyn_top = ""; // this is the variable which will remain on top of the filters $dyn_bottom = ""; // this is the variable which will remain at bottom of the filters $dyn_flag = 0; // this is the variable which will check which are at top or bottom in the filters, 0 for top and 1 for bottom /* The below code will be added to redefine search as we need to pass 'a-b-testing' in all URL's for redefine search */ $add_url_redefine = "&abtesting=" . MakeURLSafe(strtolower($GLOBALS['PathInfo'][1])); if (isset($params['make']) || isset($params['make']) && isset($params['model']) && $model_flag_link == 1 || isset($params['year'])) { $mmy_clear_links = $this->path . "/search.php?search_query=" . urlencode($params['search_query']) . $sub_catg; if (isset($params['brand'])) { $mmy_clear_links .= "&brand=" . $params['brand']; } $clear_mmy_filter_link = $this->GetClearFilterlink($query_string_array, 0); $GLOBALS['DynMsg'] = "<a href='#' onclick=\"deleteMMYcookies('" . $this->path . $clear_mmy_filter_link . "');\">Clear my Vehicle</a>"; $GLOBALS['RemoveBackgroundImage'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("RemoveBgImage"); } if (isset($params['make']) && (isset($params['model']) && $model_flag_link == 1) && isset($params['year']) && !isset($_REQUEST['change'])) { // if MMY is selected $GLOBALS['MyVehicleAreaHeader'] = $params['year'] . " " . $params['make'] . " " . $params['model']; $GLOBALS['DynmenuFilter'] = ""; } else { $GLOBALS['MyVehicleAreaHeader'] = "Choose My Vehicle"; $GLOBALS['DynmenuFilter'] = ""; } /*-------- Year -----------------------------------------*/ $GLOBALS['MouseoverFn'] = "this.style.cursor='pointer'"; $extra_year = ""; //if( !empty($make_link) || !empty($year_link) || !empty($model_link) ) { if (empty($year_link) || !empty($year_link)) { $GLOBALS['dynid'] = "prod_year"; $GLOBALS['Dynmainmenu'] = "Year"; $output2 = ""; $year_counter = 1; if (count($prod_year_new) > 0) { foreach ($prod_year_new as $key => $value) { if (!isset($_REQUEST['change'])) { // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry; } else { $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}"; } if (!empty($make_link)) { $GLOBALS['BrandLink'] .= $make_link; } if (!empty($model_link)) { $GLOBALS['BrandLink'] .= $model_link; } if (!empty($submodel_link) && isset($_REQUEST['submodel'])) { $GLOBALS['BrandLink'] .= $submodel_link; } if (!empty($year_link)) { $GLOBALS['BrandLink'] .= $year_link; } else { $GLOBALS['BrandLink'] .= "&year=" . $value; } $GLOBALS['BrandLink'] .= $mmy_string_new1; $GLOBALS['BrandLink'] .= $sub_catg; $GLOBALS['BrandName'] = isc_html_escape($value); $GLOBALS['BrandCount'] = $count_year[$value]['count']; if (!empty($year_link)) { if ($GLOBALS['BrandName'] == 'ALL' && $GLOBALS['BrandName'] != $params['year']) { $GLOBALS['BrandName'] = $params['year']; //$output2 .= "<li>".$params['year']."</li>"; $output2 .= "<li></li>"; } else { $GLOBALS['BrandName'] = $params['year']; //$output2 .= "<li>$value</li>"; $output2 .= "<li></li>"; } $dyn_flag = 1; break; // break has been added to display only single listing. } else { $dyn_flag = 0; if ($year_counter < 11) { $output2 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter3"); $year_counter++; } else { $extra_year .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter3"); } } } } else { if (isset($params['year'])) { $dyn_flag = 1; $GLOBALS['BrandName'] = $params['year']; $output2 .= "<li>" . $params['year'] . "</li>"; } } $output2 = "<ul>" . $output2 . "</ul>"; /* the below code is used to apply more link if records exceed 10 */ if ($year_counter > 11) { $GLOBALS['FilterID'] = "year"; $GLOBALS['ExtraValues'] = $extra_year; $output2 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink"); } $output2 = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output2, $GLOBALS['SNIPPETS']); //if( !empty($_REQUEST['year']) && !empty($year_link) ) { $links_year = $srch_qry; if (!empty($year_link)) { $links_year .= $year_link; } if (!empty($make_link)) { $links_year .= $make_link; } if (!empty($model_link) && isset($_REQUEST['model'])) { $links_year .= $model_link; } /*if( !empty($submodel_link) && isset($_REQUEST['submodel'])) { $links_year .= $submodel_link; }*/ if (isset($params['brand'])) { $links_year .= "&brand=" . MakeURLSafe($params['brand']); } if (isset($params['search'])) { $links_year .= "&searchtext=" . MakeURLSafe(strtolower($params['search'])); } if (isset($params['searchtext'])) { $links_year .= "&searchtext=" . MakeURLSafe(strtolower($params['searchtext'])); } if (isset($params['vqsbedsize'])) { $links_year .= "&vqsbedsize=" . MakeURLSafe($params['vqsbedsize']); } if (isset($params['vqscabsize'])) { $links_year .= "&vqscabsize=" . MakeURLSafe($params['vqscabsize']); } $links_year .= $this->GetOtherLinksForRedefine($params); $links_year .= $add_url_redefine; /* this below lines are not to display the year when clear is clicked */ if (isset($_REQUEST['change'])) { $GLOBALS['BrandName'] = ""; } if ($dyn_flag == 1 || isset($_REQUEST['change'])) { $str = "search_query=" . $links_year . $sub_catg . "&column=year"; $GLOBALS['Dyndisplay1'] = "block"; $GLOBALS['Dyndisplay'] = "none"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); //$GLOBALS['DynFilterArrow'] .= " ".$GLOBALS['BrandName']; $GLOBALS['DynmenuFilter1'] = $output2; $GLOBALS['DynmenuFilter'] = ""; $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1');checkanimate('" . $GLOBALS['dynid'] . "')"; } else { $GLOBALS['BrandName'] = ""; $GLOBALS['Dyndisplay1'] = "none"; $GLOBALS['Dyndisplay'] = "block"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter'] = $output2; $GLOBALS['DynmenuFilter1'] = ""; $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')"; if (empty($year_link)) { $GLOBALS['DynmenuFilter'] = ""; $str = "search_query=" . $links_year . $sub_catg . "&column=year"; $GLOBALS['JSfunction'] .= ";getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1')"; } } $GLOBALS['mmyid'] = "mmy_year"; $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch"); $dyn_filter = $dyn_output; //$GLOBALS['SNIPPETS']['SideProductFilter3'] = $output2; } else { $GLOBALS['HideSideProductFiltersPanelYear'] = "none"; } if ($dyn_flag == 1 && !isset($_REQUEST['change'])) { $dyn_top .= $dyn_filter; } else { $dyn_top .= $dyn_filter; } $dyn_filter = ""; /*-------- Make -----------------------------------------*/ $GLOBALS['dynid'] = "prod_make"; $GLOBALS['Dynmainmenu'] = "Make"; if (isset($make_link) && !empty($make_link)) { if (count($prod_make_new) > 0) { foreach ($prod_make_new as $key => $value) { if (!isset($_REQUEST['change'])) { // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value; } else { $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value; } if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) { $GLOBALS['BrandLink'] .= "&model="; } if (isset($_REQUEST['year'])) { $GLOBALS['BrandLink'] .= "&year=" . $_REQUEST['year']; } $GLOBALS['BrandLink'] .= $sub_catg; $GLOBALS['BrandName'] = strtoupper($value); /* this below patch is temporary used when categories with make 'NON-SPEC VEHICLE' are used when searched by redefine category */ if (isset($params['catuniversal']) && $params['catuniversal'] == 1 || $GLOBALS['BrandName'] == 'NON-SPEC VEHICLE' && $GLOBALS['BrandName'] != $params['make']) { $GLOBALS['BrandName'] = $params['make']; } if (isset($count_make[$value]['count'])) { $GLOBALS['BrandCount'] = $count_make[$value]['count']; } else { $GLOBALS['BrandCount'] = 0; } $output .= "<li></li>"; break; // break has been added to display only single listing. } } else { if (isset($params['make'])) { $GLOBALS['BrandName'] = strtoupper($params['make']); $output .= "<li></li>"; // $output .= "<li>".$_REQUEST['make']."</li>"; } } $dyn_flag = 1; $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']); } else { $dyn_flag = 0; $temp_arr = array_diff($prod_make_new, $all_makes); $temp_count_make = ""; $temp_no_count_make = ""; $display_count = 1; foreach ($all_makes as $key => $value) { if (!isset($_REQUEST['change'])) { // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value; } else { $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value; } if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) { $GLOBALS['BrandLink'] .= "&model="; } if (isset($params['year'])) { $GLOBALS['BrandLink'] .= "&year=" . $params['year']; } $GLOBALS['BrandLink'] .= $mmy_string_new1; $GLOBALS['BrandLink'] .= $sub_catg; $GLOBALS['BrandName'] = isc_html_escape($value); if (isset($count_make[$value]['count'])) { $GLOBALS['BrandCount'] = $count_make[$value]['count']; } else { $GLOBALS['BrandCount'] = 0; } /*if($GLOBALS['BrandCount'] == 0) $temp_no_count_make .= "<li>$GLOBALS[BrandName] ($GLOBALS[BrandCount])</li>";*/ if ($GLOBALS['BrandCount'] != 0) { if ($display_count < 13) { // this condiditon is applied to avoid long listing of make lsit $temp_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } else { $temp_no_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } $display_count++; //$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } } if (count($temp_arr) > 0) { foreach ($temp_arr as $key => $value) { if (!isset($_REQUEST['change'])) { // when clicked on "clear my vehicle", need to pass the value in the search query to get all Make and year $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query=" . $srch_qry . "&make=" . $value; } else { $GLOBALS['BrandLink'] = "{$this->path}/search.php?search_query={$value}&make=" . $value; } if (isset($_REQUEST['model']) && empty($_REQUEST['model'])) { $GLOBALS['BrandLink'] .= "&model="; } if (isset($params['year'])) { $GLOBALS['BrandLink'] .= "&year=" . $params['year']; } $GLOBALS['BrandName'] = isc_html_escape($value); if (isset($count_make[$value]['count'])) { $GLOBALS['BrandCount'] = $count_make[$value]['count']; } else { $GLOBALS['BrandCount'] = 0; } $GLOBALS['BrandLink'] .= $mmy_string_new1; $GLOBALS['BrandLink'] .= $sub_catg; /*if($GLOBALS['BrandCount'] == 0) $temp_no_count_make .= "<li>$GLOBALS[BrandName] ($GLOBALS[BrandCount])</li>";*/ if ($GLOBALS['BrandCount'] != 0) { if ($display_count < 13) { // this condiditon is applied to avoid long listing of make list $temp_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } else { $temp_no_count_make .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } $display_count++; } } } $output = "<ul>{$temp_count_make}</ul>"; if ($display_count > 13) { $GLOBALS['FilterID'] = "make"; $GLOBALS['ExtraValues'] = $temp_no_count_make; $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink"); //$output .= "<ul class='more'><li><a href=\"javascript:onclick=show_hide('make')\" id='make_more'>More...</a></li></ul>"; } $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']); } /* this below lines are not to display the make when clear is clicked */ if (isset($_REQUEST['change'])) { $GLOBALS['BrandName'] = ""; } if ($dyn_flag == 1 || isset($_REQUEST['change'])) { //$str = "search_query=".$srch_qry.$make_link."&model=".$year_link.$sub_catg."&column=make"; $GLOBALS['Dyndisplay1'] = "block"; $GLOBALS['Dyndisplay'] = "none"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); //$GLOBALS['DynFilterArrow'] .= " ".$GLOBALS['BrandName']; $GLOBALS['DynmenuFilter1'] = "<ul>" . $output . "</ul>"; $GLOBALS['DynmenuFilter'] = ""; //$GLOBALS['JSfunction'] = "getvalueswithajax('".$GLOBALS['dynid']."','$str');checkanimate('".$GLOBALS['dynid']."')"; //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; } else { $GLOBALS['BrandName'] = ""; $GLOBALS['Dyndisplay1'] = "none"; $GLOBALS['Dyndisplay'] = "block"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter'] = $output; $GLOBALS['DynmenuFilter1'] = ""; //$GLOBALS['JSfunction'] = "checkanimate('".$GLOBALS['dynid']."')"; if (empty($make_link)) { $GLOBALS['DynmenuFilter'] = ""; } } $str = "search_query=" . $srch_qry . $make_link . "&model=" . $year_link . $sub_catg . "&column=make"; if (isset($params['brand'])) { $str .= "&brand=" . $params['brand']; } if (isset($params['search'])) { $str .= "&searchtext=" . MakeURLSafe(strtolower($params['search'])); } if (isset($params['searchtext'])) { $str .= "&searchtext=" . MakeURLSafe(strtolower($params['searchtext'])); } if (isset($params['vqsbedsize'])) { $str .= "&vqsbedsize=" . MakeURLSafe($params['vqsbedsize']); } if (isset($params['vqscabsize'])) { $str .= "&vqscabsize=" . MakeURLSafe($params['vqscabsize']); } $str .= $this->GetOtherLinksForRedefine($params); $str .= $add_url_redefine; $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1');checkanimate('" . $GLOBALS['dynid'] . "')"; $GLOBALS['mmyid'] = "mmy_make"; $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch"); $dyn_filter = $dyn_output; if ($dyn_flag == 1 && !isset($_REQUEST['change'])) { $dyn_top .= $dyn_filter; } else { $dyn_top .= $dyn_filter; } $dyn_filter = ""; //$GLOBALS['SNIPPETS']['SideProductFilter1'] = $output; /*-------- Model - Starts -----------------------------------------*/ $GLOBALS['dynid'] = "prod_model"; $GLOBALS['Dynmainmenu'] = 'Model'; $output1 = ""; $display_count = 1; $extra = ""; if (isset($params['make'])) { // if make is selected then need to enter the loop if (isset($params['model']) && $model_flag_link == 1) { // if make is selected need to show only that make $GLOBALS['BrandName'] = strtoupper($params['model']); $dyn_flag = 1; } else { $dyn_flag = 0; $model_string_array = $query_string_array; unset($model_string_array['model_flag'], $model_string_array['model']); $ymm_links = $this->GetYMMLinks($model_string_array); $ymm_links .= $this->GetOtherLinks($params); foreach ($prod_model_new as $key => $value) { if ($GLOBALS['EnableSEOUrls'] == 0) { $GLOBALS['BrandLink'] = $this->path . "/search.php?search_query=" . $srch_qry; $GLOBALS['BrandLink'] .= $ymm_links; $GLOBALS['BrandLink'] .= "&model=" . $value; } else { $GLOBALS['BrandLink'] = $this->path; if ($srch_qry != "") { $GLOBALS['BrandLink'] .= "/" . $srch_qry; } $GLOBALS['BrandLink'] .= $ymm_links; $GLOBALS['BrandLink'] .= "/model/" . MakeURLSafe(strtolower($value)); } $GLOBALS['BrandName'] = isc_html_escape($value); $GLOBALS['BrandCount'] = $count_model[$value]['count']; if ($display_count < 11) { $output1 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter2"); } else { $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter2"); } $display_count++; } $output1 = "<ul>" . $output1 . "</ul>"; if ($display_count > 11) { $GLOBALS['FilterID'] = "model"; $GLOBALS['ExtraValues'] = $extra; $output1 .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink"); } } /* the below links are passes for redefine search - starts*/ $links = $srch_qry; $links .= $make_link; $links .= $year_link; if (isset($params['model']) && $model_flag_link == 1) { $links .= $model_link; } $links .= $sub_catg; if (isset($params['brand'])) { $links .= "&brand=" . MakeURLSafe($params['brand']); } if (isset($params['search'])) { $links .= "&searchtext=" . MakeURLSafe(strtolower($params['search'])); } if (isset($params['searchtext'])) { $links .= "&searchtext=" . MakeURLSafe(strtolower($params['searchtext'])); } if (isset($params['vqsbedsize'])) { $links .= "&vqsbedsize=" . MakeURLSafe(strtolower($params['vqsbedsize'])); } if (isset($params['vqscabsize'])) { $links .= "&vqscabsize=" . MakeURLSafe(strtolower($params['vqscabsize'])); } $links .= $this->GetOtherLinksForRedefine($params); $links .= "&column=model"; $links .= $add_url_redefine; /* the below links are passes for redefine search - ends*/ /* this below lines are not to display the make when clear is clicked */ if (isset($_REQUEST['change'])) { $GLOBALS['BrandName'] = ""; } if ($dyn_flag == 1 || isset($_REQUEST['change'])) { $GLOBALS['Dyndisplay1'] = "block"; $GLOBALS['Dyndisplay'] = "none"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter1'] = $output1; $GLOBALS['DynmenuFilter'] = ""; $str = "search_query=" . $links; if (!isset($_REQUEST['change'])) { $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1');checkanimate('" . $GLOBALS['dynid'] . "')"; } else { $GLOBALS['mousedefaultpointer'] = "mousedefaultpointer"; $GLOBALS['JSfunction'] = ""; } } else { $GLOBALS['BrandName'] = ""; $GLOBALS['Dyndisplay1'] = "none"; $GLOBALS['Dyndisplay'] = "block"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynmenuFilter'] = ""; if (isset($params['model_flag']) && $params['model_flag'] == 0 && (!isset($params['catuniversal']) || $params['catuniversal'] == 0)) { $GLOBALS['DynmenuFilter'] = $output1; $GLOBALS['dynidStyle'] = "style='display:block'"; $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif"; } $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter1'] = ""; $str = "search_query=" . $links; $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}&getymms=1');checkanimate('" . $GLOBALS['dynid'] . "')"; } } else { $GLOBALS['BrandName'] = ""; $GLOBALS['mousedefaultpointer'] = "mousedefaultpointer"; $GLOBALS['DynmenuFilter'] = ""; $GLOBALS['JSfunction'] = ""; } $GLOBALS['mmyid'] = "mmy_model"; $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleAreaSearch"); $dyn_filter = $dyn_output; $dyn_top .= $dyn_filter; $dyn_filter = ""; /*-------- Model - Ends -----------------------------------------*/ $filter1 = <<<P1 <div class="Block BrandList Moveable" id="SideProductFilters" style=""> P1; $filter2 = <<<P1 <div class="BlockContent"> <ul> P1; $filter3 = <<<P3 </ul> </div> </div> P3; $GLOBALS['MyVehicleArea'] = $dyn_top; $GLOBALS['MyVehicleArea'] .= "<p id='fit'>Guaranteed to Fit Your Vehicle!</p>"; if (isset($GLOBALS['DynMsg'])) { $GLOBALS['MyVehicleArea'] .= "<ul id='modifyvehicle'><li>" . $GLOBALS['DynMsg'] . "</li></ul>"; } if (isset($params['srch_category']) || isset($params['brand']) || isset($params['submodel'])) { $clear_filter_below_link = $this->GetClearFilterlink($query_string_array, 1); if ($clear_filter_below_link != "/") { $clear_filter_below_link = "/" . MakeURLSafe(strtolower($GLOBALS['PathInfo'][1])) . $clear_filter_below_link; } $GLOBALS['MyVehicleArea'] .= "<ul id='modifyvehicle'><li><a href='" . $this->path . "{$clear_filter_below_link}' "; if ($clear_filter_below_link == '/') { $GLOBALS['MyVehicleArea'] .= "onclick='return clearOtherFilters();'"; } $GLOBALS['MyVehicleArea'] .= " >Clear All Filters Below</a></li></ul>"; } if (isset($params['search'])) { $GLOBALS['QualiferValue'] = ""; if (isset($params['vqsbedsize'])) { $GLOBALS['QualiferValue'] .= "/vqsbedsize/" . MakeURLSafe(strtolower($params['vqsbedsize'])) . "/"; } if (isset($params['vqscabsize'])) { $GLOBALS['QualiferValue'] .= "/vqscabsize/" . MakeURLSafe(strtolower($params['vqscabsize'])) . "/"; } $GLOBALS['QualiferValue'] .= $this->GetOtherLinks($params); $GLOBALS['QualiferValue'] = trim($GLOBALS['QualiferValue'], "/"); if (trim($GLOBALS['QualiferValue']) != "") { $GLOBALS['QualiferValue'] = " var SearchQualVal = '" . $GLOBALS['QualiferValue'] . "/'; "; } $GLOBALS['QualiferValue'] .= " var SearchStringVal = '" . MakeURLSafe(strtolower($params['search'])) . "/'; "; } $dyn_top = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("MyVehicleArea"); /************** Category Listing ********************/ $str = "search_query=" . $srch_qry . $make_link . $model_link . $year_link . "&column=categories"; //$str .= isset($params['brand']) ? "&brand=".MakeURLSafe($params['brand']) : ''; $str .= isset($GLOBALS['ISC_SRCH_CATG_NAME']) ? "&catg_name=" . MakeURLSafe($GLOBALS['ISC_SRCH_CATG_NAME']) : ''; $str .= isset($params['search']) ? "&searchtext=" . MakeURLSafe($params['search']) : ''; $str .= isset($params['searchtext']) ? "&searchtext=" . MakeURLSafe($params['searchtext']) : ''; $str .= isset($params['vqsbedsize']) ? "&vqsbedsize=" . MakeURLSafe($params['vqsbedsize']) : ''; $str .= isset($params['vqscabsize']) ? "&vqscabsize=" . MakeURLSafe($params['vqscabsize']) : ''; $str .= $this->GetOtherLinksForRedefine($params); $str .= $add_url_redefine; $dyn_top .= $this->GetCategoryListing($prod_categoryid, $count_categoryid, $str, (int) $numrows); /*------------ Brand Filter --------------------*/ if (count($brand_id) > 0 || isset($params['brand'])) { $title = "<h2>Brand</h2>"; //$dyn_filter .= $filter1.$title.$filter2; $brand_link = ""; $GLOBALS['dynid'] = "dyn_brand"; $GLOBALS['Dynmainmenu'] = "Brand"; $count_brand = 1; $extra = ""; $str = ""; $brand_string_array = $query_string_array; unset($brand_string_array['brand'], $brand_string_array['series'], $brand_string_array['search_query']); $get_mmy_links = ""; $brand_string_new1 = ""; if (isset($GLOBALS['ISC_SRCH_CATG_NAME'])) { $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['PathInfo'][1])); $brand_string_new1 .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME'])); } /*else if(isset($GLOBALS['ISC_SRCH_BRAND_NAME'])) $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME']));*/ if ($get_mmy_links != "") { if ($GLOBALS['EnableSEOUrls'] == 1) { $get_mmy_links = "/" . $get_mmy_links; } } /* this condition was added when brand & catg is selected and for clear functionality, no need to pass the $params['category'] */ if (isset($params['brand']) && isset($params['category']) && strtolower($params['category']) == strtolower($GLOBALS['ISC_SRCH_CATG_NAME'])) { unset($brand_string_array['category']); } $get_mmy_links .= $this->GetYMMLinks($brand_string_array); $get_mmy_links .= $this->GetOtherLinks($params); foreach ($brand_string_array as $br_key => $br_val) { $brand_string_new1 .= "&" . $br_key . "=" . MakeURLSafe($br_val); } //$brand_string_new1 .= $sub_catg; if (isset($params['brand']) && !empty($params['brand'])) { $dyn_flag = 1; $params['brand'] = ucwords(strtolower($params['brand'])); $dyn_filter .= <<<P2 <li><img src='{$this->path}/templates/default/images/check.gif'> {$params['brand']}</li> P2; if (strtolower($params['brand']) == strtolower(urldecode($srch_qry))) { // if searched only by brand $brandclearurl = "{$this->path}/search.php?search_query=brands"; $str = "search_query="; } else { // if searched with other combinations $search_query = trim(str_ireplace($params['brand'], '', MakeURLNormal($srch_qry))); $brandclearurl = "{$this->path}/search.php?search_query=" . MakeURLSafe($search_query); $str = "search_query="; /* the below condition is added not to add the category name again as it is being added in $brand_string_new1 at the top */ if (strtolower($search_query) != strtolower(isset($GLOBALS['ISC_SRCH_CATG_NAME']) ? $GLOBALS['ISC_SRCH_CATG_NAME'] : '')) { $str .= MakeURLSafe($search_query); } } $str .= $brand_string_new1 . "&brand=" . MakeURLSafe($params['brand']) . "&column=prodbrandid"; $str .= $this->GetOtherLinksForRedefine($params); $str .= $add_url_redefine; if (!empty($brand_string_new1)) { $brandclearurl .= $brand_string_new1; } $GLOBALS['ClearURL'] = "<a href='" . $this->LeftClearLink($get_mmy_links) . "'>Clear</a>"; } else { $other_brands = ""; // this variables is used to show brand list in "other brands" $dyn_flag = 0; $brand_query = "select distinct brandid , brandname from [|PREFIX|]brands b inner join [|PREFIX|]products p on b.brandid = p.prodbrandid order by brandname asc "; $brand_result = $GLOBALS['ISC_CLASS_DB']->Query($brand_query); while ($brand_row = $GLOBALS['ISC_CLASS_DB']->Fetch($brand_result)) { if (in_array($brand_row['brandid'], $brand_id)) { $GLOBALS['BrandName'] = $brand_row['brandname']; $search_query = $srch_qry; if (urldecode($srch_qry) == 'brands' || urldecode($srch_qry) == 'categories') { $search_query = MakeURLSafe($GLOBALS['BrandName']); } //$GLOBALS['BrandLink'] = "$this->path/search.php?search_query=$search_query$brand_string_new1&brand=".$brand_row['brandid']; if (!isset($GLOBALS['ISC_SRCH_CATG_NAME'])) { if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['BrandLink'] = $this->path . "/" . MakeURLSafe(strtolower($brand_row['brandname'])) . $get_mmy_links; } else { $GLOBALS['BrandLink'] = $this->path . "/search.php?search_query=" . MakeURLSafe($brand_row['brandname']) . $get_mmy_links; } } else { $GLOBALS['BrandLink'] = $this->LeftLink($get_mmy_links, 'brand', strtolower($brand_row['brandname'])); } if ($count_brand < 11) { $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } else { $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } $count_brand++; } else { $ymm_links_for_brands = $this->GetClearFilterlink($params, 1); $ymm_links_for_brands = rtrim($ymm_links_for_brands, "/"); $GLOBALS['BrandName'] = $brand_row['brandname']; if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['BrandLink'] = $this->LeftLink($get_mmy_links, 'brand', strtolower($brand_row['brandname'])); //$GLOBALS['BrandLink'] = $this->path."/".MakeURLSafe(strtolower($brand_row['brandname'])).$ymm_links_for_brands; } else { $ymm_links_for_brands = str_replace('categories', MakeURLSafe(strtolower($brand_row['brandname'])), $ymm_links_for_brands); $GLOBALS['BrandLink'] = $this->path . $ymm_links_for_brands; } $other_brands .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } } $dyn_filter = "<ul>" . $dyn_filter . "</ul>"; if ($count_brand > 11) { $GLOBALS['FilterID'] = "brand"; $GLOBALS['ExtraValues'] = $extra; $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink"); } // lguan_20100513: Added a condition to show other brand when user enter the product detail page without any search teams in session, // So that the other brands will be available for user if ($other_brands != "" && (isset($params['srch_category']) || $showOtherBrandForDetail)) { $GLOBALS['OtherBrands'] = $other_brands; $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("OtherBrands"); } //$GLOBALS['ClearURL'] = "$this->path/search.php?search_query=$srch_qry$brand_string_new1"; $GLOBALS['ClearURL'] = ""; } if ($dyn_flag == 1) { //$str = "search_query=".$links.$model_link."&column=model"; $GLOBALS['Dyndisplay1'] = "showlist"; $GLOBALS['Dyndisplay'] = "hidelist"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter1'] = $dyn_filter; $GLOBALS['DynmenuFilter'] = ""; $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')"; //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; } else { $GLOBALS['Dyndisplay1'] = "hidelist"; $GLOBALS['Dyndisplay'] = "showlist"; $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter'] = $dyn_filter; $GLOBALS['DynmenuFilter1'] = ""; $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')"; } $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductDynFilter"); $dyn_filter = $dyn_output; if ($dyn_flag == 1) { $dyn_bottom .= $dyn_filter; } else { $dyn_top .= $dyn_filter; } $dyn_filter = ""; } /*------------ Brand Filter ends --------------------*/ /*------------ Submodel Filter - starts --------------------*/ if (isset($params['model']) && $model_flag_link == 1 && (count($prod_submodel_new) > 0 || isset($params['submodel']))) { $GLOBALS['dynid'] = "dyn_submodel"; $GLOBALS['Dynmainmenu'] = "Submodel"; $count_sub_model = 1; $extra = ""; $submodel_string = $query_string_array; unset($submodel_string['submodel'], $submodel_string['search_query']); $get_mmy_links = ""; /*if(isset($GLOBALS['ISC_SRCH_CATG_NAME'])) $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME'])); else if(isset($GLOBALS['ISC_SRCH_BRAND_NAME'])) $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME']));*/ if (isset($params['search_query'])) { $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['PathInfo'][1])); } if ($get_mmy_links != "") { if ($GLOBALS['EnableSEOUrls'] == 1) { $get_mmy_links = "/" . $get_mmy_links; } } $get_mmy_links .= $this->GetYMMLinks($submodel_string); $submodel_string_new1 = ""; foreach ($submodel_string as $br_key => $br_val) { if (is_array($br_val)) { $br_val = implode("&" . $br_key . "[]=", $br_val); $br_key = $br_key . "[]"; } else { $br_val = MakeURLSafe($br_val); } $submodel_string_new1 .= "&" . $br_key . "=" . $br_val; } //$submodel_string_new1 .= $sub_catg; if (isset($params['submodel']) && !empty($params['submodel'])) { $params['submodel'] = ucwords(strtolower($params['submodel'])); $dyn_flag = 1; $dyn_filter .= <<<P2 <ul><li><img src='{$this->path}/templates/default/images/check.gif'> {$params['submodel']}</li></ul> P2; $str = "search_query=" . $srch_qry; $submodelclearurl = $this->path . "/search.php?" . $str; $str .= $submodel_string_new1 . "&submodel=" . $params['submodel'] . "&column=submodel"; $str .= $add_url_redefine; $submodelclearurl .= $submodel_string_new1; $GLOBALS['ClearURL'] = "<a href='" . $this->LeftClearLink($get_mmy_links) . $this->GetOtherLinks($params) . "'>Clear</a>"; } else { $dyn_flag = 0; for ($s = 0; $s < count($prod_submodel_new); $s++) { $GLOBALS['BrandName'] = $prod_submodel_new[$s]; $search_query = $srch_qry; $GLOBALS['BrandLink'] = $this->LeftLink($get_mmy_links, 'submodel', $prod_submodel_new[$s]); $GLOBALS['BrandLink'] .= $this->GetOtherLinks($params); if ($count_sub_model < 11) { $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } else { $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilter1"); } $count_sub_model++; } $dyn_filter = "<ul>" . $dyn_filter . "</ul>"; if ($count_sub_model > 11) { $GLOBALS['FilterID'] = "submodel"; $GLOBALS['ExtraValues'] = $extra; $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink"); } $GLOBALS['ClearURL'] = ""; } if ($dyn_flag == 1) { //$str = "search_query=".$links.$model_link."&column=model"; $GLOBALS['Dyndisplay1'] = "showlist"; $GLOBALS['Dyndisplay'] = "hidelist"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter1'] = $dyn_filter; $GLOBALS['DynmenuFilter'] = ""; $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')"; //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; } else { $GLOBALS['Dyndisplay1'] = "hidelist"; $GLOBALS['Dyndisplay'] = "showlist"; $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter'] = $dyn_filter; $GLOBALS['DynmenuFilter1'] = ""; $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')"; } $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductDynFilter"); $dyn_filter = $dyn_output; if ($dyn_flag == 1) { $dyn_bottom .= $dyn_filter; } else { $dyn_top .= $dyn_filter; } $dyn_filter = ""; } /*------------ Submodel Filter - ends --------------------*/ /*-------- Other Filters -----------------------------------------*/ if ((isset($params['catuniversal']) && $params['catuniversal'] == 1 || !empty($make_link) && (!empty($model_link) && (!isset($params['model_flag']) || $params['model_flag'] == 1)) && !empty($year_link)) && ($numrows > 0 || isset($_REQUEST['GO']) && $numrows > 0) && isset($GLOBALS['ISC_SRCH_CATG_ID'])) { // include('includes/display/ProdDynamicFilters.php'); $map_names = array(); $filter_names = "select * from [|PREFIX|]qualifier_names"; $filter_result = $GLOBALS['ISC_CLASS_DB']->Query($filter_names); while ($filter_row = $GLOBALS['ISC_CLASS_DB']->Fetch($filter_result)) { if ($filter_row['display_names'] != '') { $map_names[$filter_row['column_name']]['name'] = $filter_row['display_names']; } $map_names[$filter_row['column_name']]['qid'] = $filter_row['qid']; } $query_string_new = $this->path . "/search.php?"; $get_mmy_links = ""; /*if(isset($GLOBALS['ISC_SRCH_CATG_NAME']) && !isset($params['category'])) $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_CATG_NAME'])); else if(isset($GLOBALS['ISC_SRCH_BRAND_NAME'])) $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['ISC_SRCH_BRAND_NAME']));*/ if (isset($params['search_query'])) { $get_mmy_links .= MakeURLSafe(strtolower($GLOBALS['PathInfo'][1])); } if ($get_mmy_links != "") { if ($GLOBALS['EnableSEOUrls'] == 1) { $get_mmy_links = "/" . $get_mmy_links; } } $get_mmy_links .= $this->GetYMMLinks($params); $get_all_param_links = $this->GetOtherLinks($params); //$dyn_filter = ""; for ($u = 0; $u < count($columns); $u++) { // loop for the filters . Here columns are the filters. if (eregi('^(vq|pq)', $columns[$u])) { // checking whether the name of the column starts with vq or pq if (isset($filterdata[$columns[$u]]) && count($filterdata[$columns[$u]]) > 0) { $filter_var = array('vq', 'pq'); //$title = ucfirst(str_ireplace($filter_var,"",$columns[$u])); if (!isset($map_names[$columns[$u]]['name']) || empty($map_names[$columns[$u]]['name'])) { $title = ucfirst(str_ireplace($filter_var, "", $columns[$u])); } else { $title = $map_names[$columns[$u]]['name']; } $Qualifier_id = $map_names[$columns[$u]]['qid']; $GLOBALS['CategoryId'] = isset($params['subcategory']) ? $this->subcatgid : $GLOBALS['ISC_SRCH_CATG_ID']; $this->GetAssocDetails($GLOBALS['CategoryId'], $Qualifier_id, $OwnAssoc, $ParentAssoc, $OwnValue, $ParentValue); $qvalue_mapping_array = $OwnAssoc; /* The below code is added to have the values sorted in alphabetical order and "Others" added at the end - starts */ if ($columns[$u] == "PQbodylength" || $columns[$u] == "PQbodywidth") { asort($filterdata[$columns[$u]], SORT_NUMERIC); } else { $temp_filterdata = array(); foreach ($filterdata[$columns[$u]] as $k => $kval) { $CurrentValueItem = array(); $CurrentValueItem['vimage'] = ''; $CurrentValueItem['vname'] = ''; $CurrentValueItem['vcomments'] = ''; if (($m = array_search($kval, $OwnValue)) !== false) { $CurrentValueItem = $qvalue_mapping_array[$m]; if ($CurrentValueItem['vname'] != '') { $kval = $CurrentValueItem['vname']; } } if ($CurrentValueItem['vimage'] == "" && $CurrentValueItem['vcomments'] == "" && $CurrentValueItem['vname'] == "") { if (($n = array_search($kval, $ParentValue)) !== false) { $CurrentValueItem = $ParentAssoc[$n]; if ($CurrentValueItem['vname'] != '') { $kval = $CurrentValueItem['vname']; } } } $temp_filterdata[$k] = strtolower($kval); } asort($filterdata[$columns[$u]]); asort($temp_filterdata); $temp_arr1 = array_keys($temp_filterdata); $temp_arr2 = array(); foreach ($temp_arr1 as $key) { $temp_arr2[] = $filterdata[$columns[$u]][$key]; } $filterdata[$columns[$u]] = array_combine($temp_arr1, $temp_arr2); } if (($others_key = array_search('Others', $filterdata[$columns[$u]])) !== FALSE) { unset($filterdata[$columns[$u]][$others_key]); $filterdata[$columns[$u]][$others_key] = 'Others'; } /* - ends - */ $GLOBALS['dynid'] = "dyn" . ($u + 1); //$GLOBALS['Dynmainmenu'] = $title; $dyn_filter = ""; $extra = ""; // this is used to hide the values if exceed 10 $count_pqvq = 1; //$dyn_filter .= $filter1.$title.$filter2; //for($k=0;$k<count($filterdata[$columns[$u]]);$k++) // this loop is for showing the list in the filters column foreach ($filterdata[$columns[$u]] as $k => $kval) { //$countfilterdata[$key][$val]['count'] $value = $filterdata[$columns[$u]][$k]; $original_value = $filterdata[$columns[$u]][$k]; $GLOBALS['HoverImage'] = ""; $GLOBALS['Comments'] = ""; /*-------------- Below code is used to cehck comments in subcategory and main category ------------ */ $CurrentValueItem = array(); $CurrentValueItem['vimage'] = ''; $CurrentValueItem['vname'] = ''; $CurrentValueItem['vcomments'] = ''; if (($m = array_search($value, $OwnValue)) !== false) { $CurrentValueItem = $qvalue_mapping_array[$m]; } if ($CurrentValueItem['vimage'] == "" && $CurrentValueItem['vcomments'] == "" && $CurrentValueItem['vname'] == "") { if (($n = array_search($value, $ParentValue)) !== false) { $CurrentValueItem = $ParentAssoc[$n]; } } if ($CurrentValueItem['vname'] != "" || $CurrentValueItem['vimage'] != "" || $CurrentValueItem['vcomments'] != "") { if (!empty($CurrentValueItem['vname'])) { $value = $CurrentValueItem['vname']; } if (!empty($CurrentValueItem['vimage'])) { $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $CurrentValueItem['vimage']); if (file_exists($file)) { $GLOBALS['HoverImage'] = $this->path . "/" . GetConfig('ImageDirectory') . "/" . $CurrentValueItem['vimage']; } } $GLOBALS['Comments'] = $CurrentValueItem['vcomments']; } /*-------------- Below code is used to cehck comments in subcategory and main category Ends ------------ */ if (isset($params['dynfilters'][$columns[$u]]) && !empty($params['dynfilters'][$columns[$u]])) { $dyn_flag = 1; $query_string_mod_array = $query_string_array; //*$query_string_mod_array[$columns[$u]]= ""; //$query_string_new1 = $query_string_new; //*$query_string_new1 = "redefine_filters.php?"; $query_string_new1 = ""; $qualifierclearurl = "search.php?"; foreach ($query_string_mod_array as $qs_key => $qs_val) { //*if($query_string_new1 != $query_string_new) if (!empty($query_string_new1)) { $query_string_new1 .= "&"; } if ($qs_key != "search_query") { $qs_val = MakeURLSafe($qs_val); } $query_string_new1 .= $qs_key . "=" . $qs_val; if ($qs_key != $columns[$u]) { if ($qualifierclearurl != "search.php?") { $qualifierclearurl .= "&"; } $qualifierclearurl .= $qs_key . "=" . $qs_val; } } $get_qualifier_links = $this->GetOtherLinks($params, $columns[$u]); if ($GLOBALS['EnableSEOUrls'] == 1) { $qualifierclearurl = $this->path . $get_mmy_links . $get_qualifier_links; } else { $qualifierclearurl = $this->path . "/search.php?search_query=" . $get_mmy_links . $get_qualifier_links; } if (strtolower($original_value) == strtolower($params['dynfilters'][$columns[$u]])) { $GLOBALS['ClearURL'] = "<a href='{$qualifierclearurl}'>Clear</a>"; $dyn_filter .= "<li><img src='{$this->path}/templates/default/images/check.gif'> " . ucwords($value) . "</li>"; //*$dyn_filter .= "<li><a class='thickbox' href='$query_string_new1&column=$columns[$u]'><b>Redefine search...</b></a></li>"; $str = "{$query_string_new1}&column=" . strtolower($columns[$u]); $str .= $add_url_redefine; break; } } else { $dyn_flag = 0; $query_string_mod_array = $query_string_array; $query_string_new1 = $query_string_new . "search_query=" . $query_string_mod_array['search_query']; unset($query_string_mod_array['search_query']); //if(array_key_exists($columns[$u],$query_string_mod_array)) { //$query_string_mod_array[$columns[$u]] = $original_value; //} foreach ($query_string_mod_array as $qs_key => $qs_val) { if ($query_string_new1 != $query_string_new) { $query_string_new1 .= "&"; } if ($qs_key != "search_query") { $qs_val = MakeURLSafe($qs_val); } $query_string_new1 .= $qs_key . "=" . $qs_val; } //$GLOBALS['ClearURL'] = $query_string_new1; $GLOBALS['ClearURL'] = ""; if ($GLOBALS['EnableSEOUrls'] == 1) { $query_string_new1 = "/" . strtolower($columns[$u]) . "/" . MakeURLSafe(strtolower($original_value)); // this is added to pass the listing value $GLOBALS['QualifierLink'] = $this->path . $get_mmy_links . $get_all_param_links . $query_string_new1; } else { $query_string_new1 = "&" . strtolower($columns[$u]) . "=" . MakeURLSafe(strtolower($original_value)); // this is added to pass the listing value $GLOBALS['QualifierLink'] = $this->path . "/search.php?search_query=" . $get_mmy_links . $get_all_param_links . $query_string_new1; } $GLOBALS['QualifierId'] = $Qualifier_id; $GLOBALS['QualifierValue'] = ucwords($value); $GLOBALS['QualifierCount'] = $countfilterdata[$columns[$u]][$original_value]['count']; //$dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage"); //$dyn_filter .= "<li><a href='$query_string_new1'>".$value."</a> (".$countfilterdata[$columns[$u]][$value]['count'].")</li>"; if ($count_pqvq < 11) { $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage"); } else { $extra .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterValuesHoverImage"); } $count_pqvq++; } } $dyn_filter = "<ul>" . $dyn_filter . "</ul>"; if ($count_pqvq > 11) { $GLOBALS['FilterID'] = $GLOBALS['dynid']; $GLOBALS['ExtraValues'] = $extra; $dyn_filter .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideFilterMoreLink"); } if ($dyn_flag == 1) { //$str = "search_query=".$links.$model_link."&column=model"; $GLOBALS['Dyndisplay1'] = "showlist"; $GLOBALS['Dyndisplay'] = "hidelist"; $GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter1'] = $dyn_filter; $GLOBALS['DynmenuFilter'] = ""; $GLOBALS['JSfunction'] = "getvalueswithajax('" . $GLOBALS['dynid'] . "','{$str}');checkanimate('" . $GLOBALS['dynid'] . "')"; //$GLOBALS['Dynimage'] = "imgHdrDropDownIconright.gif"; } else { $GLOBALS['Dyndisplay1'] = "hidelist"; $GLOBALS['Dyndisplay'] = "showlist"; $GLOBALS['Dynimage'] = "imgHdrDropDownIcon.gif"; $GLOBALS['DynFilterArrow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductFilterImage"); $GLOBALS['DynmenuFilter'] = $dyn_filter; $GLOBALS['DynmenuFilter1'] = ""; $GLOBALS['JSfunction'] = "checkanimate('" . $GLOBALS['dynid'] . "')"; } /* Filter Title related assiciation */ $CurrentItem = $qvalue_mapping_array[0]; if ($CurrentItem['qimage'] == "" && $CurrentItem['qcomments'] == "" && $CurrentItem['qname'] == "") { $CurrentItem = $ParentAssoc[0]; } if (isset($CurrentItem['qname']) && !empty($CurrentItem['qname'])) { $GLOBALS['Dynmainmenu'] = $CurrentItem['qname']; } else { $GLOBALS['Dynmainmenu'] = $title; } $mover_comment = ""; if (isset($CurrentItem) && !empty($CurrentItem['qcomments'])) { $mover_comment = $CurrentItem['qcomments']; } $mover_image = ""; if (isset($CurrentItem['qimage']) && !empty($CurrentItem['qimage'])) { $file = realpath(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/' . $CurrentItem['qimage']); if (file_exists($file)) { $mover_image = $GLOBALS['SITEPATH'] . "/" . GetConfig('ImageDirectory') . "/" . $CurrentItem['qimage']; } } $GLOBALS['MouseoverFn'] = "loadHoverImage(event, '" . $mover_image . "', '" . $mover_comment . "');"; $GLOBALS['MouseoutFn'] = "hideTip();"; $dyn_output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideProductDynFilter"); //$dyn_filter .= $filter3; if ($dyn_flag == 1) { $dyn_bottom .= $dyn_output; } else { $dyn_top .= $dyn_output; } $dyn_filter = ""; //$dyn_filter .= $filter3; } } } $dyn_filter = $dyn_top . $dyn_bottom; /* form action */ $qry_string = $_SERVER['QUERY_STRING']; if (isset($_REQUEST['page'])) { $page = $_REQUEST['page']; $search_link = str_ireplace('&page=' . $page, '', $qry_string); } else { $search_link = $qry_string; } $GLOBALS['formaction'] = "search.php?" . $search_link; } else { $GLOBALS['HideSideProductFiltersPanelPrice'] = "none"; } $dyn_filter = $dyn_top . $dyn_bottom; $GLOBALS['DynFilter'] = $dyn_filter; if (!isset($params['flag_srch_category']) || $params['flag_srch_category'] == 0 || !eregi('search.php', $_SERVER['REQUEST_URI'])) { $GLOBALS['HideSideProductFiltersPanelPrice'] = "none"; } else { $GLOBALS['HideSideProductFiltersPanelPrice'] = "block"; } $GLOBALS['FromPrice'] = "0.00"; if (isset($_REQUEST['price_from'])) { $GLOBALS['FromPrice'] = $_REQUEST['price_from']; } if (isset($_REQUEST['price_to'])) { $GLOBALS['ToPrice'] = $_REQUEST['price_to']; } if (empty($output1) && empty($output2) && empty($output)) { $this->DontDisplay = true; } /*$output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']); $GLOBALS['SNIPPETS']['SideProductFilter1'] = $output;*/ }
public function SetTrails() { // Now that we have the categories we need to organize them // into an array and work out the category ID $arrCats = explode("/", $this->GetCatPath()); // Replace all bad variables back in for ($i = 0; $i < count($arrCats); $i++) { $arrCats[$i] = MakeURLNormal($arrCats[$i]); } // The first category *MUST* have a parent ID of 0 or it's invalid $query = sprintf("select * from [|PREFIX|]categories where lower(catname) = '%s' and catparentid='0'", $GLOBALS['ISC_CLASS_DB']->Quote(isc_strtolower($arrCats[0]))); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $this->SetTrail(array($row['categoryid'], $row['catname'])); // The root category is valid, try and loop through each category to find the ID of the last category in the set if (count($arrCats) > 1) { $parentCat = $row['categoryid']; for ($i = 1; $i < count($arrCats); $i++) { $query = sprintf("select * from [|PREFIX|]categories where lower(catname)='%s' and catparentid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote(isc_strtolower($arrCats[$i])), $GLOBALS['ISC_CLASS_DB']->Quote($parentCat)); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $parentCat = $row['categoryid']; $this->Data = $row; $this->SetTrail(array($row['categoryid'], $row['catname'])); } else { continue; } } } else { $this->Data = $row; } } else { $this->Data = $row; } $GLOBALS['CatTrail'] = $this->GetTrails(); }
public function _SetBrandData() { // Retrieve the query string variables. Can't use the $_GET array // because of SEO friendly links in the URL SetPGQVariablesManually(); // Grab the page sort details $GLOBALS['URL'] = implode("/", $GLOBALS['PathInfo']); $this->SetSort(); if (isset($_REQUEST['brand'])) { $brand = $_REQUEST['brand']; } else { if (isset($GLOBALS['PathInfo'][1])) { $brand = preg_replace('#\.html\??.*$#i', "", $GLOBALS['PathInfo'][1]); } else { $brand = ''; } } $brand = MakeURLNormal($brand); // Get the link to the "all brands" page $GLOBALS['AllBrandsLink'] = BrandLink(); // Viewing a particular brand if($brand) { // Get the Id of the brand $query = sprintf("select * from [|PREFIX|]brands where brandname='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($brand)); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result); // Invalid brand if(!$row) { $GLOBALS['ISC_CLASS_404'] = GetClass('ISC_404'); $GLOBALS['ISC_CLASS_404']->HandlePage(); exit; } // Store the brand name $this->SetBrand($brand); $this->SetBrandName($row['brandname']); // Store the brand Id $this->SetId($row['brandid']); $this->SetBrandPageTitle($row['brandpagetitle']); // Store brand meta details $this->SetMetaKeywords($row['brandmetakeywords']); $this->SetMetaDesc($row['brandmetadesc']); $this->SetSearchKeywords($row['brandsearchkeywords']); $this->SetNumProducts(); $this->SetPage(); $this->SetStart(); $this->SetNumPages(); // Load the products for the brand $this->LoadProductsForBrand(); } }
function _SetSearchData() { if ($GLOBALS['EnableSEOUrls'] == 1 && !empty($GLOBALS['PathInfo'])) { // checking seo is enabled and pathinfo is not empty as pathinfo will be set only when redirected to index page $count_pathinfo = count($GLOBALS['PathInfo']); // to get the count of the parameter, i.e if its odd, query string is applied. if ($count_pathinfo % 2 == 0) { //wirror_20100913: when the smartsearch is set with empty keyword if ($GLOBALS['PathInfo'][0] == 'is_smart_search' || $GLOBALS['PathInfo'][0] != 'search') { $_REQUEST['search_query'] = ''; } else { $_REQUEST['search_query'] = MakeURLNormal($GLOBALS['PathInfo'][1]); } for ($i = 0; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $_REQUEST[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } } else { $_REQUEST['search_query'] = MakeURLNormal($GLOBALS['PathInfo'][0]); for ($i = 1; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $_REQUEST[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } } } else { // this condition is entered when seo is disabled. also in redefine search this will be accessed. if (!isset($_REQUEST['search_key'])) { foreach ($_GET as $key => $value) { $_GET[$key] = MakeURLNormal($value); $_REQUEST[$key] = MakeURLNormal($value); } } } // if user visit home page,then clear the sear query. if ($_SERVER["REQUEST_URI"] == "/") { $_REQUEST['search_query'] = ""; } //wirror_20110330 if (isset($_REQUEST['brand']) && isset($_REQUEST['category'])) { $_REQUEST['search_query'] = $_REQUEST['brand']; } if (isset($_REQUEST['search_query_adv'])) { $_GET['search_query'] = $_REQUEST['search_query'] = $_REQUEST['search_query_adv']; } if (isset($_REQUEST['search_query'])) { // Set the incoming search terms //alandy mark.init search params. $this->_searchterms = $this->BuildProductSearchTerms2($_REQUEST); //var_dump($this->_searchterms);exit; $this->CheckSeriesFlag(); //check if ymm already in search keywords //if so overwrite ymm in url /*$tmpRequest = $_REQUEST; unset($tmpRequest["make"]); unset($tmpRequest["year"]); unset($tmpRequest["model"]); $tmpTerms = BuildProductSearchTerms($tmpRequest); $this->_searchterms = BuildProductSearchTerms($_REQUEST); if( isset($tmpTerms["year"]) && $this->_searchterms["year"] !== $tmpTerms["year"] ) { $this->_searchterms["year"] = $tmpTerms["year"]; setcookie( "last_search_selection[year]", $this->_searchterms["year"], $date_of_expiry ,"/"); } if( isset($tmpTerms["make"]) && $this->_searchterms["make"] !== $tmpTerms["make"]) { $this->_searchterms["make"] = $tmpTerms["make"]; setcookie( "last_search_selection[make]", $this->_searchterms["make"], $date_of_expiry ,"/"); if( isset($tmpTerms["model"]) && $this->_searchterms["model"] !== $tmpTerms["model"]) { $this->_searchterms["model"] = $tmpTerms["model"]; $this->_searchterms["model_flag"] = 1; setcookie( "last_search_selection[model]", $this->_searchterms["model"], $date_of_expiry ,"/"); setcookie( "last_search_selection[model_flag]", 1, $date_of_expiry ,"/"); } }*/ //wirror_20110520:Product detail page: "Products" shows up in smart search box if (isset($_REQUEST['is_smart_search'])) { $OriginalSearchQuery = $_REQUEST['search_query']; } else { if ($_REQUEST['SearchLogId']) { $search_text_query = "select searchtext from [|PREFIX|]searches_extended WHERE searchid='" . $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['SearchLogId']) . "'"; $search_text_result = $GLOBALS['ISC_CLASS_DB']->Query($search_text_query); $OriginalSearchQuery = $GLOBALS['ISC_CLASS_DB']->FetchOne($search_text_result); } else { $OriginalSearchQuery = ''; } } $GLOBALS['OriginalSearchQuery'] = ucwords(isc_html_escape(html_entity_decode($OriginalSearchQuery))); $GLOBALS['FormattedSearchQuery'] = isc_html_escape($this->_searchterms['search_query']); $GLOBALS['SearchTitle'] = sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']); $this->_pagetitle = sprintf(GetLang('SearchSimpleTitle'), GetConfig('StoreName'), $GLOBALS['SearchTitle']); } else { // No search query set, show the advanced search form $GLOBALS['SearchTitle'] = sprintf(GetLang('SearchXStore'), $GLOBALS['StoreName']); $this->_pagetitle = sprintf(GetLang('SearchAdvancedTitle'), GetConfig('StoreName')); } }
function _SetSearchData() { if ($GLOBALS['EnableSEOUrls'] == 1 && !empty($GLOBALS['PathInfo'])) { // checking seo is enabled and pathinfo is not empty as pathinfo will be set only when redirected to index page $count_pathinfo = count($GLOBALS['PathInfo']); // to get the count of the parameter, i.e if its odd, query string is applied. if ($count_pathinfo % 2 == 0) { //wirror_20100913: when the smartsearch is set with empty keyword if ($GLOBALS['PathInfo'][0] == 'is_smart_search') { $_REQUEST['search_query'] = ''; } else { $_REQUEST['search_query'] = MakeURLNormal($GLOBALS['PathInfo'][1]); } for ($i = 0; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $_REQUEST[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } } else { $_REQUEST['search_query'] = MakeURLNormal($GLOBALS['PathInfo'][0]); for ($i = 1; $i < count($GLOBALS['PathInfo']); $i += 2) { if ($GLOBALS['PathInfo'][$i + 1] != '') { $_REQUEST[$GLOBALS['PathInfo'][$i]] = MakeURLNormal($GLOBALS['PathInfo'][$i + 1]); } } } } else { // this condition is entered when seo is disabled. also in redefine search this will be accessed. if (!isset($_REQUEST['search_key'])) { foreach ($_GET as $key => $value) { $_GET[$key] = MakeURLNormal($value); $_REQUEST[$key] = MakeURLNormal($value); } } } //wirror_20110330 if (isset($_REQUEST['brand']) && isset($_REQUEST['category'])) { $_REQUEST['search_query'] = $_REQUEST['brand']; } if (isset($_REQUEST['search_query_adv'])) { $_GET['search_query'] = $_REQUEST['search_query'] = $_REQUEST['search_query_adv']; } if (isset($_REQUEST['search_query'])) { // Set the incoming search terms $this->_searchterms = BuildProductSearchTerms($_REQUEST); //check if ymm already in search keywords //if so overwrite ymm in url /*$tmpRequest = $_REQUEST; unset($tmpRequest["make"]); unset($tmpRequest["year"]); unset($tmpRequest["model"]); $tmpTerms = BuildProductSearchTerms($tmpRequest); $this->_searchterms = BuildProductSearchTerms($_REQUEST); if( isset($tmpTerms["year"]) && $this->_searchterms["year"] !== $tmpTerms["year"] ) { $this->_searchterms["year"] = $tmpTerms["year"]; setcookie( "last_search_selection[year]", $this->_searchterms["year"], $date_of_expiry ,"/"); } if( isset($tmpTerms["make"]) && $this->_searchterms["make"] !== $tmpTerms["make"]) { $this->_searchterms["make"] = $tmpTerms["make"]; setcookie( "last_search_selection[make]", $this->_searchterms["make"], $date_of_expiry ,"/"); if( isset($tmpTerms["model"]) && $this->_searchterms["model"] !== $tmpTerms["model"]) { $this->_searchterms["model"] = $tmpTerms["model"]; $this->_searchterms["model_flag"] = 1; setcookie( "last_search_selection[model]", $this->_searchterms["model"], $date_of_expiry ,"/"); setcookie( "last_search_selection[model_flag]", 1, $date_of_expiry ,"/"); } }*/ $GLOBALS['OriginalSearchQuery'] = isc_html_escape(html_entity_decode($_REQUEST['search_query'])); $GLOBALS['FormattedSearchQuery'] = isc_html_escape($this->_searchterms['search_query']); $GLOBALS['SearchTitle'] = sprintf(GetLang('SearchResultsFor'), $GLOBALS['OriginalSearchQuery']); $this->_pagetitle = sprintf(GetLang('SearchSimpleTitle'), GetConfig('StoreName'), $GLOBALS['SearchTitle']); } else { // No search query set, show the advanced search form $GLOBALS['SearchTitle'] = sprintf(GetLang('SearchXStore'), $GLOBALS['StoreName']); $this->_pagetitle = sprintf(GetLang('SearchAdvancedTitle'), GetConfig('StoreName')); } }
/** * Load up the details for the page to be displayed. If $IsHomePage is true * then we're loading a page to display instead of the home page. */ public function _SetPageData($PageId = 0, $IsHomePage = false, $PageRow = null) { if (!$IsHomePage) { if ($PageId == 0) { //blessen if (count($GLOBALS['PathInfo']) > 0) { if (isset($GLOBALS['PathInfo'][1])) { $_REQUEST['pageid'] = $GLOBALS['PathInfo'][1]; } else { $_REQUEST['pageid'] = $GLOBALS['PathInfo'][0]; } if (!is_numeric($_REQUEST['pageid'])) { $pagename = $_REQUEST['pageid']; $query = "SELECT pageid FROM [|PREFIX|]pages WHERE LOWER(pagename)='" . $GLOBALS['ISC_CLASS_DB']->Quote(isc_strtolower($pagename)) . "' "; $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); $row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result); $_REQUEST['pageid'] = $row['pageid']; } } if (isset($_REQUEST['pageid'])) { $_REQUEST['page_id'] = $_REQUEST['pageid']; } if (isset($_REQUEST['page_id'])) { $pageid = (int) $_REQUEST['page_id']; $query = sprintf("select * from [|PREFIX|]pages where pageid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($pageid)); } else { if (isset($GLOBALS['PathInfo'][1])) { $page = preg_replace('#\\.html$#i', '', $GLOBALS['PathInfo'][1]); $page = $GLOBALS['ISC_CLASS_DB']->Quote(MakeURLNormal($page)); $query = sprintf("select * from [|PREFIX|]pages where pagetitle='%s'", $page); } else { ob_end_clean(); header("Location: " . GetConfig('ShopPath') . '/index.php'); exit; } } } else { $query = sprintf("select * from [|PREFIX|]pages where pageid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($PageId)); } $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $row['pagecontent'] = $this->LoadPredefinedPages($row['pagecontent']); $GLOBALS['ActivePage'] = $row['pageid']; $this->_pageid = $row['pageid']; $this->_pagetype = $row['pagetype']; $this->_pagetitle = $row['pagetitle']; $this->_pagefeed = $row['pagefeed']; $this->_pagecontent = $row['pagecontent']; $this->_pagekeywords = $row['pagekeywords']; $this->_pagedesc = $row['pagedesc']; $this->_pageparentlist = $row['pageparentlist']; //blessen $GLOBALS['CategoryTrackingCodeTop'] = isset($row['controlscript']) ? $row['controlscript'] : ''; $GLOBALS['CategoryTrackingCodeBottom'] = isset($row['trackingscript']) ? $row['trackingscript'] : ''; $this->_pagerow =& $row; if ($row['pagelayoutfile'] != '') { $File = str_replace(array(".html", ".htm"), "", $row['pagelayoutfile']); if (!file_exists(ISC_BASE_PATH . "/templates/" . GetConfig('template') . "/" . $row['pagelayoutfile']) || $row['pagelayoutfile'] == 'page.html') { if ($row['pagevendorid'] > 0) { $this->_pagelayoutfile = 'vendor_page'; } else { $this->_pagelayoutfile = 'page'; } } else { $this->_pagelayoutfile = $File; } } else { if ($row['pagevendorid'] > 0) { $this->_pagelayoutfile = 'vendor_page'; } else { $this->_pagelayoutfile = 'page'; } } // If the customer is not logged in and this page is set to customers only, then show an error message $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); if ($row['pagecustomersonly'] == 1 && !$GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId()) { $GLOBALS['ErrorMessage'] = sprintf(GetLang('ForbiddenToAccessPage'), $GLOBALS['ShopPathNormal']); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("error"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); exit; } } } else { $row = $PageRow; $row['pagecontent'] = $this->LoadPredefinedPages($row['pagecontent']); $this->_pageid = $row['pageid']; $this->_pagetype = $row['pagetype']; $this->_pagetitle = $row['pagetitle']; $this->_pagefeed = @$row['pagefeed']; $this->_pagecontent = $row['pagecontent']; $this->_pagekeywords = $row['pagekeywords']; $this->_pagedesc = $row['pagedesc']; $this->_pageparentlist = $row['pageparentlist']; $this->_pagelayoutfile = $row['pagelayoutfile']; $this->_pagerow =& $row; } }
public function SetCategoryData() { // Retrieve the query string variables. Can't use the $_GET array // because of SEO friendly links in the URL SetPGQVariablesManually(); // Grab the page sort details if (isset($_REQUEST['category'])) { $GLOBALS['CategoryPath'] = isc_html_escape($_REQUEST['category']); $path = explode("/", $_REQUEST['category']); } else { $GLOBALS['URL'] = implode("/", $GLOBALS['PathInfo']); $path = $GLOBALS['PathInfo']; array_shift($path); } $this->SetSort(); $this->SetCatPath($path); $arrCats = $this->_catpath; for ($i = 0; $i < count($arrCats); $i++) { $arrCats[$i] = MakeURLNormal($arrCats[$i]); } if (!isset($arrCats[0])) { $arrCats[0] = ''; } // The first category *MUST* have a parent ID of 0 or it's invalid $query = "\n\t\t\t\tSELECT *\n\t\t\t\tFROM [|PREFIX|]categories\n\t\t\t\tWHERE LOWER(catname) ='" . $GLOBALS['ISC_CLASS_DB']->Quote($arrCats[0]) . "' AND catparentid=0\n\t\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $this->SetTrail(array($row['categoryid'], $row['catname'])); $this->SetId($row['categoryid']); $this->SetName($row['catname']); $this->SetDesc($row['catdesc']); $this->SetLayoutFile($row['catlayoutfile']); $this->SetCatPageTitle($row['catpagetitle']); $this->SetMetaKeywords($row['catmetakeywords']); $this->SetMetaDesc($row['catmetadesc']); // The root category is valid, try and loop through each category to find the ID of the last category in the set if (count($arrCats) > 1) { $parentCat = $row['categoryid']; for ($i = 1; $i < count($arrCats); $i++) { if (!$arrCats[$i]) { continue; } $query = "\n\t\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\t\tFROM [|PREFIX|]categories\n\t\t\t\t\t\t\tWHERE LOWER(catname) ='" . $GLOBALS['ISC_CLASS_DB']->Quote($arrCats[$i]) . "' AND catparentid='" . (int) $parentCat . "'\n\t\t\t\t\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $parentCat = $row['categoryid']; $this->Data = $row; $this->SetTrail(array($row['categoryid'], $row['catname'])); $this->SetId($row['categoryid']); $this->SetName($row['catname']); $this->SetDesc($row['catdesc']); $this->SetLayoutFile($row['catlayoutfile']); $this->SetCatPageTitle($row['catpagetitle']); $this->SetMetaKeywords($row['catmetakeywords']); $this->SetMetaDesc($row['catmetadesc']); } else { continue; } } $this->SetId($parentCat); } else { $this->Data = $row; $this->SetId($row['categoryid']); $this->SetName($row['catname']); $this->SetDesc($row['catdesc']); $this->SetCatPageTitle($row['catpagetitle']); $this->SetMetaKeywords($row['catmetakeywords']); $this->SetMetaDesc($row['catmetadesc']); } } else { $this->Data = $row; $this->SetId(0); $this->SetName(""); $this->SetDesc(""); } if (!$this->_catid) { $GLOBALS['ISC_CLASS_404'] = GetClass('ISC_404'); $GLOBALS['ISC_CLASS_404']->HandlePage(); exit; } // Do we have permission to access this category? if (!CustomerGroupHasAccessToCategory($this->_catid)) { $noPermissionsPage = GetClass('ISC_403'); $noPermissionsPage->HandlePage(); exit; } $GLOBALS['CatTrail'] = $this->GetTrail(); // Find the number of products in the category $this->loadCats = $this->GetId(); // This product should show products from this category, but if there are none // show them from any child categories too if (GetConfig('CategoryListingMode') == 'emptychildren') { // Load up how many products there are in the current category, if none, load from children too $this->SetNumProducts(); if ($this->_catnumproducts == 0) { $this->loadCats = trim(implode(',', $this->GetChildCategories()), ','); $this->loadCats = rtrim($this->GetId() . "," . $this->loadCats, ','); } } else { if (GetConfig('CategoryListingMode') == 'children') { $cats = $this->GetChildCategories(); $cats[] = $this->GetId(); $this->loadCats = trim(implode(',', array_unique($cats)), ','); } } $this->SetNumProducts(); // Setup paging details $this->SetPage(); $this->SetStart(); $this->SetNumPages(); // Load the products for the categories page $this->LoadProductsForPage(); }
private function SaveSweepstakes() { if (isset($_POST['email'])) { $url_referrer = $_POST['urlreferrer']; /*if(stripos($GLOBALS['ShopPath'], $url_referrer)) { $url_referrer = ''; }*/ $email = trim($_POST['email']); $newsletter = isset($_POST['newsletter']) ? trim($_POST['newsletter']) : 0; $firstname = trim($_POST['firstname']); $lastname = trim($_POST['lastname']); $phone = trim($_POST['phone']); $address1 = trim($_POST['address1']); $address2 = trim($_POST['address2']); $city = trim($_POST['city']); $states = trim($_POST['states']); $country = "United States"; $zipcode = trim($_POST['zipcode']); $searchyear = trim($_POST['searchyear']); $searchmake = trim(MakeURLNormal($_POST['searchmake'])); $searchmodel = trim(MakeURLNormal($_POST['searchmodel'])); $sweepstakesid = $_SESSION['SweepstakesId']; $addedby = "Customer"; $createddate = date("Y-m-d H:i:s"); $captcha = ''; if (isset($_POST['captcha'])) { $captcha = $_POST['captcha']; } $captcha_check = true; // Do we need to check captcha? if (GetConfig('CaptchaEnabled')) { $GLOBALS['ISC_CLASS_CAPTCHA'] = GetClass('ISC_CAPTCHA'); if (isc_strtolower($captcha) == isc_strtolower($GLOBALS['ISC_CLASS_CAPTCHA']->LoadSecret())) { // Captcha validation succeeded $captcha_check = true; } else { // Captcha validation failed $captcha_check = false; } } if ($captcha_check) { $userDetails = array('email' => $email, 'firstname' => $firstname, 'lastname' => $lastname, 'phonenumber' => $phone, 'addressline1' => $address1, 'addressline2' => $address2, 'city' => $city, 'state' => $states, 'country' => $country, 'zipcode' => $zipcode, 'receivingmail' => $newsletter, 'year' => $searchyear, 'make' => $searchmake, 'model' => $searchmodel, 'sweepstakesid' => $sweepstakesid, 'addedby' => $addedby, 'createddate' => $createddate, 'urlreferrer' => $url_referrer); $query = $GLOBALS['ISC_CLASS_DB']->Query("SELECT email FROM [|PREFIX|]sweepstakes_users where email = '" . $email . "' and sweepstakesid = '{$sweepstakesid}'"); $cnt = $GLOBALS['ISC_CLASS_DB']->CountResult($query); # Checking for whether a user can enter 5 enteries for a sweepstakes for one email id -- Baskaran if ($cnt >= 5) { $msg = sprintf(GetLang('Sweepstakes5Exists'), $email); FlashMessage($msg, MSG_ERROR, 'sweepstakes'); } else { $GLOBALS['ISC_CLASS_DB']->InsertQuery("sweepstakes_users", $userDetails); $_SESSION['SweepsEmailId'] = ''; $_SESSION['SweepstakesId'] = ''; $_SESSION['SweepsEmailId'] = $email; $_SESSION['SweepstakesId'] = $sweepstakesid; $total = 0; $remaining = 0; if ($cnt >= 5) { $total = 5; $remaining = 0; } else { $total = $cnt + 1; $remaining = 5 - $total; } if ($GLOBALS["ISC_CLASS_DB"]->GetErrorMsg() == "") { if ($GLOBALS['EnableSEOUrls'] == 1) { header(sprintf("Location: %s/sweepstakes/successsweepstakes", $GLOBALS['ShopPath'])); } else { header(sprintf("Location: %s/sweepstakes.php?action=successsweepstakes", $GLOBALS['ShopPath'])); } // FlashMessage(sprintf(GetLang('SweepstakessavedSuccessfully'),$total,$remaining), MSG_SUCCESS, 'sweepstakes.php'); } else { $this->SweepstakesForm(GetLang('SweepstakesError'), MSG_ERROR); } } } else { $this->SweepstakesForm(GetLang('CaptchaError'), MSG_ERROR); } } else { ob_end_clean(); header(sprintf("Location: %s/sweepstakes", $GLOBALS['ShopPath'])); die; } }
public function BuildWhereFromVars($array) { $queryWhere = ""; $joinQuery = ""; // Are we selecting a specific product? if (isset($array['productId']) && $array['productId'] != '') { $queryWhere .= " p.productid = '" . $array['productId'] . "' AND "; // dont need to build a where if only one product searched return array("query" => $queryWhere, "join" => $joinQuery); } // If we're searching by category, we need to completely // restructure the search query - so do that first $categorySearch = false; $categoryIds = array(); if (isset($array['category']) && is_array($array['category'])) { if (count(array_unique($array['category'])) > 1 && $array['category'][0] == 0) { unset($array['category'][0]); } //Added by Simha foreach ($array['category'] as $categoryId) { // All categories were selected, so don't continue if ($categoryId == 0) { $categorySearch = false; break; } //Commented by Simha $categoryIds[] = (int) $categoryId; // If searching sub categories automatically, fetch & tack them on if (isset($array['subCats']) && $array['subCats'] == 1) { $categoryIds = array_merge($categoryIds, $this->_GetChildCats($categoryId)); } } $categoryIds = array_unique($categoryIds); if (!empty($categoryIds)) { $categorySearch = true; } } //print_r($array['category']);exit; if ($categorySearch == true) { $queryWhere .= "ca.categoryid IN (" . implode(',', $categoryIds) . ") AND "; } if (isset($array['searchQuery']) && $array['searchQuery'] != "") { // Perform a full text based search on the products search table /********************************************************************** Code altered by Mayank Jaitly 01 July 2010 The original code commented for future referenece /***********************************************************************/ /********* Original Code $search_query = isc_strtolower($array['searchQuery']); $fulltext_fields = array("ps.prodname", "ps.prodcode"); $queryWhere .= "(" . $GLOBALS["ISC_CLASS_DB"]->FullText($fulltext_fields, $search_query, true); $queryWhere .= "OR lower(ps.prodname) like '%" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "%' "; $queryWhere .= "OR lower(ps.prodcode) = '" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "' "; $queryWhere .= "OR p.productid='" . (int)$search_query . "') AND "; */ /********************************************************** Code Added by Mayank Jaitly 22 July 2010 This piece of code is added after Gargi found the bug in searching of records using previous ymm /*********************************************************/ if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] != '0') { $ymmQuery = "SELECT * FROM isc_user_ymm WHERE id='" . $_REQUEST['ymmID'] . "'"; $ymmResult = $GLOBALS['ISC_CLASS_DB']->Query($ymmQuery); $ymmRow = $GLOBALS['ISC_CLASS_DB']->Fetch($ymmResult); $YmmYear = $ymmRow['year']; $YmmMake = $ymmRow['make']; $YmmModel = $ymmRow['model']; } ////////////////////////// End of 22 July 2010 ////////// /// Code Added by Mayank if (isset($_REQUEST['ajaxsearchtype']) && $_REQUEST['ajaxsearchtype'] == '2') { $search_query = isc_strtolower($array['searchQuery']); $fulltext_fields = array("ps.prodcode"); $queryWhere .= "((" . $GLOBALS["ISC_CLASS_DB"]->FullText($fulltext_fields, $search_query, true); $queryWhere .= "OR lower(ps.prodcode) like '%" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "%' "; $queryWhere .= "OR lower(ps.prodcode) = '" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "') "; //------------------------------------------------------------------------// if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] != '0') { $queryWhere .= "AND ((iv.prodstartyear <=" . $YmmYear . " AND iv.prodendyear >= " . $YmmYear . ") OR iv.prodstartyear = 'ALL') "; } else { if (isset($_REQUEST['ymmyear']) && $_REQUEST['ymmyear'] != '') { $queryWhere .= "AND ((iv.prodstartyear <=" . $_REQUEST['ymmyear'] . " AND iv.prodendyear >= " . $_REQUEST['ymmyear'] . ") OR iv.prodstartyear = 'ALL') "; } } //-------------------------------------------------------------------------// //-------------------------------------------------------------------------// if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] != '0') { $queryWhere .= "AND (lower(iv.prodmake) = '" . $YmmMake . "' OR iv.prodmake = 'NON-SPEC VEHICLE' ) "; } else { if (isset($_REQUEST['ymmmake']) && $_REQUEST['ymmmake'] != '') { $queryWhere .= "AND (lower(iv.prodmake) = '" . $_REQUEST['ymmmake'] . "' OR iv.prodmake = 'NON-SPEC VEHICLE' ) "; } } //--------------------------------------------------------------------------// //--------------------------------------------------------------------------// if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] != '0') { $queryWhere .= "AND (lower(iv.prodmodel) = '" . MakeURLNormal($YmmModel) . "' OR iv.prodmodel = 'ALL') "; } else { if (isset($_REQUEST['ymmmodel']) && $_REQUEST['ymmmodel'] != '') { $queryWhere .= "AND (lower(iv.prodmodel) = '" . MakeURLNormal($_REQUEST['ymmmodel']) . "' OR iv.prodmodel = 'ALL') "; } } //--------------------------------------------------------------------------------// $queryWhere .= ") AND "; } else { $search_query = isc_strtolower($array['searchQuery']); $fulltext_fields = array("ps.prodname", "ps.prodcode"); $queryWhere .= "((" . $GLOBALS["ISC_CLASS_DB"]->FullText($fulltext_fields, $search_query, true); $queryWhere .= "OR lower(ps.prodname) like '%" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "%' "; $queryWhere .= "OR lower(ps.prodcode) = '" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "') "; /*if(isset($_REQUEST['ymmyear']) && $_REQUEST['ymmyear']!='') { $queryWhere .= "AND ((iv.prodstartyear <=".$_REQUEST['ymmyear'] ." AND iv.prodendyear >= ".$_REQUEST['ymmyear'] .") OR iv.prodstartyear = 'ALL') "; } if(isset($_REQUEST['ymmmake']) && $_REQUEST['ymmmake']!='') { $queryWhere .= "AND (lower(iv.prodmake) = '" . $_REQUEST['ymmmake']. "' OR iv.prodmake = 'NON-SPEC VEHICLE' ) "; } if(isset($_REQUEST['ymmmodel']) && $_REQUEST['ymmmodel']!='') { $queryWhere .= "AND (lower(iv.prodmodel) = '" . MakeURLNormal($_REQUEST['ymmmodel']). "' OR iv.prodmodel = 'ALL') "; }*/ //------------------------------------------------------------------------// if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] != '0') { $queryWhere .= "AND ((iv.prodstartyear <=" . $YmmYear . " AND iv.prodendyear >= " . $YmmYear . ") OR iv.prodstartyear = 'ALL') "; } else { if (isset($_REQUEST['ymmyear']) && $_REQUEST['ymmyear'] != '') { $queryWhere .= "AND ((iv.prodstartyear <=" . $_REQUEST['ymmyear'] . " AND iv.prodendyear >= " . $_REQUEST['ymmyear'] . ") OR iv.prodstartyear = 'ALL') "; } } //-------------------------------------------------------------------------// //-------------------------------------------------------------------------// if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] != '0') { $queryWhere .= "AND (lower(iv.prodmake) = '" . $YmmMake . "' OR iv.prodmake = 'NON-SPEC VEHICLE' ) "; } else { if (isset($_REQUEST['ymmmake']) && $_REQUEST['ymmmake'] != '') { $queryWhere .= "AND (lower(iv.prodmake) = '" . $_REQUEST['ymmmake'] . "' OR iv.prodmake = 'NON-SPEC VEHICLE' ) "; } } //--------------------------------------------------------------------------// //--------------------------------------------------------------------------// if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] != '0') { $queryWhere .= "AND (lower(iv.prodmodel) = '" . MakeURLNormal($YmmModel) . "' OR iv.prodmodel = 'ALL') "; } else { if (isset($_REQUEST['ymmmodel']) && $_REQUEST['ymmmodel'] != '') { $queryWhere .= "AND (lower(iv.prodmodel) = '" . MakeURLNormal($_REQUEST['ymmmodel']) . "' OR iv.prodmodel = 'ALL') "; } } //--------------------------------------------------------------------------------// $queryWhere .= "OR p.productid='" . (int) $search_query . "') AND "; } /// End of Mayank's Code /*********************************************************************************** Code Altered by Mayank Jaitly 0n 15 July 2010 original code is with in comment. Just remove if eslse to revert back // Add the join for the fulltext column $joinQuery .= " INNER JOIN [|PREFIX|]product_search ps ON p.productid=ps.productid LEFT JOIN [|PREFIX|]import_variations iv ON p.productid=iv.productid "; ***********************************************************************************/ if (isset($_REQUEST['w']) && $_REQUEST['w'] == 'orderSearchProducts') { // Add the join for the fulltext column $joinQuery .= " INNER JOIN [|PREFIX|]product_search ps ON p.productid=ps.productid LEFT JOIN [|PREFIX|]import_variations iv ON p.productid=iv.productid \n\t\t\t\t\n\t\t\t\tLEFT JOIN [|PREFIX|]categoryassociations ca ON ca.productid=p.productid\n\t\t\t\tLEFT JOIN [|PREFIX|]categories ct ON ca.categoryid=ct.categoryid\n\t\t\t\t"; } else { // Add the join for the fulltext column $joinQuery .= " INNER JOIN [|PREFIX|]product_search ps ON p.productid=ps.productid LEFT JOIN [|PREFIX|]import_variations iv ON p.productid=iv.productid "; } /*********** End of Code ***************/ } if (isset($array['letter']) && $array['letter'] != '') { $letter = chr(ord($array['letter'])); if ($array['letter'] == '0-9') { $queryWhere .= " p.prodname NOT REGEXP('^[a-zA-Z]') AND "; } else { if (isc_strlen($letter) == 1) { $queryWhere .= " p.prodname LIKE '" . $GLOBALS['ISC_CLASS_DB']->Quote($letter) . "%' AND "; } } } if (isset($array['soldFrom']) && isset($array['soldTo']) && $array['soldFrom'] != "" && $array['soldTo'] != "") { $sold_from = (int) $array['soldFrom']; $sold_to = (int) $array['soldTo']; $queryWhere .= sprintf("(prodnumsold >= '%d' and prodnumsold <= '%d') and ", $sold_from, $sold_to); } else { if (isset($array['soldFrom']) && $array['soldFrom'] != "") { $sold_from = (int) $array['soldFrom']; $queryWhere .= sprintf("prodnumsold >= '%d' and ", $sold_from); } else { if (isset($array['soldTo']) && $array['soldTo'] != "") { $sold_to = (int) $array['soldTo']; $queryWhere .= sprintf("prodnumsold <= '%d' and ", $sold_to); } } } if (isset($array['priceFrom']) && $array['priceFrom'] != "" && isset($array['priceTo']) && $array['priceTo'] != "") { $price_from = (int) $array['priceFrom']; $price_to = (int) $array['priceTo']; $queryWhere .= sprintf(" prodcalculatedprice >= '%s' and prodcalculatedprice <= '%s' and ", $price_from, $price_to); } else { if (isset($array['priceFrom']) && $array['priceFrom'] != "") { $price_from = (int) $array['priceFrom']; $queryWhere .= sprintf(" prodcalculatedprice >= '%s' and ", $price_from); } else { if (isset($array['priceTo']) && $array['priceTo'] != "") { $price_to = (int) $array['priceTo']; $queryWhere .= sprintf(" prodcalculatedprice <= '%s' and ", $price_to); } } } if (isset($array['inventoryFrom']) && $array['inventoryFrom'] != "" && isset($array['inventoryTo']) && $array['inventoryTo'] != "") { $inventory_from = (int) $array['inventoryFrom']; $inventory_to = (int) $array['inventoryTo']; $queryWhere .= sprintf("prodcurrentinv >= '%s' and prodcurrentinv <= '%s' and ", $inventory_from, $inventory_to); } else { if (isset($array['inventoryFrom']) && $array['inventoryFrom'] != "") { $inventory_from = (int) $array['inventoryFrom']; $queryWhere .= sprintf("prodcurrentinv >= '%s' and ", $inventory_from); } else { if (isset($array['inventoryTo']) && $array['inventoryTo'] != "") { $inventory_to = (int) $array['inventoryTo']; $queryWhere .= sprintf("prodcurrentinv <= '%s' and ", $inventory_to); } } } if (isset($array['inventoryLow']) && $array['inventoryLow'] != 0) { $lowVarInvProdIds = array(); $inventoryLowVarQuery = "SELECT DISTINCT(vcproductid) FROM [|PREFIX|]product_variation_combinations WHERE vcstock<=vclowstock AND vclowstock > 0"; $result = $GLOBALS['ISC_CLASS_DB']->Query($inventoryLowVarQuery); while ($lowVarInventory = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $lowVarInvProdIds[] = $lowVarInventory['vcproductid']; } $queryWhere .= "(prodcurrentinv <= prodlowinv AND prodlowinv > 0 AND prodinvtrack=1) OR ( prodinvtrack=2 AND productid in ('" . implode('\',\'', $lowVarInvProdIds) . "')) AND "; } if (isset($array['brand']) && $array['brand'] != "") { $brand = (int) $array['brand']; $queryWhere .= sprintf("prodbrandid = '%d' AND ", $brand); } // Product visibility if (isset($array['visibility'])) { if ($array['visibility'] == 1) { $queryWhere .= "prodvisible=1 AND "; } else { if ($array['visibility'] === '0') { $queryWhere .= "prodvisible=0 AND "; } } } // Featured products? if (isset($array['featured'])) { if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { $featuredColumn = 'prodvendorfeatured'; } else { $featuredColumn = 'prodfeatured'; } if ($array['featured'] == 1) { $queryWhere .= $featuredColumn . "=1 AND "; } else { if ($_REQUEST['featured'] === '0') { $queryWhere .= $featuredColumn . "=0 AND "; } } } // Free shipping if (isset($_REQUEST['freeShipping'])) { if ($_REQUEST['freeShipping'] == 1) { $queryWhere .= "prodfreeshipping=1 AND "; } else { if ($_REQUEST['freeShipping'] === '0') { $queryWhere .= "prodfreeshipping=0 AND "; } } } return array("query" => $queryWhere, "join" => $joinQuery, "categorySearch" => $categorySearch); }
/** * Generate an individual row for the order items table. * * @param string The unique identifier for this row. * @param array Array of details about the product for this row. * @param boolean Set to true to hide this row by default. * @return string The generated HTML row for this item. */ public function GenerateOrderItemRow($rowId, $product = array(), $hidden = false) { static $first = true; static $publicWrappingOptions = null; if ($hidden == true) { $GLOBALS['HideRow'] = 'display: none'; } else { $GLOBALS['HideRow'] = ''; } if (is_null($publicWrappingOptions)) { $wrappingOptions = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('GiftWrapping'); if (empty($wrappingOptions)) { $publicWrappingOptions = false; } else { $publicWrappingOptions = true; } } if ($first != true) { $GLOBALS['HideInsertTip'] = 'display: none'; } $first = false; if (empty($product)) { $GLOBALS['CartItemId'] = $rowId; $GLOBALS['ProductCode'] = ''; $GLOBALS['ProductId'] = 0; $GLOBALS['ProductName'] = ''; $GLOBALS['HideWrappingOptions'] = 'display: none'; $GLOBALS['HideProductFields'] = 'display: none;'; $GLOBALS['HideProductVariation'] = 'display: none;'; $GLOBALS['ProductPrice'] = FormatPrice(0, false, false, true); $GLOBALS['ProductQuantity'] = 1; $GLOBALS['ProductTotal'] = FormatPrice(0); $GLOBALS['HideEventDate'] = 'display : none;'; $GLOBALS['EventDate'] = ''; return $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderItem'); } $GLOBALS['CartItemId'] = $rowId; //isc_html_escape($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['ProductCode'] = GetLang('NA'); $GLOBALS['ProductName'] = isc_html_escape($product['product_name']); $GLOBALS['ProductQuantity'] = (int) $product['quantity']; $GLOBALS['ProductPrice'] = FormatPrice($product['product_price']); $GLOBALS['ProductTotal'] = FormatPrice($product['product_price'] * $product['quantity']); return $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderItemGiftCertificate'); } else { /********************************************************************** Code altered by Mayank Jaitly on 05 July 2010 /**********************************************************************/ $GLOBALS['YMMYearTemp'] = $product['year']; $GLOBALS['YMMMakeTemp'] = $product['make']; $GLOBALS['YMMModelTemp'] = MakeURLNormal($product['model']); $GLOBALS['YMMbedsizeTemp'] = $product['bedsize']; $GLOBALS['YMMcabsizeTemp'] = $product['cabsize']; $GLOBALS['ProductId'] = $product['product_id']; $GLOBALS['ProductName'] = isc_html_escape($product['product_name']); $GLOBALS['ProductQuantity'] = (int) $product['quantity']; $GLOBALS['ProductCode'] = $product['product_code']; // Don't use the discount price here as we'll be showing the coupon codes // down below in the summary table $productPrice = $product['product_price']; $GLOBALS['ProductPrice'] = FormatPrice($productPrice, false, false, true); $GLOBALS['ProductTotal'] = FormatPrice($productPrice * $product['quantity']); // Initialize the configurable product fields $GLOBALS['HideProductFields'] = 'display: none;'; $GLOBALS['ProductFields'] = ''; if (!empty($product['product_fields']) && is_array($product['product_fields'])) { $GLOBALS['HideProductFields'] = ''; foreach ($product['product_fields'] as $fieldId => $field) { switch ($field['fieldType']) { case 'file': if (isset($field['fieldExisting'])) { $fileDirectory = 'configured_products'; } else { $fileDirectory = 'configured_products_tmp'; } $fieldValue = '<a href="' . GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $fileDirectory . '/' . $field['fileName'] . '" target="_blank">' . isc_html_escape($field['fileOriginName']) . '</a>'; break; case 'checkbox': $fieldValue = GetLang('Checked'); break; default: if (isc_strlen($field['fieldValue']) > 50) { $field['fieldValue'] = isc_substr($field['fieldValue'], 0, 50) . " .."; } $fieldValue = isc_html_escape($field['fieldValue']); // browser is decoding the entities in the ajax response which prevents the row from loading so we need to double encode if (isset($_REQUEST['ajaxFormUpload'])) { $fieldValue = isc_html_escape($fieldValue); } } if (!trim($fieldValue)) { continue; } $GLOBALS['ProductFields'] .= ' <dt>' . isc_html_escape($field['fieldName']) . ':</dt> <dd>' . $fieldValue . '</dd> '; } } // Can this item be wrapped? $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'] = ''; $GLOBALS['GiftWrappingPrice'] = CurrencyConvertFormatPrice($product['wrapping']['wrapprice']); } else { $GLOBALS['GiftWrappingName'] = ''; $GLOBALS['HideGiftWrappingAdd'] = ''; $GLOBALS['HideGiftWrappingEdit'] = 'display: none'; $GLOBALS['HideGiftWrappingPrice'] = 'display: none'; $GLOBALS['GiftWrappingPrice'] = ''; } } // Is this product a variation? $GLOBALS['ProductOptions'] = ''; $GLOBALS['HideProductVariation'] = 'display: none'; if (isset($product['options']) && !empty($product['options'])) { $comma = ''; $GLOBALS['HideProductVariation'] = ''; foreach ($product['options'] as $name => $value) { if (!trim($name) || !trim($value)) { continue; } $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value); $comma = ' / '; } } else { if (isset($product['data']['prodvariationid']) && $product['data']['prodvariationid'] > 0) { $GLOBALS['HideProductVariation'] = ''; $GLOBALS['ProductOptions'] = GetLang('xNone'); } } if (isset($product['data']['prodeventdaterequired']) && $product['data']['prodeventdaterequired']) { $GLOBALS['HideEventDate'] = ''; $GLOBALS['EventDate'] = '<dl><dt>' . $product['data']['prodeventdatefieldname'] . ': </dt><dd>' . isc_date('jS M Y', $product['event_date']) . '</dd></dl>'; } else { $GLOBALS['HideEventDate'] = 'display : none;'; $GLOBALS['EventDate'] = ''; } return $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrderItem'); } }
public function SetPanelSettings() { $GLOBALS['HideProductErrorMessage'] = 'display:none'; if (isset($_SESSION['ProductErrorMessage']) && $_SESSION['ProductErrorMessage'] != '') { $GLOBALS['HideProductErrorMessage'] = ''; $GLOBALS['ProductErrorMessage'] = $_SESSION['ProductErrorMessage']; unset($_SESSION['ProductErrorMessage']); } $GLOBALS['ProductCartQuantity'] = ''; if (isset($GLOBALS['CartQuantity' . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()])) { $GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()]; } //temp script to shortern the product name $pid = $GLOBALS['ISC_CLASS_PRODUCT']->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) { $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 = '" . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' "; $resulttemp1 = $GLOBALS['ISC_CLASS_DB']->Query($querytemp1); $cat = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp1); if ($cat['catcombine'] != "") { $GLOBALS['ProductName'] = $cat['catcombine'] . " Part Number " . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU()); } else { $GLOBALS['ProductName'] = $cat['catname'] . " Part Number " . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU()); } } else { $GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()); } //temp script to shortern the product name //$GLOBALS['ProductName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()); $GLOBALS['ProductId'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId(); $GLOBALS['ProductPrice'] = ''; // Get the vendor information $vendorInfo = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor(); $GLOBALS['HideVendorDetails'] = 'display: none'; $GLOBALS['VendorName'] = ''; if (is_array($vendorInfo)) { //$GLOBALS['HideVendorDetails'] = ''; $GLOBALS['VendorName'] = '<a href="' . VendorLink($vendorInfo) . '">' . isc_html_escape($vendorInfo['vendorname']) . '</a>'; } // Can this product be gift wrapped? And do we have any gift wrapping options set up? if ($GLOBALS['ISC_CLASS_PRODUCT']->CanBeGiftWrapped() && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) { $GLOBALS['HideGiftWrapMessage'] = ''; $GLOBALS['GiftWrappingAvailable'] = GetLang('GiftWrappingOptionsAvailable'); } else { $GLOBALS['HideGiftWrapMessage'] = 'display: none'; } $thumb = ''; $GLOBALS['ImagePopupJavascript'] = "showProductImageNew('" . $this->ProdImageLink($GLOBALS['ProductId']) . "', 0, 0);"; //$GLOBALS['VideoPopupJavascript'] = "showProductVideoNew('".GetConfig('ShopPath')."/productvideo.php', ".$GLOBALS['ProductId'].");"; $GLOBALS['VideoPopupJavascript'] = "showProductVideoNew('" . $this->ProdVideoLink($GLOBALS['ProductId']) . "');"; //$GLOBALS['AudioPopupJavascript'] = "showProductVideoNew('".GetConfig('ShopPath')."/productaudio.php', ".$GLOBALS['ProductId'].");"; $GLOBALS['AudioPopupJavascript'] = "showProductVideoNew('" . $this->ProdAudioLink($GLOBALS['ProductId']) . "');"; // If we're showing images as a lightbox, we need to load up the URLs for the other images for this product if (GetConfig('ProductImageMode') == 'lightbox') { $GLOBALS['AdditionalStylesheets'] = array(GetConfig('ShopPath') . '/javascript/jquery/plugins/lightbox/lightbox.css'); $GLOBALS['LightBoxImageList'] = ''; $query = "\n\t\t\t\t\tSELECT imagefile\n\t\t\t\t\tFROM [|PREFIX|]product_images\n\t\t\t\t\tWHERE imageprodid='" . $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId() . "' AND imageisthumb=0\n\t\t\t\t\tORDER BY imagesort ASC\n\t\t\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($image = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $GLOBALS['LightBoxImageList'] .= '<a '; $GLOBALS['LightBoxImageList'] .= 'href="' . $GLOBALS['ShopPath'] . '/' . GetConfig('ImageDirectory') . '/' . $image['imagefile'] . '" '; $GLOBALS['LightBoxImageList'] .= 'title="' . isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName()) . '"'; $GLOBALS['LightBoxImageList'] .= '> </a>'; } $GLOBALS['ImagePopupJavascript'] = "showProductImageLightBox(); return false;"; $GLOBALS['LightBoxImageJavascript'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ProductImagesLightBox'); } // Is there a thumbnail image we can show? $thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb(); $thumbImage = ''; if ($thumb == '' && GetConfig('DefaultProductImage') != '') { if (GetConfig('DefaultProductImage') == 'template') { $thumb = GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/ProductDefault.gif'; } else { $thumb = GetConfig('ShopPath') . '/' . GetConfig('DefaultProductImage'); } $thumbImage = '<img src="' . $thumb . '" alt="" />'; } else { if ($thumb != '') { $thumbImage = '<img src="' . GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . $thumb . '" alt="" />'; } } // Is there more than one image? If not, hide the "See more pictures" link if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 0) { $GLOBALS['HideMorePicturesLink'] = "none"; $GLOBALS['ThumbImage'] = $thumbImage; } else { $GLOBALS['ThumbImage'] = '<a href="#" onclick="' . $GLOBALS['ImagePopupJavascript'] . '">' . $thumbImage . '</a>'; if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 2) { $var = "MorePictures1"; } else { if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() == 1) { $var = "SeeLargerImage"; } else { $var = "MorePictures2"; } } $GLOBALS['SeeMorePictures'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumImages() - 1); $this->SetAdditionalView(); } // Is there more than one video? If not, hide the "See videos" link Added by Simha if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() == 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() == 0) { $GLOBALS['HideVideosLink'] = "none"; } else { if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos() > 0) { $var = "SeeVideos"; } else { $GLOBALS['HideSpecVideosLink'] = "none"; } if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios() > 0) { $avar = "SeeAudios"; } else { $GLOBALS['HideSpecAudiosLink'] = "none"; } $GLOBALS['SeeVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumVideos()); $GLOBALS['SeeAudios'] = sprintf(GetLang($avar), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumAudios()); } //more Videos link ends Added by Simha // Is there more than one video? If not, hide the "See Ins videos" link Added by Simha if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() == 0) { $GLOBALS['HideInsVideosLink'] = "none"; } else { if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos() > 0) { $var = "SeeInsVideos"; } $GLOBALS['SeeInsVideos'] = sprintf(GetLang($var), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumInsVideos()); } //more Ins Videos link ends Added by Simha //Added by Simha to hide Not For Sale Msg $GLOBALS['DisplayNotForSaleMsg'] = 'none'; if ($GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) { if (!GetConfig('ShowProductShipping')) { $GLOBALS['HideShipping'] = 'none'; } else { if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL) { if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost() != 0) { // Is there a fixed shipping cost? $GLOBALS['ShippingPrice'] = sprintf("%s %s", CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFixedShippingCost()), GetLang('FixedShippingCost')); } else { if ($GLOBALS['ISC_CLASS_PRODUCT']->HasFreeShipping()) { // Does this product have free shipping? $GLOBALS['ShippingPrice'] = GetLang('FreeShipping'); } else { // Shipping calculated at checkout $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout'); } } } else { $GLOBALS['ShippingPrice'] = GetLang('CalculatedAtCheckout'); } } // Is tax already included in this price? if (GetConfig('TaxTypeSelected') > 0 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductTaxable()) { if (GetConfig('PricesIncludeTax')) { if (GetConfig('TaxTypeSelected') == 2 && GetConfig('DefaultTaxRateName')) { //not included $GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName'))); } else { $GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2'); } } else { if (GetConfig('TaxTypeSelected') == 2) { if (GetConfig('DefaultTaxRateName')) { $GLOBALS['IncludingExcludingTax'] = sprintf(GetLang('ProductIncludingTax1'), isc_html_escape(GetConfig('DefaultTaxRateName'))); } else { $GLOBALS['IncludingExcludingTax'] = GetLang('ProductIncludingTax2'); } } else { $GLOBALS['IncludingExcludingTax'] = GetLang('ProductExcludingTax2'); } } } $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice(); $catquery = " SELECT DISTINCT c.categoryid, p.brandseriesid\n FROM isc_categories c \n LEFT JOIN isc_categoryassociations ca ON c.categoryid = ca.categoryid \n LEFT JOIN isc_products p ON ca.productid = p.productid AND p.prodvisible='1'\n WHERE p.productid= " . $GLOBALS['ProductId'] . ""; $relcats = array(); $brandseries = 0; $catresult = $GLOBALS['ISC_CLASS_DB']->Query($catquery); while ($catrow = $GLOBALS['ISC_CLASS_DB']->Fetch($catresult)) { $relcats[] = $catrow['categoryid']; $brandseries = $catrow['brandseriesid']; } $productCats = $relcats; $discounttype = 0; //$DiscountInfo = GetRuleModuleInfo(); //$FinalPrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice(); //$FinalPrice = $GLOBALS['ProductPrice']; $FinalPrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetPrice(); $SalePrice = $GLOBALS['ISC_CLASS_PRODUCT']->GetSalePrice(); if ((double) $SalePrice > 0 && $SalePrice < $FinalPrice) { $DiscountPrice = $SalePrice; } else { $DiscountPrice = $FinalPrice; $DiscountPrice = CalculateDiscountPrice($FinalPrice, $DiscountPrice, $productCats[0], $brandseries, $discounttype); } /* foreach($DiscountInfo as $DiscountInfoSub) { $catids = explode(",", $DiscountInfoSub['catids']); foreach($catids as $catid) { if(in_array($catid, $productCats)) { $DiscountAmount = $FinalPrice * ((int)$DiscountInfoSub['amount']/100); if ($DiscountAmount < 0) { $DiscountAmount = 0; } $DiscountAmount = $FinalPrice - $DiscountAmount; } } } */ if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) { $GLOBALS['RetailPrice'] = "<strike>" . CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice()) . "</strike>"; // blessen //$GLOBALS['PriceLabel'] = GetLang('YourPrice'); $GLOBALS['PriceLabel'] = GetLang('Price'); $savings = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() - $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice(); $GLOBALS['HideRRP'] = "none"; //$GLOBALS['YouSave'] = "<span class=\"YouSave\">".sprintf(GetLang('YouSave'), "<span class= //'YouSaveAmount'>".CurrencyConvertFormatPrice($savings)."</span>")."</span>"; } else { $GLOBALS['PriceLabel'] = GetLang('Price'); $GLOBALS['HideRRP'] = "none"; } } else { $GLOBALS['PriceLabel'] = GetLang('Price'); $GLOBALS['HideShipping'] = 'none'; if ($GLOBALS['ISC_CLASS_PRODUCT']->ArePricesHidden() || !GetConfig('ShowProductPrice')) { if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel()) { $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($GLOBALS['ISC_CLASS_PRODUCT']->GetProductCallForPricingLabel()); } else { $GLOBALS['HidePrice'] = "display: none;"; } } else { $GLOBALS['ProductPrice'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice(); } $GLOBALS['HideRRP'] = 'none'; //To display not for sale message Added by Simha $GLOBALS['DisplayNotForSaleMsg'] = ''; } // Is this product linked to a brand? if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName() != "" && GetConfig('ShowProductBrand')) { $GLOBALS['BrandName'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName()); $GLOBALS['BrandLink'] = BrandLink($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandName()); } else { $GLOBALS['HideBrandLink'] = "none"; } if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductType() == PT_PHYSICAL && GetConfig('ShowProductWeight')) { // It's a physical product $prodweight = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight(); # Added to hide the weight lable while the value is 0.00 Baskaran if ($prodweight == '0.00 LBS') { $GLOBALS['HideWeight'] = "none"; } else { $GLOBALS['ProductWeight'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetWeight(); } } else { // It's a digital product $GLOBALS['HideWeight'] = "none"; } $product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct(); $dimensions = array('ProductHeight' => 'prodheight', 'ProductWidth' => 'prodwidth', 'ProductDepth' => 'proddepth'); foreach ($dimensions as $global => $field) { if ($product[$field] > 0) { $GLOBALS[$global] = FormatWeight($product[$field], false); $hasDimensions = true; } else { $GLOBALS['Hide' . $global] = 'display: none'; } } if (!isset($hasDimensions)) { $GLOBALS['HideDimensions'] = 'display: none'; } // Are reviews disabled? Then don't show anything related to reviews if (GetConfig('EnableProductReviews') == 0) { $GLOBALS['HideReviewLink'] = "none"; $GLOBALS['HideRating'] = "none"; $GLOBALS['HideReviews'] = "none"; } else { // How many reviews are there? if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 0) { $GLOBALS['HideReviewLink'] = "none"; } else { $GLOBALS['HideNoReviewsMessage'] = "none"; if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 1) { $GLOBALS['ReviewLinkText'] = GetLang('ReviewLinkText1'); } else { $GLOBALS['ReviewLinkText'] = sprintf(GetLang('ReviewLinkText2'), $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews()); } } } // Has a product availability been given? if ($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability() != "") { $GLOBALS['Availability'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetAvailability()); } else { $GLOBALS['HideAvailability'] = "none"; } // Is there an SKU for this product? if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU() != "" && GetConfig('ShowProductSKU')) { $GLOBALS['SKU'] = isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetSKU()); } else { $GLOBALS['HideSKU'] = "none"; } if (!GetConfig('ShowProductRating')) { $GLOBALS['HideRating'] = "none"; } $GLOBALS['Rating'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetRating(); $GLOBALS['CartLink'] = CartLink(); /* Baskaran added to display image in product detail page */ $brandimage = $GLOBALS['ISC_CLASS_PRODUCT']->GetProdbrandimagefile(); $imageurl = ''; if ($brandimage != '' || !empty($brandimage)) { $imageurl = GetConfig('ShopPath') . "/product_images/" . $brandimage; } else { $imageurl = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif"; } $GLOBALS['ImageUrl'] = $imageurl; /* Baskaran ends */ $GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->_prodid; $GLOBALS['ImagePage'] = sprintf("%s/productimage.php", $GLOBALS['ShopPath']); $GLOBALS['ProductNumReviews'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews(); // Does this product have any bulk discount? if ($GLOBALS['ISC_CLASS_PRODUCT']->CanUseBulkDiscounts()) { $GLOBALS['HideBulkDiscountLink'] = ''; $GLOBALS['BulkDiscountThickBoxTitle'] = sprintf(GetLang('BulkDiscountThickBoxTitle'), isc_html_escape($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName())); require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php'; $GLOBALS['BulkDiscountThickBoxRates'] = ISC_SIDEPRODUCTADDTOCART_PANEL::GetProductBulkDiscounts(); $GLOBALS['ProductBulkDiscountThickBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductBulkDiscountThickBox"); } else { $GLOBALS['HideBulkDiscountLink'] = 'none'; } if (GetConfig('ShowInventory') == 1 && $GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() > 0) { $GLOBALS['InventoryList'] = ''; if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 2) { $variations = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVariations(); if (empty($options)) { $GLOBALS['HideCurrentStock'] = "display: none;"; } } else { if ($GLOBALS['ISC_CLASS_PRODUCT']->GetProductInventoryTracking() == 1) { $currentStock = $GLOBALS['ISC_CLASS_PRODUCT']->GetInventoryLevel(); if ($currentStock <= 0) { $GLOBALS['InventoryList'] = GetLang('SoldOut'); } else { $GLOBALS['InventoryList'] = $currentStock; } } } } else { $GLOBALS['HideCurrentStock'] = "display: none;"; } /* Added for to display the "Make an offer" Button -- Baskaran */ # Checked for the selected series offer is 'yes' $GLOBALS['HideOfferButton'] = 'none'; if (GetConfig('ShowBestOffer') == '1') { if ($GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesOffer() == 'yes') { $GLOBALS['HideOfferButton'] = ''; } else { # Checking for the selected sub category offer is 'yes' if ($GLOBALS['ISC_CLASS_PRODUCT']->GetCategoryOffer() == 'yes') { $GLOBALS['HideOfferButton'] = ''; } else { # Checking brand offer is 'yes' and corresponding series offer are 'no' if ($GLOBALS['ISC_CLASS_PRODUCT']->GetBrandOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSeriesCntOffer() == 0) { $GLOBALS['HideOfferButton'] = ''; } else { # Checking for Root category offer is 'yes' and corresponding sub category offer are 'no' if ($GLOBALS['ISC_CLASS_PRODUCT']->GetRootCategoryOffer() == 'yes' and $GLOBALS['ISC_CLASS_PRODUCT']->GetSubCategoryCntOffer() == 0) { $GLOBALS['HideOfferButton'] = ''; } else { $GLOBALS['HideOfferButton'] = 'none'; } } } } } //Check for item in Cart Session $CartItems = $_SESSION['CART']['ITEMS']; $compids = array(); $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId(); //print_r($CartItems); foreach ($CartItems as $key => $item) { if ($item['product_id'] == $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()) { if ($item['compitem'] == 1) { foreach ($item['complementary'] as $citem) { $compids[$citem['comp_productid']] = $citem['quantity']; } } break; } } //Check for item in Cart Session Ends # Complementary items -- Baskaran $productid = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId(); $make = ''; $model = ''; $year = ''; if ($GLOBALS['EnableSEOUrls'] == 0) { if (isset($_REQUEST['make']) && $_REQUEST['make'] != '') { $make = MakeURLNormal($_REQUEST['make']); } if (isset($_REQUEST['model']) && $_REQUEST['model'] != '') { $model = MakeURLNormal($_REQUEST['model']); } if (isset($_REQUEST['year']) && $_REQUEST['year'] != '') { $year = $_REQUEST['year']; } } else { if (count($GLOBALS['PathInfo']) > 0) { foreach ($GLOBALS['PathInfo'] as $key => $value) { if (eregi('make=', $value)) { $make = MakeURLNormal(substr($value, strpos($value, '=') + 1)); } else { if (eregi('model=', $value)) { $model = MakeURLNormal(substr($value, strpos($value, '=') + 1)); } else { if (eregi('year=', $value)) { $year = substr($value, strpos($value, '=') + 1); } } } } } } $where = ''; if ($make != '') { $where .= "and (prodmake = '" . $make . "' or prodmake = 'NON-SPEC VEHICLE')"; } if ($model != '') { $where .= " and (prodmodel = '" . $model . "' or prodmodel = 'ALL')"; } if ($year != '') { $where .= " and (({$year} between prodstartyear and prodendyear) or (prodstartyear = 'ALL'and prodendyear = 'ALL'))"; } $result = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT id,productid FROM [|PREFIX|]import_variations where productid = '" . $productid . "' {$where} order by id"); $impvariationid = ''; while ($improw = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $impvariationid[] = $improw['id']; } $impid = implode("','", $impvariationid); $impquery = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT complementaryitems FROM [|PREFIX|]application_data where variationid in('" . $impid . "') AND complementaryitems != ''"); if ($GLOBALS["ISC_CLASS_DB"]->countResult($impquery) > 0) { $compitems = ''; while ($joinrecord = $GLOBALS["ISC_CLASS_DB"]->Fetch($impquery)) { $compitems .= $joinrecord['complementaryitems'] . ","; } $comp = substr($compitems, 0, -1); if ($comp != '') { # Spliting the string with [ ] with regular expression -- Baskaran $temp = $comp; $temp = htmlspecialchars_decode($temp); preg_match_all('/\\[([^\\]]+)\\]/', $temp, $matches); $compexplode = $matches[1]; $cntproducts = count($compexplode); /*$arraycnt = array_count_values($compexplode); asort($arraycnt); $compunique = array_keys($arraycnt); rsort($compunique); $cntproducts = count($compunique);*/ $originalarray = array(); $tempArr = array(); $tempArr1 = array(); # Checking whether the SKU are valid and present in the db -- Baskaran for ($i = 0; $i < $cntproducts; $i++) { $split = split(",", $compexplode[$i]); $sku = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT productid, prodname, prodcode, proddescfeature, imagefile, brandname, catname FROM [|PREFIX|]brands b, [|PREFIX|]categories c, [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' WHERE prodcode = '" . $split[0] . "' AND p.prodbrandid = b.brandid AND p.prodcatids = c.categoryid AND p.prodvisible = '1'"); if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku) == 1 and $split[0] != 0) { if (in_array($split[0], $tempArr)) { continue; } $originalarray[] = $split[0] . "," . $split[1] . "," . $split[2]; $tempArr[] = $split[0]; } else { if ($GLOBALS["ISC_CLASS_DB"]->countResult($sku) != 1 and $split[0] == 0) { if (in_array($split[0], $tempArr1)) { continue; } $originalarray[] = $split[0] . "," . $split[1] . "," . $split[2]; $tempArr1[] = $split[0]; } } } $cntoriginal = count($originalarray); # Ordering the resultent array which is come from above one with the no thanks option '0' is the key to create the array -- Baskaran $arrManipulate = array(); $nothanks = array(); for ($i = 0; $i < $cntoriginal; $i++) { $orsplit = split(",", $originalarray[$i]); if ($i == 0 and $orsplit[0] == 0) { $arrManipulate[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2]; } else { if ($i != 0 and $orsplit[0] == 0) { $nothanks[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2]; } else { $arrManipulate[] = $orsplit[0] . "," . $orsplit[1] . "," . $orsplit[2]; } } } if (count($nothanks) > 0) { $arrOrder = array_merge($arrManipulate, $nothanks); } else { $arrOrder = $arrManipulate; } $cntarrOrder = count($arrOrder); if ($cntarrOrder > 0) { $complementary = "<table cellspacing='2' cellpadding='0' border='0' width='100%'>"; for ($i = 0; $i < $cntarrOrder; $i++) { $split = split(",", $arrOrder[$i]); $sku = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT productid, prodname, prodcode, proddescfeature, imagefile, brandname, catname FROM [|PREFIX|]brands b, [|PREFIX|]categories c, [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' WHERE prodcode = '" . $split[0] . "' AND p.prodbrandid = b.brandid AND p.prodcatids = c.categoryid AND p.prodvisible = '1'"); $skurow = $GLOBALS["ISC_CLASS_DB"]->Fetch($sku); $brandname = $skurow['brandname']; $catname = $skurow['catname']; $skucode = $skurow['prodcode']; $productid = $split[0] != 0 ? $skurow['productid'] : '0'; # $split[0] is sku code, $split[1] is comp. price $path = $skurow['imagefile']; $feature = $skurow['proddescfeature']; $prodimage = ''; if ($skurow['imagefile'] != '') { $prodimage = GetConfig('ShopPath') . "/product_images/{$path}"; } else { $prodimage = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif"; } $compdesc = html_entity_decode($split[2]); $compprice = "<b>Price :" . CurrencyConvertFormatPrice($split[1]) . "</b>"; $price = CurrencyConvertFormatPrice($split[1]); $feature = addslashes($feature); $esc = htmlentities($feature, ENT_QUOTES); $pricefeature = $esc . isc_html_escape($compprice); $pricefeature = $esc . isc_html_escape($compprice); if (isset($compids[$productid])) { $sel = $compids[$productid]; $styleval = "style='display: block;'"; $checked = "checked = 'checked'"; } else { $sel = 0; $styleval = "style='display: none;'"; $checked = ""; } if ($i == 0 and $productid != 0) { if (count($compids) == 0) { $styleval = "style='display: block;'"; $checked = " checked = 'checked' "; } $complementary .= '<input type="hidden" name="hidmake" value="' . $make . '" id="hidmake" />'; $complementary .= '<input type="hidden" name="hidmodel" value="' . $model . '" id="hidmodel" />'; $complementary .= '<input type="hidden" name="hidyear" value="' . $year . '" id="hidyear" />'; $complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_" . $i . "' value='" . $productid . "' {$checked} onclick='ActiveProductTab(\"CompItem_Tab\");ShowCompDesc(\"{$skucode}\",this.id);unCheck()'>" . "<label id='complabel' for='rdprod_" . $i . "' onmouseover= 'loadHoverImage(event, \"{$prodimage}\", \"{$pricefeature}\");' onmouseout = 'hideTip();'> <a href='#Compl'>{$catname} {$brandname} {$skucode}</a></label>" . "{$compdesc}" . "</td>\n <td><div {$styleval} id='compqty_" . $productid . "'>" . $this->BuildOption('compqty[' . $productid . ']', $sel) . "</div></td><td><div id='pr_" . $productid . "' {$styleval}><b>{$price}<b></div></td>\n </tr>"; } else { if ($i == 0 and $productid == 0) { if (count($compids) == 0) { $checked = " checked = 'checked' "; } $complementary .= '<input type="hidden" name="hidmake" value="' . $make . '" id="hidmake" />'; $complementary .= '<input type="hidden" name="hidmodel" value="' . $model . '" id="hidmodel" />'; $complementary .= '<input type="hidden" name="hidyear" value="' . $year . '" id="hidyear" />'; // $complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_".$i."' value='".$productid."' checked = 'checked'>"."<label for='rdprod_".$i."'> $split[2]</label>"."</td></tr>"; $complementary .= "<tr><td><input type='checkbox' name='nothanks' id='nothanks' value='{$productid}' {$checked} onclick='Check()'>" . "<label for='nothanks'> {$split['2']}</label><input type = 'hidden' name = 'isremovable' value = '1' />" . "</td></tr>"; } else { if ($i != 0 and $productid != 0) { $complementary .= "<tr><td><input type='checkbox' name='rdprod[]' id='rdprod_" . $i . "' value='" . $productid . "' {$checked} onclick='ActiveProductTab(\"CompItem_Tab\");ShowCompDesc(\"{$skucode}\",this.id);unCheck()'>" . "<label id='complabel' for='rdprod_" . $i . "' onmouseover= 'loadHoverImage(event, \"{$prodimage}\", \"{$pricefeature}\");' onmouseout = 'hideTip();'> <a href='#Compl'>{$catname} {$brandname} {$skucode}</a></label>" . "{$compdesc}" . "</td>\n <td><div {$styleval} id='compqty_" . $productid . "'>" . $this->BuildOption('compqty[' . $productid . ']', $sel) . "</div></td><td><div id='pr_" . $productid . "' {$styleval}><b>{$price}</b></div></td>\n </tr>"; } else { if ($i != 0 and $productid == 0) { $complementary .= "<tr><td><input type='checkbox' name='nothanks' id='nothanks' value='{$productid}' onclick='Check()'>" . "<label for='nothanks'> {$split['2']}</label><input type = 'hidden' name = 'isremovable' value = '1' />" . "</td></tr>"; } } } } $complementary .= '<input type="hidden" name="hidRadio" value="' . $brandname . " " . $skucode . '" id="hid_rdprod_' . $i . '" />'; } $complementary .= "</table>"; $GLOBALS['complementaryproducts'] = $complementary; $GLOBALS['complementarypaneltoshow'] = "%%Panel.ComplementartyItems%%<hr />"; } } } /* Code Ends */ if (GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) { require_once ISC_BASE_PATH . '/includes/display/SideProductAddToCart.php'; ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle'); //blessen if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice()) { $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart1"); } else { $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart"); } //Added by Simha if (isc_strtolower($GLOBALS['ISC_CLASS_PRODUCT']->IsTestData()) == 'yes') { $GLOBALS['SNIPPETS']['ProductAddToCart'] = "<hr>" . GetLang('ThisIsTestData'); } //blessen // original $GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart"); } $price_for_shipping = $GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice(); //blessen //$GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() replaced by GetPrice if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() && (double) $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice() > 0) { $price_for_shipping = $GLOBALS['ISC_CLASS_PRODUCT']->GetRetailPrice(); $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice()); $GLOBALS['ProductPrice'] = "<strike>" . $GLOBALS['ProductPrice'] . "</strike> <b alt='Price may be adjusted. Add to your cart and see the final price.' Title='Price may be adjusted. Add to your cart and see the final price.'>(" . GetLang('CheckPriceInCart') . ")</b>"; } if ($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice() > $DiscountPrice && $discounttype == 1) { $price_for_shipping = $DiscountPrice; $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_PRODUCT']->GetFinalPrice()); $GLOBALS['ProductPrice'] = "<strike>" . $GLOBALS['ProductPrice'] . "</strike> <b alt='Price may be adjusted. Add to your cart and see the final price.' Title='Price may be adjusted. Add to your cart and see the final price.'>(" . GetLang('CheckPriceInCart') . ")</b>"; } $GLOBALS['ShowOnSaleImage'] = ''; if (isset($DiscountPrice) && $discounttype == 0 && $DiscountPrice < $FinalPrice) { //&& GetConfig('ShowOnSale') $price_for_shipping = $DiscountPrice; $GLOBALS['ProductPrice'] = "<strike>" . CurrencyConvertFormatPrice($FinalPrice) . "</strike>"; $GLOBALS['DiscountPrice'] = "" . CurrencyConvertFormatPrice($DiscountPrice) . ""; if (GetConfig('ShowOnSale')) { $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">'; } } $price = 0; $upper_price = 0; $shipping_qry = "SELECT variablename, variableval FROM isc_shipping_vars WHERE methodid='1' AND modulename='shipping_bytotal' AND ( variablename LIKE 'cost_0' OR variablename LIKE 'lower_0' OR variablename LIKE 'upper_0' )"; $shipping_res = $GLOBALS['ISC_CLASS_DB']->Query($shipping_qry); while ($shipping_arr = $GLOBALS['ISC_CLASS_DB']->Fetch($shipping_res)) { if ($shipping_arr['variablename'] == 'cost_0') { $price = $shipping_arr['variableval']; } if ($shipping_arr['variablename'] == 'upper_0') { $upper_price = $shipping_arr['variableval']; } } if ($price_for_shipping < $upper_price) { $GLOBALS['ShippingPrice'] = "\$" . $price; } else { $GLOBALS['ShippingPrice'] = "Ships Freight Free, see <a href='" . $GLOBALS['ShopPath'] . "/pages/8'>policy</a> for details"; } //blessen $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($GLOBALS['ISC_CLASS_PRODUCT']->BuildTitle()); }
public function BuildTitle() { $title = ''; if ($this->GetPageTitle() != "") { $title = $this->GetPageTitle(); } elseif ($this->GetProductName() != "") { $title = sprintf("%s - %s", $this->GetProductName(), GetConfig('StoreName')); } else { $title = sprintf("%s %s", GetConfig('StoreName'), GetLang('Products')); } /* Adding YMM to page title */ if (!empty($this->_prodymmselection)) { $tempTitle = array(); if (isset($this->_prodymmselection['year'])) { $tempTitle[] = $this->_prodymmselection['year']; } if (isset($this->_prodymmselection['make'])) { $this->_prodymmselection['make'] = MakeURLNormal($this->_prodymmselection['make']); $tempTitle[] = ucwords(strtolower($this->_prodymmselection['make'])); } if (isset($this->_prodymmselection['model'])) { $this->_prodymmselection['model'] = MakeURLNormal($this->_prodymmselection['model']); $tempTitle[] = ucwords(strtolower($this->_prodymmselection['model'])); } $tempTitle[] = $title; $title = implode(" ", $tempTitle); } return $title; }
/** * GenerateDynamicPagesURLs * */ public function GenerateDynamicPagesURLs(&$curfilename, &$pageCateBrand, &$pageYMM, &$hasmore = false) { $filesize = 50000; $pagesize = 1; $totalsize = $filesize * $pagesize; $filePrefix = 'dynamic-pages'; //$categoryBrandURLs = $this->GetCategoryBrandURLs(); $categoryURLs = $this->GetCategoryURLS(); $brandURLs = $this->GetBrandURLS(); $categoryBrandURLs = array_merge(array_keys($categoryURLs), array_keys($brandURLs)); $urlCount = 1; $countName = 'Cake' . $urlCount; ${$countName} = array(); $countCateBrand = count($categoryBrandURLs); $countFlag = true; for ($cc = $pageCateBrand; $cc < $countCateBrand; $cc++) { /* reset($ymmURLs); while(next($ymmURLs)){ current($ymmURLs); }*/ if (isset($categoryURLs[$categoryBrandURLs[$cc]])) { $ymmURLs = $this->_generalYMM($categoryURLs[$categoryBrandURLs[$cc]]); } else { $ymmURLs = $this->_generalYMM($brandURLs[$categoryBrandURLs[$cc]]); } $countYMM = count($ymmURLs); $pageYMM = $countFlag ? $pageYMM : 0; for ($yy = $pageYMM; $yy < $countYMM; $yy++) { if (count(${$countName}) < $filesize) { array_push(${$countName}, $categoryBrandURLs[$cc] . $ymmURLs[$yy]); } else { if ($urlCount < $pagesize - 1) { $urlCount++; $countName = 'Cake' . $urlCount; ${$countName} = array(); array_push(${$countName}, $categoryBrandURLs[$cc] . $ymmURLs[$yy]); } else { $pageCateBrand = $cc; $pageYMM = $yy; $hasmore = true; break; } } } $countFlag = false; if ($hasmore) { break; } } if ($pageCateBrand == 0 && $pageYMM == 0 && !$hasmore) { $this->SaveAsXML(array($filePrefix => ${$countName})); } else { for ($ii = 1; $ii <= $urlCount; $ii++) { $countName = 'Cake' . $ii; $countArr = ${$countName}; if ($GLOBALS['EnableSEOUrls'] == 1) { $nameArr = explode('/', $countArr[0]); for ($i = 4; $i < count($nameArr); $i += 2) { $newArr[$nameArr[$i]] = $nameArr[$i + 1]; } } else { $delimiters = array("?", "&", "="); $res = multiexplode($delimiters, $countArr[0]); foreach ($res[1] as $value) { $newArr[$value[0]] = $value[1]; } } if (isset($newArr['series'])) { $suffixName = $newArr['series']; } else { if (isset($newArr['brand'])) { $suffixName = $newArr['brand']; } else { if (isset($newArr['subcategory'])) { $suffixName = $newArr['subcategory']; } else { if ($GLOBALS['EnableSEOUrls'] == 1) { $suffixName = $nameArr[3]; } else { $suffixName = $newArr['search_query']; } } } } $filename = $filePrefix . '-' . $this->GenerateFilename($filePrefix, $this->MakeFileNameSafe(MakeURLNormal($suffixName))); $curfilename = $filename; $this->SaveAsXML(array($filename => $countArr)); } } return true; }
/** * Add a product to the order that's being created/edited. */ private function OrderAddProduct() { if (!isset($_REQUEST['cartItemId']) && !isset($_REQUEST['productId']) || !isset($_REQUEST['orderSession'])) { exit; } $cartOptions = array('updateQtyIfExists' => false); if (isset($_REQUEST['EventDate'])) { $cartOptions['EventDate'] = isc_gmmktime(0, 0, 0, $_REQUEST['EventDate']['Mth'], $_REQUEST['EventDate']['Day'], $_REQUEST['EventDate']['Yr']); } if (isset($_REQUEST['ordcustid']) && $_REQUEST['ordcustid'] != 0) { $customerClass = GetClass('ISC_CUSTOMER'); $customer = $customerClass->GetCustomerInfo($_REQUEST['ordcustid']); if (isset($customer['custgroupid'])) { $cartOptions['customerGroup'] = $customer['custgroupid']; } } else { if (isset($_REQUEST['custgroupid']) && $_REQUEST['custgroupid'] != 0) { $cartOptions['customerGroup'] = (int) $_REQUEST['custgroupid']; } } if (isset($_REQUEST['variationId'])) { $variationId = $_REQUEST['variationId']; } else { $variationId = 0; } if (isset($_REQUEST['customerGroup'])) { $orderDetails['customerGroup'] = (int) $_REQUEST['customerGroup']; } /* -- Added below condition to check if YMM values coming from dropdown, then need to decode - starts */ if (isset($_REQUEST['ymmID']) && $_REQUEST['ymmID'] == 0) { if (isset($_REQUEST['ymmmake'])) { $_REQUEST['ymmmake'] = MakeURLNormal($_REQUEST['ymmmake']); } if (isset($_REQUEST['ymmmodel'])) { $_REQUEST['ymmmodel'] = MakeURLNormal($_REQUEST['ymmmodel']); } } /* -- ends -- */ $productFields = $this->BuildProductConfigurableFieldData(); $orderClass = GetClass('ISC_ADMIN_ORDERS'); $rowId = $orderClass->GetCartApi($_REQUEST['orderSession'])->AddItem($_REQUEST['productId'], $_REQUEST['quantity'], $variationId, $productFields, $_REQUEST['cartItemId'], $cartOptions); if ($rowId === false) { $errors = implode("\n", $orderClass->GetCartApi()->GetErrors()); if (!$errors) { $errors = GetLang('ErrorAddingProductToOrder'); } $response = array('error' => $errors); } else { $product = $orderClass->GetCartApi()->GetProductInCart($rowId); $response = array('productRow' => $orderClass->GenerateOrderItemRow($rowId, $product), 'orderSummary' => $orderClass->GenerateOrderSummaryTable(), 'productRowId' => $rowId); if ($_REQUEST['cartItemId'] != $rowId) { $response['removeRow'] = (string) $_REQUEST['cartItemId']; } } if (isset($_REQUEST['ajaxFormUpload'])) { echo '<textarea>' . isc_json_encode($response) . '</textarea>'; exit; } echo isc_json_encode($response); exit; }