Hi everyone!
What a buggy add on!
I got it to work fine, that is until I add some more price ranges with extra PRANGE statements.
I amended 3 files and added more PRANGE statements
My header_php.php was amended with:
$enable_price_filter = true;
switch($price_range){
case 0:
$pfrom = MIN_PRICE;
$pto = MAX_PRICE;
break;
case 1:
$pfrom = PRANGE1_MIN;
$pto = PRANGE1_MAX;
break;
case 2:
$pfrom = PRANGE2_MIN;
$pto = PRANGE2_MAX;
break;
case 3:
$pfrom = PRANGE3_MIN;
$pto = PRANGE3_MAX;
break;
case 4:
$pfrom = PRANGE4_MIN;
$pto = PRANGE4_MAX;
break;
case 5:
$pfrom = PRANGE5_MIN;
$pto = PRANGE5_MAX;
break;
$pfrom = PRANGE6_MIN;
$pto = PRANGE6_MAX;
break;
My product_filter_defines.php amended:
define('MIN_PRICE','0');
define('MAX_PRICE','1000000');
define('PRANGE1_WORD','Below 10');
define('PRANGE1_MIN',MIN_PRICE);
define('PRANGE1_MAX',9.99);
define('PRANGE2_WORD','10 -- 20');
define('PRANGE2_MIN',10.00);
define('PRANGE2_MAX',19.99);
define('PRANGE3_WORD','20 -- 30');
define('PRANGE3_MIN',20.00);
define('PRANGE3_MAX',29.99);
define('PRANGE4_WORD','30 -- 40');
define('PRANGE4_MIN',30.00);
define('PRANGE4_MAX',39.99);
define('PRANGE5_WORD','40 -- 50');
define('PRANGE5_MIN',40.00);
define('PRANGE5_MAX',49.99);
define('PRANGE6_WORD','Over 50');
define('PRANGE6_MIN',50.00);
define('PRANGE6_MAX',MAX_PRICE);
And finally my tpl_product_filter.php:
if(SHOW_PRICE_RANGE){
$prices = array (array("id"=> 0, "text" => PRODUCT_FILTER_TEXT_ALL_PRICE),
array("id"=> 1, "text" => PRANGE1_WORD),
array("id"=> 2, "text" => PRANGE2_WORD),
array("id"=> 3, "text" => PRANGE3_WORD),
array("id"=> 4, "text" => PRANGE4_WORD),
array("id"=> 5, "text" => PRANGE5_WORD),
array("id"=> 6, "text" => PRANGE6_WORD));
$content .= zen_draw_pull_down_menu('price_range', $prices, (isset($_GET['price_range']) ? $_GET['price_range'] : ''), '') . zen_hide_session_id();
}
Whenever I search based on the original 5 PRANGE I have no issues its when I try the range specified by the new 6th PRANGE that I get this error:
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND p.products_price <= AND p.products_quantity > 0 AND p.products_id = pd.pro' at line 1
in:
[select count(distinct p.products_id) as total FROM products p, products_description pd, products_to_categories p2c, products_attributes pa, categories cat , products_options po , products_options_values pov WHERE (p.products_status = 1 AND p.products_id = pa.products_id AND p2c.categories_id = 66 AND p.products_price >= AND p.products_price <= AND p.products_quantity > 0 AND p.products_id = pd.products_id AND p.products_id = p2c.products_id) ]
Also if you look at my page https://www.majesticsilver.co.uk/store
you will see that the drop down fields for the filter search are all different sizes and spill over to my center column.
So any Ideas how I can edit the PRONGE properly, what am I doing wrong, cant be an issue with the rest of the code because if I dont add extra PRANGE everything works great. Even with the new PRANGE the original 5 work fine! just the extra one makes an error.
And which file to edit to control the width of the drop down fields..
Kindly assist me on this :smile:
P.S. Anyone posting some examples of working code would be really nice- Cheers!