woocommerce/templates/checkout/review-order.php

305 lines
11 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
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
2011-08-09 15:16:18 +00:00
<table class="shop_table">
<thead>
<tr>
<th class="product-name"><?php _e('Product', 'woocommerce'); ?></th>
<th class="product-quantity"><?php _e('Qty', 'woocommerce'); ?></th>
2012-02-16 16:54:22 +00:00
<th class="product-total"><?php _e('Totals', 'woocommerce'); ?></th>
2011-08-09 15:16:18 +00:00
</tr>
</thead>
<tfoot>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
<tr class="cart-subtotal">
2012-01-05 11:31:22 +00:00
<th colspan="2"><strong><?php _e('Cart Subtotal', 'woocommerce'); ?></strong></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
2011-12-30 21:11:18 +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">
2012-01-05 11:31:22 +00:00
<th colspan="2"><?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
<?php do_action('woocommerce_review_order_before_shipping'); ?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
<tr class="shipping">
2012-01-05 11:31:22 +00:00
<th colspan="2"><?php _e('Shipping', 'woocommerce'); ?></th>
2011-08-09 15:16:18 +00:00
<td>
<?php
// If at least one shipping method is available
if ( $available_methods ) {
2011-12-30 21:11:18 +00:00
// Prepare text labels with price for each shipping method
foreach ( $available_methods as $method ) {
$method->full_label = esc_html( $method->label );
2011-12-30 21:11:18 +00:00
if ( $method->cost > 0 ) {
2012-05-13 20:02:07 +00:00
$method->full_label .= ': ';
2011-12-30 21:11:18 +00:00
// Append price to label using the correct tax settings
if ( $woocommerce->cart->display_totals_ex_tax || ! $woocommerce->cart->prices_include_tax ) {
$method->full_label .= woocommerce_price( $method->cost );
if ( $method->get_shipping_tax() > 0 && $woocommerce->cart->prices_include_tax ) {
$method->full_label .= ' '.$woocommerce->countries->ex_tax_or_vat();
}
} else {
$method->full_label .= woocommerce_price( $method->cost + $method->get_shipping_tax() );
if ( $method->get_shipping_tax() > 0 && ! $woocommerce->cart->prices_include_tax ) {
$method->full_label .= ' '.$woocommerce->countries->inc_tax_or_vat();
}
}
}
}
2011-12-30 21:11:18 +00:00
// Print a single available shipping method as plain text
if ( 1 === count( $available_methods ) ) {
2011-08-09 15:16:18 +00:00
echo $method->full_label;
echo '<input type="hidden" name="shipping_method" id="shipping_method" value="'.esc_attr( $method->id ).'">';
2012-05-13 20:02:07 +00:00
// Show multiple shipping methods
} else {
2012-05-13 20:02:07 +00:00
if ( get_option('woocommerce_shipping_method_format') == 'select' ) {
echo '<select name="shipping_method" id="shipping_method">';
2012-08-14 18:05:45 +00:00
foreach ( $available_methods as $method )
2012-09-07 17:26:13 +00:00
echo '<option value="' . esc_attr( $method->id ) . '" ' . selected( $method->id, $woocommerce->session->chosen_shipping_method, false ) . '>' . strip_tags( $method->full_label ) . '</option>';
2012-05-13 20:02:07 +00:00
echo '</select>';
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
} else {
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
echo '<ul id="shipping_method">';
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
foreach ( $available_methods as $method )
2012-09-07 17:26:13 +00:00
echo '<li><input type="radio" name="shipping_method" id="shipping_method_' . sanitize_title( $method->id ) . '" value="' . esc_attr( $method->id ) . '" ' . checked( $method->id, $woocommerce->session->chosen_shipping_method, false) . ' /> <label for="shipping_method_' . sanitize_title( $method->id ) . '">' . $method->full_label . '</label></li>';
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
echo '</ul>';
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
}
2012-08-14 18:05:45 +00:00
}
// No shipping methods are available
} else {
if ( ! $woocommerce->customer->get_shipping_country() || ! $woocommerce->customer->get_shipping_state() || ! $woocommerce->customer->get_shipping_postcode() ) {
2012-01-05 11:31:22 +00:00
echo '<p>'.__('Please fill in your details above to see available shipping methods.', 'woocommerce').'</p>';
} else {
2012-01-05 11:31:22 +00:00
echo '<p>'.__('Sorry, it seems that there are no available shipping methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce').'</p>';
}
}
2011-08-09 15:16:18 +00:00
?></td>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
</tr>
2012-08-14 18:05:45 +00:00
<?php do_action('woocommerce_review_order_after_shipping'); ?>
2011-08-09 15:16:18 +00:00
<?php endif; ?>
2012-08-14 18:05:45 +00:00
<?php
2011-12-30 21:11:18 +00:00
if ($woocommerce->cart->get_cart_tax()) :
2012-08-14 18:05:45 +00:00
$taxes = $woocommerce->cart->get_formatted_taxes();
2012-08-14 18:05:45 +00:00
if (sizeof($taxes)>0) :
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
$has_compound_tax = false;
2012-08-14 18:05:45 +00:00
foreach ($taxes as $key => $tax) : if ($woocommerce->cart->tax->is_compound( $key )) : $has_compound_tax = true; continue; endif;
2011-12-30 21:11:18 +00:00
?>
<tr class="tax-rate tax-rate-<?php echo $key; ?>">
2012-08-14 18:05:45 +00:00
<th colspan="2"><?php
if ( get_option('woocommerce_prices_include_tax') == 'yes' )
_e('incl.&nbsp;', 'woocommerce');
echo $woocommerce->cart->tax->get_rate_label( $key );
2012-06-29 19:45:09 +00:00
?></th>
<td><?php echo $tax; ?></td>
2011-12-30 21:11:18 +00:00
</tr>
<?php
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
endforeach;
2012-08-14 18:05:45 +00:00
if ($has_compound_tax && !$woocommerce->cart->prices_include_tax) :
2011-12-30 21:11:18 +00:00
?>
<tr class="order-subtotal">
2012-01-05 11:31:22 +00:00
<th colspan="2"><strong><?php _e('Order Subtotal', 'woocommerce'); ?></strong></th>
2011-12-30 21:11:18 +00:00
<td><?php echo $woocommerce->cart->get_cart_subtotal( true ); ?></td>
</tr>
<?php
endif;
2012-08-14 18:05:45 +00:00
foreach ($taxes as $key => $tax) : if (!$woocommerce->cart->tax->is_compound( $key )) continue;
2011-08-09 15:16:18 +00:00
2011-12-30 21:11:18 +00:00
?>
<tr class="tax-rate tax-rate-<?php echo $key; ?>">
2012-08-14 18:05:45 +00:00
<th colspan="2"><?php
if ( get_option('woocommerce_prices_include_tax') == 'yes' )
_e('incl.&nbsp;', 'woocommerce');
echo $woocommerce->cart->tax->get_rate_label( $key );
2012-06-29 19:45:09 +00:00
?></th>
<td><?php echo $tax; ?></td>
2011-12-30 21:11:18 +00:00
</tr>
<?php
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
endforeach;
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
else :
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
?>
<tr class="tax">
<th colspan="2"><?php echo $woocommerce->countries->tax_or_vat(); ?></th>
2011-12-30 21:11:18 +00:00
<td><?php echo $woocommerce->cart->get_cart_tax(); ?></td>
</tr>
<?php
2012-08-14 18:05:45 +00:00
endif;
elseif ( get_option( 'woocommerce_display_cart_taxes_if_zero' ) == 'yes' ) :
?>
<tr class="tax">
<th colspan="2"><?php echo $woocommerce->countries->tax_or_vat(); ?></th>
2012-03-12 16:14:00 +00:00
<td><?php _ex( 'N/A', 'Relating to tax', 'woocommerce' ); ?></td>
</tr>
<?php
2011-12-30 21:11:18 +00:00
endif;
?>
<?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">
2012-01-05 11:31:22 +00:00
<th colspan="2"><?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
2011-12-22 20:30:12 +00:00
<?php do_action('woocommerce_before_order_total'); ?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
<tr class="total">
2012-01-05 11:31:22 +00:00
<th colspan="2"><strong><?php _e('Order Total', 'woocommerce'); ?></strong></th>
<td><strong><?php echo $woocommerce->cart->get_total(); ?></strong></td>
2011-08-09 15:16:18 +00:00
</tr>
2012-08-14 18:05:45 +00:00
2011-12-22 20:30:12 +00:00
<?php do_action('woocommerce_after_order_total'); ?>
2012-08-14 18:05:45 +00:00
2011-08-09 15:16:18 +00:00
</tfoot>
<tbody>
<?php
2012-08-14 18:05:45 +00:00
if (sizeof($woocommerce->cart->get_cart())>0) :
2011-12-30 21:11:18 +00:00
foreach ($woocommerce->cart->get_cart() as $item_id => $values) :
$_product = $values['data'];
if ($_product->exists() && $values['quantity']>0) :
echo '
<tr class = "' . esc_attr( apply_filters('woocommerce_checkout_table_item_class', 'checkout_table_item', $values, $item_id ) ) . '">
2011-12-30 21:11:18 +00:00
<td class="product-name">'.$_product->get_title().$woocommerce->cart->get_item_data( $values ).'</td>
<td class="product-quantity">'.$values['quantity'].'</td>
<td class="product-total">' . apply_filters( 'woocommerce_checkout_item_subtotal', $woocommerce->cart->get_product_subtotal( $_product, $values['quantity'] ), $values, $item_id ) . '</td>
2011-12-30 21:11:18 +00:00
</tr>';
endif;
2012-08-14 18:05:45 +00:00
endforeach;
2011-12-30 21:11:18 +00:00
endif;
2012-02-15 15:39:22 +00:00
do_action( 'woocommerce_cart_contents_review_order' );
2011-08-09 15:16:18 +00:00
?>
</tbody>
</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();
2012-08-14 18:05:45 +00:00
if ($available_gateways) :
2011-08-09 15:16:18 +00:00
// Chosen Method
2011-12-06 16:45:08 +00:00
if (sizeof($available_gateways)) :
$default_gateway = get_option('woocommerce_default_gateway');
2012-09-07 17:26:13 +00:00
if ( isset( $woocommerce->session->chosen_shipping_method ) && isset( $available_gateways[ $woocommerce->session->chosen_shipping_method ] ) ) {
$available_gateways[ $woocommerce->session->chosen_shipping_method ]->set_current();
} elseif ( isset( $available_gateways[ $default_gateway ] ) ) {
$available_gateways[ $default_gateway ]->set_current();
} else {
current( $available_gateways )->set_current();
}
2011-12-06 16:45:08 +00:00
endif;
2011-08-09 15:16:18 +00:00
foreach ($available_gateways as $gateway ) :
?>
<li>
2011-09-19 06:01:26 +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 if ($gateway->chosen) echo 'checked="checked"'; ?> />
2012-08-14 18:05:45 +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() ) :
2011-08-09 15:16:18 +00:00
echo '<div class="payment_box payment_method_'.$gateway->id.'" style="display:none;">';
$gateway->payment_fields();
echo '</div>';
endif;
?>
</li>
<?php
endforeach;
else :
2012-08-14 18:05:45 +00:00
if ( !$woocommerce->customer->get_country() ) :
2012-01-05 11:31:22 +00:00
echo '<p>'.__('Please fill in your details above to see available payment methods.', 'woocommerce').'</p>';
2011-08-09 15:16:18 +00:00
else :
2012-01-05 11:31:22 +00:00
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>';
2011-08-09 15:16:18 +00:00
endif;
2012-08-14 18:05:45 +00:00
2011-08-09 15:16:18 +00:00
endif;
?>
</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-07-16 19:21:44 +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 $woocommerce->nonce_field('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
2012-01-12 00:54:45 +00:00
<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="<?php echo apply_filters('woocommerce_order_button_text', __('Place order', 'woocommerce')); ?>" />
2012-08-14 18:05:45 +00:00
2012-01-06 17:14:31 +00:00
<?php if (woocommerce_get_page_id('terms')>0) : ?>
2011-08-09 15:16:18 +00:00
<p class="form-row terms">
2012-01-06 17:14:31 +00:00
<label for="terms" class="checkbox"><?php _e('I 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>
2011-08-09 15:16:18 +00:00
<input type="checkbox" class="input-checkbox" name="terms" <?php if (isset($_POST['terms'])) echo 'checked="checked"'; ?> id="terms" />
</p>
<?php endif; ?>
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
2011-08-09 15:16:18 +00:00
</div>