Page 35 of 81 FirstFirst ... 25333435363745 ... LastLast
Results 341 to 350 of 808
  1. #341
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,296
    Plugin Contributions
    1

    Default Re: Help with Dynamic filter 1.1

    Solved - All of these niggles were actually symptoms of something fairly simple (as always). The names of my options and values were in a bit of a mess because of the previous Product Filter setup I was using. I've cleaned/tidied/rationalised and all seems to work perfectly.

  2. #342
    Join Date
    Aug 2013
    Location
    India
    Posts
    7
    Plugin Contributions
    0

    Default Regarding PHP Warning: strlen() expects parameter 1 to be string Warning

    Hi there

    I have been reading the thread to resolve the PHP Warning: strlen() expects parameter 1 to be string error but to no avail.

    I have tried and done each and every thing mentioned in the thread.

    I have a zen cart 1.5.1 (upgraded version) and major mods installed are: IH4, Multi cross sell and Dynamic filter. URL: http://artemisia.com/store/

    The problem is when I click Add to Cart button, it gives me a blank page with the warning.

    Hosting Details:

    Server OS: Linux 2.6.18-238.19.1.el5PAE
    Database: MySQL 5.0.96-log
    PHP Version: 5.3.24 (Zend: 2.3.0)
    PHP Memory Limit: 64M
    PHP Safe Mode: Off
    PHP File Uploads: On
    Max Size: 32M
    Database Data Size: 7,920 kB

    Following is what my functions_general.php file looks like:

    PHP Code:
    // Return all HTTP GET variables, except those passed as a parameter
    function zen_get_all_get_params($exclude_array ''$search_engine_safe true) {

    if (!
    is_array($exclude_array)) $exclude_array = array();

    $get_url '';
    if (
    is_array($_GET) && (sizeof($_GET) > 0)) {
    reset($_GET);
    while (list(
    $key$value) = each($_GET)) {
    // bof dynamic filter 1 of 3
    if ( (!in_array($key$exclude_array)) && (strlen($value) > || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
    // eof dynamic filter 1 of 3
    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
    // die ('here');
    $get_url .= $key '/' rawurlencode(stripslashes($value)) . '/';
    } else {
    // bof dynamic filter 2 of 3
    if (is_array($value)) {
    foreach(
    $value as $arr){
    $get_url .= zen_sanitize_string($key) . '[]=' rawurlencode(stripslashes($arr)) . '&';
    }
    } else {
    // eof dynamic filter 2 of 3
    $get_url .= zen_sanitize_string($key) . '=' rawurlencode(stripslashes($value)) . '&';
    // bof dynamic filter 3 of 3
    }
    // eof dynamic filter 3 of 3
    }
    }
    }
    }
    while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);
    while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);

    return 
    $get_url;

    Please help me out.


    Thanks

  3. #343
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Regarding PHP Warning: strlen() expects parameter 1 to be string Warning

    Quote Originally Posted by laksh0302 View Post
    Hi there

    I have been reading the thread to resolve the PHP Warning: strlen() expects parameter 1 to be string error but to no avail.

    I have tried and done each and every thing mentioned in the thread.

    I have a zen cart 1.5.1 (upgraded version) and major mods installed are: IH4, Multi cross sell and Dynamic filter. URL: http://artemisia.com/store/

    The problem is when I click Add to Cart button, it gives me a blank page with the warning.

    Hosting Details:

    Server OS: Linux 2.6.18-238.19.1.el5PAE
    Database: MySQL 5.0.96-log
    PHP Version: 5.3.24 (Zend: 2.3.0)
    PHP Memory Limit: 64M
    PHP Safe Mode: Off
    PHP File Uploads: On
    Max Size: 32M
    Database Data Size: 7,920 kB

    Following is what my functions_general.php file looks like:

    PHP Code:
    // Return all HTTP GET variables, except those passed as a parameter
    function zen_get_all_get_params($exclude_array ''$search_engine_safe true) {

    if (!
    is_array($exclude_array)) $exclude_array = array();

    $get_url '';
    if (
    is_array($_GET) && (sizeof($_GET) > 0)) {
    reset($_GET);
    while (list(
    $key$value) = each($_GET)) {
    // bof dynamic filter 1 of 3
    if ( (!in_array($key$exclude_array)) && (strlen($value) > || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
    // eof dynamic filter 1 of 3
    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
    // die ('here');
    $get_url .= $key '/' rawurlencode(stripslashes($value)) . '/';
    } else {
    // bof dynamic filter 2 of 3
    if (is_array($value)) {
    foreach(
    $value as $arr){
    $get_url .= zen_sanitize_string($key) . '[]=' rawurlencode(stripslashes($arr)) . '&';
    }
    } else {
    // eof dynamic filter 2 of 3
    $get_url .= zen_sanitize_string($key) . '=' rawurlencode(stripslashes($value)) . '&';
    // bof dynamic filter 3 of 3
    }
    // eof dynamic filter 3 of 3
    }
    }
    }
    }
    while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);
    while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);

    return 
    $get_url;

    Please help me out.


    Thanks
    The code for 1.5.1 should be:
    PHP Code:
    // bof dynamic filter 1 of 3
            
    if ( (!in_array($key$exclude_array)) && (is_string($value) && strlen($value) > || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
    // eof dynamic filter 1 of 3
              
    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) )
              {
    //    die ('here');
                
    $get_url .= $key '/' rawurlencode(stripslashes($value)) . '/';
              }
              else
              {
    // bof dynamic filter 2 of 3
                
    if (is_array($value))
                {
                  foreach(
    $value as $arr)
                  {
                    
    $get_url .= zen_sanitize_string($key) . '[]=' rawurlencode(stripslashes($arr)) . '&';
                  }
                }
                else
                {
    // eof dynamic filter 2 of 3
                  
    $get_url .= zen_sanitize_string($key) . '=' rawurlencode(stripslashes($value)) . '&';
    // bof dynamic filter 3 of 3
                
    }
    // eof dynamic filter 3 of 3
              
    }
            }
          }
        }
        while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);
        while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);

        return 
    $get_url;
      } 

  4. #344
    Join Date
    Aug 2013
    Location
    India
    Posts
    7
    Plugin Contributions
    0

    Default Re: Regarding PHP Warning: strlen() expects parameter 1 to be string Warning

    Quote Originally Posted by Design75 View Post
    The code for 1.5.1 should be:
    PHP Code:
    // bof dynamic filter 1 of 3
            
    if ( (!in_array($key$exclude_array)) && (is_string($value) && strlen($value) > || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
    // eof dynamic filter 1 of 3
              
    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) )
              {
    //    die ('here');
                
    $get_url .= $key '/' rawurlencode(stripslashes($value)) . '/';
              }
              else
              {
    // bof dynamic filter 2 of 3
                
    if (is_array($value))
                {
                  foreach(
    $value as $arr)
                  {
                    
    $get_url .= zen_sanitize_string($key) . '[]=' rawurlencode(stripslashes($arr)) . '&';
                  }
                }
                else
                {
    // eof dynamic filter 2 of 3
                  
    $get_url .= zen_sanitize_string($key) . '=' rawurlencode(stripslashes($value)) . '&';
    // bof dynamic filter 3 of 3
                
    }
    // eof dynamic filter 3 of 3
              
    }
            }
          }
        }
        while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);
        while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);

        return 
    $get_url;
      } 

    Thanks a lotfor the correct code.

    I just made changes to my functions_general.php file.
    However, the add to cart still shows a blank page with a warning.

    I checked the log files and following is what it showed me:

    [02-Sep-2013 14:34:50 America/Phoenix] PHP Fatal error: 1146:Table 'artemisiacartdem.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK' doesn't exist :: select stock_id from TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK where products_id = '47' in /home/content/b/a/r/barbschulman/html/store/includes/classes/db/mysql/query_factory.php on line 120

    Please tell me if anything was wrong with the upgrade?

  5. #345
    Join Date
    Aug 2013
    Location
    India
    Posts
    7
    Plugin Contributions
    0

    Default Re: Regarding PHP Warning: strlen() expects parameter 1 to be string Warning

    Quote Originally Posted by Design75 View Post
    The code for 1.5.1 should be:
    PHP Code:
    // bof dynamic filter 1 of 3
            
    if ( (!in_array($key$exclude_array)) && (is_string($value) && strlen($value) > || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
    // eof dynamic filter 1 of 3
              
    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) )
              {
    //    die ('here');
                
    $get_url .= $key '/' rawurlencode(stripslashes($value)) . '/';
              }
              else
              {
    // bof dynamic filter 2 of 3
                
    if (is_array($value))
                {
                  foreach(
    $value as $arr)
                  {
                    
    $get_url .= zen_sanitize_string($key) . '[]=' rawurlencode(stripslashes($arr)) . '&';
                  }
                }
                else
                {
    // eof dynamic filter 2 of 3
                  
    $get_url .= zen_sanitize_string($key) . '=' rawurlencode(stripslashes($value)) . '&';
    // bof dynamic filter 3 of 3
                
    }
    // eof dynamic filter 3 of 3
              
    }
            }
          }
        }
        while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);
        while (
    strstr($get_url'&&')) $get_url str_replace('&&''&'$get_url);

        return 
    $get_url;
      } 

    Thanks a lotfor the correct code.

    I just made changes to my functions_general.php file.
    However, the add to cart still shows a blank page with a warning.

    I checked the log files and following is what it showed me:

    [02-Sep-2013 14:34:50 America/Phoenix] PHP Fatal error: 1146:Table 'artemisiacartdem.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK' doesn't exist :: select stock_id from TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK where products_id = '47' in /home/content/b/a/r/barbschulman/html/store/includes/classes/db/mysql/query_factory.php on line 120

    Please tell me if anything was wrong with the upgrade?

  6. #346
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Regarding PHP Warning: strlen() expects parameter 1 to be string Warning

    Quote Originally Posted by laksh0302 View Post
    Thanks a lotfor the correct code.

    I just made changes to my functions_general.php file.
    However, the add to cart still shows a blank page with a warning.

    I checked the log files and following is what it showed me:

    [02-Sep-2013 14:34:50 America/Phoenix] PHP Fatal error: 1146:Table 'artemisiacartdem.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK' doesn't exist :: select stock_id from TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK where products_id = '47' in /home/content/b/a/r/barbschulman/html/store/includes/classes/db/mysql/query_factory.php on line 120

    Please tell me if anything was wrong with the upgrade?
    Apparently you are running products with attribute stock, but do not have the tables installed

  7. #347
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,296
    Plugin Contributions
    1

    Default Re: Incorrect Product Count on Featured and Advanced Search Result

    Hi,

    Zencart v1.51
    Dynamic Filter v1.2
    With Multisite v0.4.2

    This problem is to do with the display of the product count (next to the option value name) in the dynamic filter sidebox, the issue I believe may be related to the Multisite add-on although I can't be certain.

    Category product listing pages - correct number of products listed in the center column, correct product count shown next to option value name

    Featured and Advanced Search Results pages (I don't use specials, new or all) - correct number of products listed in the center column, incorrect product count shown next to option value name. The product count shows the total number of all products of all multisite sites that use the option value.

    I had thought that there might be a cat_filter missing after the core file merges of the header_php.php files for Featured and Advanced Search Results pages but I have checked, and in any event the products listed in the center column of these pages are displayed correctly according to multisite settings.

    It seems strange that the sidebox option values on the Category product listing pages 'count' correctly but those on the search result and featured pages do not.

    Anyone have any ideas?

  8. #348
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Incorrect Product Count on Featured and Advanced Search Result

    Quote Originally Posted by simon1066 View Post
    Hi,

    Zencart v1.51
    Dynamic Filter v1.2
    With Multisite v0.4.2

    This problem is to do with the display of the product count (next to the option value name) in the dynamic filter sidebox, the issue I believe may be related to the Multisite add-on although I can't be certain.

    Category product listing pages - correct number of products listed in the center column, correct product count shown next to option value name

    Featured and Advanced Search Results pages (I don't use specials, new or all) - correct number of products listed in the center column, incorrect product count shown next to option value name. The product count shows the total number of all products of all multisite sites that use the option value.

    I had thought that there might be a cat_filter missing after the core file merges of the header_php.php files for Featured and Advanced Search Results pages but I have checked, and in any event the products listed in the center column of these pages are displayed correctly according to multisite settings.

    It seems strange that the sidebox option values on the Category product listing pages 'count' correctly but those on the search result and featured pages do not.

    Anyone have any ideas?
    This is the code I use for Dynamic fiter in combination with Multishop

    file: includes/templates/YOUR_TEMPLATE/sideboxes/tpl_dynamic_filter.php
    PHP Code:
    <?php
    /*
     * tpl_dynamic_filter.php
     *
     *Zen Cart dynamic filter module
     *Damian Taylor, March 2010
     *
     */

      //if (defined('CEON_URI_MAPPING_ENABLED') && CEON_URI_MAPPING_ENABLED == 1) $pageName = preg_replace('{^.*/([^\?]+)\??.*$}', '$1', $_SERVER['REQUEST_URI']);
      
    $pageName substr(strrchr($breadcrumb->trail('/'), "/"), 1);
      if (empty(
    $currency_type))
      {
        
    $currency_type $_SESSION['currency'];
      }
      
    $currency_symbol $currencies->currencies[$currency_type]['symbol_left'];
      
    $conversion_rate $currencies->get_value($_SESSION['currency']);
      
    $resetParms = array();
      
    $display_limit zen_get_new_date_range();
      if (
    FILTER_GOOGLE_TRACKING == 'Asynchronous')
      {
        
    $trackingStart '_gaq.push([\'_trackEvent\', ';
        
    $trackingEnd ']);';
      }
      else if (
    FILTER_GOOGLE_TRACKING == 'ga.js')
      {
        
    $trackingStart 'pageTracker._trackEvent(';
        
    $trackingEnd ');';
      }

    // draw filter form
      
    $content '';
      
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent">';
      
    $content .= zen_draw_form('product_filter_form','''get');

    // draw hidden fields
      
    reset($_GET);
      while(list(
    $key$value) = each ($_GET))
      {
        if ( (
    $key != 'main_page' || $key == 'main_page' && (!defined('CEON_URI_MAPPING_ENABLED') || CEON_URI_MAPPING_ENABLED == || $current_page_base == 'advanced_search_result')) && ($key != zen_session_name()) && ($key != 'error') && ($key != 'currency') && ($key != 'x') && ($key != 'y') && ($key != 'filter_id') )
        {
          if ((
    substr($key,0,strlen(DYNAMIC_FILTER_PREFIX)) != DYNAMIC_FILTER_PREFIX) )
          {
            
    $content .= zen_draw_hidden_field($key$value);
          }
        }
      }

    // use $listing_sql to populate dynamic filter
      
    $query_lower strtolower($listing_sql);
      
    $pos_from strpos($query_lower' from'0);
      
    $pos_where strpos($query_lower' where'0);
      
    $pos_group strpos($query_lower' group by'0);
      
    $pos_to strlen($query_lower);
      if (
    $pos_group == 0)
      {
        
    $pos_group $pos_to;
      }

    // list filtered and unfiltered products for category
      
    $unfiltered_sql str_replace(array($filter$having), array("",""), "SELECT p.products_id, p.products_price_sorter, p.master_categories_id, p.manufacturers_id" substr($listing_sql$pos_from, ($pos_where $pos_from)) . substr($listing_sql$pos_where, ($pos_group $pos_where)));
    // bof Multi site
      
    $unfiltered $db->Execute(cat_filter($unfiltered_sql));
    // eof Multi site

      
    $filtered_sql "SELECT p.products_id, p.products_price_sorter, p.master_categories_id, p.manufacturers_id" substr($listing_sql$pos_from, ($pos_where $pos_from)) . substr($listing_sql$pos_where, ($pos_to $pos_where));

    // bof Multi site
      
    $filtered $db->Execute(cat_filter($filtered_sql));
    // eof Multi site
      
    if ($filtered->RecordCount() == 0)
      {
        
    $filtered_sql str_replace(array($filter$having), array("",""), "SELECT p.products_id, p.products_price_sorter, p.master_categories_id, p.manufacturers_id" substr($listing_sql$pos_from, ($pos_where $pos_from)) . substr($listing_sql$pos_where, ($pos_group $pos_where)));
    // bof Multi site
        
    $filtered $db->Execute(cat_filter($filtered_sql));
    // eof Multi site
      
    }

    // retrieve filtered and unfiltered product options
      
    $min 0;
      
    $max 0;
      while (!
    $unfiltered->EOF)
      {
        if (
    $min == or round($unfiltered->fields['products_price_sorter'], 2) < $min)
        {
          
    $min round($unfiltered->fields['products_price_sorter'], 2);
        }
        if (
    round($unfiltered->fields['products_price_sorter'], 2) > $max)
        {
          
    $max round($unfiltered->fields['products_price_sorter'], 2);
        }
        
    $unfilteredProducts[] = $unfiltered->fields['products_id'];
        
    $unfilteredManufacturers[] = $unfiltered->fields['manufacturers_id'];
        
    $unfilteredCategories[] = $unfiltered->fields['master_categories_id'];

        
    $unfiltered->MoveNext();
      }
      while (!
    $filtered->EOF)
      {
        
    $priceArray[] = round($filtered->fields['products_price_sorter'], 2);
        
    $filteredProducts[] = $filtered->fields['products_id'];
        
    $filteredManufacturers[] = $filtered->fields['manufacturers_id'];
        
    $filteredCategories[] = $filtered->fields['master_categories_id'];

        
    $filtered->MoveNext();
      }

      if (
    count($unfilteredManufacturers) > 1)
      {
        
    $unfilteredManufacturers array_filter(array_unique($unfilteredManufacturers));
      }
      if (
    count($unfilteredCategories) > 1)
      {
        
    $unfilteredCategories array_filter(array_unique($unfilteredCategories));
      }
      if (
    count($unfilteredProducts) > 1)
      {
        
    $unfilteredProducts array_filter(array_unique($unfilteredProducts));
      }
      if (
    count($filteredManufacturers) > 1)
      {
        
    $filteredManufacturers array_filter(array_unique($filteredManufacturers));
      }
      if (
    count($filteredCategories) > 1)
      {
        
    $filteredCategories array_filter(array_unique($filteredCategories));
      }
      if (
    count($filteredProducts) > 1)
      {
        
    $filteredProducts array_filter(array_unique($filteredProducts));
      }
      if (
    count($priceArray) > 1)
      {
        
    $priceArray array_filter(array_unique($priceArray));
      }

    /*
     * start manufacturer/category drop down/link/check boxes
     */

    // Only display if standard zen cart category/manufacturer dropdown is disabled
      
    if (PRODUCT_LIST_FILTER == 0)
      {
        if (isset(
    $_GET['manufacturers_id']) && $_GET['manufacturers_id'] != '' || $current_page_base == 'products_all' || $current_page_base == 'products_new' || $current_page_base == 'specials' || $current_page_base == 'featured_products' || $current_page_base == 'advanced_search_result')
        {
          if (
    count($unfilteredCategories) > 0)
          {
            
    $group DYNAMIC_FILTER_PREFIX str_replace(' '''DYNAMIC_FILTER_CATEGORY_GROUP);
            
    $resetParms[] = $group;
            
    $parameters zen_get_all_get_params();
            
    $dropdownDefault str_replace('%n'DYNAMIC_FILTER_CATEGORY_GROUPDYNAMIC_FILTER_DROPDOWN_DEFAULT);

    // BOF language fix by a_berezin
    // bof Multi site
            
    $categories $db->Execute(cat_filter("SELECT categories_id, categories_name, IF(categories_id IN (" implode(','$filteredCategories) . "), 'Y', 'N') as flag" .
                                  
    " FROM " TABLE_CATEGORIES_DESCRIPTION .
                                  
    " WHERE categories_id IN (" implode(','$unfilteredCategories) . ")" .
                                  
    " AND language_id=" . (int)$_SESSION['languages_id'] .
                                  
    " ORDER BY categories_name"));
    // eof Multi site
    // EOF language fix

            
    $content .= '<div><div class="dFilter"><p class="dFilterHeading">' DYNAMIC_FILTER_TEXT_PREFIX DYNAMIC_FILTER_TEXT_CATEGORY DYNAMIC_FILTER_TEXT_SUFFIX '</p>';
            if (isset(
    $_GET[$group]) && array_filter($_GET[$group])) $content .= '<div class="dFilterClear"><a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array($group)), 'NONSSL') . '">' zen_image(DIR_WS_TEMPLATE_IMAGES 'clear_filter.png'DYNAMIC_FILTER_BUTTON_CLEAR_FILTER_ALT) . '</a></div>';
            if (
    strtok(FILTER_STYLE" ") == 'Dropdown'$content .= '<select name="' $group '[]" class="dFilterDrop"' . (FILTER_STYLE == 'Dropdown - Single' ' onchange="this.form.submit();"' '') . '>' '<option value=""' . (!isset($_GET[$group]) || !array_filter($_GET[$group]) ? ' selected="selected"' '') . '>' $dropdownDefault '</option>';
            else 
    $content .= '<ul' . (count($unfilteredCategories) > FILTER_MAX_OPTIONS ? (FILTER_OPTIONS_STYLE == 'Scroll' ' class="dFilterScroll">' ' class="dFilterExpand">') : '>');
            while (!
    $categories->EOF)
            {
              if (isset(
    $_GET[$group]) && in_array($categories->fields['categories_id'],$_GET[$group]))
              {
                
    $linkClass 'selected';
              }
              else if (
    $categories->fields['flag'] == 'N')
              {
                
    $linkClass 'disabled';
              }
              else
              {
                
    $linkClass 'enabled';
              }

              
    $onClick '';
              if (
    FILTER_GOOGLE_TRACKING != 'No')
              {
                
    $onClick .= $trackingStart '\'filterAction\', \'' . ($linkClass != 'selected' 'addFilter' 'removeFilter') . '\', \'' $pageName ';' DYNAMIC_FILTER_CATEGORY_GROUP '=' $categories->fields['categories_name'] . '\'' $trackingEnd;
              }
              if (
    FILTER_STYLE == 'Checkbox - Single'$onClick .= ' this.form.submit();';

              if (
    FILTER_METHOD != 'Hidden' || $linkClass != 'disabled')
              {
                
    $hrefLink $group '[]=' $categories->fields['categories_id'];
                switch(
    strtok(FILTER_STYLE" "))
                {
                  case 
    'Checkbox':
                    
    $content .= '<li class="dFilterLink">' zen_draw_checkbox_field($group '[]'$categories->fields['categories_id'], (isset($_GET[$group]) && in_array($categories->fields['categories_id'],$_GET[$group]) ? true false), ($linkClass == 'disabled' 'disabled="disabled"' '') . ($onClick != '' && FILTER_STYLE == 'Checkbox - Single' ' onclick="' $onClick '"' '')) . $categories->fields['categories_name'] . '</li>';
                    break;
                  case 
    'Link':
                    
    $content .= '<li class="dFilterLink"><a class="' $linkClass '"' . ($linkClass != 'disabled' ' rel="nofollow" href="' zen_href_link($_GET['main_page'], ($linkClass != 'selected' $parameters $hrefLink str_replace(array($hrefLink,'&'.$hrefLink), array("",""), $parameters)), 'NONSSL') . '"' . ($onClick != '' ' onclick="' $onClick '"' '') : '') . ' >' $categories->fields['categories_name'] . '</a></li>';
                    break;
                  case 
    'Dropdown':
                    
    $content .= '<option value="' $categories->fields['categories_id'] . '"' . ($linkClass == 'selected' ' selected="selected"' '') . ($linkClass == 'disabled' ' disabled="disabled"' '') . ($onClick != '' && FILTER_STYLE == 'Dropdown - Single' ' onclick="' $onClick '"' '') . ' >' .  $categories->fields['categories_name'] . '</option>';
                    break;
                }
              }
              
    $categories->MoveNext();
            }
            if (
    strtok(FILTER_STYLE" ") == 'Dropdown')
            {
              
    $content .= '</select>';
            }
            else
            {
              
    $content .= '</ul>';
            }
            if (
    FILTER_OPTIONS_STYLE == 'Expand' && count($unfilteredCategories) > FILTER_MAX_OPTIONS)
            {
              
    $content .= '<a class="dFilterToggle" href="#">' TEXT_DYNAMIC_FILTER_SHOW_MORE zen_image(DIR_WS_TEMPLATE_IMAGES 'arrow_more.gif'TEXT_DYNAMIC_FILTER_SHOW_MORE'''''class="dFilterToggleImg"') . '</a>';
            }
            
    $content .= '</div></div>';
          }
        }
        if (!isset(
    $_GET['manufacturers_id']))
        {
          if (
    count($unfilteredManufacturers) > 0)
          {
            
    $group DYNAMIC_FILTER_PREFIX str_replace(' '''DYNAMIC_FILTER_MANUFACTURER_GROUP);
            
    $resetParms[] = $group;
            
    $parameters zen_get_all_get_params(array($group));
            
    $dropdownDefault str_replace('%n'DYNAMIC_FILTER_MANUFACTURER_GROUPDYNAMIC_FILTER_DROPDOWN_DEFAULT);

    // BOF fix by a_berezin
            
    if (sizeof($filteredManufacturers) > 0)
              {
                
    $manufacturers $db->Execute("SELECT manufacturers_id, manufacturers_name, IF(manufacturers_id IN(" implode(','$filteredManufacturers) . "), 'Y', 'N') as flag" .
                     
    " FROM " TABLE_MANUFACTURERS .
                     
    " WHERE manufacturers_id IN (" implode(','$unfilteredManufacturers) . ")" .
                     
    " ORDER BY manufacturers_name");
            }
            else
            {
              
    $manufacturers $db->Execute("SELECT manufacturers_id, manufacturers_name, 'N' as flag" .
                     
    " FROM " TABLE_MANUFACTURERS .
                     
    " WHERE manufacturers_id IN (" implode(','$unfilteredManufacturers) . ")" .
                    
    " ORDER BY manufacturers_name");
            }
    // EOF fix

            
    $content .= '<hr width="90%" size="0" />';
            
    $content .= '<div><div class="dFilter"><p class="dFilterHeading">' DYNAMIC_FILTER_TEXT_PREFIX DYNAMIC_FILTER_TEXT_MANUFACTURER DYNAMIC_FILTER_TEXT_SUFFIX '</p>';
            if (isset(
    $_GET[$group]) && array_filter($_GET[$group])) $content .= '<div class="dFilterClear"><a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array($group)), 'NONSSL') . '">' zen_image(DIR_WS_TEMPLATE_IMAGES 'clear_filter.png'DYNAMIC_FILTER_BUTTON_CLEAR_FILTER_ALT) . '</a></div>';
            if (
    strtok(FILTER_STYLE" ") == 'Dropdown'$content .= '<select name="' $group '[]" class="dFilterDrop"' . (FILTER_STYLE == 'Dropdown - Single' ' onchange="this.form.submit();"' '') . '>' '<option value=""' . (!isset($_GET[$group]) || !array_filter($_GET[$group]) ? ' selected="selected"' '') . '>' $dropdownDefault '</option>';
            else 
    $content .= '<ul' . (count($unfilteredManufacturers) > FILTER_MAX_OPTIONS ? (FILTER_OPTIONS_STYLE == 'Scroll' ' class="dFilterScroll">' ' class="dFilterExpand">') : '>');
            while (!
    $manufacturers->EOF)
            {
              if (isset(
    $_GET[$group]) && in_array($manufacturers->fields['manufacturers_id'],$_GET[$group])) $linkClass 'selected';
              else if (
    $manufacturers->fields['flag'] == 'N'$linkClass 'disabled';
              else 
    $linkClass 'enabled';

              
    $onClick '';
              if (
    FILTER_GOOGLE_TRACKING != 'No'$onClick .= $trackingStart '\'filterAction\', \'' . ($linkClass != 'selected' 'addFilter' 'removeFilter') . '\', \'' $pageName ';' DYNAMIC_FILTER_MANUFACTURER_GROUP '=' $manufacturers->fields['manufacturers_name'] . '\'' $trackingEnd;
              if (
    FILTER_STYLE == 'Checkbox - Single'$onClick .= ' this.form.submit();';

              if (
    FILTER_METHOD != 'Hidden' || $linkClass != 'disabled')
              {
                
    $hrefLink $group '[]=' $manufacturers->fields['manufacturers_id'];
                switch(
    strtok(FILTER_STYLE" "))
                {
                  case 
    'Checkbox':
                    
    $content .= '<li class="dFilterLink">' zen_draw_checkbox_field($group '[]'$manufacturers->fields['manufacturers_id'], (isset($_GET[$group]) && in_array($manufacturers->fields['manufacturers_id'],$_GET[$group]) ? true false), ($linkClass == 'disabled' 'disabled="disabled"' '') . ($onClick != '' && FILTER_STYLE == 'Checkbox - Single' ' onclick="' $onClick '"' '')) . $manufacturers->fields['manufacturers_name'] . '</li>';
                    break;
                  case 
    'Link':
                    
    $content .= '<li class="dFilterLink"><a class="' $linkClass '"' . ($linkClass != 'disabled' ' rel="nofollow" href="' zen_href_link($_GET['main_page'], ($linkClass != 'selected' $parameters $hrefLink str_replace(array($hrefLink,'&'.$hrefLink), array("",""), $parameters)), 'NONSSL') . '"' . ($onClick != '' ' onclick="' $onClick '"' '') : '') . ' >' $manufacturers->fields['manufacturers_name'] . '</a></li>';
                    break;
                  case 
    'Dropdown':
                    
    $content .= '<option value="' $manufacturers->fields['manufacturers_id'] . '"' . ($linkClass == 'selected' ' selected="selected"' '') . ($linkClass == 'disabled' ' disabled="disabled"' '') . ($onClick != '' && FILTER_STYLE == 'Dropdown - Single' ' onclick="' $onClick '"' '') . ' >' .  $manufacturers->fields['manufacturers_name'] . '</option>';
                    break;
                }
              }
            
    $manufacturers->MoveNext();
            }
            if (
    strtok(FILTER_STYLE" ") == 'Dropdown'$content .= '</select>';
            else 
    $content .= '</ul>';
            if (
    FILTER_OPTIONS_STYLE == 'Expand' && count($unfilteredManufacturers) > FILTER_MAX_OPTIONS$content .= '<a class="dFilterToggle" href="#">' TEXT_DYNAMIC_FILTER_SHOW_MORE zen_image(DIR_WS_TEMPLATE_IMAGES 'arrow_more.gif'TEXT_DYNAMIC_FILTER_SHOW_MORE'''''class="dFilterToggleImg"') . '</a>';
            
    $content .= '</div></div>';
          }
        }
      }

    /*
     * end manufacturer/category drop down/link/check boxes
     */


    /*
     * start price range link/check boxes
     */
      
    if (count($priceArray) > 0)
      {
        
    $priceGap floor(($max $min) / (FILTER_MAX_RANGES 1));
        if (
    FILTER_MIN_PRICE && $priceGap FILTER_MIN_PRICE)
        {
          
    $priceGap FILTER_MIN_PRICE;
        }
        if (
    FILTER_MAX_PRICE && $priceGap FILTER_MAX_PRICE)
        {
          
    $priceGap FILTER_MAX_PRICE;
        }

      
    $group DYNAMIC_FILTER_PREFIX str_replace(' '''DYNAMIC_FILTER_PRICE_GROUP);
      
    $resetParms[] = $group;
      
    $parameters zen_get_all_get_params();
      
    $dropdownDefault str_replace('%n'DYNAMIC_FILTER_PRICE_GROUPDYNAMIC_FILTER_DROPDOWN_DEFAULT);
      
    $priceCount 0;
      
    $prices '';

      for (
    $start $min 0.5$start $max$start $end 0.01)
      {
        
    $end round($start $priceGap);
        if (
    $end $max)
        {
    // BOF tax fix by design75
        
    $text $currency_symbol round(zen_add_tax($start$products_tax) * $conversion_rate) . TEXT_DYNAMIC_FILTER_DIVIDER $currency_symbol round(zen_add_tax($end$products_tax) * $conversion_rate);
        }
        else
        {
          
    $text $currency_symbol round(zen_add_tax($start$products_tax) * $conversion_rate) . TEXT_DYNAMIC_FILTER_AND_OVER;
    // EOF tax fix
        
    }
        foreach(
    $priceArray as $price )
        {
          if (
    $start <= $price && $end >= $price)
          {
            if (isset(
    $_GET[$group]) && in_array($start '--' $end,$_GET[$group]))
            {
              
    $linkClass 'selected';
            }
            else
            {
              
    $linkClass 'enabled';
            }
            break;
          }
          else
          {
            
    $linkClass 'disabled';
          }
        }

        
    $onClick '';
        if (
    FILTER_GOOGLE_TRACKING != 'No'$onClick .= $trackingStart '\'filterAction\', \'' . ($linkClass != 'selected' 'addFilter' 'removeFilter') . '\', \'' $pageName ';' DYNAMIC_FILTER_PRICE_GROUP '=' $start '-' $end '\'' $trackingEnd;
              if (
    FILTER_STYLE == 'Checkbox - Single'$onClick .= ' this.form.submit();';

              if (
    FILTER_METHOD != 'Hidden' || $linkClass != 'disabled')
                {
                  
    $hrefLink $group '[]=' $start '--' $end;
                  switch(
    strtok(FILTER_STYLE" "))
                    {
                      case 
    'Checkbox':
                        
    $prices .= '<li class="dFilterLink">' zen_draw_checkbox_field($group '[]'$start '--' $end, (isset($_GET[$group]) && in_array($start '--' $end,$_GET[$group]) ? true false), ($linkClass == 'disabled' 'disabled="disabled"' '') . ($onClick != '' && FILTER_STYLE == 'Checkbox - Single' ' onclick="' $onClick '"' '')) . $text '</li>';
                      break;
                      case 
    'Link':
                        
    $prices .= '<li class="dFilterLink"><a class="' $linkClass '"' . ($linkClass != 'disabled' ' rel="nofollow" href="' zen_href_link($_GET['main_page'], ($linkClass != 'selected' $parameters $hrefLink str_replace(array($hrefLink,'&'.$hrefLink), array("",""), $parameters)), 'NONSSL') . '"' . ($onClick != '' ' onclick="' $onClick '"' '') : '') . ' >' $text '</a></li>';
                      break;
                      case 
    'Dropdown':
                        
    $prices .= '<option value="' $start '--' $end '"' . ($linkClass == 'selected' ' selected="selected"' '') . ($linkClass == 'disabled' ' disabled="disabled"' '') . ($onClick != '' && FILTER_STYLE == 'Dropdown - Single' ' onclick="' $onClick '"' '') . ' >' $text '</option>';
                      break;
                    }
                }
              ++
    $priceCount;
            }

          
    $content .= '<hr width="90%" size="0" />';
          
    $content .= '<div><div class="dFilter"><p class="dFilterHeading">' DYNAMIC_FILTER_TEXT_PREFIX DYNAMIC_FILTER_TEXT_PRICE DYNAMIC_FILTER_TEXT_SUFFIX '</p>';
          if (isset(
    $_GET[$group]) && array_filter($_GET[$group])) $content .= '<div class="dFilterClear"><a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array($group)), 'NONSSL') . '">' zen_image(DIR_WS_TEMPLATE_IMAGES 'clear_filter.png'DYNAMIC_FILTER_BUTTON_CLEAR_FILTER_ALT) . '</a></div>';
          if (
    strtok(FILTER_STYLE" ") == 'Dropdown'$content .= '<select name="' $group '[]" class="dFilterDrop"' . (FILTER_STYLE == 'Dropdown - Single' ' onchange="this.form.submit();"' '') . '>' '<option value=""' . (!isset($_GET[$group]) || !array_filter($_GET[$group]) ? ' selected="selected"' '') . '>' $dropdownDefault '</option>';
          else 
    $content .= '<ul' . ($priceCount FILTER_MAX_OPTIONS ? (FILTER_OPTIONS_STYLE == 'Scroll' ' class="dFilterScroll">' ' class="dFilterExpand">') : '>');
          
    $content .= $prices;
          if (
    strtok(FILTER_STYLE" ") == 'Dropdown'$content .= '</select>';
          else 
    $content .= '</ul>';
          if (
    FILTER_OPTIONS_STYLE == 'Expand' && $priceCount FILTER_MAX_OPTIONS$content .= '<a class="dFilterToggle" href="#">' TEXT_DYNAMIC_FILTER_SHOW_MORE zen_image(DIR_WS_TEMPLATE_IMAGES 'arrow_more.gif'TEXT_DYNAMIC_FILTER_SHOW_MORE'''''class="dFilterToggleImg"') . '</a>';
          
    $content .= '</div></div>';
        }

    /*
     * end price range link/check boxes
     */


    /*
     * start attribute link/check boxes
     */

      
    if(count($filteredProducts) > 0)
        {
        
    // Below line counts up all quantities of each item. e.g. if a glove is available in Small and Medium, quantity = 2.
        //$attributes = $db->Execute("SELECT po.products_options_name, pov.products_options_values_name, count( p2as.quantity ) as quantity" .
    ................................
    rest of file is cut of due to post length

    the 4 pieces of changed code are marked with
    // bof Multi site
    and
    // eof Multi site

  9. #349
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,296
    Plugin Contributions
    1

    Default Re: Incorrect Product Count on Featured and Advanced Search Result

    You are a star, thank you

  10. #350
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,296
    Plugin Contributions
    1

    Default Re: Dynamic Filter Mod - suggestion for future release

    One thing that might be useful to include in a future release:

    At the moment the the product count - I guess it should be called quantity - displayed next to the attribute remains constant, I think it would be good to have that change dynamically as attributes are selected.

    I'm not sure how much work that would mean as it's beyond my capabilities.

    Just a thought.

 

 
Page 35 of 81 FirstFirst ... 25333435363745 ... LastLast

Similar Threads

  1. Hebrew Support - latest release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 20
    Last Post: 23 Apr 2025, 08:49 AM
  2. Empty Dynamic Filter
    By LadyoftheCave in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 6 Jun 2016, 12:47 PM
  3. v150 Dynamic filter
    By Dinoleix in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 13 Aug 2013, 10:23 AM
  4. v150 Dynamic filter - All pages
    By Okkwebmedia in forum Addon Sideboxes
    Replies: 0
    Last Post: 8 Jul 2013, 08:52 AM
  5. v138a Dynamic Filter
    By SoftCorpse in forum All Other Contributions/Addons
    Replies: 9
    Last Post: 18 Jun 2012, 01:32 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR