Page 10 of 17 FirstFirst ... 89101112 ... LastLast
Results 91 to 100 of 169
  1. #91
    Join Date
    May 2009
    Posts
    64
    Plugin Contributions
    0

    Default Re: product filter module addon

    Quote Originally Posted by SCkatlyns View Post
    I have tried and tried to get this mod to work. I get it installed and it shows up on the sidebox. The problem is that no matter what filter I choose, I do not get any products at all.

    Can someone help?

    Thanks,
    Kat
    The search-sql just lists products, if they are on stock. (see in sql: AND p.products_quantity > 0)

    As I do not use zen-cart to control my stock, I didn't refer on this - but for this mod to work, one has to. Or one has to change the sql and get rid of "AND p.products_quantity > 0".

  2. #92
    Join Date
    Apr 2010
    Posts
    22
    Plugin Contributions
    0

    Default Re: product filter module addon

    Hey,

    Having a couple of issues with this module. I've managed to fix the attribute and price filter. And that all works (Sort of).

    I currently have two of everything. I.e two colour boxes and two size boxes. The module only works if you select the attribute twice. But in the attributes boxes I also have two of everything. So it looks like:

    Size
    32C
    32C
    34C
    34C
    36C
    36C
    38C
    38C
    28D
    28D

    etc.

    How do I

    a) Make there one of eac attribute filter
    b) Make one of each option value
    Regards,

    Adam.

  3. #93
    Join Date
    May 2009
    Posts
    64
    Plugin Contributions
    0

    Default Re: product filter module addon

    Quote Originally Posted by Lavanya View Post
    ok, as nobody answered i had to find out myself with the help of firebug and the delopers tool kit (indeed very helpfull both of them )
    For any other zencart beginner like me who wants to know:
    change in includes/templates/your template/templates/tpl_product_filter_result_default.php the line <h1 id="advSearchResultsDefaultHeading"><?php echo HEADING_TITLE; ?></h1> to
    <h1 id="advSearchResultsDefaultHeading"><?php echo PRODUCT_FILTER_HEADING_TITLE; ?></h1>
    and then in product_filter_define.php the line
    define('HEADING_TITLE','Product Filter Results'); to
    define('PRODUCT_FILTER_HEADING_TITLE','Product Filter Results');
    Like this the headers of my define pages don't get effected anymore by the product filter heading.
    Thank you.

  4. #94
    Join Date
    May 2009
    Posts
    14
    Plugin Contributions
    0

    Default Re: product filter module addon

    Quote Originally Posted by atmpartmart View Post
    Can anybody help me out with the error quoted below?

    Thanks in advance. I'd love to get this installed as we have added so many products lately and it's getting harder for customers to find the specific product they are looking for.
    Figured I'd try one more time to get some help on this. Can anybody help with the error I'm getting? Thank you

    ---

    1054 Unknown column 'p.master_categories_id' in 'on clause'
    in:
    [select count(distinct p.products_id) as total FROM zen_products p, zen_products_description pd, zen_products_to_categories p2c, zen_products_attributes pa, zen_products_options po , zen_products_options_values pov LEFT JOIN zen_hide_categories h ON (p.master_categories_id = h.categories_id) WHERE (h.visibility_status < 2 OR h.visibility_status IS NULL) AND (p.products_status = 1 AND p.products_quantity > 0 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id) ]

    ---

  5. #95
    Join Date
    Oct 2009
    Location
    Texas
    Posts
    194
    Plugin Contributions
    0

    Default Re: product filter module addon

    I have read this thread over and over again, yet I still have not found a fix for the sort by price returning no results issue.
    Everything else is working fine.

    The prices of my products are determined by their attributes, which may be part of the problem.

    Here's my header_php.php file after applying most of the suggested tweaks. The results of which can bee seen here
    http://sterlingleafjewelry.com/index.php
    PHP Code:
    <?php
    /**
    * header_php.php
    *
    *Zen Cart product filter module
      *Johnny Ye, Oct 2007
    * update by Jan Cabicar, Apr 2009
      
      */
      


    require(DIR_WS_MODULES zen_get_module_directory('require_languages.php'));
    $error false;
    $missing_one_input false;


    if (isset(
    $_GET['categories_id'])  && !is_numeric($_GET['categories_id'])){
      
    $error true;
      
    $messageStack->add_session('filter'ERROR_AT_LEAST_ONE_INPUT);
    } else {
        
    $categories_id ='';
    }

    $available 'yes';

    $option_ids = array();
    $option_values = array();
    foreach(
    $_GET as $key => $value){
        if(
    substr_count($key,'options')>0)
        {
            
    $option_ids[sizeof($option_ids)] = str_replace('options_','',$key);
            
    $option_values[sizeof($option_values)] = $value;
        }
    }
      
      
      if (isset(
    $_GET['categories_id'])) {
        
    $categories_id $_GET['categories_id'];
      }
      if (isset(
    $_GET['price_range'])) {
        
    $price_range $_GET['price_range'];
      }
      if (isset(
    $_GET['available'])) {
        
    $available $_GET['available'];        
        }
      if (isset(
    $_GET['sort'])) {
        
    $sort $_GET['sort'];
      }
      
      
    $price_check_error false;
      if (
    zen_not_null($pfrom)) {
        if (!
    settype($pfrom'float')) {
          
    $error true;
          
    $price_check_error true;

          
    $messageStack->add_session('filter'ERROR_PRICE_FROM_MUST_BE_NUM);
        }
      }

      
    $define_list = array('PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                         
    'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
                         
    'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                         
    'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                         
    'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                         
    'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);

    asort($define_list);

    $column_list = array();
    reset($define_list);
    while (list(
    $column$value) = each($define_list)) {
      if (
    $value$column_list[] = $column;
    }

    $select_column_list '';

    for (
    $col=0$n=sizeof($column_list); $col<$n$col++) {
      if ((
    $column_list[$col] == 'PRODUCT_LIST_NAME') || ($column_list[$col] == 'PRODUCT_LIST_PRICE')) {
        continue;
      }

      if (
    zen_not_null($select_column_list)) {
        
    $select_column_list .= ', ';
      }

      switch (
    $column_list[$col]) {
        case 
    'PRODUCT_LIST_MODEL':
        
    $select_column_list .= 'p.products_model';
        break;
        case 
    'PRODUCT_LIST_MANUFACTURER':
        
    $select_column_list .= 'm.manufacturers_name';
        break;
        case 
    'PRODUCT_LIST_QUANTITY':
        
    $select_column_list .= 'p.products_quantity';
        break;
        case 
    'PRODUCT_LIST_IMAGE':
        
    $select_column_list .= 'p.products_image';
        break;
        case 
    'PRODUCT_LIST_WEIGHT':
        
    $select_column_list .= 'p.products_weight';
        break;
      }
    }

    // always add quantity regardless of whether or not it is in the listing for add to cart buttons
    if (PRODUCT_LIST_QUANTITY 1) {
      if (empty(
    $select_column_list)) {
        
    $select_column_list .= ' p.products_quantity ';
      } else  {
        
    $select_column_list .= ', p.products_quantity ';
      }
    }

    if (
    zen_not_null($select_column_list)) {
      
    $select_column_list .= ', ';
    }

    // Notifier Point


    $select_str "SELECT DISTINCT " $select_column_list .
                  
    " m.manufacturers_id, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status ";


    $from_str " FROM " TABLE_PRODUCTS ." p, " TABLE_PRODUCTS_DESCRIPTION "  pd, " TABLE_PRODUCTS_TO_CATEGORIES " p2c, " TABLE_PRODUCTS_ATTRIBUTES " pa, " TABLE_PRODUCTS_OPTIONS " po , " TABLE_PRODUCTS_OPTIONS_VALUES " pov ";


    $order_str='';

    $listing_sql $select_str $from_str $where_str $order_str;
    $listing_sql "select DISTINCT ";
    $listing_sql .= "p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, p.products_price_sorter, p.products_qty_box_status ";

     
    $where_str " WHERE (p.products_status = 1  ";


    $enable_attribute_filter true;
    if(
    sizeof($option_ids)>0){
        for(
    $i=0;$i<sizeof($option_ids);$i++){
            if(!(empty(
    $option_values[$i])))
            {
                
    $where_str .= " AND ((pa.products_id In (SELECT pa.products_id FROM " TABLE_PRODUCTS_ATTRIBUTES " pa WHERE (";
                
    $where_str .= " pa.options_id = ".$option_ids[$i];
                
    $where_str .= " AND pa.options_values_id = ".$option_values[$i];
                
    $where_str .= " )))) ";
                
    $enable_attribute_filter true;
            }
        }
    }
            

    if(
    $enable_attribute_filter){
        
    $where_str .= " AND p.products_id = pa.products_id";
        
            
    $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;
    }
    if(
    SHOW_SORT){
        switch(
    $sort){
            case 
    0:
                
    $order_str " order by p.products_date_added DESC, p.products_date_available DESC, products_price ASC ";
            break;
            case 
    1:
                
    $order_str " order by p.products_date_added ASC, p.products_date_available ASC, products_price ASC ";
            break;
            case 
    2:
                
    $order_str " order by p.products_price ASC, p.products_date_added DESC, p.products_date_available DESC ";
            break;
            case 
    3:
                
    $order_str " order by products_price DESC, p.products_date_added DESC, p.products_date_available DESC  ";
            break;
            
    $order_str " order by p.products_date_added DESC, p.products_date_available DESC, products_price ASC ";
        }
    }


    if(
    $categories_id !=''){
        
    $where_str .=" AND p2c.categories_id = ".$categories_id;
    }

    if(
    $enable_price_filter){
        
    $where_str .= " AND p.products_price >= ".$pfrom;
        
    $where_str .= " AND p.products_price <= ".$pto;
    }


    }
    if(
    $available=='yes'){
    $where_str .= " AND p.products_quantity > 0 ";    
    }

    $where_str .=" AND p.products_id = pd.products_id";
    $where_str .=" AND pd.language_id = ".$_SESSION['languages_id'];
    $where_str .=" AND p.products_id = p2c.products_id)    ";


    $listing_sql .= $from_str;
    $listing_sql .= $where_str;
    $listing_sql .= $order_str;


    //$breadcrumb->add('title');


    // This should be last line of the script:
    ?>

  6. #96
    Join Date
    Oct 2009
    Location
    Texas
    Posts
    194
    Plugin Contributions
    0

    Default Re: product filter module addon

    Does anyone have this box working with products priced by attributes?
    It seems to be missing some code in order to get those values. I've been looking for clues in the includes/functions_price.php but, I haven't had any luck.

  7. #97
    Join Date
    Mar 2009
    Posts
    45
    Plugin Contributions
    0

    Default Re: product filter module addon

    Quote Originally Posted by Louis View Post
    Hi All, I installed this mod but found that regardless of the criteria selected no items were shown. I started debugging and modified the header_php.php file a bit.

    The scenario is as follows.

    1. The file as contained in the downloads folder will only work IF YOU HAVE ATTRIBUTES loaded against your products. I do not make use of attributes but I did like the idea of having a Price and Category search on my site.
    2. In the downloaded version there was a reference to a ZS_table. I fixed this by changing it to the correct variable so you no longer have to change the table prefix, it will be done for you.

    To install this "fix" just override the header_php.php file contained in the contribution with the following:

    Code:
    <?php
    /**
    * header_php.php
    *
    *Zen Cart product filter module
      *Johnny Ye, Oct 2007
    * update by Jan Cabicar, Apr 2009  
      */
      
    
    
    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
    $error = false;
    $missing_one_input = false;
    
    
    if (isset($_GET['categories_id'])  && !is_numeric($_GET['categories_id'])){
      $error = true;
      $messageStack->add_session('filter', ERROR_AT_LEAST_ONE_INPUT);
    } else {
    	$categories_id ='';
    }
    
    $available = 'yes';
    
    $option_ids = array();
    $option_values = array();
    foreach($_GET as $key => $value){
        if(substr_count($key,'options')>0)
    	{
    		$option_ids[sizeof($option_ids)] = str_replace('options_','',$key);
    		$option_values[sizeof($option_values)] = $value;
    	}
    }
      
      
      if (isset($_GET['categories_id'])) {
        $categories_id = $_GET['categories_id'];
      }
      if (isset($_GET['price_range'])) {
        $price_range = $_GET['price_range'];
      }
      if (isset($_GET['available'])) {
        $available = $_GET['available'];
      }
      if (isset($_GET['sort'])) {
        $sort = $_GET['sort'];
      }
      
      $price_check_error = false;
      if (zen_not_null($pfrom)) {
        if (!settype($pfrom, 'float')) {
          $error = true;
          $price_check_error = true;
    
          $messageStack->add_session('filter', ERROR_PRICE_FROM_MUST_BE_NUM);
        }
      }
    
      
    $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
                         'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                         'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
                         'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                         'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                         'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                         'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);
    
    asort($define_list);
    
    $column_list = array();
    reset($define_list);
    while (list($column, $value) = each($define_list)) {
      if ($value) $column_list[] = $column;
    }
    
    $select_column_list = '';
    
    for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
      if (($column_list[$col] == 'PRODUCT_LIST_NAME') || ($column_list[$col] == 'PRODUCT_LIST_PRICE')) {
        continue;
      }
    
      if (zen_not_null($select_column_list)) {
        $select_column_list .= ', ';
      }
    
      switch ($column_list[$col]) {
        case 'PRODUCT_LIST_MODEL':
        $select_column_list .= 'p.products_model';
        break;
        case 'PRODUCT_LIST_MANUFACTURER':
        $select_column_list .= 'm.manufacturers_name';
        break;
        case 'PRODUCT_LIST_QUANTITY':
        $select_column_list .= 'p.products_quantity';
        break;
        case 'PRODUCT_LIST_IMAGE':
        $select_column_list .= 'p.products_image';
        break;
        case 'PRODUCT_LIST_WEIGHT':
        $select_column_list .= 'p.products_weight';
        break;
      }
    }
    
    // always add quantity regardless of whether or not it is in the listing for add to cart buttons
    if (PRODUCT_LIST_QUANTITY < 1) {
      if (empty($select_column_list)) {
        $select_column_list .= ' p.products_quantity ';
      } else  {
        $select_column_list .= ', p.products_quantity ';
      }
    }
    
    if (zen_not_null($select_column_list)) {
      $select_column_list .= ', ';
    }
    
    // Notifier Point
    
    
    $select_str = "SELECT DISTINCT " . $select_column_list .
                  " m.manufacturers_id, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status ";
    
    
    $from_str = " FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . "  pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_OPTIONS . " po , " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ";
    
    
    $order_str='';
    
    $listing_sql = $select_str . $from_str . $where_str . $order_str;
    $listing_sql = "select DISTINCT ";
    $listing_sql .= "p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, p.products_price_sorter, p.products_qty_box_status ";
    
     
    $where_str = " WHERE (p.products_status = 1  ";
    	
    $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;
    }
    if(SHOW_SORT){
    	switch($sort){
    		case 0:
    			$order_str = " order by p.products_date_added DESC, p.products_date_available DESC, products_price ASC ";
    		break;
    		case 1:
    			$order_str = " order by p.products_date_added ASC, p.products_date_available ASC, products_price ASC ";
    		break;
    		case 2:
    			$order_str = " order by p.products_price ASC, p.products_date_added DESC, p.products_date_available DESC ";
    		break;
    		case 3:
    			$order_str = " order by products_price DESC, p.products_date_added DESC, p.products_date_available DESC  ";
    		break;
    		$order_str = " order by p.products_date_added DESC, p.products_date_available DESC, products_price ASC ";
    	}
    }
    
    
    if($categories_id !=''){
    	$where_str .=" AND p2c.categories_id = ".$categories_id;
    }
    
    if($enable_price_filter){
    	$where_str .= " AND p.products_price >= ".$pfrom;
    	$where_str .= " AND p.products_price <= ".$pto;
    }
    
    
    
    if($available=='yes'){
    	$where_str .= " AND p.products_quantity > 0 ";	
    }
    
    $where_str .=" AND p.products_id = pd.products_id";
    
    $where_str .=" AND p.products_id = p2c.products_id)	";
    
    
    $listing_sql .= $from_str;
    $listing_sql .= $where_str;
    $listing_sql .= $order_str;
    
     $listing_sql
    //$breadcrumb->add('title');
    
    
    // This should be last line of the script:
    ?>
    Thank you to the original author for this great mod.
    This did it for me. You're my hero!

  8. #98
    Join Date
    Oct 2009
    Location
    Texas
    Posts
    194
    Plugin Contributions
    0

    Default Re: product filter module addon

    Ok, wild goose chase is over.

    Turns out to be an issue with editing the prices ranges in:
    product_filter_defines.php and I'm not sure what I'm doing wrong.
    I changed the minimum value to $1000 to see if it would find anything, and it did.
    I put it back to $50 and continued to edit the values to reflect my shop, but again, it won't return any results.
    Here is an example of what I have so far. Where am I going wrong here?
    PHP Code:
    <?php
    /**
    * product_filter_defines.php
    *
    *Zen Cart product filter module
      *Johnny Ye, Oct 2007
      */
    define('PRODUCT_FILTER_TEXT_ALL_CATEGORIES','All Categories');
    define('PRODUCT_FILTER_TEXT_ALL_PRICE','Price Range');
    define('FILENAME_PRODUCT_FILTER_RESULT''product_filter_result');
    define('BOX_HEADING_FILTER''Advanced Search');

    define('PRODUCT_FILTER_HEADING_TITLE''Your Search Results');
    define('PRODUCT_FILTER_BUTTON_NAME''Search');
      
    define('MIN_PRICE','0');
    define('MAX_PRICE','1000000');

    define('PRANGE1_WORD','Below $50');
    define('PRANGE1_MIN',MIN_PRICE);
    define('PRANGE1_MAX',50.00);

    define('PRANGE2_WORD','$100 -- $500');
    define('PRANGE2_MIN',100.00);
    define('PRANGE2_MAX',499.99);

    define('PRANGE3_WORD','$500 -- $900');
    define('PRANGE3_MIN',500.00);
    define('PRANGE3_MAX',899.99);

    define('PRANGE4_WORD','$900 -- $1400');
    define('PRANGE4_MIN',900.00);
    define('PRANGE4_MAX',1399.99);

    define('PRANGE5_WORD','Above $1400');
    define('PRANGE5_MIN',1400.00);
    define('PRANGE5_MAX',MAX_PRICE);

    define('SHOW_CATEGORIES',true);
    define('SHOW_ATTRIBUTES',true);
    define('SHOW_PRICE_RANGE',true);
    define('SHOW_AVAILABLE',true);
    define('SHOW_SORT',true);

  9. #99
    Join Date
    Oct 2009
    Location
    Texas
    Posts
    194
    Plugin Contributions
    0

    Default Re: product filter module addon

    Back to fiddling with this again and I've come to the conclusion that it won't give search results based on products that are priced by attributes.

    I really like this module and hope that someone has figured it out or has an alternative similar to this that will give results based on ALL attributes.

  10. #100
    Join Date
    Sep 2010
    Posts
    10
    Plugin Contributions
    0

    Default Re: product filter module addon

    Hi,
    I got the filter to work on my test site. It filters the results by color/ size/ price separately. It also sorts if selected price + color or price + size. It does not work with color + size yet. I will try to get it to work. But this was my first attempt at looking at php (i am not a coder, but I understand sql).
    I made changes to header_php.php (updated file below)
    (BTW, I wont be able to answer anything as I still dont know php or any other language)

    <?php
    /**
    * header_php.php
    *
    *Zen Cart product filter module
    *Johnny Ye, Oct 2007
    * update by Jan Cabicar, Apr 2009
    * update by xzaqus, Sep 2010
    */



    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
    $error = false;
    $missing_one_input = false;


    if (isset($_GET['categories_id']) && !is_numeric($_GET['categories_id'])){
    $error = true;
    $messageStack->add_session('filter', ERROR_AT_LEAST_ONE_INPUT);
    } else {
    $categories_id ='';
    }

    $available = 'yes';

    $option_ids = array();
    $option_values = array();
    foreach($_GET as $key => $value){
    if(substr_count($key,'options')>0)
    {
    $option_ids[sizeof($option_ids)] = str_replace('options_','',$key);
    $option_values[sizeof($option_values)] = $value;
    }
    }


    if (isset($_GET['categories_id'])) {
    $categories_id = $_GET['categories_id'];
    }
    if (isset($_GET['price_range'])) {
    $price_range = $_GET['price_range'];
    }
    if (isset($_GET['available'])) {
    $available = $_GET['available'];
    }
    if (isset($_GET['sort'])) {
    $sort = $_GET['sort'];
    }

    $price_check_error = false;
    if (zen_not_null($pfrom)) {
    if (!settype($pfrom, 'float')) {
    $error = true;
    $price_check_error = true;

    $messageStack->add_session('filter', ERROR_PRICE_FROM_MUST_BE_NUM);
    }
    }


    $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
    'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
    'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
    'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
    'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
    'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
    'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);

    asort($define_list);

    $column_list = array();
    reset($define_list);
    while (list($column, $value) = each($define_list)) {
    if ($value) $column_list[] = $column;
    }

    $select_column_list = '';

    for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
    if (($column_list[$col] == 'PRODUCT_LIST_NAME') || ($column_list[$col] == 'PRODUCT_LIST_PRICE')) {
    continue;
    }

    if (zen_not_null($select_column_list)) {
    $select_column_list .= ', ';
    }

    switch ($column_list[$col]) {
    case 'PRODUCT_LIST_MODEL':
    $select_column_list .= 'p.products_model';
    break;
    case 'PRODUCT_LIST_MANUFACTURER':
    $select_column_list .= 'm.manufacturers_name';
    break;
    case 'PRODUCT_LIST_QUANTITY':
    $select_column_list .= 'p.products_quantity';
    break;
    case 'PRODUCT_LIST_IMAGE':
    $select_column_list .= 'p.products_image';
    break;
    case 'PRODUCT_LIST_WEIGHT':
    $select_column_list .= 'p.products_weight';
    break;
    }
    }

    // always add quantity regardless of whether or not it is in the listing for add to cart buttons
    if (PRODUCT_LIST_QUANTITY < 1) {
    if (empty($select_column_list)) {
    $select_column_list .= ' p.products_quantity ';
    } else {
    $select_column_list .= ', p.products_quantity ';
    }
    }

    if (zen_not_null($select_column_list)) {
    $select_column_list .= ', ';
    }

    // Notifier Point


    $select_str = "SELECT DISTINCT " . $select_column_list .
    " m.manufacturers_id, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status ";


    $from_str = " FROM " . TABLE_PRODUCTS ." p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS . " po , " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ";


    $order_str='';

    $listing_sql = $select_str . $from_str . $where_str . $order_str;
    $listing_sql = "select DISTINCT ";
    $listing_sql .= "p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, p.products_price_sorter, p.products_qty_box_status ";


    $where_str = " WHERE (p.products_status = 1 ";


    $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;
    }
    if(SHOW_SORT){
    switch($sort){
    case 0:
    $order_str = " order by p.products_date_added DESC, p.products_date_available DESC, products_price ASC ";
    break;
    case 1:
    $order_str = " order by p.products_date_added ASC, p.products_date_available ASC, products_price ASC ";
    break;
    case 2:
    $order_str = " order by p.products_price ASC, p.products_date_added DESC, p.products_date_available DESC ";
    break;
    case 3:
    $order_str = " order by products_price DESC, p.products_date_added DESC, p.products_date_available DESC ";
    break;
    $order_str = " order by p.products_date_added DESC, p.products_date_available DESC, products_price ASC ";
    }
    }




    $enable_attribute_filter = true ;
    if(sizeof($option_ids)>0){
    for($i=0;$i<sizeof($option_ids);$i++){
    if(!(empty($option_values[$i])))
    {
    $where_str .= " AND pa.options_id = ".$option_ids[$i];
    $where_str .= " AND pa.options_values_id = ".$option_values[$i];
    }
    }
    }


    if($enable_attribute_filter){
    $where_str .= " AND p.products_id = pa.products_id ";

    }


    if($categories_id !=''){
    $where_str .=" AND p2c.categories_id = ".$categories_id;
    }

    if($enable_price_filter){
    $where_str .= " AND p.products_price >= ".$pfrom;
    $where_str .= " AND p.products_price <= ".$pto;
    }



    if($available=='yes'){
    $where_str .= " AND p.products_quantity > 0 ";
    }

    $where_str .=" AND p.products_id = pd.products_id";

    $where_str .=" AND p.products_id = p2c.products_id) ";


    $listing_sql .= $from_str;
    $listing_sql .= $where_str;
    $listing_sql .= $order_str;

    $listing_sql
    //$breadcrumb->add('title');


    // This should be last line of the script:
    ?>

 

 
Page 10 of 17 FirstFirst ... 89101112 ... LastLast

Similar Threads

  1. Product filter Module: Advanced search results page not working
    By WWRepair in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 5 Mar 2013, 11:51 PM
  2. v139h 1064 SQL error in product filter addon?
    By 4jDesigns in forum All Other Contributions/Addons
    Replies: 12
    Last Post: 17 Jan 2013, 07:59 PM
  3. Product Filter Module - 1109:Unknown table 'p' in field list
    By moesoap in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 28 May 2012, 01:40 PM
  4. modified product filter / alpha filter help please
    By bn17311 in forum General Questions
    Replies: 1
    Last Post: 5 Oct 2011, 09:43 PM
  5. SQL problem with filter by attributes addon
    By daparky in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 6 Jan 2010, 10:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg