Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sections Within Categories?


jeffy777

Recommended Posts

Posted

Is it possible to have sections within Categories? I'm not talking about Sub-categories, but what I would like to see is on the product listing if it were divided up into different sections wiht headings for each one. Is there a contrib for this?

Posted

hi jeff, You could try a bit the all products contribution and modify the code to list only the products under the current category and sub-cats.

Posted

install the all products contrib then define a var say $test_cat at the beginning of the all products file in the php section like say: $test_cat = 11;

where 11 is an arbitrary id that in your case should match a real category id (pick a top one from your admin you could change the number later for subs for testing)

 

locate the query in that file, must be something like

 ?$included_categories_query = tep_db_query("SELECT c.categories_id, c.parent_id, c.categories_image, cd.categories_name FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id AND cd.language_id = FLOOR($languages_id)");

modify it to add an extra test for the test_cat

 

 ?$included_categories_query = tep_db_query("SELECT c.categories_id, c.parent_id, c.categories_image, cd.categories_name FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id and c.categories_id = '" . (int)$test_cat . "' AND cd.language_id = FLOOR($languages_id)");

 

then format your html code align/set the cat tables nicely till you're happy with it.

Finally drop the $test_cat and use the $current_category_id global var in its place, add the php code as a new module to be included from the index.php much like the product_listing.php is done.

Posted

Hi enigma1,

 

I made the changes to the all products file as you described (defining the var and changed the query), but now it only displays all the products from the category and sub-cats, but it doesn't display the category/sub-cat names.

 

Did I do something wrong?

Posted

hmm.. shouldn't be the query, it includes the cat name, so can you locate where it stores it? must be like a ['categories_name'] somewhere. Should also be a loop for the products can you add the category name just before each loop?

Posted

Another weird thing is that it still seems to display products from all categories instead of just the one I specified when I defined the var. Did you get your all_products.php to just display products from the category (and it's sub-cats) you definedin the var?

 

I really appreciate your help :)

Posted

yes that code will display products from the specified category and products from sub-categories (beneath the specified one). If you only want products from the selected category change the while loop for the products with an if. Something like:

if($products = tep_db_fetch_array($products_query)) {  

Posted

Yes, I would like for it to display products from the specified category and products from sub-categories. The problem is it still displays products from every category, regardless of the one I specify in the var.

Posted

can you PM me the modified file? I'll take a look. Kinda long to post it here

  • 4 months later...
Posted
can you PM me the modified file? I'll take a look. Kinda long to post it here

 

Hi, if you ever made this work, I would be very happy if you could give me the solution. I also would like this in my all products page.

 

Thank you:-)

 

Kjolebutikken

Best regards

Kjolebutikken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...