您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop商品批发插件代码实例
雷友水2023-12-20 19:25:42ecshop商城教程已有人查阅
导读1、打开goods.dwt加入;2、打开goods.php 加入;3、打开flow.php加入
代码:1、打开goods.dwt加入
<form action="flow.php" method="post" name="ECS_ALL_addcart" >
<table width=" " border="0" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
<tr bgcolor="#5e554e" style="color:#FFFFFF;">
<td align="center" width="150">货号</td>
<td align="center" width="150">规格</td>
<td align="center" width="80">销售价</td>
<td align="center" width="140">会员价</td>
<td align="center">订购数量</td>
<td align="center">库存</td>
</tr>
<!-- {foreach from=$product_list item=product} -->
<tr bgcolor="#f7f7f7">
<td align="center" >{$product.product_sn}<input name="product_sn[{$product.product_id}]" id="number" value="{$product.product_sn}" type="hidden" /></td>
<td align="center" >
<!--{foreach from=$product.goods_attr_id item=goods_attr_id }-->
<input name="goods_attr[{$product.product_id}][]" type="hidden" value="{$goods_attr_id}" />
<!-- {/foreach}-->
<!--{foreach from=$product.goods_attr item=goods_attr name=pro }--> {$goods_attr}
<!--{if $smarty.foreach.pro.iteration ne $smarty.foreach.pro.total}--> | <!--{/if}-->
<!-- {/foreach}--></td>
<td align="center" >{$goods.shop_price_formated}</td>
<td align="center" > <!-- 会员等级对应的价格{foreach from=$rank_prices item=rank_price key=key} -->
{$rank_price.rank_name}: <span class="goodsPrice" id="ECS_RANKPRICE_{$key}">{$rank_price.price}</span>
<!-- {/foreach} --></td>
<td align="center" ><input name="number[{$product.product_id}]" id="number" value="1" type="text" size="3" /></td>
<td align="center" >{$product.product_number}</td>
</tr>
<!-- {/foreach}-->
<tr>
<td colspan="6" align="right"><input type="image" name="submit" src="images/add_cart.gif"></td>
</tr>
</table>
<input name="goods_id" value="{$goods.goods_id}" type="hidden" />
<input name="step" value="all_addcart" type="hidden" />
</form>
2、打开goods.php 加入
$smarty->assign('product_list',product_list($goods_id, ''));
3、打开flow.php加入
//-- 添加商品到购物车
if($_REQUEST['step'] =='all_addcart')
{
$goods_id = $_POST["goods_id"];
//获得批发相关值
foreach($_POST['number'] as $idx=>$value)
{
$number = $value;
$number_all= $value+$number_all;
$goods_attr_id = join(",",$_POST['goods_attr'][$idx]);
$product_sn = $_POST['product_sn'][$idx];
addto_cart($goods_id,$number,$_POST['goods_attr'][$idx],'',$content);
$arr[$idx] = array('number'=>$number,'goods_attr'=>$goods_attr_id,'product_sn'=>$product_sn);
// $sql = $GLOBALS['db']->query("insert into ".$GLOBALS['ecs']->table('cart_p')." (goods_id,product_id,number,goods_attr,product_sn,session_id) values('$goods_id','$idx','$number','$goods_attr_id','$product_sn','".SESS_ID."')");
}
//商品id
// $content = serialize($arr);
//$number = $number_all;
ecs_header("Location:./flow.php\n");
}
function product_list($goods_id, $conditions = '')
{
$sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('products'). " AS p WHERE goods_id = $goods_id $where";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
$sql = "SELECT product_id, goods_id, goods_attr, product_sn, product_number
FROM " . $GLOBALS['ecs']->table('products') . " AS g
WHERE goods_id = $goods_id ";
$row = $GLOBALS['db']->getAll($sql);
$goods_attr = product_goods_attr_list($goods_id);
foreach ($row as $key => $value)
{
$_goods_attr_array = explode('|', $value['goods_attr']);
if (is_array($_goods_attr_array))
{
$_temp = '';
foreach ($_goods_attr_array as $_goods_attr_value)
{
$_temp[] = $goods_attr[$_goods_attr_value];
}
$row[$key]['goods_attr'] = $_temp;
}
$row[$key]['goods_attr_id'] = $_goods_attr_array;
}
return $row;
}
本文标签:
很赞哦! ()
相关文章
- ecshop商品列表页面和商品页面自定义url网址前缀的实现方法
- ecshop商品页显示商品收藏数量怎么修改
- ecshop商品批发多属性多规格多库存怎么批量购买
- ecshop水印ecshop商品添加水印的实现方法
- ecshop商品价格将属性价格改为直接价非加价修改的方法
- ecshop商品页商品详细描述内容调用商品相册图片代码的方法
- ecshop商品图片模糊修改图片上传压缩质量的方法
- ecshop商品相册显示顺序为正序的修改方法
- ecshop商品售完商品库存为0显示商品售完已售罄的实现方法
- ecshop商品详情页相关属性商品由新到旧排序的方法
- ecshop商品页商品浏览次数怎样修改按倍数增加
- ecshop商品页面定制属性附件上传文件上传图片
随机图文
-
ecshop后台怎么新增搜索功能
目前后台按照我们自身的需求便于管理可能要加搜索功能,比如供货商列表,如果信息太多的话加个搜索会更方便些 -
ecshop商品类型添加编辑方法
各位ECSHOP网店系统用户大家好,欢迎来到ECSHOP教程网图文教程,今天为大家详细解说一下ECSHOP商品类型,ECSHOP商品属 设置。 ECSHO -
ecshop首页怎么显示积分商城的商品信息内容
1)、首先打开 index.php 文件在最末尾增加下面函数,注意千万不要写到 “?>” 的外面去,要加在“?>”的前面。 -
ecshop购物进入结算页面无法选择“ ”
问:我使用ecshop前台购物进入结算页面,无法选择“ ”?答:“ ”是跟你上一栏选择的“配送方式”相关的。
留言与评论 (共有 条评论) |