WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WordPress Shopping Cart: Redirect/Hosted Payment Gateway step 6 | |
// http://tribulant.com/docs/wordpress-shopping-cart-plugin/7190 | |
<?php | |
function process_order($order = null, $user = null, $params = null) { | |
global $wpcoDb, $Order, $Item; | |
$wpcoDb -> model = $Item -> model; | |
$items = $wpcoDb -> find_all(array('order_id' => $order -> id)); | |
// You could use the render() method to output a template file in your extension plugin | |
//$this -> render('views' . DS . 'form', array('order' => $order, 'items' => $items), true, false, 'gateway'); | |
// Alternatively, just output the HTML here | |
$merchantid = $this -> get_option('gateway_merchantid'); // the 'gateway_merchantid' you previously put in your settings | |
$mode = $this -> get_option('gateway_mode'); // the 'gateway_mode' you have in your settings | |
$amount = $order -> total; | |
$currency = $this -> get_option('currency'); | |
$invoice = $order -> id; | |
$email = $order -> bill_email; | |
$tax = $order -> tax; | |
$discount = $order -> discount; | |
?> | |
<form action="<?php echo $action; ?>" method="post" id="gatewayform"> | |
<input type="hidde" name="merchantid" value="<?php echo $merchantid; ?>" /> | |
<input type="hidde" name="mode" value="<?php echo $mode; ?>" /> | |
<input type="hidde" name="amount" value="<?php echo $amount; ?>" /> | |
<input type="hidde" name="currency" value="<?php echo $currency; ?>" /> | |
<input type="hidde" name="invoice" value="<?php echo $invoice; ?>" /> | |
<input type="hidde" name="email" value="<?php echo $email; ?>" /> | |
<input type="hidde" name="tax" value="<?php echo $tax; ?>" /> | |
<input type="hidde" name="discount" value="<?php echo $discount; ?>" /> | |
<p class="submit"> | |
<input class="<?php echo $this -> pre; ?>button" type="button" name="back" value="<?php _e('« Back', $this -> plugin_name); ?>" onclick="history.go(-1);" /> | |
<input class="<?php echo $this -> pre; ?>button" type="submit" name="continue" value="<?php _e('Continue »', $this -> plugin_name); ?>" /> | |
</p> | |
</form> | |
<script type="text/javascript"> | |
jQuery(document).ready(function() { | |
jQuery('#gatewayform').submit(); | |
}); | |
</script> | |
<?php | |
} | |
add_action('wpco_process_order_gateway', 'process_order', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment