2011-08-10 17:11:11 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Thankyou Shortcode
|
|
|
|
*
|
|
|
|
* The thankyou page displays after successful checkout and can be hooked into by payment gateways.
|
|
|
|
*
|
|
|
|
* @package WooCommerce
|
|
|
|
* @category Shortcode
|
|
|
|
* @author WooThemes
|
|
|
|
*/
|
|
|
|
|
|
|
|
function get_woocommerce_thankyou( $atts ) {
|
2011-09-06 11:11:22 +00:00
|
|
|
global $woocommerce;
|
|
|
|
return $woocommerce->shortcode_wrapper('woocommerce_thankyou', $atts);
|
2011-08-10 17:11:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-09-22 19:50:58 +00:00
|
|
|
* Outputs the order received page
|
2011-08-10 17:11:11 +00:00
|
|
|
**/
|
2011-09-22 19:50:58 +00:00
|
|
|
function woocommerce_thankyou( $atts ) {
|
2011-09-06 11:11:22 +00:00
|
|
|
global $woocommerce;
|
2011-08-10 17:11:11 +00:00
|
|
|
|
|
|
|
// Pay for order after checkout step
|
|
|
|
if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0;
|
|
|
|
if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = '';
|
|
|
|
|
2011-08-11 22:39:02 +00:00
|
|
|
// Empty awaiting payment session
|
|
|
|
unset($_SESSION['order_awaiting_payment']);
|
|
|
|
|
2011-08-10 17:11:11 +00:00
|
|
|
if ($order_id > 0) :
|
|
|
|
|
|
|
|
$order = &new woocommerce_order( $order_id );
|
|
|
|
|
|
|
|
if ($order->order_key == $order_key) :
|
2011-09-22 19:50:58 +00:00
|
|
|
|
|
|
|
if (in_array($order->status, array('failed'))) :
|
|
|
|
|
|
|
|
echo '<p>' . __('Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction.', 'woothemes') . '</p>';
|
|
|
|
|
|
|
|
echo '<p>';
|
2011-09-30 08:50:59 +00:00
|
|
|
|
2011-09-22 19:50:58 +00:00
|
|
|
if (is_user_logged_in()) :
|
2011-09-30 08:50:59 +00:00
|
|
|
_e('Please attempt your purchase again or go to your account page.', 'woothemes');
|
|
|
|
else :
|
|
|
|
_e('Please attempt your purchase again.', 'woothemes');
|
2011-09-22 19:50:58 +00:00
|
|
|
endif;
|
|
|
|
|
2011-09-30 08:50:59 +00:00
|
|
|
echo '</p>';
|
2011-09-22 19:50:58 +00:00
|
|
|
|
|
|
|
echo '<a href="'.esc_url( $order->get_checkout_payment_url() ).'" class="button pay">'.__('Pay', 'woothemes').'</a> ';
|
|
|
|
|
|
|
|
if (is_user_logged_in()) :
|
|
|
|
echo '<a href="'.esc_url( get_permalink(get_option('woocommerce_myaccount_page_id')) ).'" class="button pay">'.__('My Account', 'woothemes').'</a>';
|
|
|
|
endif;
|
2011-10-31 00:47:41 +00:00
|
|
|
|
2011-09-22 19:50:58 +00:00
|
|
|
else :
|
|
|
|
|
|
|
|
echo '<p>' . __('Thank you. Your order has been received.', 'woothemes') . '</p>';
|
|
|
|
|
|
|
|
?>
|
|
|
|
<ul class="order_details">
|
|
|
|
<li class="order">
|
|
|
|
<?php _e('Order:', 'woothemes'); ?>
|
|
|
|
<strong># <?php echo $order->id; ?></strong>
|
|
|
|
</li>
|
|
|
|
<li class="date">
|
|
|
|
<?php _e('Date:', 'woothemes'); ?>
|
|
|
|
<strong><?php echo date(get_option('date_format'), strtotime($order->order_date)); ?></strong>
|
|
|
|
</li>
|
|
|
|
<li class="total">
|
|
|
|
<?php _e('Total:', 'woothemes'); ?>
|
|
|
|
<strong><?php echo woocommerce_price($order->order_total); ?></strong>
|
|
|
|
</li>
|
|
|
|
<li class="method">
|
|
|
|
<?php _e('Payment method:', 'woothemes'); ?>
|
|
|
|
<strong><?php
|
2011-12-05 18:16:13 +00:00
|
|
|
echo $order->payment_method_title;
|
2011-09-22 19:50:58 +00:00
|
|
|
?></strong>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<div class="clear"></div>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
endif;
|
2011-08-10 17:11:11 +00:00
|
|
|
|
2011-09-21 15:15:55 +00:00
|
|
|
do_action( 'woocommerce_thankyou_' . $order->payment_method, $order_id );
|
2011-10-31 00:47:41 +00:00
|
|
|
do_action( 'woocommerce_thankyou', $order_id );
|
2011-08-10 17:11:11 +00:00
|
|
|
|
|
|
|
endif;
|
2011-09-22 19:50:58 +00:00
|
|
|
|
|
|
|
else :
|
|
|
|
|
|
|
|
echo '<p>' . __('Thank you. Your order has been received.', 'woothemes') . '</p>';
|
2011-08-10 17:11:11 +00:00
|
|
|
|
|
|
|
endif;
|
|
|
|
|
|
|
|
}
|