skip to Main Content

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:

  1. index.php – change on around line 37:

    if ($category_depth == 'nested') {
    

    To:

    if ($category_depth == 'nested' && isset($HTTP_GET_VARS['cPath'])) {
    
  2. includes/application_top.php – change around line 437:

    $cPath = '';
    

    To:

     $cPath = '22';
    
  3. includes/modules/boxes/bm_categories.php – find around line 99:

     $parent_id = $categories['categories_id'];
    

    Add:

     $dbs[] = $categories['categories_id'];
    
  4. 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


  1. Change the second step to the following:

    $cPath = '0';
    

    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.

    Login or Signup to reply.
  2. function  single_genealogy($category,  $level  =  0){
                  global $tree, $categories_string;
            // the sons of the current node = the IDs that are matched with this parentid
                $q  =  "select c.categories_id, cd.categories_name, c.parent_id from categories c , categories_description cd
                 where c.parent_id ='".$category."' and c.categories_id = cd.categories_id order by sort_order , cd.categories_name";
                 $r  =  mysql_query($q);  //or  die/mail/echo  mysql_error()
                   $level++;
                 $categories_string .= "<ul>";
                   while($d  =  mysql_fetch_row($r)){
                        $cPath_new = 'cPath='.$d[0];
                     $categories_string .=  '<li><a href='.tep_href_link(FILENAME_DEFAULT, $cPath_new).'>'.$d[1].'</a>';
                     //displaying  current  node  :  $d[1]
                      //recursive  call  :
                     $this->single_genealogy($d[0],  $level);
    echo "</li>";
                    }
                $categories_string .=  "</ul>";    
            }
    
    
    You need to put this function in bm_categories and call this function in getData()
    and you simply find your all categories tree of product.
    And now for applying navigation effect using css and jquery you can use www.htmldrive.net
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search