Forums / Basic Configuration / Price Range

Price Range

Locked
Results 1 to 20 of 34
This thread is locked. New replies are disabled.
02 Jan 2009, 17:35
#1
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Price Range

I hope everyone had a Happy New Year! :smile:

This code (tpl_search.php) isn't working correctly.

[PHP]<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: tpl_search.php 277 2004-09-10 23:03:52Z wilt $
// $Id: tpl_search.php,v 1.0 2005/02/01 00:00:00 juxi zoza $
//
$content = '';

//------------------------------------------------------------------------ REMOVED
// $content .= '<span class="search_subtitle">' . BOX_SEARCH_QUICK_TEXT . '</span>';


// Optional silver.gif, used by Zencart in many places
// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';

//------------------------------------------------------------------------ REMOVED

// Optional <HR> "Horizontal Rule"
// $content .='<HR />';
//
// $content .= zen_draw_form('quick_find', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get');
// $content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
// $content .= zen_draw_hidden_field('search_in_description', '1');
// $content .= '<div align="center">' . zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px"') . '<br /><input type="submit" value="' . HEADER_SEARCH_BUTTON . '" style="width: 50px" />';
// $content .= "</div></form>";
//
// $content .= '<br /><span class="search_subtitle">' . BOX_SEARCH_QUICK_PRICE . '</span>';
//
//// Optional silver.gif, used by Zencart in many places
//// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';
//
//// Optional <HR> "Horizontal Rule"
// $content .='<HR />';
//
//------------------------------------------------------------------------ REMOVED

// Advanced Search URLs are created
// Add or Delete $content rows, as needed

//------------------------------------------------------------------------ ADDED
// Define Search Price From and To ranges
define('SP_RANGE_1_F','0.00' ); define('SP_RANGE_1_T','49.99' );
define('SP_RANGE_2_F','50.00' ); define('SP_RANGE_2_T','99.99' );
define('SP_RANGE_3_F','100.00' ); define('SP_RANGE_3_T','499.99');
define('SP_RANGE_4_F','500.00' ); define('SP_RANGE_4_T','999.99');
define('SP_RANGE_5_F','1000.00' ); define('SP_RANGE_5_T','' );

// Use Search Price From & To Defines to Define text shown in sidebox
define('SP_RANGE_1', "\$" . SP_RANGE_1_F . " - \$" . SP_RANGE_1_T);
define('SP_RANGE_2', "\$" . SP_RANGE_2_F . " - \$" . SP_RANGE_2_T);
define('SP_RANGE_3', "\$" . SP_RANGE_3_F . " - \$" . SP_RANGE_3_T);
define('SP_RANGE_4', "\$" . SP_RANGE_4_F . " - \$" . SP_RANGE_4_T);
define('SP_RANGE_5', "\$" . SP_RANGE_5_F . " +");
//------------------------------------------------------------------------ ADDED

$content .= '<hr class="leg_hr_sidebox"/>';
$content .= '<div class="search_pricerange">';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_1_F . '&pto=' . SP_RANGE_1_T) . '">' . SP_RANGE_1 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_2_F . '&pto=' . SP_RANGE_2_T) . '">' . SP_RANGE_2 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_3_F . '&pto=' . SP_RANGE_3_T) . '">' . SP_RANGE_3 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_4_F . '&pto=' . SP_RANGE_4_T) . '">' . SP_RANGE_4 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_5_F . '&pto=' . SP_RANGE_5_T) . '">' . SP_RANGE_5 . '</a><br />';
$content .= '</div>';
$content .= '<br/>';

// Optional <HR> "Horizontal Rule"
$content .='<HR />';

$content .= '<a id="advanced_search" href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';

// Optional silver.gif, used by Zencart in many places
// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';

?>[/PHP]

When I click on a price range I'd like it to stay within the current category.

For example, if I click $0.00 - $49.99 for a specific category I'd like the $0.00 - $49.99 items of the specific category NOT ALL the $0.00 - $49.99 categories in the store.

