ECSHOP调用标签,分类文章,调用公告的方法
2013-09-05 17:56:15   来源:   浏览: 次

导读:页面关键字 {$keywords } 页面标题 {$page_title} 产品分类 父分类列表 {foreach from=$categories item=cat } 父分类超链接 [url=

页面关键字 {$keywords }
页面标题 {$page_title}
产品分类
父分类列表 {foreach from=$categories item=cat }
父分类超链接 [url==”{$cat.url}”>{$cat.name|escape:html}</a>
相对应子分类 {foreach from=$cat.children item=child}
子分类超链接 [url==”{$child.url}”>{$child.name|escape:html}</a>
[=#ff0000]促销产品 {if $promotion_info} 检验是否存在促销产品,不存在就不显示相关信息
促销产品列表 {foreach from=$promotion_info item=item key=key}
里面还有很多标签,没弄明白,以后在添加,修改
[=#ff0000]订单查询 {if empty($order_query)} 同上看下就知道了
订单用户ID {if $order_query.user_id}
订单数量 {$lang.order_number}
订单编号 {$order_query.order_sn}
里面还有很多标签,没弄明白,以后在添加,修改
[=#ff0000]发货查询 {if $invoice_list} 当有完成的订单测显示
发货列表 {foreach from=$invoice_list item=invoice}
订单号名称 {$lang.order_number}
订单号 {$invoice.order_sn}
发货单名称 {$lang.consignment}
发货单号 {$invoice.invoice_no}
[=#ff0000]销售排行 {if $top_goods} 看看就知道
销售列表 {foreach name=top_goods from=$top_goods item=goods}
产品短名称 {$goods.short_name}
看例子:
<!– {foreach name=top_goods from=$top_goods item=goods}–>
<li class=”top10-li-{$smarty.foreach.top_goods.iteration}”> [url==”{$goods.url}” title=”{$goods.name|escape:html}”>{$goods.short_name}</a></li>
<!–{/foreach}–>
精品推荐 {if $best_goods}
精品推荐列表 {foreach from=$best_goods item=goods}
市场价名称 {$lang.market_price}
市场价价格 {$goods.market_price}
促销价名称 {$lang.promote_price}
促销价价格 {$goods.promote_price}
商店价名称 {$lang.shop_price}
商店价价格 {$goods.shop_price}


大家看到了吗??{$lang.xxxx_xxxx}以lang开头的为相对应的名称
{$goods.xxxx_xxxx}以goods开头的为价格
{$page_title} 网站标题
{$keywords} 网站关键字标签
{$description} 网站描述标签
{$shop_notice} 商店公告
$new_articles 新文章
{$article.short_title} 调用文章标题
{foreach from=$new_articles item=article} 循环的开始,
{/foreach} 循环的结束
item --> 具体意义和用法?
表格一行一行的循环
<table>
{foreach from=$new_articles item=article}
<tr><td>
{$article.short_title}
</td></td>
{/foreach}
</table>
from=$best_goods 表示循环的内容来自$best_goods
$best_goods 精品商品推荐的标签
{$goods.short_style_name} 表示goods 这个对象的商品名称
$new_goods 新品上市
$hot_goods 热卖商品
$categories 分类的标签
$goods_list 商品标签
商品图片: <img src= {$goods.goods_img} />
商品名称:{$goods.goods_style_name}
商品货号:{$goods.goods_sn}<br>
商品品牌: {$goods.goods_brand}
商品数量:{$goods.goods_number}
单位:{$goods.measure_unit}
添加时间:{$goods.add_time}
市场价格:{$goods.market_price}
本店价格:{$goods.shop_price_formated}
注册用户价格:{$rank_price.price}
注册用户价格:{$rank_price.price}
注册用户价格:{$rank_price.price}
商品id为1的商品
http://localhost/ecshop/goods.php?id=1

邮件模板管理
商城在进行某些操作时可以向用户发送邮件提示。在本页你可以定制自己个性化的邮件的模板。邮件主题为发送邮件的标题。邮件模板中有可以替换的内容都用{$_var}方式表示。以下将解释所有变量含义。
公共变量
{$shop_name}
网店名称
{$sent_date}
邮件发送时间
发送密码模板变量
{$user_name}
注册帐号名
{$password}
网店为用户生成的新密码
订单确认模板变量
{$order.consignee}
订单收货人姓名
{$order.order_time}
订单生成时间
{$order.order_sn}
订单序号
发货通知模板变量
{$order.consignee}
收货人姓名
{$order.shipping_time}
发货时间
{$confirm_url}
确认收货的链接地址
订单取消模板变量
{$order.consignee}
收货人姓名
{$order.order_sn}
订单序号
订单无效模板变量
{$order.consignee}
收货人姓名
{$order.order_sn}
订单序号
发送红包模板变量
{$user_name}
用户注册名
{$count}
红包个数
{$money}
红包个数金额

具体实现方法:
举例如首页调用方法:
1、先打开index.php文件找到以下代码:
$smarty->assign('new_articles', index_get_new_articles()); // 最新文章

在它下面增加以下:
//调用方法

$smarty->assign('class_articles_4', index_get_class_articles(4,6)); // 分类调用文章
//调用多个就修改传进去的参数,以及模板接收的变量,其中上面的4就是文章分类ID,其中6是调用数量
$smarty->assign('class_articles_5', index_get_class_articles(5,6)); // 分类调用文章
$smarty->assign('class_articles_6', index_get_class_articles(6,6)); // 分类调用文章
$smarty->assign('class_articles_7', index_get_class_articles(7,6)); // 分类调用文章
$smarty->assign('class_articles_8', index_get_class_articles(8,6)); // 分类调用文章

//在最后?>这个之前增加以下函数

 

function index_get_class_articles($cat_aid, $cat_num)
{
$sql = "SELECT article_id, title,open_type,cat_id,file_url FROM " .$GLOBALS['ecs']->table('article'). " WHERE cat_id = ".$cat_aid." and is_open = 1 LIMIT " . $cat_num;
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
foreach ($res AS $idx => $row)
{
$arr[$idx]['id'] = $row['article_id'];
$arr[$idx]['title'] = $row['title'];
$arr[$idx]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ?
sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title'];
$arr[$idx]['cat_name'] = $row['cat_name'];
$arr[$idx]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
$arr[$idx]['url'] = $row['open_type'] != 1 ?
build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']);
$arr[$idx]['cat_url'] = build_uri('article_cat', array('acid' => $row['cat_id']));
}
return $arr;
}


2、第二步是在index.dwt模板想调用的地方增加以下代码,(注:以下调上面设置里的分类ID为8的文章列表):

<!--{foreach from=$class_articles_8 item=article}-->
<li><a href="{$article.url}" title="{$article.title|escape:html}"><!--{$article.short_title|truncate:15:true}--></a></li>
<!--{/foreach}-->