woocommerce/templates/checkout/review-order.php

213 lines
8.0 KiB
PHP
Raw Normal View History

<?php
/**
2012-08-14 18:05:45 +00:00
* Review order form
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
2012-08-14 18:05:45 +00:00
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce;
$available_methods = $woocommerce->shipping->get_available_shipping_methods();
?>
2011-08-09 15:16:18 +00:00
<div id="order_review">
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>
<tfoot>
2011-12-30 21:11:18 +00:00
<tr class="cart-subtotal">
<th><?php _e( 'Cart Subtotal', 'woocommerce' ); ?></th>
<td><?php echo $woocommerce->cart->get_cart_subtotal(); ?></td>
2011-08-09 15:16:18 +00:00
</tr>
2012-08-14 18:05:45 +00:00
<?php if ( $woocommerce->cart->get_discounts_before_tax() ) : ?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
<tr class="discount">
<th><?php _e( 'Cart Discount', 'woocommerce' ); ?></th>
2011-11-21 10:38:14 +00:00
<td>-<?php echo $woocommerce->cart->get_discounts_before_tax(); ?></td>
2011-12-30 21:11:18 +00:00
</tr>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
<?php endif; ?>
2012-08-14 18:05:45 +00:00
2012-04-11 12:08:04 +00:00
<?php if ( $woocommerce->cart->needs_shipping() && $woocommerce->cart->show_shipping() ) : ?>
2012-08-14 18:05:45 +00:00
2012-11-09 21:17:48 +00:00
<?php do_action('woocommerce_review_order_before_shipping'); ?>
2012-11-27 16:22:47 +00:00
2012-11-09 21:17:48 +00:00
<tr class="shipping">
2013-05-21 10:23:56 +00:00
<th><?php _e( 'Shipping and Handling', 'woocommerce' ); ?></th>
2012-11-09 21:17:48 +00:00
<td><?php woocommerce_get_template( 'cart/shipping-methods.php', array( 'available_methods' => $available_methods ) ); ?></td>
</tr>
2012-11-27 16:22:47 +00:00
2012-11-09 21:17:48 +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
2012-11-12 17:15:54 +00:00
<?php foreach ( $woocommerce->cart->get_fees() as $fee ) : ?>
2012-11-27 16:22:47 +00:00
2012-11-12 17:15:54 +00:00
<tr class="fee fee-<?php echo $fee->id ?>">
<th><?php echo $fee->name ?></th>
2012-11-27 16:22:47 +00:00
<td><?php
if ( $woocommerce->cart->tax_display_cart == 'excl' )
2012-11-12 17:15:54 +00:00
echo woocommerce_price( $fee->amount );
else
echo woocommerce_price( $fee->amount + $fee->tax );
?></td>
</tr>
2012-11-27 16:22:47 +00:00
2012-11-12 17:15:54 +00:00
<?php endforeach; ?>
2012-08-14 18:05:45 +00:00
<?php
2012-10-12 11:48:06 +00:00
// Show the tax row if showing prices exlcusive of tax only
if ( $woocommerce->cart->tax_display_cart == 'excl' ) {
foreach ( $woocommerce->cart->get_tax_totals() as $code => $tax ) {
echo '<tr class="tax-rate tax-rate-' . $code . '">
<th>' . $tax->label . '</th>
<td>' . $tax->formatted_amount . '</td>
</tr>';
2012-10-12 11:48:06 +00:00
}
}
2011-12-30 21:11:18 +00:00
?>
<?php if ( $woocommerce->cart->get_discounts_after_tax() ) : ?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
<tr class="discount">
<th><?php _e( 'Order Discount', 'woocommerce' ); ?></th>
2011-11-21 10:38:14 +00:00
<td>-<?php echo $woocommerce->cart->get_discounts_after_tax(); ?></td>
2011-12-30 21:11:18 +00:00
</tr>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
<?php endif; ?>
2012-08-14 18:05:45 +00:00
<?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
<tr class="total">
<th><strong><?php _e( 'Order Total', 'woocommerce' ); ?></strong></th>
2012-10-12 11:48:06 +00:00
<td>
<strong><?php echo $woocommerce->cart->get_total(); ?></strong>
<?php
// If prices are tax inclusive, show taxes here
if ( $woocommerce->cart->tax_display_cart == 'incl' ) {
$tax_string_array = array();
foreach ( $woocommerce->cart->get_tax_totals() as $code => $tax ) {
$tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
2012-10-12 11:48:06 +00:00
}
2012-11-27 16:22:47 +00:00
if ( ! empty( $tax_string_array ) ) {
?><small class="includes_tax"><?php printf( __( '(Includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ); ?></small><?php
}
2012-10-12 11:48:06 +00:00
}
?>
</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>
<tbody>
<?php
do_action( 'woocommerce_review_order_before_cart_contents' );
if (sizeof($woocommerce->cart->get_cart())>0) :
2013-03-18 10:17:25 +00:00
foreach ($woocommerce->cart->get_cart() as $cart_item_key => $values) :
$_product = $values['data'];
if ($_product->exists() && $values['quantity']>0) :
echo '
2013-03-18 10:17:25 +00:00
<tr class="' . esc_attr( apply_filters('woocommerce_checkout_table_item_class', 'checkout_table_item', $values, $cart_item_key ) ) . '">
<td class="product-name">' .
apply_filters( 'woocommerce_checkout_product_title', $_product->get_title(), $_product ) . ' ' .
apply_filters( 'woocommerce_checkout_item_quantity', '<strong class="product-quantity">&times; ' . $values['quantity'] . '</strong>', $values, $cart_item_key ) .
$woocommerce->cart->get_item_data( $values ) .
'</td>
<td class="product-total">' . apply_filters( 'woocommerce_checkout_item_subtotal', $woocommerce->cart->get_product_subtotal( $_product, $values['quantity'] ), $values, $cart_item_key ) . '</td>
</tr>';
endif;
endforeach;
endif;
do_action( 'woocommerce_review_order_after_cart_contents' );
?>
</tbody>
2011-08-09 15:16:18 +00:00
</table>
2012-08-14 18:05:45 +00:00
2011-08-09 15:16:18 +00:00
<div id="payment">
<?php if ($woocommerce->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 = $woocommerce->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
2013-01-02 12:59:36 +00:00
if ( isset( $woocommerce->session->chosen_payment_method ) && isset( $available_gateways[ $woocommerce->session->chosen_payment_method ] ) ) {
$available_gateways[ $woocommerce->session->chosen_payment_method ]->set_current();
} 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
?>
<li>
2013-01-02 12:59:36 +00:00
<input type="radio" id="payment_method_<?php echo $gateway->id; ?>" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> />
<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
2013-01-02 12:59:36 +00:00
if ( ! $woocommerce->customer->get_country() )
echo '<p>' . __( 'Please fill in your details above to see available payment methods.', 'woocommerce' ) . '</p>';
else
echo '<p>' . __( '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' ) . '</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
2013-06-11 16:55:55 +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
$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="' . $order_button_text . '" />' );
?>
2012-08-14 18:05:45 +00:00
<?php if ( woocommerce_get_page_id( 'terms' ) > 0 && apply_filters( 'woocommerce_checkout_show_terms', true ) ) { ?>
<p class="form-row terms">
<label for="terms" class="checkbox"><?php _e( 'I have read and accept the', 'woocommerce' ); ?> <a href="<?php echo esc_url( get_permalink(woocommerce_get_page_id('terms')) ); ?>" target="_blank"><?php _e( 'terms &amp; conditions', 'woocommerce' ); ?></a></label>
<input type="checkbox" class="input-checkbox" name="terms" <?php checked( isset( $_POST['terms'] ), 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
</div>