曼波中国
曼波社区
曼波知识库
曼波搜索

查看完整版本: VirtueMart 支付宝模块

13hao 2006-5-11 10:54

VirtueMart 支付宝模块

这个是hoveryi 老大的 ,我的就是老大帮弄好的 哈哈
代码如下:
<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/**
* This file is called after the order has been placed by the customer
*
* @version $Id: checkout.thankyou.php,v 1.7 2005/10/24 18:13:07 soeren_nb Exp $
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2004-2005 Soeren Eberhardt. All rights reserved.
* @license [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* [url]http://virtuemart.net[/url]
*/
mm_showMyFileName( __FILE__ );

require_once(CLASSPATH.'ps_product.php');
$ps_product= new ps_product;
$Itemid = mosGetParam( $_REQUEST, "Itemid", null );

global $vendor_currency;

// Order_id is returned by checkoutComplete function
$order_id = $GLOBALS['vmInputFilter']->process( $vars["order_id"] );

$print = mosgetparam( $_REQUEST, 'print', 0);

/** Retrieve User Email **/
$q  = "SELECT * FROM #__{vm}_order_user_info WHERE order_id='$order_id' AND address_type='BT'";
$db->query( $q );
$db->next_record();
$user = $db->record[0];
$dbbt = $db->_clone( $db );

$user->email = $db->f("user_email");

/** Retrieve Order & Payment Info **/
$db = new ps_DB;
$q  = "SELECT * FROM #__{vm}_payment_method, #__{vm}_order_payment, #__{vm}_orders ";
$q .= "WHERE #__{vm}_order_payment.order_id='$order_id' ";
$q .= "AND #__{vm}_payment_method.payment_method_id=#__{vm}_order_payment.payment_method_id ";
$q .= "AND #__{vm}_orders.user_id='" . $auth["user_id"] . "' ";
$q .= "AND #__{vm}_orders.order_id='$order_id' ";
$db->query($q);
if ($db->next_record()) {

?>
<h3><?php echo $VM_LANG->_PHPSHOP_THANKYOU ?></h3>
<p>
<?php
if( empty($vars['error'])) { ?>
   <img src="<?php echo IMAGEURL ?>ps_image/button_ok.png" height="48" width="48" align="center" alt="Success" border="0" />
   <?php echo $VM_LANG->_PHPSHOP_THANKYOU_SUCCESS?>
  
  <br /><br />
  <?php echo $VM_LANG->_PHPSHOP_EMAIL_SENDTO .": <strong>". $user->user_email; ?></strong><br />
  </p>
  <?php
} ?>
  
<!-- Begin Payment Information -->
<?php

if ($db->f("order_status") == "P" ) {
        // Copy the db object to prevent it gets altered
        $db_temp = ps_DB::_clone( $db );
/** Start printing out HTML Form code (Payment Extra Info) **/ ?>
<br />
<table width="100%">
  <tr>
    <td width="100%" align="center">
    <?php
    /* Try to get PayPal/PayMate/Worldpay/whatever Configuration File */
    @include( CLASSPATH."payment/".$db->f("payment_class").".cfg.php" );
   
        echo DEBUG ? vmCommonHTML::getInfoField('Beginning to parse the payment extra info code...' ) : '';
       
    // Here's the place where the Payment Extra Form Code is included
    // Thanks to Steve for this solution (why make it complicated...?)
    if( eval('?>' . $db->f("payment_extrainfo") . '<?php ') === false ) {
            echo vmCommonHTML::getErrorField( "Error: The code of the payment method ".$db->f( 'payment_method_name').' ('.$db->f('payment_method_code').') '
            .'contains a Parse Error!<br />Please correct that first' );
    }
    else {
            echo DEBUG ? vmCommonHTML::getInfoField('Successfully parsed the payment extra info code.' ) : '';
    }
    /** END printing out HTML Form code (Payment Extra Info) **/

      ?>
    </td>
  </tr>
</table>
<br />
<?php
$db = $db_temp;
}
?>
<p><a href="<?php $sess->purl(SECUREURL."index.php?page=account.order_details&order_id=". $order_id) ?>">
<?php echo $VM_LANG->_PHPSHOP_ORDER_LINK ?></a>
</p>

<?php
  $q1 = "SELECT order_status,order_total,order_number FROM #__{vm}_orders WHERE ";
  $q1 .= "#__{vm}_orders.user_id='" . $auth["user_id"] . "' ";
  $q1 .= "AND #__{vm}_orders.order_id='$order_id'";
  $db->query($q1);

$total = $db->f("order_total");
$orderno = $db->f("order_number");
        ?>


<!-- 支付宝 包含头文件 放在顶部 开始-->
<?php
require_once("alipay/Alipay_Payto.php");
?>
<!-- 支付宝 包含头文件 放在顶部 结束-->



<!-- 支付宝 接口代码 开始 -->
<?php
$interfaceurl        =        "https://www.alipay.com/payto:";
$sitename                =        "";
$weburl                        =        "";

$seller        =        "[email]ndxjj@126.com[/email]";                                                                                //支付宝账号
$payalikey                =        "1t90mnblxphjdhdfhdfhb3egve3ewayt";                                                                //安全校验码
$imgurl                        =        "images/alipay_bwrx.gif";        //按钮图片源
$imgtitle                =        "使用支付宝购买";                                                                                        //按钮图片说明

$cmd                        =        '0001';
$subject                =        '订单号:'.$orderno;
$body                        =        'www.13hao.com,总价包含邮费';
$order_no                =        $orderno;
$price                        =        $total;
$url                        =        'www.13hao.com';
$type                        =        '1';
$number                        =         '1';
$transport                =        '2';
$ordinary_fee                        =        "10";                                                                                                                //平邮费
$express_fee                        =        "20";                                                                                                                //快递费
$readonly                =        'true';
$buyer_msg                =        '';
$buyer                        =        '';
$buyer_name                =        '';
$buyer_address        =        '';
$buyer_zipcode        =        '';
$buyer_tel                =        '';
$buyer_mobile        =        '';
$partner                =        '';

$geturl        = new alipay_payto;
$link        = $geturl->geturl
        (
        $cmd,$subject,$body,$order_no,$price,$url,$type,$number,$transport,
        $ordinary_fee,$express_fee,$readonly,$buyer_msg,$seller,$buyer,
        $buyer_name,$buyer_address,$buyer_zipcode,$buyer_tel,$buyer_mobile,$partner,
        $interfaceurl,$payalikey
        );




  
  
} /* End of security check */
?><!-- 支付宝 接口代码 结束 -->
<div align="left">
        <a href="<?php echo $link?>" target="_blank"><img src="<?php echo $imgurl?>" border="0"></a>
