woocommerce/templates/checkout/review-order.php

198 lines
8.1 KiB
PHP
Raw Normal View History

<?php
/**
2012-08-14 18:05:45 +00:00
* Review order form
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.8
*/
2012-08-14 18:05:45 +00:00
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<?php if ( ! $is_ajax ) : ?><div id="order_review"><?php endif; ?>
2012-08-14 18:05:45 +00:00
<table class="shop_table">
2011-08-09 15:16:18 +00:00
<thead>
<tr>
2012-10-16 09:45:33 +00:00
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
<th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
2011-08-09 15:16:18 +00:00
</tr>
</thead>
<tbody>
<?php
do_action( 'woocommerce_review_order_before_cart_contents' );
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
?>
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
<td class="product-name">
<?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ); ?>
<?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '&times; %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); ?>
<?php echo WC()->cart->get_item_data( $cart_item ); ?>
</td>
<td class="product-total">
<?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
</td>
</tr>
<?php
}
}
do_action( 'woocommerce_review_order_after_cart_contents' );
?>
</tbody>
2011-08-09 15:16:18 +00:00
<tfoot>
2011-12-30 21:11:18 +00:00
<tr class="cart-subtotal">
<th><?php _e( 'Cart Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
2011-12-30 21:11:18 +00:00
</tr>
2012-08-14 18:05:45 +00:00
<?php foreach ( WC()->cart->get_coupons( 'cart' ) as $code => $coupon ) : ?>
<tr class="cart-discount coupon-<?php echo esc_attr( $code ); ?>">
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
</tr>
<?php endforeach; ?>
2012-08-14 18:05:45 +00:00
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
2012-08-14 18:05:45 +00:00
<?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
2012-11-27 16:22:47 +00:00
<?php wc_cart_totals_shipping_html(); ?>
2012-11-27 16:22:47 +00:00
<?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
2011-08-09 15:16:18 +00:00
<?php endif; ?>
2012-11-27 16:22:47 +00:00
<?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
<tr class="fee">
<th><?php echo esc_html( $fee->name ); ?></th>
<td><?php wc_cart_totals_fee_html( $fee ); ?></td>
2012-11-12 17:15:54 +00:00
</tr>
<?php endforeach; ?>
2012-08-14 18:05:45 +00:00
2014-01-23 04:36:24 +00:00
<?php if ( WC()->cart->tax_display_cart === 'excl' ) : ?>
<?php if ( get_option( 'woocommerce_tax_total_display' ) === 'itemized' ) : ?>
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
<tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
<th><?php echo esc_html( $tax->label ); ?></th>
<td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr class="tax-total">
<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
<td><?php echo wc_price( WC()->cart->get_taxes_total() ); ?></td>
</tr>
<?php endif; ?>
2011-12-30 21:11:18 +00:00
<?php endif; ?>
2012-08-14 18:05:45 +00:00
<?php foreach ( WC()->cart->get_coupons( 'order' ) as $code => $coupon ) : ?>
<tr class="order-discount coupon-<?php echo esc_attr( $code ); ?>">
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
</tr>
<?php endforeach; ?>
<?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
2012-08-14 18:05:45 +00:00
<tr class="order-total">
<th><?php _e( 'Order Total', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_order_total_html(); ?></td>
2011-08-09 15:16:18 +00:00
</tr>
2012-08-14 18:05:45 +00:00
<?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
2011-08-09 15:16:18 +00:00
</tfoot>
</table>
2012-08-14 18:05:45 +00:00
<?php do_action( 'woocommerce_review_order_before_payment' ); ?>
2011-08-09 15:16:18 +00:00
<div id="payment">
2014-01-15 05:53:37 +00:00
<?php if ( WC()->cart->needs_payment() ) : ?>
2011-08-09 15:16:18 +00:00
<ul class="payment_methods methods">
2012-08-14 18:05:45 +00:00
<?php
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
2013-01-02 12:59:36 +00:00
if ( ! empty( $available_gateways ) ) {
2011-08-09 15:16:18 +00:00
// Chosen Method
if ( isset( WC()->session->chosen_payment_method ) && isset( $available_gateways[ WC()->session->chosen_payment_method ] ) ) {
$available_gateways[ WC()->session->chosen_payment_method ]->set_current();
2013-01-02 12:59:36 +00:00
} elseif ( isset( $available_gateways[ get_option( 'woocommerce_default_gateway' ) ] ) ) {
$available_gateways[ get_option( 'woocommerce_default_gateway' ) ]->set_current();
} else {
current( $available_gateways )->set_current();
}
2012-11-27 16:22:47 +00:00
2013-01-02 12:59:36 +00:00
foreach ( $available_gateways as $gateway ) {
2011-08-09 15:16:18 +00:00
?>
2013-10-31 12:01:11 +00:00
<li class="payment_method_<?php echo $gateway->id; ?>">
<input id="payment_method_<?php echo $gateway->id; ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> data-order_button_text="<?php echo esc_attr( $gateway->order_button_text ); ?>" />
2013-01-02 12:59:36 +00:00
<label for="payment_method_<?php echo $gateway->id; ?>"><?php echo $gateway->get_title(); ?> <?php echo $gateway->get_icon(); ?></label>
2011-08-09 15:16:18 +00:00
<?php
2012-08-14 18:05:45 +00:00
if ( $gateway->has_fields() || $gateway->get_description() ) :
2012-12-10 11:06:14 +00:00
echo '<div class="payment_box payment_method_' . $gateway->id . '" ' . ( $gateway->chosen ? '' : 'style="display:none;"' ) . '>';
2011-08-09 15:16:18 +00:00
$gateway->payment_fields();
echo '</div>';
endif;
?>
</li>
<?php
2013-01-02 12:59:36 +00:00
}
} else {
2012-08-14 18:05:45 +00:00
if ( ! WC()->customer->get_country() )
$no_gateways_message = __( 'Please fill in your details above to see available payment methods.', 'woocommerce' );
2013-01-02 12:59:36 +00:00
else
$no_gateways_message = __( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' );
echo '<p>' . apply_filters( 'woocommerce_no_available_payment_methods_message', $no_gateways_message ) . '</p>';
2012-08-14 18:05:45 +00:00
2013-01-02 12:59:36 +00:00
}
2011-08-09 15:16:18 +00:00
?>
</ul>
<?php endif; ?>
2012-06-06 15:48:35 +00:00
<div class="form-row place-order">
2012-08-14 18:05:45 +00:00
2012-10-16 09:45:33 +00:00
<noscript><?php _e( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ); ?><br/><input type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php _e( 'Update totals', 'woocommerce' ); ?>" /></noscript>
2012-08-14 18:05:45 +00:00
<?php wp_nonce_field( 'woocommerce-process_checkout' ); ?>
2012-08-14 18:05:45 +00:00
2011-08-10 17:11:11 +00:00
<?php do_action( 'woocommerce_review_order_before_submit' ); ?>
2012-08-14 18:05:45 +00:00
<?php
2014-01-15 05:53:37 +00:00
$order_button_text = apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) );
2013-04-29 14:51:17 +00:00
echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' );
?>
2012-08-14 18:05:45 +00:00
<?php if ( wc_get_page_id( 'terms' ) > 0 && apply_filters( 'woocommerce_checkout_show_terms', true ) ) {
$terms_is_checked = apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) );
?>
<p class="form-row terms">
<label for="terms" class="checkbox"><?php printf( __( 'I&rsquo;ve read and accept the <a href="%s" target="_blank">terms &amp; conditions</a>', 'woocommerce' ), esc_url( get_permalink( wc_get_page_id( 'terms' ) ) ) ); ?></label>
<input type="checkbox" class="input-checkbox" name="terms" <?php checked( $terms_is_checked, true ); ?> id="terms" />
</p>
<?php } ?>
2012-08-14 18:05:45 +00:00
2011-08-10 17:11:11 +00:00
<?php do_action( 'woocommerce_review_order_after_submit' ); ?>
2012-08-14 18:05:45 +00:00
2011-08-09 15:16:18 +00:00
</div>
2012-08-14 18:05:45 +00:00
2011-11-16 09:38:04 +00:00
<div class="clear"></div>
2011-08-09 15:16:18 +00:00
</div>
2012-08-14 18:05:45 +00:00
<?php do_action( 'woocommerce_review_order_after_payment' ); ?>
<?php if ( ! $is_ajax ) : ?></div><?php endif; ?>