Ecshop模板开发(十四):商品详情页显示与添加标签
2017-04-09 22:31
344 查看
1、html
2、js
{if $tags} <h2>商品标签</h2> #show the tags <p> {foreach from=$tags item=tag} <a href="search.php?keywords={$tag.tag_words|escape:url}">{$tag.tag_words|escape:html}[{$tag.tag_count}]</a> {/foreach} </p> #add the tags <form action="javascript:;" name="tagForm" id="tagForm" onsubmit="return submitTag(this)"> <input type="text" name="tag" id="tag"> <input type="submit" value="添加"> <input type="hidden" name="goods_id" value="{$goods.goods_id}"> </form> <p id="ECS_TAGS"></p> {/if}
2、js
function submitTag() { try { var tag = $('input[name=tag]').val(); var idx = $('input[name=goods_id]').val(); if (tag.length > 0 && parseInt(idx) > 0) { $.post( 'user.php?act=add_tag', {'id':idx,'tag':tag}, function (result) { var div = document.getElementById('ECS_TAGS'); if (result.error > 0) { alert(result.message); } else { try { div.innerHTML = ''; var tags = result.content; for (i = 0; i < tags.length; i++) { div.innerHTML += '<a href="search.php?keywords='+tags[i].word+'" style="color:#006ace; text-decoration:none; margin-right:5px;">' +tags[i].word + '[' + tags[i].count + ']<\/a> '; } } catch (e) { alert(e); } } }, 'json'); } } catch (e) { alert(e); } return false; }
相关文章推荐
- Ecshop模板开发(十一):商品详情页显示和添加评价
- Ecshop模板开发(二十一):商品详情页相同属性的商品显示
- Ecshop模板开发(二十):商品详情页相关文章显示
- Ecshop模板开发(二十一):商品详情页相关配件显示
- Ecshop模板开发(四):商品详情页的显示配置
- Ecshop模板开发(十九):商品详情页相关商品显示
- Ecshop模板开发(五):商品详情页图片相册jqzoom放大
- Ecshop模板开发(十):商品详情页商品属性参数
- Ecshop模板开发(六):商品详情页收藏商品实现
- ECSHOP二次开发,在用户中心的订单详情页显示商品缩略图
- Ecshop模板开发(五):商品详情页购物车和立即购买的实现
- Ecshop模板开发(七):商品详情页推荐给好友实现
- Ecshop模板开发(二十二):商品浏览记录显示
- Ecshop模板开发(二十九):商品列表、排序、分页显示
- Ecshop模板开发(八):商品详情页赠送积分实现
- ECSHOP二次开发,在用户中心的订单详情页显示商品缩略图
- 在tableView中添加webView显示商品图文详情 自适应高度
- Ecshop模板开发(二十八):列表页最新、最热、精品、促销商品显示
- Ecshop模板开发(十二):商品详情页超值大礼包优惠活动
- ecshop二次开发:商品分类添加图片显示功能(附下载)