Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2009
    Posts
    86
    Plugin Contributions
    0

    Default Extra Search fields in custom Search form

    Heyas,
    Well, I went and done it again
    I created a 2nd Advanced search form with it's own results page. Some how, I was able to make it work great with the exception of 1 small thing lol, when i first created it a few weeks ago, it only had 3 fields, all of which are in an additional fields table that works well and and the customer is pleased as punch with it. Then it was decided that 3 more fields needed to be added. So I went in and added the 3 extra fields, 1 of them is "price" which comes from the product table and 2 that come from the additional fields table.

    http://surferweb.com/ojlparts/index....orklift_search

    Now if you select any or all of these 3, Capacity, Fuel, Tires, it's works as expected and I get the proper results.
    However, Selecting ANY of the other 3, Price, Make, or Mast Type it all goes haywire
    I have enabled some variables on the bottom of the page to see whats happening, particularly the "WHERE" clause, no matter which one is selected it set s the fuel box to whatever index you select.
    Now for some code:
    includes/modules/pages/advanced_forklift_search_result/header_php.php

    PHP Code:
    $_GET['tires'] = trim($_GET['tires']);
    $_GET['fuel'] = trim($_GET['fuel']);
    $_GET['make'] = trim($_GET['make']);
    $_GET['mast'] = trim($_GET['mast']);
    $_GET['price'] = trim($_GET['price']);

     if( 
    $_GET['capacity']==&& $_GET['tires']==&& $_GET['fuel']==&& ($_GET['make'] == 0) && ($_GET['mast'] == 0) && ($_GET['price'] == 0) ){
        
    $error true;
        
    $missing_one_input true;
        
    $messageStack->add_session('search'ERROR_AT_LEAST_ONE_INPUT);
      } else {
        
    $tires '';
        
    $fuel '';
        
    $capacity '';
        
    $make '';
        
    $mast '';
        
    $price '';
      
          if (
    $_GET['capacity']!= ) {
              
    $capacity $_GET['capacity'];
          }
         if (
    $_GET['tires']!= ) {
              
    $tires $_GET['tires'];
          }
         if (
    $_GET['fuel']!= ) {
              
    $fuel $_GET['fuel'];
          }
          if (
    $_GET['make']!= ) {
              
    $fuel $_GET['make'];
          }
          if (
    $_GET['mast']!= ) {
              
    $fuel $_GET['mast'];
          }
          if (
    $_GET['price']!= ) {
              
    $fuel $_GET['price'];
          }
      } 
    This is where I think the problem is, I don't think the 3 new fields are defined anywhere and for the life of me I don't remember where I defined the 3 other fields, I know they weren't standard because they are in an additional fields table.

    PHP Code:
    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;
        case 
    'PRODUCT_LIST_PRICE':
        
    $select_column_list .= 'p.products_price';
        break;
        case 
    'FORKLIFT_CPAC':
        
    $select_column_list .= 'pf.forklift_cpac';
        break;
        case 
    'FORKLIFT_TIRES':
        
    $select_column_list .= 'pf.forklift_tires';
        break;
        case 
    'FORKLIFT_FUEL':
        
    $select_column_list .= 'pf.forklift_fuel';
        break;
        case 
    'FORKLIFT_MAKE':
        
    $select_column_list .= 'pf.forklift_make';
        break;
        case 
    'FORKLIFT_MAST_TYPE':
        
    $select_column_list .= 'pf.forklift_mast_type';
        break;
        
      } 
    here is the where statement:
    PHP Code:
    if ($capacity != 0){
                
    $where_str .= " AND ";
                
                
    $where_str .= "((pf.forklift_cpac >= '$lh') and (pf.forklift_cpac <= '$hh'))";
            }
            if (
    $fuel != 0){
                
    $where_str .= " AND ";
                
                
    $where_str .= "pf.forklift_fuel='$fuel_type'";
            }
            if (
    $tires != 0){
                
    $where_str .= " AND ";
                
                
    $where_str .= "pf.forklift_tires='$tire_type'";
            }
            if (
    $make != 0){
                
    $where_str .= " AND ";
                
                
    $where_str .= "pf.forklift_make='$make_f'";
            }
            if (
    $mast != 0){
                
    $where_str .= " AND ";
                
                
    $where_str .= "pf.forklift_mast='$mast_type'";
            }
            if (
    $price != 0){
                
    $where_str .= " AND ";
                if (
    $price 4){
                    
    $where_str .= "((p.products_price >= '$pr_l') and (p.products_price <= '$pr_h'))";
                } else {
                    
    $where_str .= "p.products_price >= '$pr_l'";
                }
            } 
    I have checked everywhere for the defines and cant seem to figure out where these need to be.
    Any direction would be appreciated.

    Thanks in Advance
    Jeff

  2. #2
    Join Date
    Jan 2007
    Posts
    1,483
    Plugin Contributions
    10

    Default Re: Extra Search fields in custom Search form

    In the admin section, tools>developers toolkit. Will quickly become your best friend. Search for your define and it will tell you which file it's in. IMO, this is one of the most powerful features of zen cart with regards to customizations of php and css files.

    Zen Cart and it's community are the best!!

  3. #3
    Join Date
    Jun 2009
    Posts
    86
    Plugin Contributions
    0

    Default Re: Extra Search fields in custom Search form

    tools>developers toolkit = GOD! I know, I've searched it and i don't see the define for FORKLIFT_CPAC which is one of the ones that works, so I figured if i could find the define for it, I could find where to define the missing ones, but to no avail.
    But the price define is a system define, it should work shouldnt it?
    It's like somehow defined as only 3 fields, not 6?
    Last edited by jeffiec; 14 Mar 2013 at 01:22 AM.

 

 

Similar Threads

  1. v139h Custom Advanced Search Fields
    By divinelighting in forum General Questions
    Replies: 0
    Last Post: 27 Jul 2012, 08:22 PM
  2. How to replace the head search form with Google Adsense search form?
    By lina0962 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 14 Mar 2010, 11:33 PM
  3. Add additional custom fields to Search Feature?
    By KismetDesign in forum Addon Sideboxes
    Replies: 0
    Last Post: 15 Jul 2009, 03:56 AM
  4. Modifying the Advanced Search Form Fields?
    By uruharacosplay in forum General Questions
    Replies: 0
    Last Post: 4 Mar 2008, 06:43 PM
  5. Ajax Search for Oscommerce with Extra Fields
    By Warrior in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 17 Oct 2006, 04:14 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