</div>

---------------------------------------------------------------------------------------------------------
上面的是/administrator/components/com_virtuemart/html/checkout.thankyou.php  替换这个文件

还有需要支付宝的文件:这个文件上传到/administrator/components/com_virtuemart/html/目录

还有就是支付按钮文件alipay_bwrx.gif,在支付宝论坛有的下:上传到/images/   这个文件你可以换成你喜欢的就可以了

最后创建支付宝支付方式就可以了!

让我们一起感谢hoveryi 老大吧  哈哈哈哈哈

演示:[url]http://www.collegebook.cn/[/url]
            [url]http://www.13hao.com[/url]

lang3 2006-5-11 11:17

多谢 hoveryi 和 13hao ,为大家提供这么好的支付模块!


网银在线的整合代码呢?13hao,hoveryi 老大可是说给你了:lol

VirtueMart 有新版的时候,放入其中。

13hao 2006-5-11 11:46

;P这是老大的原稿  没该过的  网银的也在

genous 2006-5-12 10:11

LANG3。。。

该攻商城拉。。。。

问了偶拿汉化。现在又再弄支付模块。。。呵呵。。。

lang3 2006-5-12 13:07

是呀,打算用 VirtueMart 自建个商店

lzhdm 2006-5-12 14:54

[quote]原帖由 [i]lang3[/i] 于 2006-5-12 13:07 发表
是呀,打算用 VirtueMart 自建个商店 [/quote]
:),卖什么?

leaya 2006-5-15 18:11

如果用joomla+virtuemart的话。应该有人会发生错误。呵

lang3 2006-5-15 21:06

[quote]原帖由 [i]lzhdm[/i] 于 2006-5-12 14:54 发表

:),卖什么? [/quote]

卖虚拟主机和应用服务:lol

lang3 2006-5-15 21:06

[quote]原帖由 [i]leaya[/i] 于 2006-5-15 18:11 发表
如果用joomla+virtuemart的话。应该有人会发生错误。呵 [/quote]

