Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / where is the SQL that controls what the categories side box outputs?

where is the SQL that controls what the categories side box outputs?

Views: 1,354

Results 1 to 10 of 10
20 Mar 2011, 12:03 AM
#1
edwinx avatar

edwinx

New Zenner

Join Date:
Mar 2011
Posts:
6
Plugin Contributions:
0

where is the SQL that controls what the categories side box outputs?

Hi,

I am trying to modify the sql that is used to general the links in the tpl_categories.php files but I can't seem to find it. I think that file uses $box_categories_array to generate the categories.

Where is the file that I would find the sql for the categories?

or any pointers?

thanks,

20 Mar 2011, 12:14 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: where is the SQL that controls what the categories side box outputs?

Expand on what you are attempting to accomplish

20 Mar 2011, 12:32 AM
#3
edwinx avatar

edwinx

New Zenner

Join Date:
Mar 2011
Posts:
6
Plugin Contributions:
0

Re: where is the SQL that controls what the categories side box outputs?

Hi,

http://garagefive.net/z2/

The zen cart has a bit of custom work done by another developer.

So basically, there is a vehicle search that will search out all products for that vehicle only and also, customize the categories so that when you click on "intakes", it will only show intakes related to the vehicle.

So what I am trying to do is to make it so that the categories show the items related to the vehicle selected and also show products that are tagged "universal". The developer made a module in the admin to assign keywords to the products.

So I was thinking of finding out where the sql is used to generate the categories so that I can modify the sql and have it display the universal products too.

I've managed to modify the sql for the vehicle selector so that once you choose a vehicle, it will show related items and universal items too but the categories are not affected.

Thanks,

kobra:

Expand on what you are attempting to accomplish

20 Mar 2011, 1:16 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: where is the SQL that controls what the categories side box outputs?

You might modify this or write another that takes over once your vehicle search has bee excecuted

/includes/classes/category_tree.php

20 Mar 2011, 3:23 AM
#5
edwinx avatar

edwinx

New Zenner

Join Date:
Mar 2011
Posts:
6
Plugin Contributions:
0

Re: where is the SQL that controls what the categories side box outputs?

ok, so $box_categories_array is created from the category_tree class?

actually, honestly, I am not sure how those categories are generated or how the variables in the sql are populated.

$categories_query = "select ptc.category_id as categories_id, cd.categories_name, c.parent_id, c.categories_image
                             from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " ptc
                             where c.parent_id = " . (int)$value . "
                             and ptc.category_id = cd.categories_id
                             and ptc.product_type_id = " . $master_type . "
                             and c.categories_id = ptc.category_id
                             and cd.language_id=" . (int)$_SESSION['languages_id'] ."
                             and c.categories_status= 1
                             order by sort_order, cd.categories_name";

For example, how is TABLE_CATEGORIES variable populated? does zencart know that is a variable and needs to be replaced by an actual value?

sorry for asking this. or is there a document that would explain this to me?

20 Mar 2011, 3:37 AM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: where is the SQL that controls what the categories side box outputs?

Check that file for "categories_array" starting about line 157

20 Mar 2011, 3:43 AM
#7
edwinx avatar

edwinx

New Zenner

Join Date:
Mar 2011
Posts:
6
Plugin Contributions:
0

Re: where is the SQL that controls what the categories side box outputs?

awesome, thanks.

I see 2 queries in that file, I suppose I should be modifying the 2nd query. Since the 1st one is only when "$product_type == 'all'", right?

20 Mar 2011, 3:52 AM
#8
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: where is the SQL that controls what the categories side box outputs?

If you change the query code then you will break the normal display

I think you need to keep it as is and provide another query that builds another array that is invoked when your customers perform your "vehicle search"

As I stated initially this might be best in a new file that is called after a search

20 Mar 2011, 4:04 AM
#9
edwinx avatar

edwinx

New Zenner

Join Date:
Mar 2011
Posts:
6
Plugin Contributions:
0

Re: where is the SQL that controls what the categories side box outputs?

Thanks Kobra, I will give it a shot, this will destroy my weekend....

20 Mar 2011, 4:50 AM
#10
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: where is the SQL that controls what the categories side box outputs?

Thanks Kobra, I will give it a shot, this will destroy my weekend....
What else did you have to do!!

Did ya think that an online business was set and forget?