澳门新莆京手机网站-新蒲京娱乐场 > 书籍 > ecshop推荐分成实现原理

ecshop推荐分成实现原理

     1:ECSHOP分成管理步骤

展现会员品级价格

在ecshop中会员是有级其他,那么大家能够依据会员的级差设置不用的优胜,显示区别的降价价格。

修改admin/includes/lib_goods.php的goods_list(State of Qatar 函数有的在

return array('goods' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);

前方扩充下边代码

复制代码代码如下:
foreach($row as $key_tmp=>$goods_tmp)
{
$sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $goods_tmp[shop_price] / 100) AS price, r.rank_name, r.discount " .
'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = '$goods_tmp[goods_id]' AND mp.user_rank = r.rank_id " .
"WHERE r.show_price = 1 OR r.rank_id = '$_SESSION[user_rank]'";
$res_up = $GLOBALS['db']->query($sql);
while ($row_up = $GLOBALS['db']->fetchRow($res_up))
{
$row[$key_tmp]['user_price'][$row_up['rank_id']] = array(
'rank_name' => htmlspecialchars($row_up['rank_name']),
'price' => price_format($row_up['price']));
}
}

修改模板文件 admin/templates/goods_list.htm 在{$goods.shop_price}与中间扩充上面代码

复制代码代码如下:
{if $goods.user_price}
{foreach from=$goods.user_price item=user_price }

{$user_price.rank_name}:{$user_price.price}
{/foreach}
{/if}

会员注册成功后就是VIP

依据ECSHOP默许的主次,新登记的会员都是“非特殊等级”,你要想实现您愿意的那么的职能,得改注册程序,注册成功的还要活动安装为有个别“特殊阶段”,比方,让会员注册成功后就改为“vip客户”,能够用下面方法改进。

修改 includes/lib_passwort.php 在

复制代码代码如下:
$update_data = array_merge($update_data, $other);

下边扩充黄金年代行代码

复制代码代码如下:
$update_data['user_rank']=2; //自动注册成“VIP会员”
$GLOBALS['db']->query("update ".$GLOBALS['ecs']->table('user_rank') . " set special_rank =1 where rank_id=2" );

这么改善之后,会员黄金年代挂号便是“vip客户”了。

        $sql = 'SELECT rank_id, rank_name FROM ' . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '$user[user_rank]'";  


<>
<>

    近些日子在和相爱的人齐声研究七个品类,项指标焦点正是ECSHOP的分成,ECSHOP的推荐介绍分成,具有递归性,尽管A他推荐了B,B推荐了C。那么C购买了商品之后,B,A都能得到肯定的引入分成金额。

会员对于我们的网址有很深入的影响,具备一群粘性顾客是大功告成的要害,那么大家什么样去抓住会员注册然后转向会员为高端会员呢,举例我们得以让抱有会员都形成VIP会员,对于VIP会员,彰显相对杰出的价位,而对此无名氏购买的顾客就从未有过巨惠。

在上边增添代码:

复制代码代码如下:

来源:  中华夏族民共和国B4C电商 笔者:admin

$sql  = 'SELECT u.user_id, u.email,u.user_rank, u.rank_points, u.user_name, u.user_money, u.pay_points'.  

复制代码代码如下:
//$is_promote = empty($promote_price) ? 0 : 1;
$is_promote = empty($promote_price) ? 0 : $_POST['is_promote'];

        而这里的"SELECT o.parent_id as user_id,u.user_name FROM " . $GLOBALS['ecs']->table('users') . " o" .  " LEFT JOIN" . $GLOBALS['ecs']->table('users') . " u ON o.parent_id = u.user_id"." WHERE o.user_id = '$row[user_id]'";正是用来索求上一流推荐人的帐户音讯。通过轮回,而展开分成。然后写入对应的日记。

    }  

复制代码代码如下:
handlePromote(document.forms['theForm'].elements['is_promote_switch'].checked);

      $num = count($affiliate['item']State of Qatar;//推荐等级

    }  

改为

      后台->推荐管理->分成管理

$sql  = 'SELECT u.user_id, u.email, u.user_name, u.user_money, u.pay_points'.  

改为

      在ecshop的users表中,parent_id就是用来拍卖EC推荐分成人中学推荐人的会员ID的。通过分成品级。能够循环出EC某会员下具备的引荐人.

修改为:

[![](https://www.apizl.com/archives/%7B$goods.thumb%7D)](https://www.apizl.com/archives/%7B$goods.url%7D)&lt;&gt;  
[{$goods.short_name|escape:html}](https://www.apizl.com/archives/%7B$goods.url%7D)&lt;&gt;  

{$goods.promote_price}&lt;&gt;  
{$goods.market_price}&lt;&gt;  
剩余 {$lang.please_waiting}&lt;&gt;  

&lt;&gt;  
&lt;&gt;  

  for ($i=0; $i < $num; $i++)
            {
                $affiliate['item'][$i]['level_point'] = (float)$affiliate['item'][$i]['level_point'];
                $affiliate['item'][$i]['level_money'] = (float)$affiliate['item'][$i]['level_money'];
                if ($affiliate['item'][$i]['level_point'])
                {
                    $affiliate['item'][$i]['level_point'] /= 100;
                }
                if ($affiliate['item'][$i]['level_money'])
                {
                    $affiliate['item'][$i]['level_money'] /= 100;
                }
                $setmoney = round($money * $affiliate['item'][$i]['level_money'], 2);
                $setpoint = round($point * $affiliate['item'][$i]['level_point'], 0);
                $row = $db->getRow("SELECT o.parent_id as user_id,u.user_name FROM " . $GLOBALS['ecs']->table('users') . " o" .
                        " LEFT JOIN" . $GLOBALS['ecs']->table('users') . " u ON o.parent_id = u.user_id".
                        " WHERE o.user_id = '$row[user_id]'"
                    );
        $up_uid = $row['user_id'];
                if (empty($up_uid) || empty($row['user_name']))
                {
                    break;
                }
                else
                {
                  $info = sprintf($_LANG['separate_info'], $order_sn, $up_uid, $row['user_name'], $setmoney, $setpoint);
                   log_account_change($up_uid, $setmoney, 0, 0, $setpoint, $info);
                    write_affiliate_log($oid, $up_uid, $row['user_name'], $setmoney, $setpoint, $separate_by);
                }
            }

    {  

复制代码代码如下:
/**
* 获得限制时间商品
*
* @access public
* @return array
*/
function get_time_goods($cats = '')
{
$time = gmtime();
$order_type = $GLOBALS['_CFG']['recommend_order'];
/* 获得有效期lbi的多寡限定 */
$num = get_library_number("recommend_promotion");
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
"promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, b.brand_name, " .
"g.is_best, g.is_new, g.is_hot, g.is_promote, RAND() AS rnd " .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' .
"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ' .
" AND g.is_promote = 2 AND promote_start_date <= '$time' AND promote_end_date >= '$time' ";
$sql .= $order_type == 0 ? ' ORDER BY g.sort_order, g.last_update DESC' : ' ORDER BY rnd';
$sql .= " LIMIT $num ";
$result = $GLOBALS['db']->getAll($sql);
$goods = array();
foreach ($result AS $idx => $row)
{
if ($row['promote_price'] > 0)
{
$promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
}
else
{
$goods[$idx]['promote_price'] = '';
}
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['brief'] = $row['goods_brief'];
$goods[$idx]['brand_name'] = $row['brand_name'];
$goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);
$goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'],$row['goods_name_style']);
$goods[$idx]['market_price'] = price_format($row['market_price']);
$goods[$idx]['shop_price'] = price_format($row['shop_price']);
$goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
/* 限制时间时间倒计时 */
$time = gmtime();
if ($time >= $row['promote_start_date'] && $time <= $row['promote_end_date'])
{
$goods[$idx]['gmt_end_time'] = local_date('M d, Y H:i:s',$row['promote_end_date']);
}
else
{
$goods[$idx]['gmt_end_time'] = 0;
}
}
return $goods;
}

     2:ECSHOP分成原理

 

{if ($key+1)%5==0}
{if count($time_goods)!=$key+1}

{/if}
{/if}

你的等第是{$user_info.user_rank_name},

第2步:把admin下的goods.php改一句话,注释部分为本来部分

 

在index.php中加一句

Copyright © 2015-2019 http://www.carrefourstation.com. 澳门新莆京手机网站-新蒲京娱乐场有限公司 版权所有