0

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

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

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

脚步:

  1. index.php - 在第 37 行左右更改:

    if ($category_depth == 'nested') {
    

    至:

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

    $cPath = '';
    

    至:

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

     $parent_id = $categories['categories_id'];
    

    添加:

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

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

    至:

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

为什么会出现问题?

4

2 回答 2

1
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
于 2011-10-08T11:07:07.507 回答
0

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

$cPath = '0';

您现在拥有的内容$cPath = '22';是指无效的类别 ID。

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

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

于 2011-03-24T13:48:53.557 回答