Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sub categories not showing when I add new product


Guest

Recommended Posts

Posted

When I add a product to a category that already has subcategories the products show, but the sub-categories do not.

 

They do show on the categorybox but not in the main screen, so customers have to use the categorybox to select the sub categories.

 

Can someone point me to where to code is for this.. I suspect it is within index.php but I cant find it.

 

Thanks

Posted

Hi,

 

This is a 'known' issue - you can't have products and sub-categories in a category because the code looks for products first and then, it if doesn't find any, sub-categories.

 

Easiest solution is to make sure you don't have that situation.

 

There may be a fix for it, but I'm not sure.

 

I've modified admin so that you can't add a product to a category that has sub-categories.

Posted
When I add a product to a category that already has subcategories the products show, but the sub-categories do not.

 

They do show on the categorybox but not in the main screen, so customers have to use the categorybox to select the sub categories.

 

Can someone point me to where to code is for this.. I suspect it is within index.php but I cant find it.

 

Thanks

 

The code is in the index.php page

 

This is how it's coded right now:

1. If you are in a category that has subcategories only- show the subcategories

2. If you are in a category that has products not in subcategories (regardless if it has subcategories or not) -show the list of products

 

The only solution I can tell you without messing with the code is that if you have sub-categories, only place products in the subcategories.

 

Otherwise, if you want to show the subcategories when there are products in the main category, you need to change the code to reflect that you don't care whether the category has subcategories or not....

 

In index.php, look for:

if ($category_depth == 'nested') {

 

Change to:

//show subcatetories even when products present in main category

if (($category_depth == 'nested') || ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id']))) {

 

Then look for the following line and comment it out by adding // in the beggining:

} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

 

So it should be:

//} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

 

 

The only thing with this is, it will show the new products in between the subcategory and the product list.

 

If you don't want to show the new products, look for the line you just commented out:

//} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

 

Then above that change:

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

</tr>

 

To:

<? /* don't show new products

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

</tr>

*/?>

 

I hope that works for you.

Posted
The code is in the index.php page

 

This is how it's coded right now:

1. If you are in a category that has subcategories only- show the subcategories

2. If you are in a category that has products not in subcategories (regardless if it has subcategories or not) -show the list of products

 

The only solution I can tell you without messing with the code is that if you have sub-categories, only place products in the subcategories.

 

Otherwise, if you want to show the subcategories when there are products in the main category, you need to change the code to reflect that you don't care whether the category has subcategories or not....

 

In index.php, look for:

if ($category_depth == 'nested') {

 

Change to:

//show subcatetories even when products present in main category

if (($category_depth == 'nested') || ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id']))) {

 

Then look for the following line and comment it out by adding // in the beggining:

} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

 

So it should be:

//} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

The only thing with this is, it will show the new products in between the subcategory and the product list.

 

If you don't want to show the new products, look for the line you just commented out:

//} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

 

Then above that change:

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

</tr>

 

To:

<? /* don't show new products

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

</tr>

*/?>

 

I hope that works for you.

 

 

Don't forget, back up your file before you do this as I haven't tested it, okay? Just a quick solution I could think of. There is a chance the two queries might clash.

  • 3 years later...
Posted

When I add a product to a category that already has subcategories the products show, but the sub-categories do not.

 

They do show on the categorybox but not in the main screen, so customers have to use the categorybox to select the sub categories.

 

Can someone point me to where to code is for this.. I suspect it is within index.php but I cant find it.

 

Thanks

Massively old post I know but did you try the suggestion by aegrnberg? If so, did it work out?

  • 2 weeks later...
Posted

I followed the instructions in this post, and it did work, but it screws up the table structure, which makes no sense to me, since it shouldn't have any effect on the tables. anyone have any ideas why it's doing this?

 

The header info takes over the top of the page and pushes everything else down.

Archived

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

×
×
  • Create New...