Thanks!!
02 Jan 2009, 17:44
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

You need to add the: categories_id

&categories_id = 12

to the link ...

This can be built from the: $cPath or $current_categories_id

NOTE: $cPath will probably be $_GET['cPath'] depending on what you are doing ... $current_categories_id can be used to get the full path to the category ...
02 Jan 2009, 18:29
#3
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

Thank you very much for your response I appreciate it very much! :clap:

Would you be as so kind to get into more detail? I have an idea on what to do but I want to take the right path since I'm brand new to Zen Cart.

Thank you. :smile:
02 Jan 2009, 23:46
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

In your links you need to add in the:
&categories_id=XX

so something like:

    $content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_3_F . '&pto=' . SP_RANGE_3_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_3 . '</a><br />';
03 Jan 2009, 01:15
#5
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

OK so I have to add that line and 4 others :

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_1_F . '&pto=' . SP_RANGE_1_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_1 . '</a><br />';

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_2_F . '&pto=' . SP_RANGE_2_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_2 . '</a><br />';

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_4_F . '&pto=' . SP_RANGE_4_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_4 . '</a><br />';

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_5_F . '&pto=' . SP_RANGE_5_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_5 . '</a><br />';



Earlier you mentioned that categories = 12. I think mine is 11 is this possible? You're probably right it's 12 and I'm wrong.

Also, do I fill in the 12 or 11 in the line of code or is it system generated?

Thanks. You're the best! :clap:
03 Jan 2009, 04:21
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

12 was just a stab in the dark ...

The $_GET['cPath'] should call the current path to the categories_id that you are looking at when the price is selected ...

You may need to doctor it a bit for other things, but see if that helps ...
03 Jan 2009, 04:41
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

Here is a problem ...

The reference for the categories_id changes depending on how you move around the Catalog ...

Toss this in the file just to see how these variables move about:
echo 'PATH ' . $_GET['categories_id'] . ' - cpath ' . $_GET['cPath'] . ' - get $current ' . $_GET['current_categories_id'] . ' $current ' . $current_categories_id . '<br>';


You can code for which of these is available to use as the:
'&categories_id=' . $something

You just need to write something to make the $something correct for more than one click ... easy smeazy, eh? :cool:
04 Jan 2009, 23:14
#8
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

Here's my code:

[PHP]<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: tpl_search.php 277 2004-09-10 23:03:52Z wilt $
// $Id: tpl_search.php,v 1.0 2005/02/01 00:00:00 juxi zoza $
//
$content = '';

//------------------------------------------------------------------------ REMOVED
// $content .= '<span class="search_subtitle">' . BOX_SEARCH_QUICK_TEXT . '</span>';


// Optional silver.gif, used by Zencart in many places
// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';

//------------------------------------------------------------------------ REMOVED

// Optional <HR> "Horizontal Rule"
// $content .='<HR />';
//
// $content .= zen_draw_form('quick_find', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get');
// $content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
// $content .= zen_draw_hidden_field('search_in_description', '1');
// $content .= '<div align="center">' . zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px"') . '<br /><input type="submit" value="' . HEADER_SEARCH_BUTTON . '" style="width: 50px" />';
// $content .= "</div></form>";
//
// $content .= '<br /><span class="search_subtitle">' . BOX_SEARCH_QUICK_PRICE . '</span>';
//
//// Optional silver.gif, used by Zencart in many places
//// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';
//
//// Optional <HR> "Horizontal Rule"
// $content .='<HR />';
//
//------------------------------------------------------------------------ REMOVED

// Advanced Search URLs are created
// Add or Delete $content rows, as needed

//------------------------------------------------------------------------ ADDED
// Define Search Price From and To ranges
define('SP_RANGE_1_F','0.00' ); define('SP_RANGE_1_T','49.99' );
define('SP_RANGE_2_F','50.00' ); define('SP_RANGE_2_T','99.99' );
define('SP_RANGE_3_F','100.00' ); define('SP_RANGE_3_T','499.99');
define('SP_RANGE_4_F','500.00' ); define('SP_RANGE_4_T','999.99');
define('SP_RANGE_5_F','1000.00' ); define('SP_RANGE_5_T','' );

// Use Search Price From & To Defines to Define text shown in sidebox
define('SP_RANGE_1', "\$" . SP_RANGE_1_F . " - \$" . SP_RANGE_1_T);
define('SP_RANGE_2', "\$" . SP_RANGE_2_F . " - \$" . SP_RANGE_2_T);
define('SP_RANGE_3', "\$" . SP_RANGE_3_F . " - \$" . SP_RANGE_3_T);
define('SP_RANGE_4', "\$" . SP_RANGE_4_F . " - \$" . SP_RANGE_4_T);
define('SP_RANGE_5', "\$" . SP_RANGE_5_F . " +");
//------------------------------------------------------------------------ ADDED

$content .= '<hr class="leg_hr_sidebox"/>';
$content .= '<div class="search_pricerange">';

echo 'PATH ' . $_GET['categories_id'] . ' - cpath ' . $_GET['cPath'] . ' - get $current ' . $_GET['current_categories_id'] . ' $current ' . $current_categories_id . '<br>';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_1_F . '&pto=' . SP_RANGE_1_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_1 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_2_F . '&pto=' . SP_RANGE_2_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_2 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_3_F . '&pto=' . SP_RANGE_3_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_3 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_4_F . '&pto=' . SP_RANGE_4_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_4 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_5_F . '&pto=' . SP_RANGE_5_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_5 . '</a><br />';


$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_1_F . '&pto=' . SP_RANGE_1_T) . '">' . SP_RANGE_1 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_2_F . '&pto=' . SP_RANGE_2_T) . '">' . SP_RANGE_2 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_3_F . '&pto=' . SP_RANGE_3_T) . '">' . SP_RANGE_3 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_4_F . '&pto=' . SP_RANGE_4_T) . '">' . SP_RANGE_4 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_5_F . '&pto=' . SP_RANGE_5_T) . '">' . SP_RANGE_5 . '</a><br />';
$content .= '</div>';
$content .= '<br/>';

// Optional <HR> "Horizontal Rule"
$content .='<HR />';

$content .= '<a id="advanced_search" href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';

// Optional silver.gif, used by Zencart in many places
// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';

?>[/PHP]


And this is what I got my friend:
05 Jan 2009, 03:38
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

You have two sets of price ranges ... one with and one without the categories_id in the URL ...

So that is what you will see in the sidebox ...
05 Jan 2009, 05:08
#10
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

Yeah I commented that out my friend. I think what I want is the price range search filtering to be fixed with the current category. I explained my self incorrectly. Meaning the boxes up top.
05 Jan 2009, 06:18
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

On the links in the sidebox you made ... if there is a cPath known, then it will filter that way ...

Click on a Category so you have a listing ...

Now click on one of your price links with the categories_id= $_GET['cPath']

You should stay in that category and filter those products that you are looking at with that price range ...
05 Jan 2009, 13:04
#12
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

It jumps right to

Advanced Search?

"There is no product that matches the search criteria."


Maybe my code is in the wrong place??
05 Jan 2009, 15:29
#13
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

I'm right at the door dude.

I see it's picking up the categories, I see it's picking up the 'cPath' (PATH - cpath 3 - get $current $current , see screenshot) though I believe it's in the wrong spot. Obviously it shouldn't render on screen.

When I click a price in "Price By Range" it seems to go to "Advanced Search" which you can see with the screenshot I provided is right underneath (1000.00+).
05 Jan 2009, 20:46
#14
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

Ajeh:

Here is a problem ...

The reference for the categories_id changes depending on how you move around the Catalog ...

