Zen Cart Logo
Forums / Addon Sideboxes / Dynamic Filter [Support Thread]

Dynamic Filter [Support Thread]

Views: 652,516

Results 201 to 220 of 809
23 Feb 2013, 06:52
#201
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Dynamic Filter [Support Thread]

It's interesting, I just replaced the **"includes/functions/functions_general.php" **from the mod with my backed up file and it started working again.

And I know there are differences between the two.

23 Feb 2013, 07:11
#202
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Dynamic Filter [Support Thread]

Ya, but now you may have problems with users creating accounts or resetting passwords etc.

23 Feb 2013, 14:25
#203
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Kevin205:

It works, then it fails to function after clicking to test for filters. I get the white page.

I am getting the following error message:
[22-Feb-2013 21:50:56] PHP Fatal error: Cannot redeclare zen_create_random_value() (previously declared in
/home/content//html//cart/includes/functions/functions_general.php:626) in
/home/content/
/html//cart/includes/functions/password_funcs.php on line 86
Any idea where it's coming from?

You replied to my sorting manufactures post. Is this what you are having issues with? I only ask because I intended to post this as a new thread but it somehow ended up being part of this thread. Apologies if not and for any confusion.

If it is regarding sorting manufacturers please post your code and ill take a look. I'm not site why that would cause any issues in those files you mentioned.

23 Feb 2013, 14:29
#204
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Kevin205:

It's interesting, I just replaced the **"includes/functions/functions_general.php" **from the mod with my backed up file and it started working again.

And I know there are differences between the two.

My 1.5.1 didn't merge very well. Try using the 1.5.1 original file as a template and use the properly merged code which seems to work provided by DrByte here:
http://www.zen-cart.com/showthread.php?205872-Need-some-help-diagnosing-functions_general-php-errors&p=1188244#post1188244

23 Feb 2013, 21:15
#205
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Hi Phil - I was replying to Dynamic Filter [Support Thread] and not to **Sorting Manufacturers on Dynamic Filter Sidebox **. Sorry I didn't realize the title could be revised.

I am trying to install "Dynamic Filter v1.0" in a perfectly working Zen 1.5.1. I am having a terrible time trying to figure out what I am doing wrong!

Following is the error I am getting, plus a nice white page on a previously working test site.

[23-Feb-2013 13:46:13] PHP Fatal error:  Cannot redeclare zen_create_random_value() (previously declared in 
/home/content/***/html/cart/includes/functions/functions_general.php:626) in 
/home/content/***/html/cart/includes/functions/password_funcs.php on line 86

I had installed **Products Listing Sorter v1.1** and I thought that was conflicting with Dynamic Filter v1.0. So I removed it and I am still getting the above error.

I have followed exactly as per the instructions.

DrByte replied saying that I have to merge the files in /includes/functions/functions_general.php

As I am looking at the /includes/functions/functions_general.php file from Dynamic Filter v1.0 mod and comparing it to the original file of my working site, there is a vast amount code changes. And I don't think it's just a matter of doing a merge with some line of code.

There is a lot of line of code otherwise, I would have copied it here.

And I can't figure out where to start looking for other errors, if any?

I am stuck. :frusty:

23 Feb 2013, 21:24
#206
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Kevin205:

Hi Phil - I was replying to Dynamic Filter [Support Thread] and not to **Sorting Manufacturers on Dynamic Filter Sidebox **. Sorry I didn't realize the title could be revised.

I am trying to install "Dynamic Filter v1.0" in a perfectly working Zen 1.5.1. I am having a terrible time trying to figure out what I am doing wrong!

Following is the error I am getting, plus a nice white page on a previously working test site.

[23-Feb-2013 13:46:13] PHP Fatal error: Cannot redeclare zen_create_random_value() (previously declared in
/home/content//html/cart/includes/functions/functions_general.php:626) in
/home/content/
/html/cart/includes/functions/password_funcs.php on line 86

> 
> I had installed [\*\*Products Listing Sorter v1.1\*\*](http://www.zen-cart.com/showthread.php?205606-Product-Listing-Sorter-Drop-Down) and I thought that was conflicting with **Dynamic Filter v1.0**.  So I removed it and I am still getting the above error.
> 
> I have followed exactly as per the instructions.  
> 
> DrByte replied saying that I have to merge the files in /includes/functions/functions_general.php
> 
> As I am looking at the /includes/functions/functions_general.php file from **Dynamic Filter v1.0** mod and comparing it to the original file of my working site, there is a vast amount code changes.  And I don't think it's just a matter of doing a merge with some line of code.
> 
> There is a lot of line of code otherwise, I would have copied it here. 
> 
> And I can't figure out where to start looking for other errors, if any?
> 
> I am stuck. :frusty:

What files did dynamic filter override on your install?

If I remember correctly on mine te main two were the functions general and the default filter (I think) 

Both I think were out of date from the 1.5.1 files ment they needed merging instead of simply replacing.

Did you try using the clean 1.5.1 functions general file with DrBytes updated and merged function which affects dynamic filter in the post with link I made above?

Failing this its got to be either a mod somewhere conflicting or you haven't merged a file correctly somewhere.

Might be worth fully removing dynamic filter and starting over just to double check?

I can confirm that I have it working fine on 1.5.1 the only change I had to make was the functions general code in that post (but this was just to rectify warnings not because it wasn't working) which is why I think you have something wrong going on
23 Feb 2013, 21:26
#207
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I just noticed that even thought in the install section of the mod says

Modified Core Files
A few core Zen Cart files must be modified to work with the Dynamic Filter module.
If any of the core files this distribution uses have already been modified (because of another third party module being installed for example) then the changes for the respective files should be applied manually by copying across the appropriate sections of code required for the Dynamic Filter module. These sections are clearly marked (with “// bof dynamic filter x of x” and “// eof dynamic filter x of x” comments) within the sample files provided in this distribution and should be easy enough to copy across, especially if a “diff” software package (such as DiffMerge or WinMerge) is used.
The modified files can be found within the 'core file overrides' folder in the distribution as follows.

Attachment 11990

In the supplied mod file /includes/functions/functions_general.php there are other line with code changes. That are not commented with “// bof dynamic filter x of x” and “// eof dynamic filter x of x” comments. So I would not know what to merge. :yuck:

23 Feb 2013, 21:31
#208
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Kevin205:

I just noticed that even thought in the install section of the mod says

Attachment 11990

In the supplied mod file /includes/functions/functions_general.php there are other line with code changes. That are not commented with “// bof dynamic filter x of x” and “// eof dynamic filter x of x” comments. So I would not know what to merge. :yuck:

The commented bit is the only bit that needs merging. Any other differences are because the file is an old version. So hence you need to use your fresh 1.5.1 copy of te file and just update the function detailed In The post linked in where DrByte amended the function that was commented as described above.

If you still get problems it's because you have other mods that have modified the functions general file

23 Feb 2013, 21:32
#209
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Phil back to rescue again. Wow. Thanks.

philip937:

What files did dynamic filter override on your install?

If I remember correctly on mine te main two were the functions general and the default filter (I think)

Both I think were out of date from the 1.5.1 files ment they needed merging instead of simply replacing.

Did you try using the clean 1.5.1 functions general file with DrBytes updated and merged function which affects dynamic filter in the post with link I made above?

Failing this its got to be either a mod somewhere conflicting or you haven't merged a file correctly somewhere.

Might be worth fully removing dynamic filter and starting over just to double check?

I can confirm that I have it working fine on 1.5.1 the only change I had to make was the functions general code in that post (but this was just to rectify warnings not because it wasn't working) which is why I think you have something wrong going on

I will try that and will post what code overrides are. Thank you.

23 Feb 2013, 21:40
#210
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Overrides are:

The mod has the following overrides, which I have added.

includes/classes/split_page_results.php
includes/functions/functions_general.php
includes/modules/pages/advanced_search_result/header_php.php
includes/modules/pages/featured_products/header_php.php
includes/modules/pages/products_all/header_php.php
includes/modules/pages/products_new/header_php.php
includes/modules/pages/specials/header_php.php
includes/modules/pages/specials/main_template_vars.php

It also askes you to add a template override includes/index_filters/YOUR_TEMPLATE/default_filter.php

The only thing I have not done is to add ```php
[B]$excludeParams[] = DYNAMIC_FILTER_PREFIX . 'Colour';[/B]

23 Feb 2013, 21:44
#211
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Ok so first things first.

Do any of the files that have be overridden been modified by any of your other mods?

Secondly, starting to come back to me now. Pretty sure almost all if not all of the header files were out of date? Check the file version compared to the dynamic filter ones, I think I had to merge them.

Don't worry about cannonical, that doesn't do anything at this stage. All it will do is ensure that your canonical links in the source are correct when the filters are applied.

23 Feb 2013, 21:54
#212
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

philip937:

Ok so first things first.

Do any of the files that have be overridden been modified by any of your other mods?
I removed the only one that did, which was Products Listing Sorter v1.1

Secondly, starting to come back to me now. Pretty sure almost all if not all of the header files were out of date? Check the file version compared to the dynamic filter ones, I think I had to merge them.
Oh I have to look at that.

Don't worry about cannonical, that doesn't do anything at this stage. All it will do is ensure that your canonical links in the source are correct when the filters are applied.

ps. where can I get DrByte's Code revision?

23 Feb 2013, 21:57
#213
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

So you use the 1.5.1 file and change this function re written by DrByte
http://www.zen-cart.com/showthread.php?205872-Need-some-help-diagnosing-functions_general-php-errors&p=1188244#post1188244

That should be the only function in the file that is changed for dynamic filter and that version DrByte rewrote works fine for dynamic filter

23 Feb 2013, 22:27
#214
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

OK then in:
(1) Code from the mod - Creating the error and the white page.

  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) > 0 || 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;
  }

**(2)**DrBytes revision:

  function zen_get_all_get_params($exclude_array = array(), $search_engine_safe = true) {
    if (!is_array($exclude_array)) $exclude_array = array();
    $exclude_array = array_merge($exclude_array, array(zen_session_name(), 'main_page', 'error', 'x', 'y'));
    $get_url = '';
    if (is_array($_GET) && (sizeof($_GET) > 0)) {
      reset($_GET);
      while (list($key, $value) = each($_GET)) {
        if (!in_array($key, $exclude_array)) {
          if (!is_array($value)) {
            if (is_string($value) && strlen($value) > 0) {
              $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
            }
          } else {
            foreach(array_filter($value) as $arr){
              $get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
            }
          }
        }
      }
    }
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);

    return $get_url;
  }  

**(3)**Code from my backup working site before Dynamic Filter

    function zen_get_all_get_params($exclude_array = '', $search_engine_safe = true) {

    if (!is_array($exclude_array)) $exclude_array = array();
    $exclude_array = array_merge($exclude_array, array(zen_session_name(), 'main_page', 'error', 'x', 'y'));
    $get_url = '';
    if (is_array($_GET) && (sizeof($_GET) > 0)) {
      reset($_GET);
      while (list($key, $value) = each($_GET)) {
        if (is_array($value) || in_array($key, $exclude_array)) continue;
        if (strlen($value) > 0) {
          $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
        }
      }
    }
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);

    return $get_url;
  }

I just have to replace (3) with (2)?

23 Feb 2013, 22:33
#215
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Correct replace with (2) make sure you are doing this in a clean v1.5.1 functions general file

however I'm pretty sure that is not what is causing your error as I did not face the same thing. All this code change did was stopped some error log warnings.

I suspect that the problem is with other files that haven't merged properly.

You need to check the override files vs the version revisions of the 1.5.1 files they override. If they are older then they need to be merged. Will be going to bed very soon so won't be able to reply for a while. Just take it step by step one file at a time. The key is to ensure you are using the same files as version 1.5.1 uses and merge the changes dynamic filter makes.

On the plus side, I didn't find it hard to merge any of them apart from the functions general one to make it all good which DrByte kindly stepped in a did for us.

23 Feb 2013, 22:46
#216
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Phil You are the best. That did it.

It now works. No more white page. It seems to be functioning properly also. with no other revisions. I will let you know if I see other problems.

now I have to add the following to /includes/classes/shopping_cart.php line 1904-1906:

//      zen_redirect(zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action', 'notify', 'main_page'))));
//      zen_redirect(zen_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, zen_get_all_get_params(array('action', 'notify', 'main_page'))));
      zen_redirect(zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action', 'notify', 'main_page'))));  

as DrByte recommends. Doctor knows best.

@DrByte, this revision should be it. Correct? And I should not have the following issue?

DrByte:

Ya, but now you may have problems with users creating accounts or resetting passwords etc.

Thank you DrByte.

23 Feb 2013, 22:48
#217
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Glad to hear it. Yes I will be adding that code also when I get around to it. The Dr knows best as you say. Glad you got it sorted. Still worth treble checking that all your files are up to date.

Take care :-)

23 Feb 2013, 22:51
#218
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Dynamic Filter [Support Thread]

Correct.

25 Feb 2013, 05:08
#219
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I do not see the top category, but I see it filtered by Brand and Price (This top category does not have any sub-categories.)```php
index.php?main_page=index&cPath=1


I do not see the top category, or any other filter in (This has sub-categories.)```php
index.php?main_page=index&cPath=2
```.

Is there any way to see **all the categories** including the **top category** filterable in the side box, in the filter area? As you see it in ```php
index.php?main_page=products_all
25 Feb 2013, 06:21
#220
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

There are only various views when you see the category filter.

Products new and products all, probably search (though not got to testing that yet) and manufacturers pages.

There would be no point having filter by category when you are already viewing a category. Similarly on manufacters pages category filter shows but manufacters filter does not.