Merge pull request #357 from typeplus/master

Woocommerce fixes + 3.0.9 template update - Thx again @typeplus !!!
This commit is contained in:
Holger 2017-06-28 16:04:20 +02:00 committed by GitHub
commit 9c4689e13d
3 changed files with 31 additions and 114 deletions

View File

@ -28,7 +28,27 @@ $sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
<main class="site-main" id="main">
<?php woocommerce_content(); ?>
<?php
$template_name = '\archive-product.php';
$args = array();
$template_path = '';
$default_path = untrailingslashit( plugin_dir_path(__FILE__) ) . '\woocommerce';
if ( is_singular( 'product' ) ) {
woocommerce_content();
//For ANY product archive, Product taxonomy, product search or /shop landing page etc Fetch the template override;
} elseif ( file_exists( $default_path . $template_name ) )
{
wc_get_template( $template_name, $args, $template_path, $default_path );
//If no archive-product.php template exists, default to catchall;
} else {
woocommerce_content( );
}
;?>
</main><!-- #main -->

View File

@ -1,108 +0,0 @@
<?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 https://docs.woocommerce.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' ); ?>

View File

@ -1,7 +1,7 @@
<?php
/**
* Edit address form
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
* Updated for Understrap to maintain Woocommerce 3.0.9 compatability.
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-edit-address.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.0.0
* @version 3.0.9
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -36,9 +36,14 @@ do_action( 'woocommerce_before_edit_account_address_form' ); ?>
<?php do_action( "woocommerce_before_edit_address_form_{$load_address}" ); ?>
<div class="woocommerce-address-fields__field-wrapper">
<?php foreach ( $address as $key => $field ) : ?>
<?php woocommerce_form_field( $key, $field, ! empty( $_POST[ $key ] ) ? wc_clean( $_POST[ $key ] ) : $field['value'] ); ?>
<?php endforeach; ?>
<?php
foreach ( $address as $key => $field ) {
if ( isset( $field['country_field'], $address[ $field['country_field'] ] ) ) {
$field['country'] = wc_get_post_data_by_key( $field['country_field'], $address[ $field['country_field'] ]['value'] );
}
woocommerce_form_field( $key, $field, wc_get_post_data_by_key( $key, $field['value'] ) );
}
?>
</div>
<?php do_action( "woocommerce_after_edit_address_form_{$load_address}" ); ?>