added woocommerce to theme
authorIan Weller <ian@gaslightmedia.com>
Tue, 9 Aug 2016 13:10:54 +0000 (09:10 -0400)
committerIan Weller <ian@gaslightmedia.com>
Tue, 9 Aug 2016 13:10:54 +0000 (09:10 -0400)
12 files changed:
functions.php
woocommerce.php [new file with mode: 0644]
woocommerce/archive-product.php [new file with mode: 0644]
woocommerce/content-product.php [new file with mode: 0644]
woocommerce/content-product_cat.php [new file with mode: 0644]
woocommerce/content-single-product.php [new file with mode: 0644]
woocommerce/loop/price.php [new file with mode: 0644]
woocommerce/single-product.php [new file with mode: 0644]
woocommerce/single-product/add-to-cart/simple.php [new file with mode: 0644]
woocommerce/single-product/add-to-cart/variable.php [new file with mode: 0644]
woocommerce/single-product/add-to-cart/variation-add-to-cart-button.php [new file with mode: 0644]
woocommerce/single-product/price.php [new file with mode: 0644]

index 6106c1e..7a5e16d 100644 (file)
@@ -114,6 +114,120 @@ function glm_site_scripts()
 
 }
 
+/* Woocommerce */
+
+function get_product_category_by_id($cat_id) 
+{
+$category = get_term_by('id', $cat_id, 'product_cat', 'OBJECT');
+return $category; 
+}
+add_filter( 'woocommerce_variation_option_name', 'display_price_in_variation_option_name' );
+
+function display_price_in_variation_option_name( $term ) {
+    global $wpdb, $product;
+
+    if ( empty( $term ) ) return $term;
+    if ( empty( $product->id ) ) return $term;
+
+    $result = $wpdb->get_col( "SELECT slug FROM {$wpdb->prefix}terms WHERE name = '$term'" );
+
+    $term_slug = ( !empty( $result ) ) ? $result[0] : $term;
+
+    $query = "SELECT postmeta.post_id AS product_id
+                FROM {$wpdb->prefix}postmeta AS postmeta
+                    LEFT JOIN {$wpdb->prefix}posts AS products ON ( products.ID = postmeta.post_id )
+                WHERE postmeta.meta_key LIKE 'attribute_%'
+                    AND postmeta.meta_value = '$term_slug'
+                    AND products.post_parent = $product->id";
+
+    $variation_id = $wpdb->get_col( $query );
+
+    $parent = wp_get_post_parent_id( $variation_id[0] );
+
+    if ( $parent > 0 ) {
+         $_product = new WC_Product_Variation( $variation_id[0] );
+         return $term . ' (' . wp_kses( woocommerce_price( $_product->get_price() ), array() ) . ')';
+    }
+    return $term;
+
+}
+remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
+add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_single_add_to_cart', 10 );
+remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 10 );
+add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 30 );
+
+remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_single_price', 40 );
+remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_single_price', 40 );
+add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_single_price', 10 );
+
+//addfilter('woocommercevariationpricehtml', 'myfunction', $product, 2);
+//
+//function myfunction($price, $product) {
+//
+//$price = getpostmeta( $product->variationid, 'regular_price');
+//// perform calculation on $price.
+//return $price;
+//}
+//remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
+//add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 20 );
+
+// Change number of thumbnails per row to 4
+add_filter ( 'woocommerce_product_thumbnails_columns', 'four_thumb_cols' );
+ function four_thumb_cols() {
+    return 4; // .last class applied to every 4th thumbnail
+ }
+// Change number or products per row to 3
+add_filter('loop_shop_columns', 'loop_columns',999);
+function loop_columns() {
+    return 3; // 3 products per row
+}
+// Add WooCommerce excerpt to the item title on shop page
+add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);
+
+// Declare WooCommerce support
+add_action( 'after_setup_theme', 'woocommerce_support' );
+function woocommerce_support() {
+    add_theme_support( 'woocommerce' );
+}
+// WooCommerce number of products shown
+add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );
+
+// Display Price For Variable Product With Same Variations Prices
+add_filter('woocommerce_available_variation', function ($value, $object = null, $variation = null) {
+    if ($value['price_html'] == '') {
+        $value['price_html'] = '<span class="price">' . $variation->get_price_html() . '</span>';
+    }
+    return $value;
+}, 10, 3);
+
+add_filter( 'woocommerce_product_tabs', 'woo_product_tab_edits' );
+function woo_product_tab_edits( $tabs ) {
+        // to always have the WooCommerce product inquiry tab display
+       $tabs['product_inquiry_tab'] = array(
+               'title'         => __( 'Product Inquiry', 'woocommerce' ),
+               'priority'      => 50,
+               'callback'      => 'woo_product_inquiry_content'
+       );
+        // Rename Tab to Product Data
+       $tabs['additional_information']['title'] = __( 'More Info' );   // Rename the additional information tab
+
+       return $tabs;
+}
+
+function woo_product_inquiry_content() {
+    global $product;
+    echo do_shortcode('[gravityform id="2" title="true" description="true]');
+}
+add_filter( 'gform_field_value_product_name', 'gform_add_product_name_field' );
+function gform_add_product_name_field( $value ) {
+    global $product;
+    return $product->get_title();
+}
+add_filter( 'gform_field_value_product_sku', 'gform_add_product_sku_field' );
+function gform_add_product_sku_field( $value ) {
+    global $product;
+    return ( $sku = $product->get_sku() ) ? $sku : __( '(not set)', 'woocommerce' );
+}
 
 /* Header for posts*/
 function glm_get_header() {
diff --git a/woocommerce.php b/woocommerce.php
new file mode 100644 (file)
index 0000000..aaf913f
--- /dev/null
@@ -0,0 +1,164 @@
+<?php get_header(); ?>
+<main class="page-inside woocommerce">
+    
+    <div id="content-wrapper" class='side-shadow woocommerce-wrapper'>
+        <div class="row">
+            <div class="large-3 columns show-for-large-up">
+                <?php get_sidebar(); ?>
+            </div>
+            <?php if (is_shop()) { ?>
+                <div class="small-12 large-9 columns main woo-tags">
+  
+                <?php
+                        /**
+                         * woocommerce_before_main_content hook
+                         *
+                         * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
+                         * @hooked woocommerce_breadcrumb - 20
+                         */
+                        do_action( 'woocommerce_before_main_content' );
+                ?>
+
+               <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
+
+               <?php endif; ?>
+                        
+                        <?php woocommerce_content();?> 
+
+               <?php do_action( 'woocommerce_archive_description' ); ?>
+
+                <?php
+                        /**
+                         * woocommerce_after_main_content hook
+                         *
+                         * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
+                         */
+                        do_action( 'woocommerce_after_main_content' );
+                ?>
+                </div>
+            <?php } if (is_product_tag() || is_product_category()) { ?>
+                <div class="small-12 large-9 columns main woo-tags">
+  
+                <?php
+                        /**
+                         * woocommerce_before_main_content hook
+                         *
+                         * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
+                         * @hooked woocommerce_breadcrumb - 20
+                         */
+                        do_action( 'woocommerce_before_main_content' );
+                ?>
+
+               <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
+
+                       <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
+
+               <?php endif; ?>
+
+               <?php do_action( 'woocommerce_archive_description' ); ?>
+
+               <?php if ( have_posts() ) : ?>
+
+                       <?php
+                               /**
+                                * woocommerce_before_shop_loop hook
+                                *
+                                * @hooked woocommerce_result_count - 20
+                                * @hooked woocommerce_catalog_ordering - 30
+                                */
+                               do_action( 'woocommerce_before_shop_loop' );
+                       ?>
+
+                       <?php woocommerce_product_loop_start(); ?>
+
+                               <?php woocommerce_product_subcategories(); ?>
+
+                               <?php while ( have_posts() ) : the_post(); ?>
+
+                                       <?php wc_get_template_part( 'content', 'product' ); ?>
+
+                               <?php endwhile; // end of the loop. ?>
+
+                       <?php woocommerce_product_loop_end(); ?>
+
+                       <?php
+                               /**
+                                * woocommerce_after_shop_loop hook
+                                *
+                                * @hooked woocommerce_pagination - 10
+                                */
+                               do_action( 'woocommerce_after_shop_loop' );
+                       ?>
+
+               <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
+
+                       <?php wc_get_template( 'loop/no-products-found.php' ); ?>
+
+               <?php endif; ?>
+
+                <?php
+                        /**
+                         * woocommerce_after_main_content hook
+                         *
+                         * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
+                         */
+                        do_action( 'woocommerce_after_main_content' );
+                ?>
+                </div>
+            <?php } else if (is_product()) { ?>
+                <div class="small-12 large-9 columns main woo-single-product">
+                    <?php 
+                        echo '<span class="st_sharethis" st_title="'. get_the_title().'" st_url="'. get_the_permalink() .'"></span>';       
+                        if(function_exists('pf_show_link')){echo pf_show_link();} 
+                    ?>
+                    <?php
+                            /**
+                             * woocommerce_before_main_content hook
+                             *
+                             * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
+                             * @hooked woocommerce_breadcrumb - 20
+                             */
+                            do_action( 'woocommerce_before_main_content' );
+                    ?>
+
+                            <?php while ( have_posts() ) : the_post(); ?>
+
+                                    <?php wc_get_template_part( 'content', 'single-product' ); ?>
+
+                            <?php endwhile; // end of the loop. ?>
+
+                    <?php
+                            /**
+                             * woocommerce_after_main_content hook
+                             *
+                             * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
+                             */
+                            do_action( 'woocommerce_after_main_content' );
+                    ?>
+                </div>
+            <?php } ?>
+        </div>
+    </div>
+    <div id="wooImageHoverContainer">
+        <img>
+    </div>
+<?php get_footer(); ?>
+<script>
+    
+$(document).ready(function () {
+    $("#tab-html5_video p").remove();
+    var mainImage = $(".attachment-shop_single.size-shop_single.wp-post-image");
+    var thumbImage =  $(".attachment-shop_thumbnail.size-shop_thumbnail");
+    $(".attachment-shop_thumbnail").parent().css("text-align","center");
+    $(".woocommerce-placeholder").parent().css("text-align","center");
+    $(thumbImage).mouseover(function(){
+        $(mainImage).attr("srcset", $(this).attr("src"));
+    });
+
+    // Thumbnail undisplay
+    $(thumbImage).mouseout(function(){
+        $(mainImage).attr("srcset", $(mainImage).attr("src"));
+    }); 
+    
+});
+</script>
\ No newline at end of file
diff --git a/woocommerce/archive-product.php b/woocommerce/archive-product.php
new file mode 100644 (file)
index 0000000..c4eb131
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/**
+ * The Template for displaying product archives, including the main shop page which is a post type archive
+ *
+ * This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
+ *
+ * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
+ * will need to copy the new files to your theme to maintain compatibility. We try to do this.
+ * as little as possible, but it does happen. When this occurs the version of the template file will.
+ * be bumped and the readme will list any important changes.
+ *
+ * @see            http://docs.woothemes.com/document/template-structure/
+ * @author             WooThemes
+ * @package    WooCommerce/Templates
+ * @version     2.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+get_header( 'shop' ); ?>
+
+       <?php
+               /**
+                * woocommerce_before_main_content hook.
+                *
+                * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
+                * @hooked woocommerce_breadcrumb - 20
+                */
+               do_action( 'woocommerce_before_main_content' );
+       ?>
+
+               <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
+
+                       <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
+
+               <?php endif; ?>
+
+               <?php
+                       /**
+                        * woocommerce_archive_description hook.
+                        *
+                        * @hooked woocommerce_taxonomy_archive_description - 10
+                        * @hooked woocommerce_product_archive_description - 10
+                        */
+                       do_action( 'woocommerce_archive_description' );
+               ?>
+
+               <?php if ( have_posts() ) : ?>
+
+                       <?php
+                               /**
+                                * woocommerce_before_shop_loop hook.
+                                *
+                                * @hooked woocommerce_result_count - 20
+                                * @hooked woocommerce_catalog_ordering - 30
+                                */
+                               do_action( 'woocommerce_before_shop_loop' );
+                       ?>
+
+                       <?php woocommerce_product_loop_start(); ?>
+
+                               <?php woocommerce_product_subcategories(); ?>
+
+                               <?php while ( have_posts() ) : the_post(); ?>
+
+                                       <?php wc_get_template_part( 'content', 'product' ); ?>
+
+                               <?php endwhile; // end of the loop. ?>
+
+                       <?php woocommerce_product_loop_end(); ?>
+
+                       <?php
+                               /**
+                                * woocommerce_after_shop_loop hook.
+                                *
+                                * @hooked woocommerce_pagination - 10
+                                */
+                               do_action( 'woocommerce_after_shop_loop' );
+                       ?>
+
+               <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
+
+                       <?php wc_get_template( 'loop/no-products-found.php' ); ?>
+
+               <?php endif; ?>
+
+       <?php
+               /**
+                * woocommerce_after_main_content hook.
+                *
+                * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
+                */
+               do_action( 'woocommerce_after_main_content' );
+       ?>
+
+       <?php
+               /**
+                * woocommerce_sidebar hook.
+                *
+                * @hooked woocommerce_get_sidebar - 10
+                */
+               do_action( 'woocommerce_sidebar' );
+       ?>
+
+<?php get_footer( 'shop' ); ?>
diff --git a/woocommerce/content-product.php b/woocommerce/content-product.php
new file mode 100644 (file)
index 0000000..7c18d65
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+/**
+ * The template for displaying product content within loops
+ *
+ * This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
+ *
+ * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
+ * will need to copy the new files to your theme to maintain compatibility. We try to do this.
+ * as little as possible, but it does happen. When this occurs the version of the template file will.
+ * be bumped and the readme will list any important changes.
+ *
+ * @see     http://docs.woothemes.com/document/template-structure/
+ * @author  WooThemes
+ * @package WooCommerce/Templates
+ * @version 2.5.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+global $product, $woocommerce_loop;
+
+// Store loop count we're currently on
+if ( empty( $woocommerce_loop['loop'] ) ) {
+       $woocommerce_loop['loop'] = 0;
+}
+
+// Store column count for displaying the grid
+if ( empty( $woocommerce_loop['columns'] ) ) {
+       $woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 3 );
+}
+
+// Ensure visibility
+if ( ! $product || ! $product->is_visible() ) {
+       return;
+}
+
+// Increase loop count
+$woocommerce_loop['loop']++;
+
+// Extra post classes
+$classes = array();
+if ( 0 === ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 === $woocommerce_loop['columns'] ) {
+       $classes[] = 'first';
+}
+if ( 0 === $woocommerce_loop['loop'] % $woocommerce_loop['columns'] ) {
+       $classes[] = 'last';
+}
+?>
+<?php if (!is_product()) { ?>
+<li <?php post_class( $classes ); ?>>
+    <div class="row collapse">
+        <div class="small-12 large-5 column product-list-link-wrapper">
+            <a class="product-list-link" href="<?php the_permalink(); ?>">
+            <?php echo $product->get_image(); ?>
+            </a>
+        </div>
+        <div class="small-12 large-7 columns product-list-info-wrapper">
+            <div class="row">
+                <?php echo woocommerce_template_loop_product_link_open(); ?>
+                <?php do_action( 'woocommerce_shop_loop_item_title' ); ?>
+                <?php echo woocommerce_template_loop_product_link_close(); ?>
+                    <?php do_action( 'woocommerce_after_shop_loop_item_title' );?>
+                    </div>
+                        <a class="more" href="<?php the_permalink(); ?>">More Info...</a>
+
+            <div class="row">
+                <div class="row">
+                   <?php  /**
+                     * woocommerce_after_shop_loop_item hook.
+                     *
+                     * @hooked woocommerce_template_loop_product_link_close - 5
+                     * @hooked woocommerce_template_loop_add_to_cart - 10
+                     */
+                    do_action( 'woocommerce_after_shop_loop_item' );?>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</li>
+<?php } else { ?>
+<li <?php post_class( $classes ); ?>>
+       <?php
+       /**
+        * woocommerce_before_shop_loop_item hook.
+        *
+        * @hooked woocommerce_template_loop_product_link_open - 10
+        */
+       do_action( 'woocommerce_before_shop_loop_item' );
+
+       /**
+        * woocommerce_before_shop_loop_item_title hook.
+        *
+        * @hooked woocommerce_show_product_loop_sale_flash - 10
+        * @hooked woocommerce_template_loop_product_thumbnail - 10
+        */
+       do_action( 'woocommerce_before_shop_loop_item_title' );
+
+       /**
+        * woocommerce_shop_loop_item_title hook.
+        *
+        * @hooked woocommerce_template_loop_product_title - 10
+        */
+       do_action( 'woocommerce_shop_loop_item_title' );
+
+       /**
+        * woocommerce_after_shop_loop_item_title hook.
+        *
+        * @hooked woocommerce_template_loop_rating - 5
+        * @hooked woocommerce_template_loop_price - 10
+        */
+       do_action( 'woocommerce_after_shop_loop_item_title' );
+
+       /**
+        * woocommerce_after_shop_loop_item hook.
+        *
+        * @hooked woocommerce_template_loop_product_link_close - 5
+        * @hooked woocommerce_template_loop_add_to_cart - 10
+        */
+       do_action( 'woocommerce_after_shop_loop_item' );
+       ?>
+
+</li>
+
+
+<?php } ?>
+
diff --git a/woocommerce/content-product_cat.php b/woocommerce/content-product_cat.php
new file mode 100644 (file)
index 0000000..09595c9
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * The template for displaying product category thumbnails within loops.
+ *
+ * Override this template by copying it to yourtheme/woocommerce/content-product_cat.php
+ *
+ * @author             WooThemes
+ * @package    WooCommerce/Templates
+ * @version     2.5.2
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+global $woocommerce_loop;
+
+
+/* 
+ *     Exclude certain categories - Chuck Scott - 5/28/15
+ *     Enter the slug of a category to exclude in the 
+ &     $excludeCats array below.
+*/
+$excludeCats = array(
+       ''
+);
+if ( is_shop() && in_array( $category->slug, $excludeCats ) ) {
+       return;
+}
+
+
+// Store loop count we're currently on
+if ( empty( $woocommerce_loop['loop'] ) ) {
+       $woocommerce_loop['loop'] = 0;
+}
+
+// Store column count for displaying the grid
+if ( empty( $woocommerce_loop['columns'] ) ) {
+       $woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 3 );
+}
+
+// Increase loop count
+$woocommerce_loop['loop']++;
+?>
+
+
+<?php if ( $category->count > 0 ) { ?>
+<li class="product-category product<?php
+    if ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1 )
+        echo ' first';
+       if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
+               echo ' last';
+       ?>">
+
+       <?php do_action( 'woocommerce_before_subcategory', $category ); ?>
+        <div class="products-image-container">
+        <?php
+                /**
+                 * woocommerce_before_subcategory_title hook
+                 *
+                 * @hooked woocommerce_subcategory_thumbnail - 10
+                 */
+                do_action( 'woocommerce_before_subcategory_title', $category );
+        ?>
+        </div>    
+        <h3>
+                <?php
+                        echo $category->name;
+                ?>
+        </h3>
+
+        <?php
+                /**
+                 * woocommerce_after_subcategory_title hook
+                 */
+                do_action( 'woocommerce_after_subcategory_title', $category );
+        ?>
+
+       <?php do_action( 'woocommerce_after_subcategory', $category ); ?>
+
+</li>
+<?php } ?>
diff --git a/woocommerce/content-single-product.php b/woocommerce/content-single-product.php
new file mode 100644 (file)
index 0000000..cf94b16
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/**
+ * The template for displaying product content in the single-product.php template
+ *
+ * This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php.
+ *
+ * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
+ * will need to copy the new files to your theme to maintain compatibility. We try to do this.
+ * as little as possible, but it does happen. When this occurs the version of the template file will.
+ * be bumped and the readme will list any important changes.
+ *
+ * @see            http://docs.woothemes.com/document/template-structure/
+ * @author             WooThemes
+ * @package    WooCommerce/Templates
+ * @version     1.6.4
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+?>
+
+<?php
+       /**
+        * woocommerce_before_single_product hook.
+        *
+        * @hooked wc_print_notices - 10
+        */
+        do_action( 'woocommerce_before_single_product' );
+
+        if ( post_password_required() ) {
+               echo get_the_password_form();
+               return;
+        }
+?>
+
+<div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php post_class(); ?>>
+
+       <?php
+               /**
+                * woocommerce_before_single_product_summary hook.
+                *
+                * @hooked woocommerce_show_product_sale_flash - 10
+                * @hooked woocommerce_show_product_images - 20
+                */
+               do_action( 'woocommerce_before_single_product_summary' );
+       ?>
+
+       <div class="summary entry-summary">
+
+               <?php
+                       /**
+                        * woocommerce_single_product_summary hook.
+                        *
+                        * @hooked woocommerce_template_single_title - 5
+                        * @hooked woocommerce_template_single_rating - 10
+                        * @hooked woocommerce_template_single_price - 10
+                        * @hooked woocommerce_template_single_excerpt - 20
+                        * @hooked woocommerce_template_single_add_to_cart - 30
+                        * @hooked woocommerce_template_single_meta - 40
+                        * @hooked woocommerce_template_single_sharing - 50
+                        */
+                       do_action( 'woocommerce_single_product_summary' );
+               ?>
+
+       </div><!-- .summary -->
+
+       <?php
+               /**
+                * woocommerce_after_single_product_summary hook.
+                *
+                * @hooked woocommerce_output_product_data_tabs - 10
+                * @hooked woocommerce_upsell_display - 15
+                * @hooked woocommerce_output_related_products - 20
+                */
+               do_action( 'woocommerce_after_single_product_summary' );
+       ?>
+
+       <meta itemprop="url" content="<?php the_permalink(); ?>" />
+
+</div><!-- #product-<?php the_ID(); ?> -->
+
+<?php do_action( 'woocommerce_after_single_product' ); ?>
diff --git a/woocommerce/loop/price.php b/woocommerce/loop/price.php
new file mode 100644 (file)
index 0000000..dae22a4
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Loop Price
+ *
+ * This template can be overridden by copying it to yourtheme/woocommerce/loop/price.php.
+ *
+ * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
+ * will need to copy the new files to your theme to maintain compatibility. We try to do this.
+ * as little as possible, but it does happen. When this occurs the version of the template file will.
+ * be bumped and the readme will list any important changes.
+ *
+ * @see            http://docs.woothemes.com/document/template-structure/
+ * @author             WooThemes
+ * @package    WooCommerce/Templates
+ * @version     1.6.4
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+global $product;
+?>
+
+<?php if ( $price_html = $product->get_price_html() ) : ?>
+<!--   <span class="price"><?php // echo $price_html; ?></span>-->
+<?php endif; ?>
diff --git a/woocommerce/single-product.php b/woocommerce/single-product.php
new file mode 100644 (file)
index 0000000..f0ad7ca
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/**
+ * The Template for displaying all single products
+ *
+ * This template can be overridden by copying it to yourtheme/woocommerce/single-product.php.
+ *
+ * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
+ * will need to copy the new files to your theme to maintain compatibility. We try to do this.
+ * as little as possible, but it does happen. When this occurs the version of the template file will.
+ * be bumped and the readme will list any important changes.
+ *
+ * @see            http://docs.woothemes.com/document/template-structure/
+ * @author             WooThemes
+ * @package    WooCommerce/Templates
+ * @version     1.6.4
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+get_header( 'shop' ); ?>
+
+       <?php
+               /**
+                * woocommerce_before_main_content hook.
+                *
+                * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
+                * @hooked woocommerce_breadcrumb - 20
+                */
+               do_action( 'woocommerce_before_main_content' );
+       ?>
+
+               <?php while ( have_posts() ) : the_post(); ?>
+
+                       <?php wc_get_template_part( 'content', 'single-product' ); ?>
+
+               <?php endwhile; // end of the loop. ?>
+
+       <?php
+               /**
+                * woocommerce_after_main_content hook.
+                *
+                * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
+                */
+               do_action( 'woocommerce_after_main_content' );
+       ?>
+
+       <?php
+               /**
+                * woocommerce_sidebar hook.
+                *
+                * @hooked woocommerce_get_sidebar - 10
+                */
+               do_action( 'woocommerce_sidebar' );
+       ?>
+
+
+<?php get_footer( 'shop' ); ?>
diff --git a/woocommerce/single-product/add-to-cart/simple.php b/woocommerce/single-product/add-to-cart/simple.php
new file mode 100644 (file)
index 0000000..d824598
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Simple product add to cart
+ *
+ * This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/simple.php.
+ *
+ * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
+ * will need to copy the new files to your theme to maintain compatibility. We try to do this.
+ * as little as possible, but it does happen. When this occurs the version of the template file will.
+ * be bumped and the readme will list any important changes.
+ *
+ * @see            http://docs.woothemes.com/document/template-structure/
+ * @author             WooThemes
+ * @package    WooCommerce/Templates
+ * @version     2.1.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+global $product;
+
+if ( ! $product->is_purchasable() ) {
+    return;
+}
+
+?>
+
+<?php
+       // Availability
+    $availability      = $product->get_availability();
+    $availability_html = empty( $availability['availability'] ) ? '' : '<p class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</p>';
+
+    echo apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product );
+?>
+
+<?php if ( $product->is_in_stock() ) : ?>
+
+    <?php do_action( 'woocommerce_before_add_to_cart_form' ); ?>
+
+    <form class="cart" method="post" enctype='multipart/form-data'>
+        <?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
+        <div class="woo-qty-wrapper">
+        <?php
+            if ( ! $product->is_sold_individually() ) {
+                ?><span class="cart-qty-label">Qty:</span><?php
+                woocommerce_quantity_input( array(
+                    'min_value'   => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
+                    'max_value'   => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product ),
+                    'input_value' => ( 1 )
+                ) );
+            }
+
+        ?>
+        </div>
+        <input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $product->id ); ?>" />
+
+        <button type="submit" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
+
+    </form>
+
+    <?php do_action( 'woocommerce_after_add_to_cart_form' ); ?>
+
+<?php endif; ?>
diff --git a/woocommerce/single-product/add-to-cart/variable.php b/woocommerce/single-product/add-to-cart/variable.php
new file mode 100644 (file)
index 0000000..8d57d1b
--- /dev/null
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Variable product add to cart
+ *
+ * This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/variable.php.
+ *
+ * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
+ * will need to copy the new files to your theme to maintain compatibility. We try to do this.
+ * as little as possible, but it does happen. When this occurs the version of the template file will.
+ * be bumped and the readme will list any important changes.
+ *
+ * @see        http://docs.woothemes.com/document/template-structure/
+ * @author  WooThemes
+ * @package WooCommerce/Templates
+ * @version 2.5.0
+ */
+if ( ! defined( 'ABSPATH' ) ) {
+       exit;
+}
+
+global $product;
+
+$attribute_keys = array_keys( $attributes );
+
+do_action( 'woocommerce_before_add_to_cart_form' ); ?>
+
+<form class="variations_form cart" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint( $product->id ); ?>" data-product_variations="<?php echo htmlspecialchars( json_encode( $available_variations ) ) ?>">
+    <?php do_action( 'woocommerce_before_variations_form' ); ?>
+
+    <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?>
+            <p class="stock out-of-stock"><?php _e( 'This product is currently out of stock and unavailable.', 'woocommerce' ); ?></p>
+    <?php else : ?>
+
+        <?php // if (!is_product() && $product->has_child() ) { ?>
+        <table class="variations" cellspacing="0">
+            <tbody>
+                <?php $variations_arr = array();
+                foreach ( $attributes as $attribute_name => $options ) : ob_start(); ?>
+                    <tr>
+                        <td class="value">
+                            <?php // $selected = isset( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) ? wc_clean( $_REQUEST[ 'attribute_' . sanitize_title( $attribute_name ) ] ) : $product->get_variation_default_attribute( $attribute_name ); 
+                                $selected = $product->get_variation_default_attribute( $attribute_name ); 
+                                wc_dropdown_variation_attribute_options( array( 'options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected ) ); 
+                                echo end( $attribute_keys ) === $attribute_name ? apply_filters( 'woocommerce_reset_variations_link', '<a class="reset_variations" href="#">' . __( 'Clear', 'woocommerce' ) . '</a>' ) : '';
+                            ?>
+                        </td>
+                    </tr>
+                    <?php $variations_ob = ob_get_clean(); $variations_arr[wc_attribute_label($attribute_name)] = $variations_ob; endforeach;
+
+                foreach ($variations_arr as $name => $ob) {
+//                    $article = "a ";
+//                    if (ctype_alpha($name) && preg_match('/^[aeiou]/i', $name)) {
+//                        $article = "an ";
+//                    }
+                    echo str_ireplace('choose an option', 'Select '.$name, $ob );
+                } ?>
+
+            </tbody>
+        </table>
+
+        <?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
+
+        <div class="single_variation_wrap">
+            <?php
+                /**
+                 * woocommerce_before_single_variation Hook.
+                 */
+                do_action( 'woocommerce_before_single_variation' );
+
+                /**
+                 * woocommerce_single_variation hook. Used to output the cart button and placeholder for variation data.
+                 * @since 2.4.0
+                 * @hooked woocommerce_single_variation - 10 Empty div for variation data.
+                 * @hooked woocommerce_single_variation_add_to_cart_button - 20 Qty and cart button.
+                 */
+                do_action( 'woocommerce_single_variation' );
+
+                /**
+                 * woocommerce_after_single_variation Hook.
+                 */
+                do_action( 'woocommerce_after_single_variation' );
+            ?>
+        </div>
+
+        <?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
+    <?php endif; ?>
+
+    <?php do_action( 'woocommerce_after_variations_form' ); ?>
+</form>
+
+<?php do_action( 'woocommerce_after_add_to_cart_form' ); ?>
diff --git a/woocommerce/single-product/add-to-cart/variation-add-to-cart-button.php b/woocommerce/single-product/add-to-cart/variation-add-to-cart-button.php
new file mode 100644 (file)
index 0000000..5102718
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Single variation cart button
+ *
+ * @see        http://docs.woothemes.com/document/template-structure/
+ * @author  WooThemes
+ * @package WooCommerce/Templates
+ * @version 2.5.0
+ */
+if ( ! defined( 'ABSPATH' ) ) {
+       exit;
+}
+
+global $product;
+?>
+
+<div class="woocommerce-variation-add-to-cart <?php if (is_product()) { echo "products-qty-contain ";} ?>variations_button">
+        <div class="woo-qty-wrapper">
+        <?php if ( ! $product->is_sold_individually() ) : ?>
+                <span class="cart-qty-label">Qty:</span>
+                <?php woocommerce_quantity_input( array(
+                    'input_value' => ( 1 ),
+                    'min_value'   => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
+                    'max_value'   => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product )
+                ) ); ?>
+       <?php endif; ?>
+        </div>
+        <button type="submit" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
+       <input type="hidden" name="add-to-cart" value="<?php echo absint( $product->id ); ?>" />
+       <input type="hidden" name="product_id" value="<?php echo absint( $product->id ); ?>" />
+       <input type="hidden" name="variation_id" class="variation_id" value="0" />
+</div>
\ No newline at end of file
diff --git a/woocommerce/single-product/price.php b/woocommerce/single-product/price.php
new file mode 100644 (file)
index 0000000..c206593
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Single Product Price, including microdata for SEO
+ *
+ * This template can be overridden by copying it to yourtheme/woocommerce/single-product/price.php.
+ *
+ * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
+ * will need to copy the new files to your theme to maintain compatibility. We try to do this.
+ * as little as possible, but it does happen. When this occurs the version of the template file will.
+ * be bumped and the readme will list any important changes.
+ *
+ * @see     http://docs.woothemes.com/document/template-structure/
+ * @author  WooThemes
+ * @package WooCommerce/Templates
+ * @version 2.4.9
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+global $product;
+
+?>
+<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
+
+       <?php // if( $product->is_type( 'simple' ) ){ ?><p class="price price-single"><?php echo $product->get_price_html(); ?></p><?php // } ?>
+
+       <meta itemprop="price" content="<?php echo esc_attr( $product->get_price() ); ?>" />
+       <meta itemprop="priceCurrency" content="<?php echo esc_attr( get_woocommerce_currency() ); ?>" />
+       <link itemprop="availability" href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />
+
+</div>
\ No newline at end of file