Exemplo n.º 1
0
 public function SetPanelSettings()
 {
     // Do we need to show paging, etc?
     if ($GLOBALS['ISC_CLASS_PRICE']->GetNumProducts() > GetConfig('CategoryProductsPerPage')) {
         // Workout the paging data
         $GLOBALS['SNIPPETS']['PagingData'] = "";
         $num_pages_either_side_of_current = 5;
         $start = max($GLOBALS['ISC_CLASS_PRICE']->GetPage() - $num_pages_either_side_of_current, 1);
         $end = min($GLOBALS['ISC_CLASS_PRICE']->GetPage() + $num_pages_either_side_of_current, $GLOBALS['ISC_CLASS_PRICE']->GetNumPages());
         for ($page = $start; $page <= $end; $page++) {
             if ($page == $GLOBALS['ISC_CLASS_PRICE']->GetPage()) {
                 $snippet = "PricePagingItemCurrent";
             } else {
                 $snippet = "PricePagingItem";
             }
             $GLOBALS['PageLink'] = PriceLink($GLOBALS['ISC_CLASS_PRICE']->GetMinPrice(), $GLOBALS['ISC_CLASS_PRICE']->GetMaxPrice(), $GLOBALS['CatId'], $GLOBALS['ISC_CLASS_PRICE']->GetCatPath(), array("page" => $page, "sort" => $GLOBALS['ISC_CLASS_PRICE']->GetSort()));
             $GLOBALS['PageNumber'] = $page;
             $GLOBALS['SNIPPETS']['PagingData'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet($snippet);
         }
         // Parse the paging snippet
         if ($GLOBALS['ISC_CLASS_PRICE']->GetPage() > 1) {
             // Do we need to output a "Previous" link?
             $GLOBALS['PrevLink'] = PriceLink($GLOBALS['ISC_CLASS_PRICE']->GetMinPrice(), $GLOBALS['ISC_CLASS_PRICE']->GetMaxPrice(), $GLOBALS['CatId'], $GLOBALS['ISC_CLASS_PRICE']->GetCatPath(), array("page" => $GLOBALS['ISC_CLASS_PRICE']->GetPage() - 1, "sort" => $GLOBALS['ISC_CLASS_PRICE']->GetSort()));
             $GLOBALS['SNIPPETS']['PricePagingPrevious'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("PricePagingPrevious");
         }
         if ($GLOBALS['ISC_CLASS_PRICE']->GetPage() < $GLOBALS['ISC_CLASS_PRICE']->GetNumPages()) {
             // Do we need to output a "Next" link?
             $GLOBALS['NextLink'] = PriceLink($GLOBALS['ISC_CLASS_PRICE']->GetMinPrice(), $GLOBALS['ISC_CLASS_PRICE']->GetMaxPrice(), $GLOBALS['CatId'], $GLOBALS['ISC_CLASS_PRICE']->GetCatPath(), array("page" => $GLOBALS['ISC_CLASS_PRICE']->GetPage() + 1, "sort" => $GLOBALS['ISC_CLASS_PRICE']->GetSort()));
             $GLOBALS['SNIPPETS']['PricePagingNext'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("PricePagingNext");
         }
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("PricePaging");
         $output = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseSnippets($output, $GLOBALS['SNIPPETS']);
         $GLOBALS['SNIPPETS']['PricePaging'] = $output;
     }
 }
 public function SetPanelSettings()
 {
     $output = "";
     $lastend = 0;
     if (isset($GLOBALS['ISC_CLASS_CATEGORY'])) {
         $categorySql = $GLOBALS['ISC_CLASS_CATEGORY']->GetCategoryAssociationSQL();
     } else {
         if (isset($GLOBALS['ISC_CLASS_PRICE'])) {
             $categorySql = $GLOBALS['ISC_CLASS_PRICE']->GetCategoryAssociationSQL();
         }
     }
     $query = "\n\t\t\t\tSELECT\n\t\t\t\t\tMIN(prodcalculatedprice) AS pmin,\n\t\t\t\t\tMAX(prodcalculatedprice) AS pmax\n\t\t\t\tFROM\n\t\t\t\t\t[|PREFIX|]products p\n\t\t\t\tWHERE\n\t\t\t\t\tp.prodvisible='1' AND\n\t\t\t\t\tp.prodhideprice=0 " . $categorySql . "\n\t\t\t\tORDER BY\n\t\t\t\t\tp.productid DESC\n\t\t\t";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         $min = ceil($row['pmin']);
         $max = ceil($row['pmax']);
         // Is there enough of a variation to show a shop by price panel?
         if ($max - $min > $min) {
             $diff = ($max - $min) / 5;
             if ($diff == 0) {
                 $diff = 1;
             }
             for ($i = 0; $i < 5; $i++) {
                 if ($lastend == 0) {
                     $start = $min + $diff * $i;
                 } else {
                     $start = $lastend;
                 }
                 $end = $start + $diff;
                 if ($end == $lastend) {
                     break;
                 }
                 if ($lastend == 0) {
                     $start = 0;
                 }
                 $lastend = $end;
                 $start = round($start);
                 $end = round($end);
                 $GLOBALS['PriceLow'] = CurrencyConvertFormatPrice($start);
                 $GLOBALS['PriceHigh'] = CurrencyConvertFormatPrice($end);
                 if (is_array($GLOBALS['CatPath'])) {
                     $GLOBALS['CatPath'] = implode("/", $GLOBALS['CatPath']);
                 }
                 $GLOBALS['PriceLink'] = PriceLink($start, $end, $GLOBALS['CatId'], $GLOBALS['CatPath']);
                 $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ShopByPriceItem");
             }
         } else {
             $GLOBALS['HideSideCategoryShopByPricePanel'] = "none";
             $this->DontDisplay = true;
         }
     } else {
         $GLOBALS['HideSideCategoryShopByPricePanel'] = "none";
         $this->DontDisplay = true;
     }
     $GLOBALS['SNIPPETS']['SideCategoryShopByPrice'] = $output;
 }
Exemplo n.º 3
0
 public function SetPanelSettings()
 {
     $GLOBALS['ISC_CLASS_PRICE'] = GetClass('ISC_PRICE');
     if ($GLOBALS['ISC_CLASS_PRICE']->GetNumProducts() > 1) {
         // Parse the sort select box snippet
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $GLOBALS['URL'] = PriceLink($GLOBALS['ISC_CLASS_PRICE']->GetMinPrice(), $GLOBALS['ISC_CLASS_PRICE']->GetMaxPrice(), $GLOBALS['CatId'], $GLOBALS['ISC_CLASS_PRICE']->GetCatPath());
         } else {
             $GLOBALS['URL'] = $GLOBALS['ShopPath'] . "/price.php";
             $hiddenFields = array("low" => isc_html_escape($GLOBALS['ISC_CLASS_PRICE']->GetMinPrice()), "high" => isc_html_escape($GLOBALS['ISC_CLASS_PRICE']->GetMaxPrice()), "category" => (int) $GLOBALS['CatId'], "path" => isc_html_escape($GLOBALS['ISC_CLASS_PRICE']->GetCatPath()));
             $GLOBALS['HiddenSortField'] = '';
             foreach ($hiddenFields as $name => $field) {
                 $GLOBALS['HiddenSortField'] .= "<input type=\"hidden\" name=\"" . $name . "\" value=\"" . $field . "\" />";
             }
         }
         $GLOBALS['SNIPPETS']['CategorySortBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategorySortBox");
     }
 }