chrometweaks.org

What's the best free image iPage hosting service?

Click Here To View All Answers...


Got a quick question: What's the best free image iPage hosting service? Many thanks for any answer. Another question... I would like to retrieve all the products which fall under the main category that is We have.

Accesories->Car accesories->General.

Accesories->Car accesories->Other.

This is the flow of the categories I would like to view all the products which are under category Accesories which should include all the products of all the subcategories under Accesories.

The tables all the same used in the oscommerce.

Pls anyone help me out..

Comments (138)

I would like to know the answer too. Anyone here know what is the right answer. I'll do some research in Google and get back to you if I discover an answer. You should email the people at iPage as they probably could give you help..

Comment #1

To write such a sql query it is only possible to retrieve all products if you ALWAYS have the same number of subcategories; i.e. in this example you have main category accessories, then Sub 1 Car Accessories, Then Sub 2 General and Other..

If you write a query to have all products listed; logically, you have to fix where all the products will be located; in this case under Sub 2. Would you have any that were located under Sub 1, or if you would have another branch that has Sub 3 category, it would not find these with the same query; but seperate queries would need to be defined..

Hope this clarifies a bit how it works; now the question is, do you only have products listed under Sub 2 category level ?

Comment #2

I would like to retrieve all the products which fall under the main category that is We have.

Accesories->Car accesories->General.

Accesories->Car accesories->Other.

This is the flow of the categories I would like to view all the products which are under category Accesories which should include all the products of all the subcategories under Accesories.

The tables all the same used in the oscommerce.

Pls anyone help me out..

Comment #3

Well thank you for the response.

Let me make clear Like I have.

Accesories(category).

->Car Acceesories(subcategory).

-> General(subsubcategory).

-> Other(subsubcategory).

This is the hierarchyof the categories and there will not be any more sub categories under subsubcategories.I would like to query all the products under which come under Accesories.

Thank you..

Comment #4

Select mcd.categories_name, sc1d.categories_name, sc2d.categories_name, p.* , pd.*.

From categories_description mcd, categories mc, categories_description sc1d, categories sc1, categories_description sc2d, categories sc2,products p, products_description pd, products_to_categories ptc.

Where mc.categories_id = mcd.categories_id and sc1.categories_id = sc1d.categories_id and sc2.categories_id = sc2d.categories_id and sc2.parent_id = sc1.categories_id and sc1.parent_id = mc.categories_id and mcd.categories_name = "Accesories" and mcd.language_id = sc1d.language_id and sc1d.language_id = sc2d.language_id and p.products_id = ptc.products_id and ptc.categories_id = sc2.categories_id and pd.language_id = sc2d.language_id;.

This code runs without errors; but since I don't have the categories structure like you have, haven't been able to get results back..

HTH.

This post has been edited by.

Bruyndoncx.

: 02 July 2004, 18:08..

Comment #5

Try this:.

//get all subcategories.

$all_categories_array = tep_get_category_tree((int)$current_category_id, '', '0', '', true);.

$like_string = '';.

Foreach($all_categories_array AS $value){.

$like_string .= $value['id']', ';.

}.

$like_string = substr($like_string, 0, -2);.

// We show the categorie and subcategories.

$listing_sql = "select "$select_column_list" p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from "TABLE_PRODUCTS_DESCRIPTION" pd, "TABLE_CATEGORIES" c, "TABLE_PRODUCTS" p left join "TABLE_MANUFACTURERS" m on p.manufacturers_id = m.manufacturers_id, "TABLE_PRODUCTS_TO_CATEGORIES" p2c left join "TABLE_SPECIALS" s on p.products_id = s.products_id where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '"(int)$osC_Session->value('languages_id')"' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id IN("$like_string")";.

I hope this function is in the default catalog and the $current_category_id value is set. If not, you need copy it from admin to catalog and set the current category:.

Tep_get_category_tree((int)$current_category_id, '', '0', '', true);.

HTH.

Gunter.

PS: If there is still a column in there which isn't in the default OSC and you get an error, you need to take it out...

Comment #6

Hi Carine,.

You properly point out one of best reasons for not allowing double posts!.

Let's see how many good folks we can get to work independently solving the same problems..

Oh well don't let it get you down..

Tom..

Comment #7


This question was taken from a support group/message board and re-posted here so others can learn from it.