您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
商城ecshop不同商品分类调用不同模板的实现方法
谷山2023-11-17 23:41:28ecshop商城教程已有人查阅
导读目的:ecshop不同的分类调用不同的模版,如果没有就调用默认的模版;ECSHOP模板屋方法:模仿分类样式,COPY一个分类模版
目的:ecshop不同的分类调用不同的模版,如果没有就调用默认的模版;ECSHOP代码号方法:模仿分类样式,COPY一个分类模版
注意:红 部分是新增加的,黑 部分,是让你找到位置,知道在哪里增加
1,在分类表ecs_category里增加一个字段,style_moban,属 就与style相同吧,
或者执行以下SQL语句 alter table `ecs_category` add style_moban varchar(255) NOT NULL DEFAULT '';
2,修改admin\templates\category_info.htm
处:
languages\zh_cn\admin\category.php
处:
接下来,是如何调用
4.修改根目录下的:category.php
找到行,$smarty->display('category.dwt', $cache_id);
(注意应该是第二处(2.71就只有一处),本文件 有两处,我的文件修改过了,所以也不懂是第几行,300-400之间的那一处)
替换成:
注意:红 部分是新增加的,黑 部分,是让你找到位置,知道在哪里增加
1,在分类表ecs_category里增加一个字段,style_moban,属 就与style相同吧,
或者执行以下SQL语句 alter table `ecs_category` add style_moban varchar(255) NOT NULL DEFAULT '';
2,修改admin\templates\category_info.htm
<tr>
<td class="label"><a href="javascript:showNotice('noticeGoodsSN');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.notice_style}"></a>{$lang.cat_style}:</td>
<td>
<input type="text" name="style" value="{$cat_info.style|escape}" size="40" /> <br />
<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsSN">{$lang.notice_style}</span>
</td>
</tr>
<tr>
<td class="label"><a href="javascript:showNotice('noticeGoodsSN');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.notice_style}"></a>{$lang.cat_style_moban}:</td>
<td>
<input type="text" name="style_moban" value="{$cat_info.style_moban|escape}" size="40" /> <br />
<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsSN">{$lang.notice_style_moban}</span>
</td>
</tr>
2.修改admin\category.php 处:
$cat['style']= !empty($_POST['style'])? trim($_POST['style']): '';
$cat['style_moban'] = !empty($_POST['style_moban']) ? trim($_POST['style_moban']) : '';
第二处:
$cat['style']= !empty($_POST['style'])? trim($_POST['style']): '';
$cat['style_moban'] = !empty($_POST['style_moban']) ? trim($_POST['style_moban']) : '';
3.修改语言库languages\zh_cn\admin\category.php
处:
$_LANG['cat_style'] = '分类的样式表文件';
$_LANG['cat_style_moban'] = '分类的模版文件';
第二处:
$_LANG['notice_style'] = '您可以为每一个商品分类指定一个样式表文件。例如文件存放在 themes 目录下则输入:themes/style.css';
$_LANG['notice_style_moban'] = '您可以为每一个商品分类指定一个模版文件。例如文件存放在 themes 目录下则输入:themes/category.dwt';
到这里,在后台就可以输入分类模版了,接下来,是如何调用
4.修改根目录下的:category.php
找到行,$smarty->display('category.dwt', $cache_id);
(注意应该是第二处(2.71就只有一处),本文件 有两处,我的文件修改过了,所以也不懂是第几行,300-400之间的那一处)
替换成:
//获取自定义分类增加的信息
$cat_id = intval($_REQUEST['id']);
$sql = "SELECT * FROM " .$GLOBALS['ecs']->table('category'). " WHERE cat_id='$cat_id' LIMIT 1";
$cat_info = $GLOBALS['db']->getRow($sql);
/*-----------------------新增加的自定议分类模版----------------------------- */
$template_cat = $cat_info['style_moban'];
if($template_cat !='')
{
$smarty->display($template_cat, $cache_id);
}
else
{
$smarty->display('category.dwt', $cache_id);
}
5.自己制作一份新的模版,在后台输入到需要自义的分类里就可以。
本文标签:
很赞哦! ()
随机图文
-
ecshop中以C开头的ecshop函数
前面已经讲过两篇类似的函数了,这一篇讲的是 ECSHOP中以C开头的ECSHOP函数,闲言少叙,下面看函数说明吧。 -
ecshop商品属性排序怎么按最新添加商品属性排序
情况一:添加新产品时,让属 按照添加的顺序(属 id)排列修改/inclues/lib_goods.php情况二:在 商品时属 排序跟原商品相反到处理修改/inclues/lib_goods.php -
ecshop生成商城站点地图的方法
ecshop 如何生成站点地图?1.你可以通过自己写程序。调用ecs_goods,ecs_article等栏目的数据,你可以可以直接自己做成静态的HTM -
ecshop商品编辑器上传中文名图片产生乱码的解决方法
在后台上传商品图片的时候,如果你选择一个中文名称的图片,那么上传后会产生乱码,导致图片显示不出来。
留言与评论 (共有 条评论) |