Ecshop模板开发(四):商品详情页的显示配置
2017-04-01 16:46
495 查看
1、本店售价+市场价格
2、促销价格
4、不同用户类型显示不同价格
5、商品点击数
6、人气和评分
7、商品属性
层级关系如下:
单选—-radio、select
多选—-checkbox
7、商品属性的改变引起价格动态变化
html
js
{$goods.shop_price} <del>{$good.market_price}</del>
2、促销价格
<!--{if $goods.is_promote and $goods.gmt_end_time } 促销--> {insert_scripts files='lefttime.js'} <li class="padd loop" style="margin-bottom:5px; border-bottom:1px dashed #ccc;"> <strong>{$lang.promote_price}</strong><font class="shop">{$goods.promote_price}</font><br /> <strong>{$lang.residual_time}</strong> <font class="f4" id="leftTime">{$lang.please_waiting}</font><br /> </li> <!--{/if}--> <script> var gmt_end_time = {$goods.gmt_end_time}; var hour="时"; var day="天"; var minute="分"; var second="秒"; onload_leftTime(); </script>
4、不同用户类型显示不同价格
{foreach from=$rank_prices key=key item=abc} <p> {$abc.rank_name} {$abc.price}<br> </p> {/foreach}
5、商品点击数
{$goods.click_count}
6、人气和评分
<img src="images/stars{$goods.comment_rank}.gif" alt=""> <span style="color: red">{$goods.comment_rank} 分</span>
7、商品属性
层级关系如下:
单选—-radio、select
多选—-checkbox
{foreach from=$specification item=spec key=key} <div class="clearfix"></div> <p>{$spec.name}</p> {if $spec.attr_type eq 1} {if $cfg.goodsattr_style eq 1} {foreach from=$spec.values key=key_attr item=value} <div class="attr_radio"> <label for="" title="{if $value.price gt 0}加{else /}减{/if}{$value.format_price}">{$value.label}</label> </div> {/foreach} {else /} <select name="" id=""> {foreach from=$spec.values key=key_attr item=value} <div class="attr_select"> <option value="">{$value.label}--{if $value.price gt 0}加{else /}减{/if}{$value.format_price}</option> </div> {/foreach} </select> {/if} {else /} {foreach from=$spec.values key=key_attr item=value} <div class="attr_checkbox"> <label for="" title="{if $value.price gt 0}加{else /}减{/if}{$value.format_price}"><input type="checkbox">{$value.label}</label> </div> {/foreach} {/if} <br> {/foreach}
7、商品属性的改变引起价格动态变化
html
<div class="attr-form"> {foreach from=$specification item=spec key=key} <div class="clearfix"></div> <p>{$spec.name}</p> {if $spec.attr_type eq 1} {if $cfg.goodsattr_style eq 1} <div class="attr-radio-area"> {foreach from=$spec.values key=key_attr item=value} <div class="attr_radio {if $key_attr eq 0}attr_radio_checked{/if}"> <label for="" title="{if $value.price gt 0}加{else /}减{/if}{$value.format_price}">{$value.label} <input value="{$value.id}" type="radio" {if $key_attr eq 0}checked{/if} class="hn-hide"></label> </div> {/foreach} </div> {else /} {*<select name="" id=""> {foreach from=$spec.values key=key_attr item=value} <div class="attr_select"> & 10d93 lt;option value="">{$value.label}--{if $value.price gt 0}加{else /}减{/if}{$value.format_price}</option> </div> {/foreach} </select>*} {/if} {else /} {foreach from=$spec.values key=key_attr item=value} <div class="attr_radio {if $key_attr eq 0}attr_radio_checked{/if}"> <label for="" title="{if $value.price gt 0}加{else /}减{/if}{$value.format_price}"><input value="{$value.id}" type="checkbox" class="hn-hide" {if $key_attr eq 0}checked{/if} >{$value.label}</label> </div> {/foreach} {/if} <br> {/foreach} </div>
js
<script> var goodsid={$goods.goods_id};//获取商品id //点击属性label时执行的函数 $('.attr_radio label').click(function () { if($(this).children('input').attr('type')=='radio'){ $(this).parents('.attr-radio-area').children('.attr_radio').removeClass('attr_radio_checked'); $(this).parents('.attr-radio-area').find(':input').attr('checked',false); } if($(this).children('input').attr('type')=='checkbox' && $(this).parent().is('.attr_radio_checked')) { $(this).parent().removeClass('attr_radio_checked'); $(this).children('input').attr('checked', false); changePrice(); return false; } $(this).children('input').attr('checked',true); $(this).parent().addClass('attr_radio_checked'); changePrice(); return false; }); //获得商品属性选定的值并转化为字符串 function getAttrValue() { var attr_arr=[]; $('.attr-form :input:checked').each(function () { attr_arr.push($(this).val()); }); return attr_arr.join(','); } //商品数量input框失去焦点时候 $('#buy_num').blur(function () { changePrice(); }); //发送ajax请求 function changePrice() { $.get('goods.php',{"act":"price","id":goodsid,"attr":getAttrValue(),"number":$('#buy_num').val()},execTotalPrice,'json'); } //接收ajax返回值并处理 function execTotalPrice(data) { if(data.err_msg.length>0){ alert(data.err_msg); }else{ $('#buy_num').val(data.qty); $('#total_price').html(data.result) } } </script>
相关文章推荐
- Ecshop模板开发(十一):商品详情页显示和添加评价
- Ecshop模板开发(二十一):商品详情页相关配件显示
- Ecshop模板开发(二十一):商品详情页相同属性的商品显示
- Ecshop模板开发(二十):商品详情页相关文章显示
- Ecshop模板开发(十四):商品详情页显示与添加标签
- Ecshop模板开发(十九):商品详情页相关商品显示
- Ecshop模板开发(五):商品详情页购物车和立即购买的实现
- Ecshop模板开发(六):商品详情页收藏商品实现
- Ecshop模板开发(二十八):列表页最新、最热、精品、促销商品显示
- Ecshop模板开发(八):商品详情页赠送积分实现
- Ecshop模板开发(十三):商品详情页商品描述
- ECSHOP二次开发,在用户中心的订单详情页显示商品缩略图
- Ecshop模板开发(十):商品详情页商品属性参数
- ECSHOP二次开发,在用户中心的订单详情页显示商品缩略图
- Ecshop模板开发(二十二):商品浏览记录显示
- Ecshop模板开发(十二):商品详情页超值大礼包优惠活动
- Ecshop模板开发(七):商品详情页推荐给好友实现
- Ecshop模板开发(五):商品详情页图片相册jqzoom放大
- Ecshop模板开发(二十九):商品列表、排序、分页显示
- ECSHOP二次开发,在用户中心的订单详情页显示商品缩略图