Toss this in the file just to see how these variables move about:
echo 'PATH ' . $_GET['categories_id'] . ' - cpath ' . $_GET['cPath'] . ' - get $current ' . $_GET['current_categories_id'] . ' $current ' . $current_categories_id . '<br>';


You can code for which of these is available to use as the:
'&categories_id=' . $something

You just need to write something to make the $something correct for more than one click ... easy smeazy, eh? :cool:


Maybe here below where I went wrong?


You can code for which of these is available to use as the:
'&categories_id=' . $something

You just need to write something to make the $something correct for more than one click ... easy smeazy, eh? :cool:



What do I do exactly?

Thanks!!
05 Jan 2009, 21:18
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

You currently can navigate between the Categories ... and this gives the Product Listing ...

But, you have a lot of Products and Customers may want to see what in the current Category is in one of the price ranges in the sidebox ...

If you include the:
&categories_id = $_GET['cPath']

in the URL then they will see that filtered price range for the current Category in the Listing ...

Where you might run into a problem is that now the $_GET['cPath'] isn't available after that first click ...

If they try to click another price range, it will filter all Products ...

So, you need to adapt this code to work all of the time by tracking when to use the right paramaters ...

I would literally have to sit down and write all of this to make the links always capable of working right when navigating between the Categories on the Product Listing and allowing for 1 to many times of picking the price range ...

If you try this a few times with what you have, you will see where you lose the relationship of the current category and current price filter with a new price filter on the same category ...

This is the spot where doing some custom coding would be of help to keep things easy on the customer ...
05 Jan 2009, 21:38
#16
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

I keep seeing this on the screen

PATH 2 - cpath - get $current $current
06 Jan 2009, 01:48
#17
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

Can you at least tell me if I have this code in the right place?

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_1_F . '&pto=' . SP_RANGE_1_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_1 . '</a><br />';

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_2_F . '&pto=' . SP_RANGE_2_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_2 . '</a><br />';

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_3_F . '&pto=' . SP_RANGE_3_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_3 . '</a><br />';

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_4_F . '&pto=' . SP_RANGE_4_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_4 . '</a><br />';

$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_5_F . '&pto=' . SP_RANGE_5_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_5 . '</a><br />';


[PHP]<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: tpl_search.php 277 2004-09-10 23:03:52Z wilt $
// $Id: tpl_search.php,v 1.0 2005/02/01 00:00:00 juxi zoza $
//
$content = '';

//------------------------------------------------------------------------ REMOVED
// $content .= '<span class="search_subtitle">' . BOX_SEARCH_QUICK_TEXT . '</span>';


// Optional silver.gif, used by Zencart in many places
// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';

//------------------------------------------------------------------------ REMOVED

// Optional <HR> "Horizontal Rule"
// $content .='<HR />';
//
// $content .= zen_draw_form('quick_find', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get');
// $content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
// $content .= zen_draw_hidden_field('search_in_description', '1');
// $content .= '<div align="center">' . zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px"') . '<br /><input type="submit" value="' . HEADER_SEARCH_BUTTON . '" style="width: 50px" />';
// $content .= "</div></form>";
//
// $content .= '<br /><span class="search_subtitle">' . BOX_SEARCH_QUICK_PRICE . '</span>';
//
//// Optional silver.gif, used by Zencart in many places
//// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';
//
//// Optional <HR> "Horizontal Rule"
// $content .='<HR />';
//
//------------------------------------------------------------------------ REMOVED

// Advanced Search URLs are created
// Add or Delete $content rows, as needed

//------------------------------------------------------------------------ ADDED
// Define Search Price From and To ranges
define('SP_RANGE_1_F','0.00' ); define('SP_RANGE_1_T','49.99' );
define('SP_RANGE_2_F','50.00' ); define('SP_RANGE_2_T','99.99' );
define('SP_RANGE_3_F','100.00' ); define('SP_RANGE_3_T','499.99');
define('SP_RANGE_4_F','500.00' ); define('SP_RANGE_4_T','999.99');
define('SP_RANGE_5_F','1000.00' ); define('SP_RANGE_5_T','' );

