diff --git a/global-templates/left-sidebar-check.php b/global-templates/left-sidebar-check.php index 3a6d79e..9886343 100644 --- a/global-templates/left-sidebar-check.php +++ b/global-templates/left-sidebar-check.php @@ -1,13 +1,52 @@ - - - + + + + +'; + } else { + $html = ''; + if ( 'right' === $sidebar_pos || 'left' === $sidebar_pos ) { + $html = '
'; + } else { + $html .= 'col-md-12 content-area" id="primary">'; + } + echo $html; + } elseif ( is_active_sidebar( 'right-sidebar' ) && is_active_sidebar( 'left-sidebar' ) ) { + $html = '
'; + } else { + $html .= 'col-md-12 content-area" id="primary">'; + } + echo $html; + } + } +?> + - -
- -
- \ No newline at end of file diff --git a/inc/woocommerce.php b/inc/woocommerce.php index 51ab159..b55cdc5 100644 --- a/inc/woocommerce.php +++ b/inc/woocommerce.php @@ -7,8 +7,99 @@ */ add_action( 'after_setup_theme', 'woocommerce_support' ); -if ( ! function_exists ( 'woocommerce_support' ) ) { +if ( ! function_exists( 'woocommerce_support' ) ) { function woocommerce_support() { - add_theme_support( 'woocommerce' ); + add_theme_support( 'woocommerce' ); + // hook in and customizer form fields + add_filter( 'woocommerce_form_field_args', 'wc_form_field_args', 10, 3 ); } -} \ No newline at end of file +} + +/** + * Filter hook function monkey patching form classes + * Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826 + * + * @param $args + * @param $key + * @param null $value + * + * @return mixed + */ +function wc_form_field_args( $args, $key, $value = null ) { + +// Start field type switch case + + switch ( $args['type'] ) { + + /* Targets all select input type elements, except the country and state select input types */ + case 'select' : + // Add a class to the field's html element wrapper - woocommerce + // input types (fields) are often wrapped within a

tag. + $args['class'][] = 'form-group'; + // Add a class to the form input itself. + $args['input_class'] = array( 'form-control', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + $args['custom_attributes'] = array( + 'data-plugin' => 'select2', + 'data-allow-clear' => 'true', + 'aria-hidden' => 'true', + // Add custom data attributes to the form input itself. + ); + break; + + // By default WooCommerce will populate a select with the country names - $args + // defined for this specific input type targets only the country select element. + case 'country' : + $args['class'][] = 'form-group single-country'; + $args['label_class'] = array( 'control-label' ); + break; + + // By default WooCommerce will populate a select with state names - $args defined + // for this specific input type targets only the country select element. + case 'state' : + // Add class to the field's html element wrapper. + $args['class'][] = 'form-group'; + // add class to the form input itself. + $args['input_class'] = array( '', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + $args['custom_attributes'] = array( + 'data-plugin' => 'select2', + 'data-allow-clear' => 'true', + 'aria-hidden' => 'true', + ); + break; + + case 'password' : + case 'text' : + case 'email' : + case 'tel' : + case 'number' : + $args['class'][] = 'form-group'; + $args['input_class'] = array( 'form-control', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + break; + + case 'textarea' : + $args['input_class'] = array( 'form-control', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + break; + + case 'checkbox' : + $args['label_class'] = array( 'custom-control custom-checkbox' ); + $args['input_class'] = array( 'custom-control-input', 'input-lg' ); + break; + + case 'radio' : + $args['label_class'] = array( 'custom-control custom-radio' ); + $args['input_class'] = array( 'custom-control-input', 'input-lg' ); + break; + + default : + $args['class'][] = 'form-group'; + $args['input_class'] = array( 'form-control', 'input-lg' ); + $args['label_class'] = array( 'control-label' ); + break; + } + + return $args; +} diff --git a/page.php b/page.php index 9b4f237..1c87c3a 100644 --- a/page.php +++ b/page.php @@ -10,52 +10,70 @@ * @package understrap */ - get_header(); +get_header(); ?>
-
+
-
- - - +
-
+ + - +
- + - + - + -
+ -
+ - - - - - - +
-
+ + -
+ + + + + +
+ +
diff --git a/woocommerce.php b/woocommerce.php deleted file mode 100644 index e04b2ab..0000000 --- a/woocommerce.php +++ /dev/null @@ -1,61 +0,0 @@ - - - - -
- -
- - - - -
- - - - - -
- -
- - - - - - - - -
- -
- - diff --git a/woocommerce/archive-product.php b/woocommerce/archive-product.php new file mode 100755 index 0000000..13ada76 --- /dev/null +++ b/woocommerce/archive-product.php @@ -0,0 +1,108 @@ + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?> + + + + + + + + + + diff --git a/woocommerce/cart/cart-empty.php b/woocommerce/cart/cart-empty.php new file mode 100644 index 0000000..790b626 --- /dev/null +++ b/woocommerce/cart/cart-empty.php @@ -0,0 +1,39 @@ + + +

+ +

+ + + + 0 ) : ?> +

+ + + +

+ diff --git a/woocommerce/cart/cart.php b/woocommerce/cart/cart.php new file mode 100755 index 0000000..39990ab --- /dev/null +++ b/woocommerce/cart/cart.php @@ -0,0 +1,166 @@ + + +
+ + + + + + + + + + + + + + + + + + cart->get_cart() as $cart_item_key => $cart_item ) { + $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); + $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); + + if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) { + $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key ); + ?> + + + + + + + + + + + + + + + + + + + + + +
  
+ ×', + esc_url( WC()->cart->get_remove_url( $cart_item_key ) ), + __( 'Remove this item', 'woocommerce' ), + esc_attr( $product_id ), + esc_attr( $_product->get_sku() ) + ), $cart_item_key ); + ?> + + get_image(), $cart_item, $cart_item_key ); + + if ( ! $product_permalink ) { + echo $thumbnail; + } else { + printf( '%s', esc_url( $product_permalink ), $thumbnail ); + } + ?> + + get_title(), $cart_item, $cart_item_key ) . ' '; + } else { + echo apply_filters( 'woocommerce_cart_item_name', sprintf( '%s', esc_url( $product_permalink ), $_product->get_title() ), $cart_item, $cart_item_key ); + } + + // Meta data + echo WC()->cart->get_item_data( $cart_item ); + + // Backorder notification + if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) { + echo '

' . esc_html__( 'Available on backorder', 'woocommerce' ) . '

'; + } + ?> +
+ cart->get_product_price( $_product ), $cart_item, $cart_item_key ); + ?> + + is_sold_individually() ) { + $product_quantity = sprintf( '1 ', $cart_item_key ); + } else { + $product_quantity = woocommerce_quantity_input( array( + 'input_name' => "cart[{$cart_item_key}][qty]", + 'input_value' => $cart_item['quantity'], + 'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), + 'min_value' => '0' + ), $_product, false ); + } + + echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); + ?> + + cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); + ?> +
+ + +
+ + + + +
+ + + + + + + +
+ + + +
+ +
+ + + +
+ + diff --git a/woocommerce/cart/mini-cart.php b/woocommerce/cart/mini-cart.php new file mode 100755 index 0000000..25371a7 --- /dev/null +++ b/woocommerce/cart/mini-cart.php @@ -0,0 +1,91 @@ + + + + + + +cart->is_empty() ) : ?> + +

: cart->get_cart_subtotal(); ?>

+ + + +

+ + +

+ + + + diff --git a/woocommerce/cart/proceed-to-checkout-button.php b/woocommerce/cart/proceed-to-checkout-button.php new file mode 100755 index 0000000..331f5b5 --- /dev/null +++ b/woocommerce/cart/proceed-to-checkout-button.php @@ -0,0 +1,28 @@ + + + + + diff --git a/woocommerce/checkout/form-coupon.php b/woocommerce/checkout/form-coupon.php new file mode 100755 index 0000000..1a45767 --- /dev/null +++ b/woocommerce/checkout/form-coupon.php @@ -0,0 +1,44 @@ +cart->applied_coupons ) ) { + $info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) . ' ' . __( 'Click here to enter your code', 'woocommerce' ) . '' ); + wc_print_notice( $info_message, 'notice' ); +} +?> + + diff --git a/woocommerce/checkout/form-pay.php b/woocommerce/checkout/form-pay.php new file mode 100755 index 0000000..3420d70 --- /dev/null +++ b/woocommerce/checkout/form-pay.php @@ -0,0 +1,98 @@ + +
+ + + + + + + + + + + get_items() ) > 0 ) : ?> + get_items() as $item_id => $item ) : ?> + + + + + + + + + + + get_order_item_totals() ) : ?> + + + + + + + + +
+ display_item_meta( $item ); + do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order ); + ?> + ' . sprintf( '× %s', esc_html( $item['qty'] ) ) . '', $item ); ?>get_formatted_line_subtotal( $item ); ?>
+ +
+ needs_payment() ) : ?> +
    + $gateway ) ); + } + } else { + echo '
  • ' . apply_filters( 'woocommerce_no_available_payment_methods_message', __( 'Sorry, it seems that there are no available payment methods for your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) ) . '
  • '; + } + ?> +
+ +
+ + + + + + + ' ); ?> + + + + +
+
+
diff --git a/woocommerce/checkout/payment.php b/woocommerce/checkout/payment.php new file mode 100755 index 0000000..2b3f162 --- /dev/null +++ b/woocommerce/checkout/payment.php @@ -0,0 +1,60 @@ + +
+ cart->needs_payment() ) : ?> + + +
+ + + + + + + ' ); ?> + + + + +
+
+ +
> + + + + + +

+ + +

+

+ + +

+
+ + + +

+ + + + +

+

+ +

+ +
+ + + +
diff --git a/woocommerce/global/quantity-input.php b/woocommerce/global/quantity-input.php new file mode 100755 index 0000000..ccb361a --- /dev/null +++ b/woocommerce/global/quantity-input.php @@ -0,0 +1,25 @@ + +
+ +
diff --git a/woocommerce/global/wrapper-end.php b/woocommerce/global/wrapper-end.php new file mode 100644 index 0000000..d788f46 --- /dev/null +++ b/woocommerce/global/wrapper-end.php @@ -0,0 +1,23 @@ + +
diff --git a/woocommerce/global/wrapper-start.php b/woocommerce/global/wrapper-start.php new file mode 100644 index 0000000..cb8a5ff --- /dev/null +++ b/woocommerce/global/wrapper-start.php @@ -0,0 +1,31 @@ +
'; +} else { + echo '
'; +} diff --git a/woocommerce/loop/add-to-cart.php b/woocommerce/loop/add-to-cart.php new file mode 100755 index 0000000..1b4f521 --- /dev/null +++ b/woocommerce/loop/add-to-cart.php @@ -0,0 +1,35 @@ +%s', + esc_url( $product->add_to_cart_url() ), + esc_attr( isset( $quantity ) ? $quantity : 1 ), + esc_attr( $product->id ), + esc_attr( $product->get_sku() ), + // TODO: load add to cart button class from customizer? +// esc_attr( isset( $class ) ? $class : 'button' ), + esc_html( $product->add_to_cart_text() ) + ), + $product ); diff --git a/woocommerce/myaccount/downloads.php b/woocommerce/myaccount/downloads.php new file mode 100755 index 0000000..a5a2b41 --- /dev/null +++ b/woocommerce/myaccount/downloads.php @@ -0,0 +1,104 @@ +customer->get_downloadable_products(); +$has_downloads = (bool) $downloads; + +do_action( 'woocommerce_before_account_downloads', $has_downloads ); ?> + + + + + + + + + $column_name ) : ?> + + + + + + + $column_name ) : ?> + + + + +
+ + + + + + + + + + + + + + + + + + + + array( + 'url' => $download['download_url'], + 'name' => __( 'Download', 'woocommerce' ) + ) + ); + + if ( $actions = apply_filters( 'woocommerce_account_download_actions', $actions, $download ) ) { + foreach ( $actions as $key => $action ) { + echo '' . esc_html( $action['name'] ) . ''; + } + } + ?> + + +
+ + + + +
+ + + + +
+ + + diff --git a/woocommerce/myaccount/form-edit-account.php b/woocommerce/myaccount/form-edit-account.php new file mode 100755 index 0000000..bded131 --- /dev/null +++ b/woocommerce/myaccount/form-edit-account.php @@ -0,0 +1,73 @@ + + + + + diff --git a/woocommerce/myaccount/form-edit-address.php b/woocommerce/myaccount/form-edit-address.php new file mode 100755 index 0000000..db798fe --- /dev/null +++ b/woocommerce/myaccount/form-edit-address.php @@ -0,0 +1,55 @@ + + + + + + +
+ +

