Zen Cart Logo
Forums / Addon Sideboxes / product filter module addon

product filter module addon

Views: 81,446

Results 121 to 140 of 169
20 Oct 2010, 9:09 PM
#121
aozhaver avatar

aozhaver

Zen Follower

Join Date:
Sep 2010
Posts:
121
Plugin Contributions:
0

product filter module addon

HI! thanks so much for the response.

I did do as you said...

I defined

define('BUTTON_IMAGE_PRODUCT_FILTER', 'button_search.gif');

In both

/includes/languages/english/button_names.php

AND

includes/languages/english/extra_definitions/template29011/product_filter_defines.php

But my issue is that the template itself needs to call up this button and I dont know how to change the code.

Normally its some kind of php echo zen_image type of statement - any ideas how to rewrite that one line of code?

20 Oct 2010, 9:43 PM
#122
aozhaver avatar

aozhaver

Zen Follower

Join Date:
Sep 2010
Posts:
121
Plugin Contributions:
0

Re: product filter module addon

SORTED THE BUTTON ISSUE!!!:clap: :clap: :clap:

Besides defining your button in the files I mentioned before amend the $content .= '<br /><input type="submit"..... line to:

something along the lines of:

$content .= zen_image_submit ('button_search.gif',BUTTON_IMAGE_PRODUCT_FILTER);

change to suit your image defined name and file name.

NOW! what about the PRONGE issue mentioned above cmon guys and girls dont I deserve a bit of help :cry: just a tiny issue remaining cmon I read this thread twice :yuck:

HELPPP is coming I can feel it :D I can see it in the image of a lil green elf :laugh:

20 Oct 2010, 9:57 PM
#123
aozhaver avatar

aozhaver

Zen Follower

Join Date:
Sep 2010
Posts:
121
Plugin Contributions:
0

Re: product filter module addon

ALL SORTED! no need for help

My header_php.php was missing case 6:

So instead of just adding

$pfrom = PRANGE6_MIN;
$pto = PRANGE6_MAX;
break;

I should have added

case 6:
$pfrom = PRANGE6_MIN;
$pto = PRANGE6_MAX;
break;

What a rookie...:blush:

21 Oct 2010, 9:06 AM
#124
aozhaver avatar

aozhaver

Zen Follower

Join Date:
Sep 2010
Posts:
121
Plugin Contributions:
0

Re: product filter module addon

Fireflyz:

Thanks! exactly what I was looking for.:clap:
Is there a way to exclude certain attributes?

Way way back people wanted to know if there was a way to exclude certain attributes from the filter while leaving some on.

I would like to brain storm on this and see if anyone can develop on my idea to see how to implement it in php.

As far as I can see there are 2 main areas of code that control how attributes are called and displayed by the template module:

In includes/modules/pages/product_filter_result/header_php.php

$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 ";

}

But then I realised that in the process of loading the attribute dropdown menus this statement is probably irrelevant since this file controls the search/filter results and how they are displayed and not the selection of dropdown menus, its all done AFTER the sidebox has already been loaded with all the various filter options.

So I took a look at the actual tpl file.

/*start attributes drop down*************************************************/
	if(SHOW_ATTRIBUTES){
		$option_names = $db->Execute("SELECT products_options_id,products_options_name FROM ". TABLE_PRODUCTS_OPTIONS);
		while (!$option_names->EOF) {
		$options_array = array (array("id"=> "", "text" => $option_names->fields['products_options_name']));
		$option_names_values = $db->Execute("select pov.products_options_values_id, pov.products_options_values_name from ". TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS." povp,".TABLE_PRODUCTS_OPTIONS_VALUES." pov where povp.products_options_values_id = pov.products_options_values_id AND povp.products_options_id =".$option_names->fields['products_options_id']);
			while (!$option_names_values->EOF) {
				$options_array = array_pad($options_array,sizeof($options_array )+1,array("id"=>$option_names_values->fields['products_options_values_id'],"text"=>$option_names_values->fields['products_options_values_name']));
				$option_names_values->MoveNext();
			}
		$content .= zen_draw_pull_down_menu('options_'.$option_names->fields['products_options_id'], $options_array, (isset($_GET['options_'.$option_names->fields['products_options_id']]) ? $_GET['options_'.$option_names->fields['products_options_id']] : ''), '') . zen_hide_session_id();
		$option_names->MoveNext();
		}  	
	}
	/*end  attributes drop down*************************************************/

Ah ha! so from here we can see that this part of the code has functions that read through the attributes we have set up and sees their "option name ID" as is displayed on admin>>catalog>>Attribute controller>>product options on the left side under ID column.

So the lowest ID option would be displayed first (in my case https://www.majesticsilver.co.uk/store) its Colour.

Wouldnt it be great if we could break into this process and tell the template instead of calling up ALL the attributes one by one to say start from attribute ID 10, thereby masking attributes 1 to 9.

Im not a programmer but cant we put an IF statement to enclose the whole process to say that

IF ($option_names_values >10){

only then start to call up the attributes.

borrowing from the code in header_php.php

if(sizeof($option_ids)>0){

why not say instead

if(sizeof($option_ids)>10){

maybe that statement would work best

but its clear that the Attributes ID are called as an array and incremented one by one as the function loops around until all attribute IDs are called up and displayed.

All Im suggesting is cant we make this process start from a certain ID number thereby masking all the lower ID numbers in effect allowing us to be somewhat selective about which attributes to display.

Im no programmer and I did try to play around with the code but seems futile exercise. Can anyone good with PHP follow up on my idea and suggest how I can revise the code in the above files to produce the desired results.

Any input would be greatly appreciated! :bigups:

21 Oct 2010, 2:17 PM
#125
jabbawest avatar

jabbawest

Zen Follower

Join Date:
Oct 2009
Location:
Texas
Posts:
197
Plugin Contributions:
0

Re: product filter module addon

aozhaver:

ALL SORTED! no need for help

My header_php.php was missing case 6:

So instead of just adding

$pfrom = PRANGE6_MIN;
$pto = PRANGE6_MAX;
break;

I should have added

case 6:
$pfrom = PRANGE6_MIN;
$pto = PRANGE6_MAX;
break;

What a rookie...:blush:
Thank you for the compliments, sorry I was late to the party but I'm glad you got it figured out.
Yes, I have given up on the filter by price option since it simply will not get items that are priced by attribute.
Since the ZC core Search function does get items priced by attribute, I would think it would only be a matter of copying some of that code into this module.

As for attribute drop downs showing Required text, I think it would be easy, for someone with php knowledge, to write an exclusion for just the Required text attribute.

Oh, thanks for posting your button replacement code!

26 Oct 2010, 3:52 PM
#126
jjrmy1 avatar

jjrmy1

New Zenner

Join Date:
Apr 2010
Posts:
23
Plugin Contributions:
0

Re: product filter module addon

Ok... I found the bit of code that controls the values of the category drop-down on the page: tpl_product_filter.php
"/start categories drop down************************************************/
if(SHOW_CATEGORIES){
$content .= zen_draw_pull_down_menu('categories_id', zen_get_categories(array(array('id' => '', 'text' => PRODUCT_FILTER_TEXT_ALL_CATEGORIES)), '0' ,'', '1'), (isset($_GET['categories_id']) ? $_GET['categories_id'] : ''), '') . zen_hide_session_id();
}
/end categories drop down************************************************/"
I'm an asp guy myself and know nothing of php. Anyway, how can one make the dropdown a hidden field with the value being equal to the current category.
eg.
"/start categories drop down************************************************/
if(SHOW_CATEGORIES){
$content .= zen_draw_hidden_field('categories_id', zen_get_categories($cPath), (isset($_GET['categories_id']) ? $_GET['categories_id'] : ''), '') . zen_hide_session_id();
}
/end categories drop down************************************************/"

8 Nov 2010, 4:50 PM
#127
howb avatar

howb

New Zenner

Join Date:
Jun 2008
Location:
Warrenpoint, United Kingdom
Posts:
43
Plugin Contributions:
0

Re: product filter module addon

Followed everyones instructions but cant get this to work with my version of zen v1.3.9f on my site http://www.champagnewineonline.com

I'm not using any attributes! ...but does anyone have a working solution for this version of zen?

9 Nov 2010, 10:39 AM
#128
aozhaver avatar

aozhaver

Zen Follower

Join Date:
Sep 2010
Posts:
121
Plugin Contributions:
0

Re: product filter module addon

Hi!

Honestly its nothing to do with your version. I never had issues with addons because of version.

Truth is I just realised I might have similar problem to yours.

You say you dont use any attributes so I'm assuming you would use the filter to say filter a price range within a general category.

This works fine for me for sub-categories but not for the top categories.

So I can filter products based on say Rings->Cubic Zirconia
for example for a price range 10 - 20

but not just Rings.

I realise the reason for this is because the Rings top category doesnt actually and directly contain any items it only contains subcategories.

But this really sucks as its confusing since someone might want to see ALL rings in size 8 and not just rings in a specific subcategory.

This seems to be a general problem with the way Zen Cart works and the way this add on was designed.

Is anyone feeling me here?:mellow:

9 Nov 2010, 11:14 AM
#129
aozhaver avatar

aozhaver

Zen Follower

Join Date:
Sep 2010
Posts:
121
Plugin Contributions:
0

Re: product filter module addon

wt05:

Has anyone fixed the problem of filtering subcategories?

For example:

All Categories - Sub -- Subsub --- Subsubsub

The filter only works in "All Categories" and "Subsubsub" - only if Subsubsub contained products.

Sub and Subsub will not filter if no product listed in these subcategories.

YES!! I have same problem see my other post ABOVE

ANY IDEAS??:unsure:

3 Jan 2011, 4:15 PM
#130
kernheimer avatar

kernheimer

Zen Follower

Join Date:
Jul 2009
Posts:
126
Plugin Contributions:
0

Re: product filter module addon

@jabbawest please!

Hi Jabbawest!
I have been following this thread, not speaking english very well, so forgive me please! And i am envious at your webshop! ( at least how you use this module) Because i have no clue how you did this!
I downloaded it, installed it and now i'm in the dark.
I have tried but i have no idea where to go, from the basic install.
I know it is bold, but is it not possible, for you, to write us a short manual how you managed this?? the module doesn't have any read me files.. and i feel so lost.
I love the selecting, the dropdowns.. i could use this so well, ( and i'm sure not 'me' alone!)
I would even pay you for it, to get it done and explain me how i can do it in the future!
Regards
Kern

2 Feb 2011, 3:57 AM
#131
shahram avatar

shahram

Zen Follower

Join Date:
Jul 2009
Location:
New York
Posts:
122
Plugin Contributions:
1

Re: product filter module addon

Fireflyz:

I love this mod, but..

The search results have "No Image Available"!
I also get "TEXT_NO_PRODUCTS", on some searches. Does anyone have any thoughts?
:bangin:
Thanks in advance!

Is it possible to not use a drop down menu but to just have text to select. For example When people click on any category

2 Feb 2011, 3:57 AM
#132
shahram avatar

shahram

Zen Follower

Join Date:
Jul 2009
Location:
New York
Posts:
122
Plugin Contributions:
1

Re: product filter module addon

Is it possible to not use a drop down menu but to just have text to select. For example When people click on any category

1 Mar 2011, 10:51 AM
#133
jeniferous avatar

jeniferous

New Zenner

Join Date:
Oct 2010
Posts:
46
Plugin Contributions:
0

Re: product filter module addon

Has anyone got this working with 1.3.9? Whatever I choose it just brings back nothing, no results and no error .... https://www.Jambaroo.co.uk
I've obviously got attributes set, and have read through the forum as best you can when it gets to this kind of size...

Any ideas?

Has anyone tried XAttribSearch as a paid alternative?

1 Mar 2011, 11:13 AM
#134
jeniferous avatar

jeniferous

New Zenner

Join Date:
Oct 2010
Posts:
46
Plugin Contributions:
0

Re: product filter module addon

Hi - i fixed my problem

  1. when i uploaded I copied the files exactly was they were in the folder, this meant i ignored the Template_default folder presuming it contained the same content as the YOUR TEMPLATE folder... it didn't.

  2. I still got an error stating it couldnt find the table zs_product_attributes. I don't have a prefix on my tables so went into the header file (includes/modules/pages/product filter results) and removed the zs_ from the below line.

$where_str .= " AND ((pa.products_id In (SELECT pa.products_id FROM zs_products_attributes pa WHERE (";

Now i just need to work out how to change the filter to £ from $...

1 Mar 2011, 11:14 AM
#135
jeniferous avatar

jeniferous

New Zenner

Join Date:
Oct 2010
Posts:
46
Plugin Contributions:
0

Re: product filter module addon

Oh - and i'm no coder but i can't help thinking that someone who is could really contribute to the world if they could replace the drop downs with check boxes so a user can filter using multiple results?

9 Mar 2011, 6:16 AM
#136
shahram avatar

shahram

Zen Follower

Join Date:
Jul 2009
Location:
New York
Posts:
122
Plugin Contributions:
1

Re: product filter module addon

Is it possible to not use a drop down menu but to just have text to select. For example when people click on any category if somebody could do that I can pay you $50

Example

Size (options name)

Small (option values)
Medium
Large

Color (option name)

Red (option values)
Blue
Black
Green

26 Apr 2011, 8:46 PM
#137
zskiman avatar

zskiman

New Zenner

Join Date:
Mar 2005
Posts:
69
Plugin Contributions:
0

Re: product filter module addon

I've seen it asked a few times in this thread and am close to solving, just got one problem i cant get by, i am trying to make the dropdowns show in just categories, no problem have it set to show by $cPath, hve disabled catagories dropdown, and rewrote the where sql statement to

$where_str = " WHERE (p.master_categories_id = 22 "

works on category 22 fine

I also tried

$where_str = " WHERE (p.master_categories_id = '$cPath' "

and

$where_str = " WHERE (p.master_categories_id = '$_GET['$cPath']' "

also tried getting current path by

$my_dir=$_GET['$cPath'];

$where_str = " WHERE (p.master_categories_id = '$my_dir]' "

ive also tried a few other things in the header.php file and am getting nowhere trying to get current location inside the file i even tried globally with

{$_GET['$cPath'}

any help would be appreciated

26 Apr 2011, 11:04 PM
#138
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: product filter module addon

I am not sure the whole SELECT you are using but if you are trying to use the current Categories ID ... you might try using:
$current_category_id

The master_categories_id will always be an immediate categories_id like 22 not a composit such as 10_22 ...

27 Apr 2011, 1:15 PM
#139
zskiman avatar

zskiman

New Zenner

Join Date:
Mar 2005
Posts:
69
Plugin Contributions:
0

Re: product filter module addon

Thanks for the reply, i tried using $current_category_id and for some reason it always returns 0, i will keep trying to find a way to make it work and if i come up w/ somethin illpost it here

27 Apr 2011, 5:02 PM
#140
zskiman avatar

zskiman

New Zenner

Join Date:
Mar 2005
Posts:
69
Plugin Contributions:
0

Re: product filter module addon

Ok so i think ive been trying to skin this cat the wrong way! seems if you set show catagories to false, it zeros out the current catagory.

i think to make this work id have to pull current catagory only into dropdown box and make it dissappear without actually setting to false??

anyone got ideas? thanx

mike