// Use Search Price From & To Defines to Define text shown in sidebox
define('SP_RANGE_1', "\$" . SP_RANGE_1_F . " - \$" . SP_RANGE_1_T);
define('SP_RANGE_2', "\$" . SP_RANGE_2_F . " - \$" . SP_RANGE_2_T);
define('SP_RANGE_3', "\$" . SP_RANGE_3_F . " - \$" . SP_RANGE_3_T);
define('SP_RANGE_4', "\$" . SP_RANGE_4_F . " - \$" . SP_RANGE_4_T);
define('SP_RANGE_5', "\$" . SP_RANGE_5_F . " +");
//------------------------------------------------------------------------ ADDED

$content .= '<hr class="leg_hr_sidebox"/>';
$content .= '<div class="search_pricerange">';


$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_1_F . '&pto=' . SP_RANGE_1_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_1 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_2_F . '&pto=' . SP_RANGE_2_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_2 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_3_F . '&pto=' . SP_RANGE_3_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_3 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_4_F . '&pto=' . SP_RANGE_4_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_4 . '</a><br />';
$content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_5_F . '&pto=' . SP_RANGE_5_T . '&categories_id=' . $_GET['cPath']) . '">' . SP_RANGE_5 . '</a><br />';
echo 'PATH ' . $_GET['categories_id'] . ' - cpath ' . $_GET['cPath'] . ' - get $current ' . $_GET['current_categories_id'] . ' $current ' . $current_categories_id . '<br>';

// $content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_1_F . '&pto=' . SP_RANGE_1_T) . '">' . SP_RANGE_1 . '</a><br />';
// $content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_2_F . '&pto=' . SP_RANGE_2_T) . '">' . SP_RANGE_2 . '</a><br />';
// $content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_3_F . '&pto=' . SP_RANGE_3_T) . '">' . SP_RANGE_3 . '</a><br />';
// $content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_4_F . '&pto=' . SP_RANGE_4_T) . '">' . SP_RANGE_4 . '</a><br />';
// $content .= '<a href="' . zen_href_link('advanced_search_result&keyword=&pfrom=' . SP_RANGE_5_F . '&pto=' . SP_RANGE_5_T) . '">' . SP_RANGE_5 . '</a><br />';
$content .= '</div>';
$content .= '<br/>';

// Optional <HR> "Horizontal Rule"
$content .='<HR />';

$content .= '<a id="advanced_search" href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';

// Optional silver.gif, used by Zencart in many places
// $content .= zen_draw_separator('pixel_silver.gif') . '<br />';

?>[/PHP]
06 Jan 2009, 15:33
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

It looks like it would work if I were on a Product Listing for a category and wanted to see a filtered list of products ...

What will not work is if I try to filter the same Product List a second time as there won't be a cPath available to set the list from ...

This is where something like a price filter can take some work to build ...

It needs to work the first time it is used as well as the second time it is used ...

So right now, I think it will work the first time to filter a Product Listing by a price range, it will not be able to be used twice in a row and will always need a fresh Product Listing made ...

Try it out and see how it works for you ... :smile:
06 Jan 2009, 17:08
#19
robertr avatar

robertr

New Zenner

Join Date:
Dec 2008
Posts:
52
Plugin Contributions:
0

Re: Price Range

The ########## changed his mind again. He thinks the Best Buy website was written in a week? LOL!

Would this be easier Ajeh? See screenshots. Please help. If I don't conquer (make progress today with this) this for lack of a better phrase I'm done (fired).

Within the categories dropdown only the prices associated with the chosen item show. For example you'd never have $20.00 - $30.00 for a can of Pepsi. For a can of Pepsi it could be $0.50 - $5.00 per say.
06 Jan 2009, 17:20
#20
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Price Range

This gets complicated with the number of products in each range and filtering high/low ... to only show relevant price ranges ...

It all can be done ... but I would really have to sit down and write it to make it all work ...