您现在的位置是:首页 > cms教程 > Ecshop商城教程Ecshop商城教程

ecshop积分商城怎么添加金额+积分兑换功能

樊辰博2023-12-16Ecshop商城教程已有人查阅

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

ECSHOP积分商城里添加个“金额+积分”的兑换功能,(高手略过)虽然没有在商品详情页的“金额+积分”功能那么实用,但是用这个应急一下下也是可以考虑考虑的。呵呵……
好吧,进入正题:
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><input type="text" name="exchange_integral" maxlength="60" size="20" value="{$goods.exchange_integral}" />{$lang.require_field}<br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticepackagePrice">{$lang.notice_integral}</span></td>”
在下面添加:
<!--积分商城加上金额二次开发-->
<tr>
<td class="narrow-label"><a href="javascript:showNotice('noticepackagePrice');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.goods_price}</td>
<td><input type="text" name="goods_price" maxlength="60" size="20" value="{$goods.goods_price}" />{$lang.require_field}<br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticepackagePrice">{$lang.notice_price}</span></td>
</tr>
<!--end-->
3、修改admin/templates/exchange_goods_info.htm页,找到:
<th><a href="javascript:listTable.sort('exchange_integral'); ">{$lang.exchange_integral}</a>{$sort_exchange_integral}</th>
在下面添加:
<!--积分商城加上金额二次开发-->
<th><a href="javascript:listTable.sort('exchange_price'); ">{$lang.goods_price}</a>{$sort_exchange_price}</th>
<!--end-->
再找到:
<td align="center"><span onclick="listTable.edit(this, 'edit_exchange_integral', {$list.goods_id})">{$list.exchange_integral}</span></td> 在它下面添加:
<!--积分商城加上金额二次开发-->
<td align="center"><span onclick="listTable.edit(this, 'edit_exchange_price', {$list.goods_id})">{$list.goods_price}</span></td>
<!--end-->
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">
<dd>
<strong>{$lang.exchange_integral}</strong><font class="shop">{$goods.exchange_integral}</font><br />
</dd>
</li>
在下面添加:
<!--积分商城二次开发-->
<li class="clearfix">
<dd>
<strong>{$lang.exchange_price}</strong><font class="shop">
<!--{if $goods.goods_price >0}--> {$goods.goods_price}元+<!--{/if}-->{$goods.exchange_integral}积分</font><br />
</dd>
</li>
<!--二次开发结束-->
最后一步是在语言文件夹中的languages/zh_cn/common.php 的$_LANG['exchange_integral'] = '消耗积分:';
下面添加:$_LANG['exchange_price'] = '积分套餐:';
与 /admin/exchange_goods.php中的$_LANG['exchange_integral'] = '使用积分值';
下面加上:$_LANG['goods_price'] = '还需要的价格';
OK! 完成!

本文标签:

很赞哦! ()

相关源码

  • (自适应)html5中英双语通用机械设备pbootcms模板下载本模板基于PbootCMS内核精心开发,为机械设备制造企业量身打造。设计风格大气稳重,充分展现机械行业的专业特质与技术实力。采用HTML5技术构建,支持中英文双语切换,满足国际化业务需求。整站布局合理,充分展示企业产品、案例与服务,帮助访客快速了解企业核心优势。查看源码
  • 响应式HTML5家居建材办公家具桌椅pbootcms模板为家居建材、办公家具企业打造的响应式网站模板,同时支持多行业快速适配通过替换文字图片即可转型为其他行业官网,大幅降低开发成本。查看源码
  • (自适应)工业机械设备产品介绍免费pbootcms源码下载本网站模板基于PbootCMS内核精心开发,为机械设备与工业产品制造企业量身打造。设计充分考量行业特性,突出产品展示与技术实力呈现查看源码
  • (自适应)游泳馆泳池水处理器设备pbootcms网站模板免费下载专注服务于泳池水处理设备制造商、泳池系统工程商等企业用户。模板预设设备分类体系、技术参数展示模块和解决方案呈现页面,满足行业特有展示需求。查看源码
  • pbootcms模板(PC+WAP)微信小程序开发公司网站本模板为微信小程序开发代理、软件开发公司等企业设计,基于PbootCMS内核开发,支持PC+WAP双端响应式布局,数据实时同步,适用于多行业快速建站。查看源码
  • (自适应响应式)html5高档服装定制西服pbootcms模板下载本模板基于PbootCMS内核开发,为服装定制企业和服装品牌量身打造。设计风格时尚现代,充分展现服装行业的审美特质与品牌魅力。采用HTML5响应式技术,确保在各种设备上呈现视觉效果。整站布局注重产品展示与品牌叙事,帮助企业有效展示服装系列与定制服务,提升客户体验。查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