首页 > 教學 > wordpress > wordpress shopperpress中付款方式程式修改
2012
02-18

wordpress shopperpress中付款方式程式修改

wordpress shopperpress中付款方式程式修改

1.


*/
$gatway[26]['name'] 	= "藍新信用卡刷卡";
$gatway[26]['function'] 	= "tmh_card_01";
$gatway[26]['fields'] 	= array(
							'1' => array(
											'name' => 'Enable Gateway',
											'type' => 'listbox',
											'fieldname' => 'tmh_card_01',
											'list' => array(
												'yes'=>'Enable','no'=>'Disable',
											)
										   ),

							'2' => array(
											'name' => '顯示名稱', 'type' => 'text', 'fieldname' => 'tmh_card_01_name'
										   ),
							'3' => array(
											'name' => '商城編號', 'type' => 'text', 'fieldname' => 'tmh_card_01_Merchantnumber', 'default' => '輸入商城編號'
										   ),
							'4' => array(
											'name' => 'code', 'type' => 'text', 'fieldname' => 'tmh_card_01_code', 'default' => ''
										   ),
							'5' => array(
											'name' => '呼叫程式', 'type' => 'text', 'fieldname' => 'tmh_card_01_gateway','default' => ''
										   ),
							'6' => array(
											'name' => '回傳目錄', 'type' => 'text', 'fieldname' => 'tmh_card_01_return','default' => ''
										   ),
);

$gatway[27]['name'] 	= "藍新虛擬帳號轉帳";
$gatway[27]['function'] 	= "tmh_no_card_01";
$gatway[27]['fields'] 	= array(
							'1' => array(
											'name' => 'Enable Gateway',
											'type' => 'listbox',
											'fieldname' => 'tmh_no_card_01',
											'list' => array(
												'yes'=>'Enable','no'=>'Disable',
											)
										   ),

							'2' => array(
											'name' => '顯示名稱', 'type' => 'text', 'fieldname' => 'tmh_no_card_01_name'
										   ),
							'3' => array(
											'name' => '商城編號', 'type' => 'text', 'fieldname' => 'tmh_no_card_01_Merchantnumber', 'default' => ''
										   ),
							'4' => array(
											'name' => 'code', 'type' => 'text', 'fieldname' => 'tmh_no_card_01_code', 'default' => ''
										   ),
							'5' => array(
											'name' => '商品名稱', 'type' => 'text', 'fieldname' => 'tmh_no_card_01_doc',
										   ),
							'6' => array(
											'name' => '呼叫程式', 'type' => 'text', 'fieldname' => 'tmh_no_card_01_gateway',
										   ),

);

$gatway[28]['name'] 	= "貨到付款";
$gatway[28]['function'] 	= "tmh_other_01";
$gatway[28]['fields'] 	= array(
							'1' => array(
											'name' => 'Enable Gateway',
											'type' => 'listbox',
											'fieldname' => 'tmh_other_01',
											'list' => array(
												'yes'=>'Enable','no'=>'Disable',
											)
										   ),

							'2' => array(
											'name' => '顯示名稱', 'type' => 'text', 'fieldname' => 'tmh_other_01_name'
										   ),

							'3' => array(
											'name' => '呼叫程式', 'type' => 'text', 'fieldname' => 'tmh_other_01_gateway',
										   ),
);

2.上半部程式碼

 