+ + + + $field ) : ?> + + + + + + + +

+ + + +

+ +
+ + + + diff --git a/woocommerce/myaccount/form-login.php b/woocommerce/myaccount/form-login.php new file mode 100755 index 0000000..3ba1f4c --- /dev/null +++ b/woocommerce/myaccount/form-login.php @@ -0,0 +1,124 @@ + + + + + + + + +
+ +
+ + + +

+ + + + + +
+ +
+ +

+ +
+ + + + + +

+ + +

+ + + +

+ + +

+ + + +

+ + +

+ + + + +
+ + + + +

+ + +

+ + + +
+ +
+ +
+ + + diff --git a/woocommerce/myaccount/form-lost-password.php b/woocommerce/myaccount/form-lost-password.php new file mode 100755 index 0000000..df71787 --- /dev/null +++ b/woocommerce/myaccount/form-lost-password.php @@ -0,0 +1,45 @@ + + +
+ +

+ +

+ + +

+ +
+ + + +

+ + +

+ + + +
diff --git a/woocommerce/myaccount/form-reset-password.php b/woocommerce/myaccount/form-reset-password.php new file mode 100755 index 0000000..5ba92cc --- /dev/null +++ b/woocommerce/myaccount/form-reset-password.php @@ -0,0 +1,52 @@ + + +
+ +

+ +

+ + +

+

+ + +

+ + + + +
+ + + +

+ + +

+ + + +
diff --git a/woocommerce/myaccount/my-orders.php b/woocommerce/myaccount/my-orders.php new file mode 100755 index 0000000..e1c084b --- /dev/null +++ b/woocommerce/myaccount/my-orders.php @@ -0,0 +1,105 @@ + __( 'Order', 'woocommerce' ), + 'order-date' => __( 'Date', 'woocommerce' ), + 'order-status' => __( 'Status', 'woocommerce' ), + 'order-total' => __( 'Total', 'woocommerce' ), + 'order-actions' => ' ', +) ); + +$customer_orders = get_posts( apply_filters( 'woocommerce_my_account_my_orders_query', array( + 'numberposts' => $order_count, + 'meta_key' => '_customer_user', + 'meta_value' => get_current_user_id(), + 'post_type' => wc_get_order_types( 'view-orders' ), + 'post_status' => array_keys( wc_get_order_statuses() ) +) ) ); + +if ( $customer_orders ) : ?> + +

+ + + + + + $column_name ) : ?> + + + + + + + get_item_count(); + ?> + + $column_name ) : ?> + + + + + + + diff --git a/woocommerce/myaccount/navigation.php b/woocommerce/myaccount/navigation.php new file mode 100755 index 0000000..edb1a7d --- /dev/null +++ b/woocommerce/myaccount/navigation.php @@ -0,0 +1,35 @@ + + + + + diff --git a/woocommerce/myaccount/orders.php b/woocommerce/myaccount/orders.php new file mode 100755 index 0000000..64fdc2e --- /dev/null +++ b/woocommerce/myaccount/orders.php @@ -0,0 +1,125 @@ + + + + + + + + $column_name ) : ?> + + + + + + + orders as $customer_order ) : + $order = wc_get_order( $customer_order ); + $item_count = $order->get_item_count(); + ?> + + $column_name ) : ?> + + + + + + + + + + max_num_pages ) : ?> +
+ + + + + max_num_pages ) ) : ?> + + +
+ + + +
+ + + + +
+ + + diff --git a/woocommerce/single-product/add-to-cart/simple.php b/woocommerce/single-product/add-to-cart/simple.php new file mode 100755 index 0000000..0e56dd2 --- /dev/null +++ b/woocommerce/single-product/add-to-cart/simple.php @@ -0,0 +1,65 @@ +is_purchasable() ) { + return; +} + +?> + +get_availability(); + $availability_html = empty( $availability['availability'] ) ? '' : '

' . esc_html( $availability['availability'] ) . '

'; + + echo apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product ); +?> + +is_in_stock() ) : ?> + + + +
+ + + is_sold_individually() ) { + 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' => ( isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : 1 ) + ) ); + } + ?> + + + + + + +
+ + + +