Checkout error page

This commit is contained in:
Mike Jolley 2012-02-12 11:36:33 +00:00
parent 1c6b6ac1dd
commit 9cf264504b
4 changed files with 35 additions and 4 deletions

View File

@ -21,6 +21,7 @@ class WC_Checkout {
function __construct () {
global $woocommerce;
add_action('woocommerce_checkout_process',array(&$this,'checkout_process'));
add_action('woocommerce_checkout_billing',array(&$this,'checkout_form_billing'));
add_action('woocommerce_checkout_shipping',array(&$this,'checkout_form_shipping'));
@ -60,6 +61,12 @@ class WC_Checkout {
$this->checkout_fields = apply_filters('woocommerce_checkout_fields', $this->checkout_fields);
}
/** Checkout process */
function checkout_process() {
// When we process the checkout, lets ensure cart items are rechecked to prevent checkout
do_action('woocommerce_check_cart_items');
}
/** Output the billing information form */
function checkout_form_billing() {
woocommerce_get_template( 'checkout/form-billing.php', array( 'checkout' => $this ) );

View File

@ -87,6 +87,8 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* Classes added to my-account
* Fix for price filtering when the shop is the homepage
* Renamed orderby GET variable to 'sort' to prevent conflicts with permalinks
* Fixed a bug allowing checkout when items are out of stock
* Added a cart item error page for checkout, if the items are invalid
= 1.4.2 - 09/02/2012 =
* Uninstall fix

View File

@ -21,11 +21,20 @@ function woocommerce_checkout( $atts ) {
if (sizeof($woocommerce->cart->get_cart())==0) return;
$non_js_checkout = (isset($_POST['woocommerce_checkout_update_totals']) && $_POST['woocommerce_checkout_update_totals']) ? true : false;
do_action('woocommerce_check_cart_items');
if ( $woocommerce->error_count()>0 ) {
woocommerce_get_template('checkout/cart-errors.php');
} else {
$non_js_checkout = (isset($_POST['woocommerce_checkout_update_totals']) && $_POST['woocommerce_checkout_update_totals']) ? true : false;
if ( $woocommerce->error_count()==0 && $non_js_checkout) $woocommerce->add_message( __('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'woocommerce') );
woocommerce_get_template('checkout/form-checkout.php');
}
}

View File

@ -0,0 +1,13 @@
<?php
/**
* Cart errors page
*/
?>
<?php $woocommerce->show_messages(); ?>
<p><?php _e('There are some issues with the items in your cart (shown above). Please go back to the cart page and resolve these issues before checking out.', 'woocommerce') ?></p>
<?php do_action('woocommerce_cart_has_errors'); ?>
<p><a class="button" href="<?php echo get_permalink(woocommerce_get_page_id('cart')); ?>"><?php _e('&larr; Return To Cart', 'woocommerce') ?></a></p>