Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How To Display Products Instead Of Subcategories?


JohnSanders

Recommended Posts

Hi all,

 

First off, thank you for a wonderful e-commerce solution. osCommerce is really great!

 

I have been searching this forum and the contribution section for an answer, but I couldn't find it. Maybe this has been done already. If so please point me in the right direction.

 

If not, I hope someone can help me, cause I just started with PHP and I believe this is way above my head. :rolleyes:

 

What I would like to accomplish is the following:

 

When one browses through the categories, I would like to show all products within that category instead of showing the subcategories.

 

For instance:

 

Men's Apparel

 

> Adidas

>> Suits & Sweaters

>> Shirts & Polos

>> Shorts

 

> Nike

>> Suits & Sweaters

>> Shirts & Polos

>> Shorts

 

So when one clicks on the main category "Men's Apparel" it would list all products from the subcategories (2 levels) instead of showing the subcategories "Adidas" and "Nike". When one clicks on the subcategory "Adidas" it would list all products from the subcategories "Suits & Sweaters", "Shirts & Polos", "Shorts" and "Socks" within Adidas. Clicking on for instance "Suits & Sweaters" would result in Adidas products within the subcategory "Suits & Sweaters".

 

An example can be found on: http://www.shopadidas.com/family/index.jsp...2039608.2039611

 

Within the "Basketball category" all products from this category are shown, then simply filtered if you click on a subcategory.

 

How would I accomplish this? I know it requires changing index.php, where the categories are called from the database, but my PHP knowledge is too limited unfortunately.

 

Thanks for your help.

 

John Sanders

Link to comment
Share on other sites

The code will do that automatically. If there are products in a category, only the products will be shown.

 

Jack

 

Hi Jack,

 

I think you misunderstood. There are no products in the main category, only subcategories. If you click on the main category, the code will display the subcategories on the main page. If there are no products in a subcategory, the code will display the 2nd level subcategories.

 

What I would like is to display the products as described earlier. If one clicks on a main category all products within that category subcategories included (e.g. 2 levels deep) are displayed in the main window. Once one hits a subcategory (1st level) the products are filtered again...and so on.

 

Thanks for your help.

Link to comment
Share on other sites

I'm confused. In your first post you said

show all products within that category instead of showing the subcategories
In your last you said
If there are no products in a subcategory, the code will display the 2nd level subcategories
Maybe I am still missing something but you can't have the first without having the second. If you want to display products in a category, as you said in your first post, you have to have products in that category to display. Am I still missing the problem?

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I'm confused. In your first post you saidIn your last you saidMaybe I am still missing something but you can't have the first without having the second. If you want to display products in a category, as you said in your first post, you have to have products in that category to display. Am I still missing the problem?

 

Jack

 

Hi Jack,

 

It does sound a bit confusing. I'll try to explain it.

 

Let's say you have a main category "Men's Apparel".

Within this category there are for instance two subcategories "Adidas" and "Nike", but no products!

The subcategories "Adidas" and "Nike" consists of the subcategories "Suits & Sweaters", "Shirts & Polos" and "Shorts", again no products!

The products reside in the subcategories (2nd level) "Suits & Sweaters", "Shirts & Polos" and "Shorts".

 

1) By default osCommerce will show the categories "Adidas" and "Nike" when someone clicks on the main category "Men's Apparel".

2) Clicking further on one of the subcategories would result in displaying the subcategories (2nd level) "Suits & Sweaters", "Shirts & Polos" and "Shorts".

3) Finally, clicking on one of the subcategories (2nd level) you would see the products.

 

What I would like is the following.

 

Clicking on the main category "Men's Apparel" would result in all the products from the 2nd level subcategories. In other words with respect to the example above it would show all the products from the 2nd level subcategories "Suits & Sweaters", "Shirts & Polos" and "Shorts" from both subcategories "Adidas" and "Nike".

 

Clicking on the subcategory "Adidas" would result in listing all products from the 2nd level subcategories "Suits & Sweaters", "Shirts & Polos" and "Shorts" within the subcategory "Adidas".

 

Clicking on the 2nd level subcategory "Suits & Sweaters" within the subcategory "Adidas" would result in a list of products from the 2nd level subcategory "Suits & Sweaters" within the subcategory "Adidas". This is what osCommerce does by default (see step 3 above).

 

I hope this is a bit clearer now. Thanks for your help.

Link to comment
Share on other sites

Yes, I think I understand. But since it doesn't follow a logical flow, I don't think you are going to fina a contribution that will do it. You would have to code it so the sub-categories are read. What if you used the copy products option and duplicated the product in both categories?

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I have been looking for a solution to this for over a year now. Same problem with me and in searching the forums, it seems as thought quite a few other people would like this sort of contribution as well.

 

Using the copy products option like Jack said is one way to do it... but when you have tons of products and tons of categories, it is just too time consuming to do that. Especially if you have new products regularly.

 

I wish there was a way to read all subcategories products below a parent category and display them all. It seems like it could be done... but I have yet to figure it out.

 

This would greatly improve sales because as soon as a customer clicks any category they will see products regardless if products are in that category or a subcategory.

 

Lots of stores use the lowest level category possible to insert products, this would be a huge benefit if anyone could figure out how to code it.

 

Thank you,

Shawn

Link to comment
Share on other sites

