轻源码

  • QingYuanMa.com
  • 全球最大的互联网技术和资源下载平台
搜索
一起源码网 门户 ECShop网店 查看主题

ecshop添加“金额+积分”的兑换功能

发布者: ok1818 | 发布时间: 2018-4-3 13:36| 查看数: 4948| 评论数: 1|帖子模式

积分商城里添加个“金额+积分”的兑换功能,(高手略过)虽然没有在商品详情页的“金额+积分”功能那么实用,但是用这个应急一下下也是可以考虑考虑的。呵呵……

   好吧,进入正题:
  1、执行SQL语句:ALTER TABLE `ecs_exchange_goods` ADD `goods_price` DECIMAL (10,2) default 0.00 NOT NULL
  2、修改admin/templates/exchange_goods_info.htm页:找到
“[td]{$lang.require_field}
{$lang.notice_integral}[/td]”
在下面添加:

    [tr]
      [td]{$lang.goods_price}[/td]
      [td]{$lang.require_field}
{$lang.notice_price}[/td]
    [/tr]
   
3、修改admin/templates/exchange_goods_info.htm页,找到:
{$lang.exchange_integral}{$sort_exchange_integral}
在下面添加:

    {$lang.goods_price}{$sort_exchange_price}
   
再找到:
[td]{$list.exchange_integral}[/td] 在它下面添加:

    [td]{$list.goods_price}[/td]
   
4、修改admin/exchange_goods.php页:找到
$sql = "INSERT INTO ".$ecs->table('exchange_goods')."(goods_id, exchange_integral, goods_price,  is_exchange, is_hot) ".
            "VALUES ('$_POST[goods_id]', '$_POST[exchange_integral]', '$_POST[goods_price]', '$_POST[is_exchange]', '$_POST[is_hot]')"
注意上面是添加了:goods_price, 和 '$_POST[goods_price]',的;
找到:$sql = "SELECT eg.goods_id, eg.exchange_integral,eg.is_exchange, eg.is_hot,eg.goods_price, g.goods_name ".
注意上面是添加了eg.goods_price的;
找到:if ($exc->edit("exchange_integral='$_POST[exchange_integral]',goods_price='$_POST[goods_price]', is_exchange='$_POST[is_exchange]', is_hot='$_POST[is_hot]' ", $_POST['goods_id']))里面也是添加了goods_price='$_POST[goods_price]'的。
最后找到elseif ($_REQUEST['act'] == 'edit_exchange_integral') 这个条件语句,在这个条件语句的下面添加一个条件语句:
//积分商城二次开发添加
elseif ($_REQUEST['act'] == 'edit_exchange_price')
{
    check_authz_json('exchange_goods');

    $id                = intval($_POST['id']);
    $exchange_integral = floatval($_POST['val']);

    if ($exchange_integral < 0 || $exchange_integral == 0 && $_POST['val'] != "$goods_price")
    {
        make_json_error($_LANG['exchange_integral_invalid']);
    }
    else
    {
        if ($exc->edit("goods_price = '$exchange_integral'", $id))
        {
            clear_cache_files();
            admin_log($id, 'edit', 'goods_price');
            make_json_result(stripslashes($exchange_integral));
        }
        else
        {
            make_json_error($db->error());
        }
    }
}
//二次开发结束
5、修改根目录下的exchange.php页面:
找到'market_price'   => $goods['market_price'],在它的下面把'goods_price'    => 0 改成:'goods_price'    => $goods['goods_price'],
找到   $sql =  'SELECT g.goods_id, g.goods_name, g.goods_name_style, eg.exchange_integral ' .在最后添加上eg.goods_price;
再找到:$sql = 'SELECT g.*, c.measure_unit, b.brand_id, b.brand_name AS goods_brand, eg.exchange_integral eg.is_exchange ' .在后面添加上eg.goods_price;
6、修改exchange_goods.dwt页面:找到
<li class="clearfix">
            
            {$lang.exchange_integral}{$goods.exchange_integral}

            
         
在下面添加:

          <li class="clearfix">
            
            {$lang.exchange_price}
             {$goods.goods_price}元+{$goods.exchange_integral}积分

            
         
         
最后一步是在语言文件夹中的languages/zh_cn/common.php 的$_LANG['exchange_integral'] = '消耗积分:';
下面添加:$_LANG['exchange_price'] = '积分套餐:';
与 /admin/exchange_goods.php中的$_LANG['exchange_integral'] = '使用积分值';
下面加上:$_LANG['goods_price'] = '还需要的价格';

   OK! 完成!

最新评论

etsygl 发表于 2022-6-4 21:31
html网页源代码模板

轻源码让程序更轻更快

QingYuanMa.com

工作时间 周一至周六 8:00-17:30

侵权处理

客服QQ点击咨询

关注抖音号

定期抽VIP

Copyright © 2016-2021 https://www.171739.xyz/ 滇ICP备13200218号

快速回复 返回顶部 返回列表