Exemplo n.º 1
0
    /**
     * This function is used to show the price narrow search
     * 
     * 
     * @return string
     */
    function dispPriceNarrow()
    {
        $searchoption = $_SESSION['search_option'];
        $id = (int) $_GET['subcatid'];
        if (is_int($id) && $id > 0) {
            $sql = 'SELECT max(msrp) as maximum FROM products_table WHERE category_id=' . $id;
            $query = new Bin_Query();
            $query->executeQuery($sql);
            if (count($query->records) > 0) {
                $maximum = $query->records[0];
            }
            $maxi = $maximum['maximum'];
            $interval = ceil($maxi / 5);
            $i = 0;
            while ($i < $maxi) {
                $j = $i + $interval;
                $sql = 'SELECT count(msrp) as count,msrp FROM products_table WHERE msrp >' . $i . ' and msrp <= ' . $j . ' and ';
                $sql .= ' product_id
						IN (';
                $sql .= Core_CFeaturedItems::evaluate($id);
                $sql .= '	)';
                if ($searchoption['Brand']) {
                    $sql .= " and brand='" . $searchoption['Brand'] . "'";
                }
                $sql .= ' group by msrp';
                $query = new Bin_Query();
                $query->executeQuery($sql);
                $tmp[] = $query->records;
                $range[] = $_SESSION['currencysetting']['selected_currency_settings']['currency_tocken'] . " " . ($i + 1) * $_SESSION['currencysetting']['selected_currency_settings']['conversion_rate'] . "- " . $_SESSION['currencysetting']['selected_currency_settings']['currency_tocken'] . " " . $j * $_SESSION['currencysetting']['selected_currency_settings']['conversion_rate'];
                $i = $j;
            }
            return Display_DFeaturedItems::displayPriceNarrow($tmp, $range);
        }
    }