<?php
function tmh_card_01($data=""){
$id=substr($data['orderid'],6,9);

$host=$_SERVER['SERVER_NAME'];
$Merchantnumber=get_option('tmh_card_01_Merchantnumber');
$total=$data['price']['total'];
$tmh_card_01_gateway=get_option('tmh_card_01_gateway');
$code = get_option('tmh_card_01_code');
$tmh_card_01_return = get_option('tmh_card_01_return');

if($tmh_card_01_return!="" && substr($tmh_card_01_return,strlen($tmh_card_01_return)-1,1)!="/" && strlen($tmh_card_01_return)>1)
	$tmh_card_01_return=$tmh_card_01_return."/";
?>

<FORM METHOD="POST" ACTION="tmh_card_01.php" name="tmh_card_01" target="_blank">
<input name="call_url" type="hidden" value="<?=get_option('tmh_card_01_gateway')?>"/>
<input name="Merchantnumber" type="hidden"  value="<?php echo get_option('tmh_card_01_Merchantnumber');?>"/>
<input name="Amount" type="hidden" value="<?php echo $data['price']['total']; ?>" />
 <input type=hidden name="ApproveFlag"    value="1">
<input type=hidden name="DepositFlag"    value="0">
<input type=hidden name="Englishmode"    value="0">
<input name="ordernumber" type="hidden"  value="<?php echo $data['orderid']; ?>"/>
<input type=hidden name="OrderNumber"    value="<?php print $id ?>">
<input type=hidden name="OrderURL"       value="http://<?=$host?>/<?=$tmh_card_01_return?>tmh/card/feedback2.php">
<input type=hidden name="ReturnURL"      value="http://<?=$host?>/<?=$tmh_card_01_return?>tmh/card/receive.php">
<input type=hidden name="checksum"       value="<?php print md5($Merchantnumber.$id.$code.$total) ?>">
<input type=hidden name="op"             value="AcceptPayment">

<p class="CheckoutBtn"><a href="javascript:document.tmh_card_01.submit();"><?php echo SPEC($GLOBALS['_LANG']['_checkout']); ?></a></p>

</form>

<?php } ?>

	<?php
function tmh_no_card_01($data=""){

    $code = get_option('tmh_no_card_01_code');
	$orderid=$data['orderid'];
	$total=$data['price']['total'];;
	$Merchantnumber=get_option('tmh_no_card_01_Merchantnumber');

	$total=substr($total, 0, strlen($total)-3);

     $merchantnumber = $Merchantnumber;
     $ordernumber = $orderid;
     $amount = $total;

     $hash = md5($merchantnumber.$code.$amount.$ordernumber);

	$host=$_SERVER['SERVER_NAME'];

 ?>

<FORM METHOD="POST" ACTION="tmh_no_card_01.php" name="tmh_no_card_01" >
<input name="call_url" type="hidden" value="<?=get_option('tmh_no_card_01_gateway')?>"/>
<input name="ordernumber" type="hidden"  value="<?php echo $data['orderid']; ?>"/>
<input name="merchantnumber" type="hidden"  value="<?=$Merchantnumber?>"/>
<input name="amount" type="hidden" value="<?=$total?>" />
<input type=hidden name="paymenttype"    value="ATM">
<input type=hidden name="bankid"    value="004">
<input type="hidden" name="hash" value="<?php echo $hash ?>">
<input type="hidden" name="nexturl" value="http://<?=$host?>">
<input type="hidden" name="paytitle" value="<?=get_option('tmh_no_card_01_doc')?>">
<p class="CheckoutBtn"><a href="javascript:document.tmh_no_card_01.submit();"><?php echo SPEC($GLOBALS['_LANG']['_checkout']); ?></a></p>

</form>

<?php } ?>

	<?php
function tmh_other_01($data=""){
 ?>

<FORM METHOD="POST" ACTION="tmh_other_01.php" name="tmh_other_01" >
<input name="call_url" type="hidden" value="<?=get_option('tmh_other_01_gateway')?>"/>
<input name="merchantnumber" type="hidden"  value="<?=$Merchantnumber?>"/>
<input name="ordernumber" type="hidden"  value="<?php echo $data['orderid']; ?>"/>
<p class="CheckoutBtn"><a href="javascript:document.tmh_other_01.submit();"><?php echo SPEC($GLOBALS['_LANG']['_checkout']); ?></a></p>

</form>

<?php } ?>

3.下半部程式

同步發表於:wordpress shopperpress中付款方式程式修改
最后编辑:
作者:明和 蔡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。