v1.3.9h商品分类显示一二级联动目录美化片

Zen Cart 模板、教程、设计、使用交流
版面规则
严禁盗版、侵权的模板下载、讨论,违者封ID、IP。

v1.3.9h商品分类显示一二级联动目录美化片

帖子skyliu2004 » 2012-04-30 22:24

经过一天的努力,并参考网上的一些方法,现地将此功能分享出来!
首先将CSS部份贴出如下:
.sidebar {background: #fc6597;width:190px;padding:1px;margin:5px 5px;}
.sidebar h2{color:#fff;font-size:14px;line-height:30px;text-align:center;background:url("../images/title.jpg") no-repeat; }

#menu {width:190px;background: #fff;padding:8px 0;}
#menu li{float:left;width:150px;display:block;padding-left:40px;background: #fff;position:relative;border-bottom:#ffeef4 1px solid;background:url("../images/arrow.gif") no-repeat 16px 10px;}
#menu li:hover {background: #fc6597;}
#menu li a {font-size:14px;color:#3B4053;display:block;outline:0;text-decoration:none;line-height:28px;}
#menu li:hover a {color:#fff;}

#menu li:hover div a {font-size:12px;color:#969494;line-height:16px;}
#menu li:hover div a:hover {color:#fc6597;}

#menu li:hover .cms_submenu{left:190px;top:0;}

.cms_submenu{float:left;position:absolute;left:-999em;text-align:left;border-left:2px solid #fc6597; border-top:2px solid #fc6597;border-bottom:2px solid #fc6597;border-right:2px solid #fc6597;width:335px;background: #fff;padding:5px 0 5px;}
.cmsmenuleft{float:left;width:335px;color:#ccc;padding:5px;border-right:1px #eee solid;}

.cmsmenuleft dt{font-weight:bold;color:#fc6597;margin:5px 0;padding:3px 0 3px 10px;text-align:left;}
.menu_recommend dd,.menu_price dd{}
.menu_new dd{padding-left:8px;}
.cmsmenuleft dd i{float:left;padding:0 8px;margin:3px 0;white-space: nowrap;border-right:1px solid #ccc;}
图片就不提供了,自己找一下替换图片
再将以下代码复制到你所在模板目录中的sideboxes目录下的tpl_categories.php文件中
<?php
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}

$categories_TOP = 'SELECT cd.categories_name,cd.categories_id FROM ' . TABLE_CATEGORIES . ' c LEFT JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON c.categories_id = cd.categories_id'.' where c.parent_id=0 and c.categories_status=1 and cd.language_id=2 order by sort_order, cd.categories_name';

$categories_zero = $db->Execute($categories_TOP);
//echo $categories_TOP,'<hr />';
while(!$categories_zero->EOF){
$categories_zero_id = intval($categories_zero->fields['categories_id']);
$categories_SUB= 'SELECT cd.categories_name,cd.categories_id FROM ' . TABLE_CATEGORIES . ' c LEFT JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON c.categories_id = cd.categories_id'.' where c.parent_id='.$categories_zero_id.' and c.categories_status=1 and cd.language_id=2 order by sort_order, cd.categories_name';
//echo $categories_SUB;

$categories_zero_sub = $db->Execute($categories_SUB);
while(!$categories_zero_sub->EOF){
$categories_sub_array[$categories_zero_id][] = array('categories_id'=>$categories_zero_sub->fields['categories_id'],
'categories_name'=>$categories_zero_sub->fields['categories_name']
);
$categories_zero_sub->MoveNext();
}
//$categories_zero_sub->MoveNext();
$categories_zero_array[] = array( 'categories_name' => $categories_zero->fields['categories_name'],
'categories_id' => $categories_zero_id,
'categories_sub'=>$categories_sub_array[$categories_zero_id]
);
$categories_zero->MoveNext();
}

//echo "<pre>";print_r($categories_zero_array);echo "</pre>";die();

if(is_array($categories_zero_array)){
$content = "";
$content .= '<ul id="menu">';
$content .="\n";
foreach($categories_zero_array as $val){

$content .= '<li>';
$content .="\n";
$content .= '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$val['categories_id']) . '">' . $val['categories_name'] . '</a>';
$content .="\n";
if(empty($val['categories_sub'])){
$content .='';
}else{
$content .= ' <div class="cms_submenu">';
$content .="\n";
$content .= '<div class="cmsmenuleft" >';
$content .="\n";
$content .= '<dl class="menu_recommend">';
$content .="\n";
$content .= '<dd>';
$content .="\n";
foreach($val['categories_sub'] as $sub){


$content .= '<i>';
$content .= '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$val['categories_id'].'_'.(int)$sub['categories_id']) . '">' . $sub['categories_name'] .$sub['language_id'].'</a>';

$content .= '</i>';
$content .="\n";


}
$content .= '</dd>';
$content .="\n";
$content .= '<div class="clear"></div>';
$content .="\n";
$content .= '</dl>';
$content .="\n";
$content .= '</div>';
$content .="\n";
$content .= '<div class="clear"></div></div>';
$content .="\n";
}

$content .= '</li>';

$content .="\n";
}
$content .= '<div class="clear"></div>';
$content .= '</ul>';

}
?>
再修改你所在模板目录中的common目录里的tpl_box_default_left.php文件内
<?php
/**
* Template designed by 12leaves.com
* 12leaves.com - Free ecommerce templates and design services
*
* Common Template
*
* @package languageDefines
* @copyright Copyright 2009-2010 12leaves.com
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_box_default_left.php 2975 2006-02-05 19:33:51Z birdbrain $
*/

// choose box images based on box position
if ($title_link) {
$title = $title . ' - <a href="' . zen_href_link($title_link) . '">' . BOX_HEADING_LINKS . '</a>';
}
//
// #wel - category header style
if ($box_id == "categories") {
$header_left = 'main-sidebox-header-left';
$header_right = 'main-sidebox-header-right';
} else {
$header_left = '';
$header_right = '';
}
//
?>
<!--// bof: <?php echo $box_id; ?> //-->

<div class="sidebar"><h2><?php echo $title; ?></h2>
<div style="width:190px; background:#ffffff;">
<?php echo $content; ?>
</div>
</div>
<!--// eof: <?php echo $box_id; ?> //-->

按以上方式修改后,可以达到此要求,如需要变换别的样式,只需要更改CSS样式
特此注明,此方法只适应于v1.3.9h版本里的中文展示,如需中英文都能照此处理,需要另外更改上面带红色的代码中的值,1为英文,2为中文!
skyliu2004
 
帖子: 3
注册: 2010-05-20 21:09

Re: v1.3.9h商品分类显示一二级联动目录美化片

帖子smilenimo » 2012-05-02 16:08

测试页有木有? 图片预览有木有的?
头像
smilenimo
高级会员
高级会员
 
帖子: 213
注册: 2010-03-24 11:42

Re: v1.3.9h商品分类显示一二级联动目录美化片

帖子themaobull » 2012-05-02 20:55

具体是神马样的效果呢?
themaobull
 
帖子: 1
注册: 2010-08-25 14:33


  • 相关话题
    回复总数
    阅读次数
    最新文章

回到 模板美工



在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客