php 获取订单的product_id 和相对id的数量
<?php foreach ($val->groupResults(2) as $key2=>$val2):?> <tr class="eveData" shoppingCartId="<?=$val2->id?>" productId="<?=$val2->product()->id?>" freightId="<?=$val2->product()->freight_id?>"> <td width="10%"><a href="<?=$val2->product()->strUrl()?>" target="_blank"><img src="<?=$val2->strPic()?>" class="img75" /></a></td> <td width="33%"> <a href="<?=$val2->product()->strUrl()?>" target="_blank"><?=$val2->product()->title?></a><br/> <?php if($val2->shop()->isVip()):?> <a href="javascript:void(0)" title="VIP商家" class="shop_ico_vip"></a> <?php endif;?> <?php if($val2->product()->is_24h>0):?> <a href="javascript:void(0)" title="<?=$val2->product()->is_24h?>小时内发货" class="shop_ico_24h"></a> <?php endif;?> <?php if($val2->product()->is_aftermarket>0):?> <a href="javascript:void(0)" title="售后保障" class="shop_ico_baozhang"></a> <?php endif;?> <?php if($val2->product()->is_7goodsreturn>0):?> <a href="javascript:void(0)" title="<?=$val2->product()->is_7goodsreturn?>+天包退" class="shop_ico_7"></a> <?php endif;?> <?php if($val2->product()->is_15renew>0):?> <a href="javascript:void(0)" title="<?=$val2->product()->is_15renew?>+天换新" class="shop_ico_15"></a> <?php endif;?> <?php if($val2->product()->is_wholesale>0):?> <a href="javascript:void(0)" title="批发" class="shop_ico_pifa"></a> <?php endif;?> </td> <td width="13%"> <i class="i_gray">型号:</i><?=$val2->attriModel()->title?><br/> <i class="i_gray">分类:</i><?=$val2->attriCategory()->title?> </td> <td><b class="eveUnitPrice"><?=$val2->product()->price?>a<?=$val2->product()->id?></b></td> <td> <input type="text" class="num eveNum" shoppingCartId="<?=$val2->id?>" value="<?=$val2->number?>" /><br/> <i class="i_gray">库存:</i><?=$val2->product()->inventorySurplus()?> </td> <td><i class="i_16red evePrice"><?=$val2->priceSum()?></i></td> <?php if($key2==0):?> <td rowspan="3"> 方式: <select name="logistics_type" onchange="freightPrice()"> <option value="1">自取</option> <option value="2">配送</option> </select> <br/> 费用:<span class="eveLogisticsPrice">0.00</span> </td> <?php endif;?> </tr>
jquery获取的方法
/*获取产品的id和产品的数量*/ var data=[]; $('.eveData').each(function(k,v){ var tmp = { 'prodcut_id':$(this).attr('productId'), 'count':$(this).find('.eveNum').val(), }; data.push(tmp); }); param.product = data;