Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can I display products for category and all subcategories?


earth-friendly

Recommended Posts

I'd like to have an option in index.php to display the products that are in a category and all its subcategories.

Right now, index.php is called as: index.php?cPath=2_1_3

I'd like to have the option to call it as: index.php?cpath=2&recursive=yes

I'm not concerned with having this be a feature that is turned on/off from the admin side. I just want to be able to have a link to a url that will generate this type of page.

 

Suppose I have the following hierarchy:

Category1 has 2 subcategories: Category2 and Category3.

Category2 has 2 products: Product2-a and Products2-b.

Category3 has 2 products: Product3-a and Product3-b.

 

So we have the following:

 

Category1

Category2

Product2-a

Product2-b

Category3

Product3-a

Product3-b

 

I would like to display the info as follows:

 

Category1 name/description/image

 

Category2 name/description/image

 

Product2-a listing

 

Product2-b listing

 

---------------- Separator --------------------

 

Category3 name/description/image

 

Product3-a listing

 

Product3-b listing

 

I looked through the code to see if I could easily figure out what changes would be needed, but it seems pretty complicated.

It looks like it would involve changes to index.php and includes/modules/product_listing.php or product_listing_col.php (depending on the display). It looks like the functionality which generates and prints the category info and the product info would need to be taken out and rewritten, so that it can be called recursively, to traverse the category tree. ???

 

I looked through the forums and the contributions, but I don't think there is anything like this.

 

Could someone please give me some guidance on how to approach this problem.

I am a php programmer, but I'm fairly new with oscommerce, so I'd really appreciate some suggestions!

 

Thanks very much for any help/guidance with this problem!

 

Regards,

-Lori-

Link to comment
Share on other sites

BACKUP your current files before editing. Did I mention to BACKUP your current files, first?

 

"I'm not a hero, I'm a firefighter; it is my job to save lives. I'm a Jesus Christ Firefighter saving souls from the flames!"

 

Installed contribs: Almost XP Buttons *** Attribute Sort *** Auto Thumbnail Change *** Column Product Listing (for SPPC v4.0) *** Contact Us Registered *** Country-State Selector 1.3.3J *** CC# Db Mask 1.3 *** Email Order Clickable Link *** Extra Images *** Linkpoint API CVM *** Loginbox Best *** New Spiders *** New Attrib Mgr v.5.0 w/ New Attrib Include *** Multi Product Update *** MySQL Cron *** Pricing per Category *** Product Listing in Columns v2.2 [later upgraded to CPL(SPPC)] *** Product Sort v1.6 *** Seperate Pricing Per Customer v4.15 *** Simple Down for Maintenance [Gokou] *** Ultimate_SEO_URLs_v2.2.2 *** UPS Worldship Export 1.3 *** Welcome Email username & password

Link to comment
Share on other sites

Thanks for your quick response!

I'm not sure this mod does what I want, though.

Does this show all the products within a category and its subcategories, or just all the products?

I don't see anything about categories specified in the description of the contribution, or in the Readme file that comes in the contribution.

I want to display all the products directly under a category, and under all subcategories of a category.

 

Thanks for any help with this!

 

Regards,

-Lori-

Link to comment
Share on other sites

Thanks for your quick response!

I'm not sure this mod does what I want, though.

Does this show all the products within a category and its subcategories, or just all the products?

I don't see anything about categories specified in the description of the contribution, or in the Readme file that comes in the contribution.

I want to display all the products directly under a category, and under all subcategories of a category.

 

Thanks for any help with this!

 

Regards,

-Lori-

 

Lori,

 

Do you want to display the images under the categories and sub-categories?

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

Lori,

 

Do you want to display the images under the categories and sub-categories?

If possible, I want to display the name/description of the category or subcategory, possibly an image if one is there. Then I want to display the names/descriptions of the products directly in that category. Then I want to do the same for sibling categories and subcategories.

 

I currently have a mod installed: Add Multi Products Revived, which displays the products in such a way that you can specify a quantity for each product, and at the bottom, you can add all specified products to the cart. So I'd like it to work with this or a similar mod.

 

Thanks,

-Lori-

Link to comment
Share on other sites

If possible, I want to display the name/description of the category or subcategory, possibly an image if one is there. Then I want to display the names/descriptions of the products directly in that category. Then I want to do the same for sibling categories and subcategories.

 

I currently have a mod installed: Add Multi Products Revived, which displays the products in such a way that you can specify a quantity for each product, and at the bottom, you can add all specified products to the cart. So I'd like it to work with this or a similar mod.

 

Thanks,

-Lori-

Well I have looked and I have found nothing just go to: http://www.oscommerce.com/community/contributions and look around

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

Well I have looked and I have found nothing just go to: http://www.oscommerce.com/community/contributions and look around

Wade,

Thanks very much for trying!

Late last night, I was looking through contributions for hours, and didn't find anything, so perhaps I could write something myself, if it isn't way too complicated.

 

As a simplification for what I want, I was thinking that instead of writing this recursively, I could just list, in the url, all the categories in the tree that I want to show the products of for a single web page.

So, I would pass in the url like this:

index.php?cPath=1_2_3&recursive=yes

and in this case, it would display category1, with its products, then category2, with its products, then category3 with its products.

The coding for this should be a lot simpler.

It looks like there is no existing mod to do this, but could anyone please point me in the right direction for how I would modify things so that I can implement this myself?

 

Thanks very much for any help with this!

 

Regards,

-Lori-

Link to comment
Share on other sites

I thought the All Products with Images contribution does what you want?

I haven't installed this one quite yet (on my list to-do).

 

I believe, just like with Site Maps, All Products list products under categories, like a directory tree.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...