发生什么错误?

leaya 2006-5-16 15:20

[quote]原帖由 [i]lang3[/i] 于 2006-5-15 21:06 发表


发生什么错误? [/quote]

淘宝网不支持UTF编码。所以如果JOOMLA是UTF编码的话。那就会出现按纽创建后,交易被修改的错误提示。

另外。尽可能不要在CHECK.THANKYOU页面上改代码。否则每个交易界面结尾都会出现支付宝的交易接口。

可看我网站的支付效果。已经放上了网银在线和支付宝。
[url]www.qinin.com[/url]

hoveryi 2006-5-16 15:43

嗯,楼上的说的很对,我在上个贴子里面也说过这个问题~

可以在 添加支付方式的那里把相关代码加上去,这样的话,只有选择此种支付方式时才会出现相关的支付按钮。

不过加到最后可以方便购买者在最后更改支付方式,呵呵

23570252 2006-5-18 06:15

QQ留言是那个插件呢

好哦, 13hao 大大

你在 演示:[url]http://www.collegebook.cn/[/url]  的QQ留言是那个插件呢? 能发出来用吗? 谢谢

23570252 2006-5-18 06:20

QQ留言是那个插件呢

好哦, 13hao 大大

你在 演示:[url]http://www.collegebook.cn/[/url]  的QQ留言是那个插件呢? 能发出来用吗? 谢谢

walkerhxg 2006-6-4 12:57

[quote]原帖由 [i]hoveryi[/i] 于 2006-5-16 15:43 发表
嗯,楼上的说的很对,我在上个贴子里面也说过这个问题~

可以在 添加支付方式的那里把相关代码加上去,这样的话,只有选择此种支付方式时才会出现相关的支付按钮。

不过加到最后可以方便购买者在最后更改支 ... [/quote]

[color=Blue][size=2]能否说明一下在 添加支付方式的那里把相关代码加上去时,加的是哪段代码? 如果这样加的话,那个checkout_thankyou文件是不是就不需要做任何改动了哦?[/size][/color]

hoveryi 2006-6-10 10:44

[quote]原帖由 [i]23570252[/i] 于 2006-5-18 06:20 发表
好哦, 13hao 大大

你在 演示:[url]http://www.collegebook.cn/[/url]  的QQ留言是那个插件呢? 能发出来用吗? 谢谢 [/quote]

就是QQ的代码

你打开 collegebook.cn 的主页,看源文件,把关代码给复制下就可以了!

poweb 2006-6-17 15:52

不错

lang3 2006-7-7 13:32

支付过程有点麻烦!

怎么选择银联支付,订单确认后,还要再点击银联或支付宝的按钮,才会转到支付界面?
这样会让人不知所措,以为付不了款,我看其它商城都是直接转到支付界面的 。

另外,还有个问题,就是没有支付的订单,没有提供再次支付的界面。

1062026 2006-8-3 17:45

学会了,3ks

artery 2006-9-15 00:52

测试了一下,其购物过程一流的繁琐!!点到最后已没了购买欲了,还真不如打个电话联系来的快些。
不错的商城,但只上面这一点就让人失去信心了。

liangdi 2006-11-14 12:12

[quote]原帖由 [i]13hao[/i] 于 2006-5-11 10:54 发表
这个是hoveryi 老大的 ,我的就是老大帮弄好的 哈哈

最后创建支付宝支付方式就可以了!

... [/quote]


请问:最后创建支付宝支付方式就可以了! 该如何操作啊?
是“付款方式表单”么?里面的名称和代码怎么填啊?

bunbun 2006-12-19 02:23

[quote]原帖由 [i]liangdi[/i] 于 2006-11-14 12:12 发表
请问:最后创建支付宝支付方式就可以了! 该如何操作啊?
是“付款方式表单”么?里面的名称和代码怎么填啊? [/quote]

期待中!!

brooke501 2008-6-11 17:47

有paypal模块吗?

frankykong 2008-6-12 19:25

hahahahahah. .. 怎么不能下载附件啊???!!!

carolyn_su 2008-7-17 09:24

咨询

virtuemart有没有那个模板可以换啊,紧急,谢谢哦

jony83 2008-9-8 01:24

好强啊
这个源码现在还能用吗?
页: [1]
查看完整版本: VirtueMart 支付宝模块