ECSHOP商品批发插件免费共享给大家

2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家

代码: 1、打开goods.dwt加入    

                                                                                            
货号规格销售价会员价订购数量库存
{$product.product_sn}       {$goods_attr} |           {$goods.shop_price_formated}                   {$rank_price.rank_name}: {$rank_price.price}                 {$product.product_number}
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; }