繁体   English   中英

在左侧显示所有osCommerce类别和子类别可隐藏主页上的产品列表

[英]Showing all osCommerce categories and subcategories on left hides products list from home page

我更改了一些osCommerce代码,以在左侧边栏中显示所有类别和子类别,并且它可以成功运行。

不幸的是,它在首页上隐藏了产品。 在osCommerce网站的默认主页上,我们获得当月的产品,并显示所有产品。

如果我跳过下面所做的更改的步骤2,则会显示产品,但左侧导航不会显示所有类别和子类别。

脚步:

  1. index.php-在第37行附近更改:

     if ($category_depth == 'nested') { 

    至:

     if ($category_depth == 'nested' && isset($HTTP_GET_VARS['cPath'])) { 
  2. include / application_top.php-在第437行更改:

     $cPath = ''; 

    至:

      $cPath = '22'; 
  3. include / modules / boxes / bm_categories.php-在第99行找到:

      $parent_id = $categories['categories_id']; 

    加:

      $dbs[] = $categories['categories_id']; 
  4. include / modules / boxes / bm_categories.php-在第109行左右更改:

      while (list($key, $value) = each($cPath_array)) { 

    至:

      while (list($key, $value) = each($dbs)) { 

为什么会发生此问题?

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

将第二步更改为以下内容:

$cPath = '0';

您现在拥有的是$cPath = '22'; 引用无效的类别ID。

如果将默认类别路径ID设置为顶部(零(0)),这将解决问题,并默认显示该月的新产品。

如果将该值更改为子类别ID,则该类别的产品将是默认显示在主页上的产品。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM