Skip to content

Commit

Permalink
templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Aug 14, 2012
1 parent 5dbab16 commit ef7ec98
Show file tree
Hide file tree
Showing 81 changed files with 1,100 additions and 716 deletions.
6 changes: 3 additions & 3 deletions templates/archive-product.php
Expand Up @@ -4,9 +4,9 @@
*
* Override this template by copying it to yourtheme/woocommerce/archive-product.php
*
* @package WooCommerce
* @since WooCommerce 1.0
* @todo replace loop-shop with a content template and include query/loop here instead.
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/

get_header('shop'); ?>
Expand Down
72 changes: 38 additions & 34 deletions templates/cart/cart.php
@@ -1,8 +1,12 @@
<?php
/**
* Cart Page
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/

global $woocommerce;
?>

Expand All @@ -23,7 +27,7 @@
</thead>
<tbody>
<?php do_action( 'woocommerce_before_cart_contents' ); ?>

<?php
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
Expand All @@ -33,107 +37,107 @@
<tr class = "<?php echo esc_attr( apply_filters('woocommerce_cart_table_item_class', 'cart_table_item', $values, $cart_item_key ) ); ?>">
<!-- Remove from cart link -->
<td class="product-remove">
<?php
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">&times;</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __('Remove this item', 'woocommerce') ), $cart_item_key );
<?php
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">&times;</a>', esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), __('Remove this item', 'woocommerce') ), $cart_item_key );
?>
</td>

<!-- The thumbnail -->
<td class="product-thumbnail">
<?php
<?php
$thumbnail = apply_filters( 'woocommerce_in_cart_product_thumbnail', $_product->get_image(), $values, $cart_item_key );
printf('<a href="%s">%s</a>', esc_url( get_permalink( apply_filters('woocommerce_in_cart_product_id', $values['product_id'] ) ) ), $thumbnail );
printf('<a href="%s">%s</a>', esc_url( get_permalink( apply_filters('woocommerce_in_cart_product_id', $values['product_id'] ) ) ), $thumbnail );
?>
</td>

<!-- Product Name -->
<td class="product-name">
<?php
<?php
if ( ! $_product->is_visible() || ( $_product instanceof WC_Product_Variation && ! $_product->parent_is_visible() ) )
echo apply_filters( 'woocommerce_in_cart_product_title', $_product->get_title(), $values, $cart_item_key );
else
printf('<a href="%s">%s</a>', esc_url( get_permalink( apply_filters('woocommerce_in_cart_product_id', $values['product_id'] ) ) ), apply_filters('woocommerce_in_cart_product_title', $_product->get_title(), $values, $cart_item_key ) );

// Meta data
echo $woocommerce->cart->get_item_data( $values );

// Backorder notification
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $values['quantity'] ) )
echo '<p class="backorder_notification">' . __('Available on backorder', 'woocommerce') . '</p>';
?>
</td>

<!-- Product price -->
<td class="product-price">
<?php
<?php
$product_price = get_option('woocommerce_display_cart_prices_excluding_tax') == 'yes' || $woocommerce->customer->is_vat_exempt() ? $_product->get_price_excluding_tax() : $_product->get_price();
echo apply_filters('woocommerce_cart_item_price_html', woocommerce_price( $product_price ), $values, $cart_item_key );

echo apply_filters('woocommerce_cart_item_price_html', woocommerce_price( $product_price ), $values, $cart_item_key );
?>
</td>

<!-- Quantity inputs -->
<td class="product-quantity">
<?php
<?php
if ( $_product->is_sold_individually() ) {
$product_quantity = '1';
} else {
$data_min = apply_filters( 'woocommerce_cart_item_data_min', '', $_product );
$data_max = ( $_product->backorders_allowed() ) ? '' : $_product->get_stock_quantity();
$data_max = apply_filters( 'woocommerce_cart_item_data_max', $data_max, $_product );
$data_max = apply_filters( 'woocommerce_cart_item_data_max', $data_max, $_product );

$product_quantity = sprintf( '<div class="quantity"><input name="cart[%s][qty]" data-min="%s" data-max="%s" value="%s" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>', $cart_item_key, $data_min, $data_max, esc_attr( $values['quantity'] ) );
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key );

echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key );
?>
</td>

<!-- Product subtotal -->
<td class="product-subtotal">
<?php
echo apply_filters( 'woocommerce_cart_item_subtotal', $woocommerce->cart->get_product_subtotal( $_product, $values['quantity'] ), $values, $cart_item_key );
<?php
echo apply_filters( 'woocommerce_cart_item_subtotal', $woocommerce->cart->get_product_subtotal( $_product, $values['quantity'] ), $values, $cart_item_key );
?>
</td>
</tr>
<?php
}
}
}

do_action( 'woocommerce_cart_contents' );
?>
<tr>
<td colspan="6" class="actions">

<?php if ( get_option( 'woocommerce_enable_coupons' ) == 'yes' && get_option( 'woocommerce_enable_coupon_form_on_cart' ) == 'yes') { ?>
<div class="coupon">

<label for="coupon_code"><?php _e('Coupon', 'woocommerce'); ?>:</label> <input name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'woocommerce'); ?>" />

<?php do_action('woocommerce_cart_coupon'); ?>

</div>
<?php } ?>

<input type="submit" class="button" name="update_cart" value="<?php _e('Update Cart', 'woocommerce'); ?>" /> <a href="<?php echo esc_url( $woocommerce->cart->get_checkout_url() ); ?>" class="checkout-button button alt"><?php _e('Proceed to Checkout &rarr;', 'woocommerce'); ?></a>
<?php do_action('woocommerce_proceed_to_checkout'); ?>

<?php $woocommerce->nonce_field('cart') ?>
</td>
</tr>

<?php do_action( 'woocommerce_after_cart_contents' ); ?>
</tbody>
</table>
<?php do_action( 'woocommerce_after_cart_table' ); ?>
</form>
<div class="cart-collaterals">

<?php do_action('woocommerce_cart_collaterals'); ?>

<?php woocommerce_cart_totals(); ?>

<?php woocommerce_shipping_calculator(); ?>

</div>
22 changes: 13 additions & 9 deletions templates/cart/cross-sells.php
@@ -1,6 +1,10 @@
<?php
/**
* Cross-sells
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/

global $woocommerce_loop, $woocommerce, $product;
Expand All @@ -25,21 +29,21 @@
if ( $products->have_posts() ) : ?>

<div class="cross-sells">

<h2><?php _e('You may be interested in&hellip;', 'woocommerce') ?></h2>

<ul class="products">

<?php while ( $products->have_posts() ) : $products->the_post(); ?>

<?php woocommerce_get_template_part( 'content', 'product' ); ?>

<?php endwhile; // end of the loop. ?>

</ul>

</div>
<?php endif;

<?php endif;

wp_reset_query();
6 changes: 5 additions & 1 deletion templates/cart/empty.php
@@ -1,6 +1,10 @@
<?php
/**
* Empty Cart Page
* Empty cart page
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
?>

Expand Down
52 changes: 28 additions & 24 deletions templates/cart/mini-cart.php
@@ -1,62 +1,66 @@
<?php
/**
* Mini-Cart
* Mini-cart
*
* Contains the markup for the mini-cart, used by the cart widget
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/

global $woocommerce;
?>
<ul class="cart_list product_list_widget <?php echo $args['list_class']; ?>">

<?php if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) : ?>
<?php foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $cart_item ) :

<?php foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $cart_item ) :

$_product = $cart_item['data'];

// Only display if allowed
if ( ! apply_filters('woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) || ! $_product->exists() || $cart_item['quantity'] == 0 )
if ( ! apply_filters('woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) || ! $_product->exists() || $cart_item['quantity'] == 0 )
continue;

// Get price
$product_price = get_option( 'woocommerce_display_cart_prices_excluding_tax' ) == 'yes' || $woocommerce->customer->is_vat_exempt() ? $_product->get_price_excluding_tax() : $_product->get_price();
$product_price = apply_filters( 'woocommerce_cart_item_price_html', woocommerce_price( $product_price ), $cart_item, $cart_item_key );

$product_price = apply_filters( 'woocommerce_cart_item_price_html', woocommerce_price( $product_price ), $cart_item, $cart_item_key );
?>

<li>
<a href="<?php echo get_permalink( $cart_item['product_id'] ); ?>">

<?php echo $_product->get_image(); ?>

<?php echo apply_filters('woocommerce_widget_cart_product_title', $_product->get_title(), $_product ); ?>

</a>

<?php echo $woocommerce->cart->get_item_data( $cart_item ); ?>

<span class="quantity"><?php printf( '%s &times; %s', $cart_item['quantity'], $product_price ); ?></span>
</li>

<?php endforeach; ?>

<?php else : ?>

<li class="empty"><?php _e('No products in the cart.', 'woocommerce'); ?></li>

<?php endif; ?>

</ul><!-- end product list -->

<?php if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) : ?>

<p class="total"><strong><?php _e('Subtotal', 'woocommerce'); ?>:</strong> <?php echo $woocommerce->cart->get_cart_subtotal(); ?></p>

<?php do_action( 'woocommerce_widget_shopping_cart_before_buttons' ); ?>

<p class="buttons">
<a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" class="button"><?php _e('View Cart &rarr;', 'woocommerce'); ?></a>
<a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" class="button"><?php _e('View Cart &rarr;', 'woocommerce'); ?></a>
<a href="<?php echo $woocommerce->cart->get_checkout_url(); ?>" class="button checkout"><?php _e('Checkout &rarr;', 'woocommerce'); ?></a>
</p>

Expand Down
22 changes: 13 additions & 9 deletions templates/cart/shipping-calculator.php
@@ -1,8 +1,12 @@
<?php
/**
* Shipping Calculator
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/

global $woocommerce;

if ( get_option('woocommerce_enable_shipping_calc')=='no' || ! $woocommerce->cart->needs_shipping() ) return;
Expand All @@ -26,18 +30,18 @@
<?php
$current_cc = $woocommerce->customer->get_shipping_country();
$current_r = $woocommerce->customer->get_shipping_state();

$states = $woocommerce->countries->get_states( $current_cc );

if ( is_array( $states ) && empty( $states ) ) {

// Hidden
?>
<input type="hidden" name="calc_shipping_state" id="calc_shipping_state" />
<?php

} elseif ( is_array( $states ) ) {

// Dropdown
?>
<span>
Expand All @@ -47,14 +51,14 @@
?></select>
</span>
<?php

} else {

// Input
?>
<input type="text" class="input-text" value="<?php echo esc_attr( $current_r ); ?>" placeholder="<?php _e('State', 'woocommerce'); ?>" name="calc_shipping_state" id="calc_shipping_state" />
<?php

}
?>
</p>
Expand Down

0 comments on commit ef7ec98

Please sign in to comment.