I changed some osCommerce code to show all categories and subcategories on the left sidebar and it is successfully working.
Unfortunately it’s hiding products on the home page. On the default home page of osCommerce site we get products for the month and it shows all products.
If I escape step 2 of the changes made below it shows the products but the left navigation does not show all categories and subcategories.
Steps:
-
index.php – change on around line 37:
if ($category_depth == 'nested') {
To:
if ($category_depth == 'nested' && isset($HTTP_GET_VARS['cPath'])) {
-
includes/application_top.php – change around line 437:
$cPath = '';
To:
$cPath = '22';
-
includes/modules/boxes/bm_categories.php – find around line 99:
$parent_id = $categories['categories_id'];
Add:
$dbs[] = $categories['categories_id'];
-
includes/modules/boxes/bm_categories.php – change at around line 109:
while (list($key, $value) = each($cPath_array)) {
To:
while (list($key, $value) = each($dbs)) {
Why is the problem happening?
2
Answers
Change the second step to the following:
What you have now,
$cPath = '22';
refers to an invalid category ID.If you set the default category path ID to the top, which is zero (0), this will correct the problem and by default show the new products for that month.
If you changed that value to a child category ID, products from that category will be the default showing on the main page.