Actually it does follow a logical flow, because it filters the products based on the category you are in. Instead of displaying the subcategories you would display the products. From a marketing point of view this would be much more efficient.

 

Like Shawn mentioned the copy products contribution is not really an option, especially if you have lots of products, categories and subcategories (1st, 2nd level).

 

I'll have to dive into php a little bit more. From what I as a php rookie can tell it would mean rewriting the code that calls the categories and subcategories until the deepest level has been found. Instead of displaying the categories and subcategories you would call the products as explained in my previous posts.

 

I thought this would be easy, or that it has been done already, unfortunately... ;)

 

Thanks for all your help,

John

Link to comment
Share on other sites

Actually it does follow a logical flow, because it filters the products based on the category you are in. Instead of displaying the subcategories you would display the products. From a marketing point of view this would be much more efficient.
That's not what was asked for. You can do that already, as mentioned, by just adding products to the category. But the need is to display the products of the sub-category. That is not a logical flow since it skips a level. I'm at a loss to provide a suggestion as to how to code it since I can't imagine a use for it. But like I said, maybe I'm still not understanding.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

That's not what was asked for. You can do that already, as mentioned, by just adding products to the category. But the need is to display the products of the sub-category. That is not a logical flow since it skips a level. I'm at a loss to provide a suggestion as to how to code it since I can't imagine a use for it. But like I said, maybe I'm still not understanding.

 

Jack

 

Hi Jack,

 

Maybe you should take a look at the following site: shopadidas.com.

 

You can browse products by sport. Check the page below. It displays all products from the main category BASKETBALL in total 50 products. This is basically the sum of products from all the subcategories within the main category BASKETBALL, i.e. Jackets & Vests (5), Sleeveless Shirts (7), Short Sleeve Shirts (11), Shorts (16), Long Sleeve Shirts (2), Warm Ups(1), Pants (8)

 

http://www.shopadidas.com/family/index.jsp...2019627.2039608

 

If you click on one of the subcategories, e.g. Jackets & Vests (5), the site will only display the products from the selected category, see below:

 

http://www.shopadidas.com/family/index.jsp...2039608.2019530

 

Maybe I'm mistaking - I'm no programmer - but to me it wouldn't be logical to copy all products into the main category and 1st level subcategories, if all the products already reside in the 2nd level subcategories. I think it should be possible to code, that all the products are called from the 2nd level subcategories and then simply work your way back?

Then again I'm no programmer... ;)

 

Thanks for your help,

John

Link to comment
Share on other sites

Jack...

 

I think I have a way of explaining it a little better...

 

Here is what is needed to be done:

 

**NOTE both examples below are the same, just one is named for easy reference.

------------------------

Category1

--SubCategory1-1

--SubCategory1-2

----SubCategory1-21

----SubCategory1-22

--SubCategory1-3

------------------------

Men's Clothing

--Shirts

--Hats

----Cowboy Hats

----Baseball Hats

--Boots

 

My store always uses the lowest level category possible... so SubCategory1-21 (Cowboy Hats) & SubCategory1-21 (Baseball Hats) will have all the products, while --SubCategory1-2(Hats) will have no products in it.

 

When the user clicks on SubCategory1-2(Hats) they will see two categories on the main screen:

SubCategory1-21 (Cowboy Hats) & SubCategory1-21 (Baseball Hats)

 

What we are wanting to do... is take all the child categories and have them display the products rather than show the categories. So, when the user clicks on SubCategory1-2(Hats), they will not just see two icons on the page, but they will see all the products from SubCategory1-21 (Cowboy Hats) & SubCategory1-21 (Baseball Hats).

 

Basically anytime a category is clicked... all the products from that category and all child categories are displayed.

 

So if a customer would click on Men's Clothing.. by default no products would show up, because all of the products are listed in all the child categories.... so with this new way of listing products... when a customer clicks on Men's Clothing... all the products from all the child categories would show up.. including... Shirts, Hats, Cowboy Hats, Baseball Hats, Boots.

 

Then when a user clicks on Hats... all the Cowboy Hats & Baseball Hats would appear.

 

Hope that helps to better explain it.

 

Thank you again!

Shawn

Link to comment
Share on other sites

  • 2 weeks later...

has anyone found a solution to this problem yet? i too am suffering.

i find the queries very complex but indeed possible. a logical repeat through all subcategories to list all products in any main category seems the right way forward.

Link to comment
Share on other sites

see how the advanced search works when it filters by category

Do you actually know of a solution to this problem, or did you just feel like being a tard today?

Link to comment
Share on other sites

My bad... I see what you are talking about now. I thought you were another one of those people who think the universal answer to everyone's problem is "why don't you try searching the forums" - that really gets under my skin. Sorry for jumping the gun on ya! :blush:

 

Anyways, I've thought about using the advanced search function to do this as well, but the problem is exactly what code needs to be copied, and where do you put it?

Link to comment
Share on other sites

the advanced_search_result.php file includes part of what you need to do. See around

 

tep_get_subcategories($subcategories_array, $HTTP_GET_VARS['categories_id']);

 

 

basically you pass the category_id and returns back an array of sub-categories that you need. Use the products_to_categories table to identify the product identifiers afterwards along with the products_descriptions for the names. This is what the script does actually but is mixed with other code for the search filters.

 

It's a little bit of work to do it.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...