From 2f1eb1e9754dd66c702510ce36e92e8ffdad549f Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 9 Dec 2011 22:44:03 +0000 Subject: [PATCH] Tabs --- .../single-product/add-to-cart/external.php | 6 ++- templates/single-product/tabs/attributes.php | 16 ++++++ templates/single-product/tabs/description.php | 16 ++++++ templates/single-product/tabs/reviews.php | 12 +++++ woocommerce_hooks.php | 3 -- woocommerce_template.php | 52 +++---------------- 6 files changed, 57 insertions(+), 48 deletions(-) create mode 100644 templates/single-product/tabs/attributes.php create mode 100644 templates/single-product/tabs/description.php create mode 100644 templates/single-product/tabs/reviews.php diff --git a/templates/single-product/add-to-cart/external.php b/templates/single-product/add-to-cart/external.php index 578afd18df3..d323f8151eb 100644 --- a/templates/single-product/add-to-cart/external.php +++ b/templates/single-product/add-to-cart/external.php @@ -3,7 +3,11 @@ * External Add to Cart */ -global $woocommerce, $product_url; +global $woocommerce; + +$product_url = get_post_meta( $_product->id, 'product_url', true ); + +if (!$product_url) return; ?> diff --git a/templates/single-product/tabs/attributes.php b/templates/single-product/tabs/attributes.php new file mode 100644 index 00000000000..77f46e3a935 --- /dev/null +++ b/templates/single-product/tabs/attributes.php @@ -0,0 +1,16 @@ + +
+ + + +

+ + list_attributes(); ?> + +
\ No newline at end of file diff --git a/templates/single-product/tabs/description.php b/templates/single-product/tabs/description.php new file mode 100644 index 00000000000..a37b1b33e6b --- /dev/null +++ b/templates/single-product/tabs/description.php @@ -0,0 +1,16 @@ + +
+ + + +

+ + + +
\ No newline at end of file diff --git a/templates/single-product/tabs/reviews.php b/templates/single-product/tabs/reviews.php new file mode 100644 index 00000000000..1f8289cc70a --- /dev/null +++ b/templates/single-product/tabs/reviews.php @@ -0,0 +1,12 @@ + +
+ + + +
\ No newline at end of file diff --git a/woocommerce_hooks.php b/woocommerce_hooks.php index 97a32c9864a..064c551cb39 100644 --- a/woocommerce_hooks.php +++ b/woocommerce_hooks.php @@ -66,9 +66,6 @@ add_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart' add_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30, 2 ); add_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30, 2 ); -/* Product Add to Cart forms */ -add_action( 'woocommerce_add_to_cart_form', 'woocommerce_add_to_cart_form_nonce', 10); - /* Pagination in loop-shop */ add_action( 'woocommerce_pagination', 'woocommerce_pagination', 10 ); add_action( 'woocommerce_pagination', 'woocommerce_catalog_ordering', 20 ); diff --git a/woocommerce_template.php b/woocommerce_template.php index b4c3a0727f2..a6cd63e9823 100644 --- a/woocommerce_template.php +++ b/woocommerce_template.php @@ -14,11 +14,8 @@ **/ if (!function_exists('woocommerce_output_content_wrapper')) { function woocommerce_output_content_wrapper() { - if ( get_option('template') === 'twentyeleven' ) : - echo '
'; - else : - echo '
'; - endif; + $id = ( get_option('template') === 'twentyeleven' ) ? 'primary' : 'container'; + echo '
'; } } if (!function_exists('woocommerce_output_content_wrapper_end')) { @@ -119,7 +116,6 @@ if (!function_exists('woocommerce_check_product_visibility')) { **/ if (!function_exists('woocommerce_show_product_images')) { function woocommerce_show_product_images() { - global $post, $woocommerce; echo '
'; @@ -327,10 +323,7 @@ if (!function_exists('woocommerce_variable_add_to_cart')) { } if (!function_exists('woocommerce_external_add_to_cart')) { function woocommerce_external_add_to_cart( $post, $_product ) { - global $product_url; - - $product_url = get_post_meta( $_product->id, 'product_url', true ); - if ($product_url) woocommerce_get_template('single-product/add-to-cart/external.php', false); + woocommerce_get_template('single-product/add-to-cart/external.php', false); } } @@ -342,17 +335,6 @@ if (!function_exists('woocommerce_quantity_input')) { echo '
'; } } - - -/** - * Product Add to Cart forms - **/ -if (!function_exists('woocommerce_add_to_cart_form_nonce')) { - function woocommerce_add_to_cart_form_nonce() { - global $woocommerce; - $woocommerce->nonce_field('add_to_cart'); - } -} /** * Pagination @@ -388,11 +370,7 @@ if (!function_exists('woocommerce_catalog_ordering')) { 'price' => __('Price', 'woothemes') )); - foreach ($catalog_orderby as $id => $name) : - - echo ''; - - endforeach; + foreach ($catalog_orderby as $id => $name) echo ''; ?> @@ -406,9 +384,7 @@ if (!function_exists('woocommerce_catalog_ordering')) { **/ if (!function_exists('woocommerce_product_description_tab')) { function woocommerce_product_description_tab() { - ?> -
  • -
  • '; - $heading = apply_filters('woocommerce_product_description_heading', __('Product Description', 'woothemes')); - if ($heading) echo '

    ' . $heading . '

    '; - the_content(); - echo '
    '; + woocommerce_get_template('single-product/tabs/description.php', false); } } if (!function_exists('woocommerce_product_attributes_panel')) { function woocommerce_product_attributes_panel() { - global $_product; - echo '
    '; - echo '

    ' . apply_filters('woocommerce_product_additional_information_heading', __('Additional Information', 'woothemes')) . '

    '; - $_product->list_attributes(); - echo '
    '; + woocommerce_get_template('single-product/tabs/attributes.php', false); } } if (!function_exists('woocommerce_product_reviews_panel')) { function woocommerce_product_reviews_panel() { - echo '
    '; - comments_template(); - echo '
    '; + woocommerce_get_template('single-product/tabs/reviews.php', false); } } - - /** * WooCommerce Product Thumbnail **/