在ecshop中通过js获取商品goods_id 10
1个回答
展开全部
商品列表页
<!--{foreach from=$goods_list item=goods}-->
<!--{if $goods.goods_id} -->
<li>
<a href="{$goods.url}">
<img style="display: inline;" src="{$goods.goods_thumb}" alt="{$goods.goods_name}" height="140" width="140">
</a>
<p>
<a href="{$goods.url}">{$goods.goods_name}</a>
</p>
<h4> <!-- {if $goods.promote_price neq ""} -->
{$goods.promote_price}
<!-- {else}-->
{$goods.shop_price}
<!--{/if}--></h4>
<font>已有<a class="review_" href="{$goods.url}">{$goods.comment_count}</a>人评价</font>
<h5>
<a href="javascript:addToCart({$goods.goods_id})">立即购买</a>
<a href='javascript:collect({$goods.goods_id});' class="shouc_btn">收藏</a>
</h5>
</li>
<!-- {/if} -->
<!--{/foreach}-->
{$goods.goods_id}就是获取商品列表页面的商品ID
<!--{foreach from=$goods_list item=goods}-->
<!--{if $goods.goods_id} -->
<li>
<a href="{$goods.url}">
<img style="display: inline;" src="{$goods.goods_thumb}" alt="{$goods.goods_name}" height="140" width="140">
</a>
<p>
<a href="{$goods.url}">{$goods.goods_name}</a>
</p>
<h4> <!-- {if $goods.promote_price neq ""} -->
{$goods.promote_price}
<!-- {else}-->
{$goods.shop_price}
<!--{/if}--></h4>
<font>已有<a class="review_" href="{$goods.url}">{$goods.comment_count}</a>人评价</font>
<h5>
<a href="javascript:addToCart({$goods.goods_id})">立即购买</a>
<a href='javascript:collect({$goods.goods_id});' class="shouc_btn">收藏</a>
</h5>
</li>
<!-- {/if} -->
<!--{/foreach}-->
{$goods.goods_id}就是获取商品列表页面的商品ID
更多追问追答
追问
帮我把加入购物车js里的获取商品id的代码段抽出来
追答
立即购买就是
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询