Merge branch 'master' of github.com:woothemes/woocommerce
This commit is contained in:
commit
0ccf153227
File diff suppressed because one or more lines are too long
|
@ -784,7 +784,13 @@ ul.wc_coupon_list_block {
|
|||
padding: 8px;
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
|
||||
color: #555;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
&:last-child {
|
||||
padding-right: 12px;
|
||||
}
|
||||
|
@ -792,6 +798,9 @@ ul.wc_coupon_list_block {
|
|||
&:first-child {
|
||||
padding-left: 12px;
|
||||
}
|
||||
&.sortable {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
tbody th, td {
|
||||
|
|
|
@ -628,6 +628,7 @@ jQuery( function ( $ ) {
|
|||
$( '#woocommerce-order-items .inside' ).append( response );
|
||||
runTipTip();
|
||||
removeOrderItemsLoading();
|
||||
$('.woocommerce_order_items').stupidtable();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1163,4 +1164,6 @@ jQuery( function ( $ ) {
|
|||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.woocommerce_order_items').stupidtable();
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -149,10 +149,13 @@ jQuery( function ( $ ) {
|
|||
}
|
||||
});
|
||||
|
||||
var variation_ids = [];
|
||||
variation_ids.push( variation );
|
||||
|
||||
var data = {
|
||||
action: 'woocommerce_remove_variation',
|
||||
variation_id: variation,
|
||||
security: woocommerce_admin_meta_boxes_variations.delete_variation_nonce
|
||||
action: 'woocommerce_remove_variations',
|
||||
variation_ids: variation_ids,
|
||||
security: woocommerce_admin_meta_boxes_variations.delete_variations_nonce
|
||||
};
|
||||
|
||||
$.post( woocommerce_admin_meta_boxes_variations.ajax_url, data, function ( response ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -271,6 +271,12 @@ jQuery( function( $ ){
|
|||
});
|
||||
};
|
||||
|
||||
$('.product_attributes .woocommerce_attribute').each(function(index, el){
|
||||
if ( $(el).css('display') != 'none' && $(el).is('.taxonomy') ) {
|
||||
$('select.attribute_taxonomy').find('option[value="' + $(el).data( 'taxonomy' ) + '"]').attr('disabled','disabled');
|
||||
}
|
||||
});
|
||||
|
||||
// Add rows
|
||||
$('button.add_attribute').on('click', function(){
|
||||
|
||||
|
@ -278,7 +284,7 @@ jQuery( function( $ ){
|
|||
|
||||
var attribute_type = $('select.attribute_taxonomy').val();
|
||||
|
||||
if (!attribute_type) {
|
||||
if ( ! attribute_type ) {
|
||||
|
||||
var product_type = $('select#product-type').val();
|
||||
if (product_type!='variable') enable_variation = 'style="display:none;"'; else enable_variation = '';
|
||||
|
@ -327,6 +333,7 @@ jQuery( function( $ ){
|
|||
$('.product_attributes').append( $(thisrow) );
|
||||
$(thisrow).show().find('.woocommerce_attribute_data').show();
|
||||
attribute_row_indexes();
|
||||
$('select.attribute_taxonomy').find('option[value="' + attribute_type + '"]').attr('disabled','disabled');
|
||||
|
||||
}
|
||||
|
||||
|
@ -357,6 +364,7 @@ jQuery( function( $ ){
|
|||
if ($parent.is('.taxonomy')) {
|
||||
$parent.find('select, input[type=text]').val('');
|
||||
$parent.hide();
|
||||
$('select.attribute_taxonomy').find('option[value="' + $parent.data( 'taxonomy' ) + '"]').removeAttr('disabled');
|
||||
} else {
|
||||
$parent.find('select, input[type=text]').val('');
|
||||
$parent.hide();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -50,7 +50,7 @@ jQuery( function( $ ) {
|
|||
s_address_2 = address_2;
|
||||
}
|
||||
|
||||
$( '#order_methods, #order_review' ).block({
|
||||
$( '.woocommerce-checkout-payment, .woocommerce-checkout-review-order-table' ).block({
|
||||
message: null,
|
||||
overlayCSS: {
|
||||
background: '#fff',
|
||||
|
@ -82,15 +82,20 @@ jQuery( function( $ ) {
|
|||
type: 'POST',
|
||||
url: wc_checkout_params.ajax_url,
|
||||
data: data,
|
||||
success: function( response ) {
|
||||
if ( response ) {
|
||||
$( '#order_review' ).html( $.trim( response ) );
|
||||
$( '#order_review' ).find( 'input[name=payment_method]:checked' ).trigger('click');
|
||||
success: function( data ) {
|
||||
console.log( data );
|
||||
if ( data && data.fragments ) {
|
||||
|
||||
$.each( data.fragments, function( key, value ) {
|
||||
$( key ).replaceWith( value );
|
||||
$( key ).unblock();
|
||||
});
|
||||
|
||||
$( '.woocommerce-checkout' ).find( 'input[name=payment_method]:checked' ).trigger('click');
|
||||
$( 'body' ).trigger('updated_checkout' );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Event for updating the checkout
|
||||
|
@ -123,7 +128,6 @@ jQuery( function( $ ) {
|
|||
}).change();
|
||||
|
||||
if ( wc_checkout_params.option_guest_checkout === 'yes' ) {
|
||||
|
||||
$( 'div.create-account' ).hide();
|
||||
|
||||
$( 'input#createaccount' ).change( function() {
|
||||
|
@ -133,7 +137,6 @@ jQuery( function( $ ) {
|
|||
$( 'div.create-account' ).slideDown();
|
||||
}
|
||||
}).change();
|
||||
|
||||
}
|
||||
|
||||
$( '#order_review' )
|
||||
|
@ -410,5 +413,4 @@ jQuery( function( $ ) {
|
|||
if ( wc_checkout_params.is_checkout === '1' ) {
|
||||
$( 'body' ).trigger( 'init_checkout' );
|
||||
}
|
||||
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,115 @@
|
|||
// Stupid jQuery table plugin.
|
||||
|
||||
// Call on a table
|
||||
// sortFns: Sort functions for your datatypes.
|
||||
(function($) {
|
||||
|
||||
$.fn.stupidtable = function(sortFns) {
|
||||
return this.each(function() {
|
||||
var $table = $(this);
|
||||
sortFns = sortFns || {};
|
||||
|
||||
// Merge sort functions with some default sort functions.
|
||||
sortFns = $.extend({}, $.fn.stupidtable.default_sort_fns, sortFns);
|
||||
|
||||
|
||||
// ==================================================== //
|
||||
// Begin execution! //
|
||||
// ==================================================== //
|
||||
|
||||
// Do sorting when THs are clicked
|
||||
$table.on("click.stupidtable", "thead th", function() {
|
||||
var $this = $(this);
|
||||
var th_index = 0;
|
||||
var dir = $.fn.stupidtable.dir;
|
||||
|
||||
// Account for colspans
|
||||
$this.parents("tr").find("th").slice(0, $this.index()).each(function() {
|
||||
var cols = $(this).attr("colspan") || 1;
|
||||
th_index += parseInt(cols,10);
|
||||
});
|
||||
|
||||
// Determine (and/or reverse) sorting direction, default `asc`
|
||||
var sort_dir = $this.data("sort-default") || dir.ASC;
|
||||
if ($this.data("sort-dir"))
|
||||
sort_dir = $this.data("sort-dir") === dir.ASC ? dir.DESC : dir.ASC;
|
||||
|
||||
// Choose appropriate sorting function.
|
||||
var type = $this.data("sort") || null;
|
||||
|
||||
// Prevent sorting if no type defined
|
||||
if (type === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Trigger `beforetablesort` event that calling scripts can hook into;
|
||||
// pass parameters for sorted column index and sorting direction
|
||||
$table.trigger("beforetablesort", {column: th_index, direction: sort_dir});
|
||||
// More reliable method of forcing a redraw
|
||||
$table.css("display");
|
||||
|
||||
// Run sorting asynchronously on a timeout to force browser redraw after
|
||||
// `beforetablesort` callback. Also avoids locking up the browser too much.
|
||||
setTimeout(function() {
|
||||
// Gather the elements for this column
|
||||
var sortMethod = sortFns[type];
|
||||
|
||||
$table.children("tbody").each(function(index,tbody){
|
||||
var column = [];
|
||||
var $tbody = $(tbody);
|
||||
var trs = $tbody.children("tr").not('[data-sort-ignore]');
|
||||
|
||||
// Extract the data for the column that needs to be sorted and pair it up
|
||||
// with the TR itself into a tuple
|
||||
trs.each(function(index,tr) {
|
||||
var $e = $(tr).children().eq(th_index);
|
||||
var sort_val = $e.data("sort-value");
|
||||
var order_by = typeof(sort_val) !== "undefined" ? sort_val : $e.text();
|
||||
column.push([order_by, tr]);
|
||||
});
|
||||
|
||||
// Sort by the data-order-by value
|
||||
column.sort(function(a, b) { return sortMethod(a[0], b[0]); });
|
||||
if (sort_dir != dir.ASC)
|
||||
column.reverse();
|
||||
|
||||
// Replace the content of tbody with the sorted rows. Strangely (and
|
||||
// conveniently!) enough, .append accomplishes this for us.
|
||||
trs = $.map(column, function(kv) { return kv[1]; });
|
||||
$tbody.append(trs);
|
||||
});
|
||||
|
||||
// Reset siblings
|
||||
$table.find("th").data("sort-dir", null).removeClass("sorting-desc sorting-asc");
|
||||
$this.data("sort-dir", sort_dir).addClass("sorting-"+sort_dir);
|
||||
|
||||
// Trigger `aftertablesort` event. Similar to `beforetablesort`
|
||||
$table.trigger("aftertablesort", {column: th_index, direction: sort_dir});
|
||||
// More reliable method of forcing a redraw
|
||||
$table.css("display");
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Enum containing sorting directions
|
||||
$.fn.stupidtable.dir = {ASC: "asc", DESC: "desc"};
|
||||
|
||||
$.fn.stupidtable.default_sort_fns = {
|
||||
"int": function(a, b) {
|
||||
return parseInt(a, 10) - parseInt(b, 10);
|
||||
},
|
||||
"float": function(a, b) {
|
||||
return parseFloat(a) - parseFloat(b);
|
||||
},
|
||||
"string": function(a, b) {
|
||||
return a.localeCompare(b);
|
||||
},
|
||||
"string-ins": function(a, b) {
|
||||
a = a.toLocaleLowerCase();
|
||||
b = b.toLocaleLowerCase();
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
|
@ -0,0 +1 @@
|
|||
!function(a){a.fn.stupidtable=function(b){return this.each(function(){var c=a(this);b=b||{},b=a.extend({},a.fn.stupidtable.default_sort_fns,b),c.on("click.stupidtable","thead th",function(){var d=a(this),e=0,f=a.fn.stupidtable.dir;d.parents("tr").find("th").slice(0,d.index()).each(function(){var b=a(this).attr("colspan")||1;e+=parseInt(b,10)});var g=d.data("sort-default")||f.ASC;d.data("sort-dir")&&(g=d.data("sort-dir")===f.ASC?f.DESC:f.ASC);var h=d.data("sort")||null;null!==h&&(c.trigger("beforetablesort",{column:e,direction:g}),c.css("display"),setTimeout(function(){var i=b[h];c.children("tbody").each(function(b,c){var d=[],h=a(c),j=h.children("tr").not("[data-sort-ignore]");j.each(function(b,c){var f=a(c).children().eq(e),g=f.data("sort-value"),h="undefined"!=typeof g?g:f.text();d.push([h,c])}),d.sort(function(a,b){return i(a[0],b[0])}),g!=f.ASC&&d.reverse(),j=a.map(d,function(a){return a[1]}),h.append(j)}),c.find("th").data("sort-dir",null).removeClass("sorting-desc sorting-asc"),d.data("sort-dir",g).addClass("sorting-"+g),c.trigger("aftertablesort",{column:e,direction:g}),c.css("display")},10))})})},a.fn.stupidtable.dir={ASC:"asc",DESC:"desc"},a.fn.stupidtable.default_sort_fns={"int":function(a,b){return parseInt(a,10)-parseInt(b,10)},"float":function(a,b){return parseFloat(a)-parseFloat(b)},string:function(a,b){return a.localeCompare(b)},"string-ins":function(a,b){return a=a.toLocaleLowerCase(),b=b.toLocaleLowerCase(),a.localeCompare(b)}}}(jQuery);
|
|
@ -994,13 +994,26 @@ class WC_Product {
|
|||
|
||||
$where_meta_value = $value ? $wpdb->prepare( " AND meta_value = %d", $value ) : " AND meta_value > 0";
|
||||
|
||||
$count = $wpdb->get_var( $wpdb->prepare("
|
||||
SELECT COUNT(meta_value) FROM $wpdb->commentmeta
|
||||
LEFT JOIN $wpdb->comments ON $wpdb->commentmeta.comment_id = $wpdb->comments.comment_ID
|
||||
WHERE meta_key = 'rating'
|
||||
AND comment_post_ID = %d
|
||||
AND comment_approved = '1'
|
||||
", $this->id ) . $where_meta_value );
|
||||
if ( get_option( 'woocommerce_enable_review_rating' ) == 'yes' && get_option( 'woocommerce_review_rating_required' ) == 'yes' ) {
|
||||
|
||||
$count = $wpdb->get_var( $wpdb->prepare("
|
||||
SELECT COUNT(meta_value) FROM $wpdb->commentmeta
|
||||
LEFT JOIN $wpdb->comments ON $wpdb->commentmeta.comment_id = $wpdb->comments.comment_ID
|
||||
WHERE meta_key = 'rating'
|
||||
AND comment_post_ID = %d
|
||||
AND comment_approved = '1'
|
||||
", $this->id ) . $where_meta_value );
|
||||
|
||||
} else {
|
||||
|
||||
$count = $wpdb->get_var( $wpdb->prepare("
|
||||
SELECT COUNT(*) FROM $wpdb->comments
|
||||
WHERE comment_parent = 0
|
||||
AND comment_post_ID = %d
|
||||
AND comment_approved = '1'
|
||||
", $this->id ) );
|
||||
|
||||
}
|
||||
|
||||
set_transient( 'wc_rating_count_' . $this->id . $value_suffix, $count, YEAR_IN_SECONDS );
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class WC_Admin_Assets {
|
|||
*/
|
||||
public function admin_scripts() {
|
||||
global $wp_query, $post, $current_user;
|
||||
|
||||
|
||||
get_currentuserinfo();
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
@ -91,13 +91,15 @@ class WC_Admin_Assets {
|
|||
|
||||
wp_register_script( 'round', WC()->plugin_url() . '/assets/js/admin/round' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||
|
||||
wp_register_script( 'wc-admin-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round', 'ajax-chosen', 'chosen', 'plupload-all' ), WC_VERSION );
|
||||
wp_register_script( 'wc-admin-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round', 'ajax-chosen', 'chosen', 'plupload-all', 'stupidtable' ), WC_VERSION );
|
||||
|
||||
wp_register_script( 'ajax-chosen', WC()->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery' . $suffix . '.js', array('jquery', 'chosen'), WC_VERSION );
|
||||
wp_register_script( 'ajax-chosen', WC()->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery' . $suffix . '.js', array( 'jquery', 'chosen' ), WC_VERSION );
|
||||
|
||||
wp_register_script( 'chosen', WC()->plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), WC_VERSION );
|
||||
wp_register_script( 'chosen', WC()->plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||
|
||||
wp_register_script( 'qrcode', WC()->plugin_url() . '/assets/js/admin/jquery.qrcode.min.js', array('jquery'), WC_VERSION );
|
||||
wp_register_script( 'qrcode', WC()->plugin_url() . '/assets/js/admin/jquery.qrcode.min.js', array( 'jquery' ), WC_VERSION );
|
||||
|
||||
wp_register_script( 'stupidtable', WC()->plugin_url() . '/assets/js/stupidtable/stupidtable' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||
|
||||
// Accounting
|
||||
$params = array(
|
||||
|
@ -146,7 +148,7 @@ class WC_Admin_Assets {
|
|||
|
||||
// Products
|
||||
if ( in_array( $screen->id, array( 'edit-product' ) ) ) {
|
||||
wp_enqueue_script( 'woocommerce_quick-edit', WC()->plugin_url() . '/assets/js/admin/quick-edit' . $suffix . '.js', array('jquery'), WC_VERSION );
|
||||
wp_enqueue_script( 'woocommerce_quick-edit', WC()->plugin_url() . '/assets/js/admin/quick-edit' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||
}
|
||||
|
||||
// Meta boxes
|
||||
|
@ -158,11 +160,10 @@ class WC_Admin_Assets {
|
|||
$params = array(
|
||||
'post_id' => isset( $post->ID ) ? $post->ID : '',
|
||||
'plugin_url' => WC()->plugin_url(),
|
||||
'ajax_url' => admin_url('admin-ajax.php'),
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'woocommerce_placeholder_img_src' => wc_placeholder_img_src(),
|
||||
'add_variation_nonce' => wp_create_nonce("add-variation"),
|
||||
'link_variation_nonce' => wp_create_nonce("link-variations"),
|
||||
'delete_variation_nonce' => wp_create_nonce("delete-variation"),
|
||||
'delete_variations_nonce' => wp_create_nonce("delete-variations"),
|
||||
'i18n_link_all_variations' => esc_js( __( 'Are you sure you want to link all variations? This will create a new variation for each and every possible combination of variation attributes (max 50 per run).', 'woocommerce' ) ),
|
||||
'i18n_enter_a_value' => esc_js( __( 'Enter a value', 'woocommerce' ) ),
|
||||
|
@ -218,11 +219,11 @@ class WC_Admin_Assets {
|
|||
'load_billing' => __( 'Load the customer\'s billing information? This will remove any currently entered billing information.', 'woocommerce' ),
|
||||
'load_shipping' => __( 'Load the customer\'s shipping information? This will remove any currently entered shipping information.', 'woocommerce' ),
|
||||
'featured_label' => __( 'Featured', 'woocommerce' ),
|
||||
'prices_include_tax' => esc_attr( get_option('woocommerce_prices_include_tax') ),
|
||||
'prices_include_tax' => esc_attr( get_option( 'woocommerce_prices_include_tax' ) ),
|
||||
'round_at_subtotal' => esc_attr( get_option( 'woocommerce_tax_round_at_subtotal' ) ),
|
||||
'no_customer_selected' => __( 'No customer selected', 'woocommerce' ),
|
||||
'plugin_url' => WC()->plugin_url(),
|
||||
'ajax_url' => admin_url('admin-ajax.php'),
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'order_item_nonce' => wp_create_nonce("order-item"),
|
||||
'add_attribute_nonce' => wp_create_nonce("add-attribute"),
|
||||
'save_attributes_nonce' => wp_create_nonce("save-attributes"),
|
||||
|
@ -258,7 +259,7 @@ class WC_Admin_Assets {
|
|||
// Term ordering - only when sorting by term_order
|
||||
if ( ( strstr( $screen->id, 'edit-pa_' ) || ( ! empty( $_GET['taxonomy'] ) && in_array( $_GET['taxonomy'], apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ) ) ) ) && ! isset( $_GET['orderby'] ) ) {
|
||||
|
||||
wp_register_script( 'woocommerce_term_ordering', WC()->plugin_url() . '/assets/js/admin/term-ordering.js', array('jquery-ui-sortable'), WC_VERSION );
|
||||
wp_register_script( 'woocommerce_term_ordering', WC()->plugin_url() . '/assets/js/admin/term-ordering.js', array( 'jquery-ui-sortable' ), WC_VERSION );
|
||||
wp_enqueue_script( 'woocommerce_term_ordering' );
|
||||
|
||||
$taxonomy = isset( $_GET['taxonomy'] ) ? wc_clean( $_GET['taxonomy'] ) : '';
|
||||
|
@ -271,9 +272,9 @@ class WC_Admin_Assets {
|
|||
}
|
||||
|
||||
// Product sorting - only when sorting by menu order on the products page
|
||||
if ( current_user_can('edit_others_pages') && $screen->id == 'edit-product' && isset( $wp_query->query['orderby'] ) && $wp_query->query['orderby'] == 'menu_order title' ) {
|
||||
if ( current_user_can( 'edit_others_pages' ) && $screen->id == 'edit-product' && isset( $wp_query->query['orderby'] ) && $wp_query->query['orderby'] == 'menu_order title' ) {
|
||||
|
||||
wp_enqueue_script( 'woocommerce_product_ordering', WC()->plugin_url() . '/assets/js/admin/product-ordering.js', array('jquery-ui-sortable'), WC_VERSION, true );
|
||||
wp_enqueue_script( 'woocommerce_product_ordering', WC()->plugin_url() . '/assets/js/admin/product-ordering.js', array( 'jquery-ui-sortable' ), WC_VERSION, true );
|
||||
|
||||
}
|
||||
|
||||
|
@ -281,7 +282,7 @@ class WC_Admin_Assets {
|
|||
if ( in_array( $screen->id, apply_filters( 'woocommerce_reports_screen_ids', array( $wc_screen_id . '_page_wc-reports', 'dashboard' ) ) ) ) {
|
||||
wp_enqueue_script( 'wc-reports', WC()->plugin_url() . '/assets/js/admin/reports' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker' ), WC_VERSION );
|
||||
wp_enqueue_script( 'flot', WC()->plugin_url() . '/assets/js/admin/jquery.flot' . $suffix . '.js', array( 'jquery' ), WC_VERSION );
|
||||
wp_enqueue_script( 'flot-resize', WC()->plugin_url() . '/assets/js/admin/jquery.flot.resize' . $suffix . '.js', array('jquery', 'flot'), WC_VERSION );
|
||||
wp_enqueue_script( 'flot-resize', WC()->plugin_url() . '/assets/js/admin/jquery.flot.resize' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
|
||||
wp_enqueue_script( 'flot-time', WC()->plugin_url() . '/assets/js/admin/jquery.flot.time' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
|
||||
wp_enqueue_script( 'flot-pie', WC()->plugin_url() . '/assets/js/admin/jquery.flot.pie' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
|
||||
wp_enqueue_script( 'flot-stack', WC()->plugin_url() . '/assets/js/admin/jquery.flot.stack' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* The attributes section lets users add custom attributes to assign to products - they can also be used in the layered nav widget.
|
||||
*
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.1.0
|
||||
* @author WooThemes
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ class WC_Admin_Attributes {
|
|||
* Handles output of the attributes page in admin.
|
||||
*
|
||||
* Shows the created attributes and lets you add new ones or edit existing ones.
|
||||
* The added attributes are stored in the database and can be used for layered navigation.
|
||||
* The added attributes are stored in the database and can be used for layered navigation.
|
||||
*/
|
||||
public static function output() {
|
||||
global $wpdb;
|
||||
|
@ -167,6 +167,8 @@ class WC_Admin_Attributes {
|
|||
);
|
||||
}
|
||||
|
||||
echo '<div class="updated fade"><p>' . __( 'Attribute updated successfully', 'woocommerce' ) . '</p></div>';
|
||||
|
||||
$action_completed = true;
|
||||
}
|
||||
|
||||
|
@ -205,10 +207,11 @@ class WC_Admin_Attributes {
|
|||
}
|
||||
|
||||
// Show admin interface
|
||||
if ( ! empty( $_GET['edit'] ) )
|
||||
if ( ! empty( $_GET['edit'] ) ) {
|
||||
self::edit_attribute();
|
||||
else
|
||||
} else {
|
||||
self::add_attribute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -221,17 +224,17 @@ class WC_Admin_Attributes {
|
|||
|
||||
$edit = absint( $_GET['edit'] );
|
||||
|
||||
$attribute_to_edit = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = '$edit'");
|
||||
$attribute_to_edit = $wpdb->get_row( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = '$edit'" );
|
||||
|
||||
$att_type = $attribute_to_edit->attribute_type;
|
||||
$att_label = $attribute_to_edit->attribute_label;
|
||||
$att_name = $attribute_to_edit->attribute_name;
|
||||
$att_orderby = $attribute_to_edit->attribute_orderby;
|
||||
$att_type = $attribute_to_edit->attribute_type;
|
||||
$att_label = $attribute_to_edit->attribute_label;
|
||||
$att_name = $attribute_to_edit->attribute_name;
|
||||
$att_orderby = $attribute_to_edit->attribute_orderby;
|
||||
?>
|
||||
<div class="wrap woocommerce">
|
||||
<div class="icon32 icon32-attributes" id="icon-woocommerce"><br/></div>
|
||||
<h2><?php _e( 'Edit Attribute', 'woocommerce' ) ?></h2>
|
||||
<form action="admin.php?page=product_attributes&edit=<?php echo absint( $edit ); ?>" method="post">
|
||||
<h2><?php _e( 'Edit Attribute', 'woocommerce' ) ?></h2>
|
||||
<form action="edit.php?post_type=product&page=product_attributes&edit=<?php echo absint( $edit ); ?>" method="post">
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr class="form-field form-required">
|
||||
|
@ -258,8 +261,8 @@ class WC_Admin_Attributes {
|
|||
</th>
|
||||
<td>
|
||||
<select name="attribute_type" id="attribute_type">
|
||||
<option value="select" <?php selected( $att_type, 'select' ); ?>><?php _e( 'Select', 'woocommerce' ) ?></option>
|
||||
<option value="text" <?php selected( $att_type, 'text' ); ?>><?php _e( 'Text', 'woocommerce' ) ?></option>
|
||||
<option value="select" <?php selected( $att_type, 'select' ); ?>><?php _e( 'Select', 'woocommerce' ); ?></option>
|
||||
<option value="text" <?php selected( $att_type, 'text' ); ?>><?php _e( 'Text', 'woocommerce' ); ?></option>
|
||||
<?php do_action('woocommerce_admin_attribute_types'); ?>
|
||||
</select>
|
||||
<p class="description"><?php _e( 'Determines how you select attributes for products. Under admin panel -> products -> product data -> attributes -> values, <strong>Text</strong> allows manual entry whereas <strong>select</strong> allows pre-configured terms in a drop-down list.', 'woocommerce' ); ?></p>
|
||||
|
@ -271,9 +274,10 @@ class WC_Admin_Attributes {
|
|||
</th>
|
||||
<td>
|
||||
<select name="attribute_orderby" id="attribute_orderby">
|
||||
<option value="menu_order" <?php selected( $att_orderby, 'menu_order' ); ?>><?php _e( 'Custom ordering', 'woocommerce' ) ?></option>
|
||||
<option value="name" <?php selected( $att_orderby, 'name' ); ?>><?php _e( 'Name', 'woocommerce' ) ?></option>
|
||||
<option value="id" <?php selected( $att_orderby, 'id' ); ?>><?php _e( 'Term ID', 'woocommerce' ) ?></option>
|
||||
<option value="menu_order" <?php selected( $att_orderby, 'menu_order' ); ?>><?php _e( 'Custom ordering', 'woocommerce' ); ?></option>
|
||||
<option value="name" <?php selected( $att_orderby, 'name' ); ?>><?php _e( 'Name', 'woocommerce' ); ?></option>
|
||||
<option value="name_num" <?php selected( $att_orderby, 'name_num' ); ?>><?php _e( 'Name (numeric)', 'woocommerce' ); ?></option>
|
||||
<option value="id" <?php selected( $att_orderby, 'id' ); ?>><?php _e( 'Term ID', 'woocommerce' ); ?></option>
|
||||
</select>
|
||||
<p class="description"><?php _e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
|
||||
</td>
|
||||
|
@ -296,80 +300,92 @@ class WC_Admin_Attributes {
|
|||
?>
|
||||
<div class="wrap woocommerce">
|
||||
<div class="icon32 icon32-attributes" id="icon-woocommerce"><br/></div>
|
||||
<h2><?php _e( 'Attributes', 'woocommerce' ) ?></h2>
|
||||
<br class="clear" />
|
||||
<div id="col-container">
|
||||
<div id="col-right">
|
||||
<div class="col-wrap">
|
||||
<table class="widefat attributes-table wp-list-table ui-sortable" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Name', 'woocommerce' ) ?></th>
|
||||
<th scope="col"><?php _e( 'Slug', 'woocommerce' ) ?></th>
|
||||
<th scope="col"><?php _e( 'Type', 'woocommerce' ) ?></th>
|
||||
<th scope="col"><?php _e( 'Order by', 'woocommerce' ) ?></th>
|
||||
<th scope="col" colspan="2"><?php _e( 'Terms', 'woocommerce' ) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
||||
if ( $attribute_taxonomies ) :
|
||||
foreach ($attribute_taxonomies as $tax) :
|
||||
?><tr>
|
||||
<h2><?php _e( 'Attributes', 'woocommerce' ); ?></h2>
|
||||
<br class="clear" />
|
||||
<div id="col-container">
|
||||
<div id="col-right">
|
||||
<div class="col-wrap">
|
||||
<table class="widefat attributes-table wp-list-table ui-sortable" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Name', 'woocommerce' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Slug', 'woocommerce' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Type', 'woocommerce' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Order by', 'woocommerce' ); ?></th>
|
||||
<th scope="col" colspan="2"><?php _e( 'Terms', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if ( $attribute_taxonomies = wc_get_attribute_taxonomies() ) :
|
||||
foreach ( $attribute_taxonomies as $tax ) :
|
||||
?><tr>
|
||||
|
||||
<td><a href="edit-tags.php?taxonomy=<?php echo esc_html(wc_attribute_taxonomy_name($tax->attribute_name)); ?>&post_type=product"><?php echo esc_html( $tax->attribute_label ); ?></a>
|
||||
<td>
|
||||
<strong><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&post_type=product"><?php echo esc_html( $tax->attribute_label ); ?></a></strong>
|
||||
|
||||
<div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg('edit', $tax->attribute_id, 'admin.php?page=product_attributes') ); ?>"><?php _e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg('delete', $tax->attribute_id, 'admin.php?page=product_attributes'), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php _e( 'Delete', 'woocommerce' ); ?></a></span></div>
|
||||
</td>
|
||||
<td><?php echo esc_html( $tax->attribute_name ); ?></td>
|
||||
<td><?php echo esc_html( ucfirst( $tax->attribute_type ) ); ?></td>
|
||||
<td><?php
|
||||
switch ( $tax->attribute_orderby ) {
|
||||
case 'name' :
|
||||
_e( 'Name', 'woocommerce' );
|
||||
break;
|
||||
case 'id' :
|
||||
_e( 'Term ID', 'woocommerce' );
|
||||
break;
|
||||
default:
|
||||
_e( 'Custom ordering', 'woocommerce' );
|
||||
break;
|
||||
}
|
||||
?></td>
|
||||
<td class="attribute-terms"><?php
|
||||
if (taxonomy_exists(wc_attribute_taxonomy_name($tax->attribute_name))) :
|
||||
$terms_array = array();
|
||||
$terms = get_terms( wc_attribute_taxonomy_name($tax->attribute_name), 'orderby=name&hide_empty=0' );
|
||||
if ($terms) :
|
||||
foreach ($terms as $term) :
|
||||
$terms_array[] = $term->name;
|
||||
endforeach;
|
||||
echo implode(', ', $terms_array);
|
||||
else :
|
||||
<div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg( 'edit', $tax->attribute_id, 'edit.php?post_type=product&page=product_attributes' ) ); ?>"><?php _e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'delete', $tax->attribute_id, 'edit.php?post_type=product&page=product_attributes' ), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php _e( 'Delete', 'woocommerce' ); ?></a></span></div>
|
||||
</td>
|
||||
<td><?php echo esc_html( $tax->attribute_name ); ?></td>
|
||||
<td><?php echo esc_html( ucfirst( $tax->attribute_type ) ); ?></td>
|
||||
<td><?php
|
||||
switch ( $tax->attribute_orderby ) {
|
||||
case 'name' :
|
||||
_e( 'Name', 'woocommerce' );
|
||||
break;
|
||||
case 'name_num' :
|
||||
_e( 'Name (numeric)', 'woocommerce' );
|
||||
break;
|
||||
case 'id' :
|
||||
_e( 'Term ID', 'woocommerce' );
|
||||
break;
|
||||
default:
|
||||
_e( 'Custom ordering', 'woocommerce' );
|
||||
break;
|
||||
}
|
||||
?></td>
|
||||
<td class="attribute-terms"><?php
|
||||
$taxonomy = wc_attribute_taxonomy_name( $tax->attribute_name );
|
||||
|
||||
if ( taxonomy_exists( $taxonomy ) ) {
|
||||
$terms = get_terms( $taxonomy, 'hide_empty=0' );
|
||||
|
||||
switch ( $tax->attribute_orderby ) {
|
||||
case 'name_num' :
|
||||
usort( $terms, '_wc_get_product_terms_name_num_usort_callback' );
|
||||
break;
|
||||
case 'parent' :
|
||||
usort( $terms, '_wc_get_product_terms_parent_usort_callback' );
|
||||
break;
|
||||
}
|
||||
|
||||
$terms_string = implode( ', ', wp_list_pluck( $terms, 'name' ) );
|
||||
if ( $terms_string ) {
|
||||
echo $terms_string;
|
||||
} else {
|
||||
echo '<span class="na">–</span>';
|
||||
endif;
|
||||
else :
|
||||
}
|
||||
} else {
|
||||
echo '<span class="na">–</span>';
|
||||
endif;
|
||||
?></td>
|
||||
<td class="attribute-actions"><a href="edit-tags.php?taxonomy=<?php echo esc_html(wc_attribute_taxonomy_name($tax->attribute_name)); ?>&post_type=product" class="button alignright tips configure-terms" data-tip="<?php _e( 'Configure terms', 'woocommerce' ); ?>"><?php _e( 'Configure terms', 'woocommerce' ); ?></a></td>
|
||||
</tr><?php
|
||||
endforeach;
|
||||
else :
|
||||
?><tr><td colspan="6"><?php _e( 'No attributes currently exist.', 'woocommerce' ) ?></td></tr><?php
|
||||
endif;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="col-left">
|
||||
<div class="col-wrap">
|
||||
<div class="form-wrap">
|
||||
<h3><?php _e( 'Add New Attribute', 'woocommerce' ) ?></h3>
|
||||
<p><?php _e( 'Attributes let you define extra product data, such as size or colour. You can use these attributes in the shop sidebar using the "layered nav" widgets. Please note: you cannot rename an attribute later on.', 'woocommerce' ) ?></p>
|
||||
<form action="admin.php?page=product_attributes" method="post">
|
||||
}
|
||||
?></td>
|
||||
<td class="attribute-actions"><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&post_type=product" class="button alignright tips configure-terms" data-tip="<?php _e( 'Configure terms', 'woocommerce' ); ?>"><?php _e( 'Configure terms', 'woocommerce' ); ?></a></td>
|
||||
</tr><?php
|
||||
endforeach;
|
||||
else :
|
||||
?><tr><td colspan="6"><?php _e( 'No attributes currently exist.', 'woocommerce' ) ?></td></tr><?php
|
||||
endif;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="col-left">
|
||||
<div class="col-wrap">
|
||||
<div class="form-wrap">
|
||||
<h3><?php _e( 'Add New Attribute', 'woocommerce' ); ?></h3>
|
||||
<p><?php _e( 'Attributes let you define extra product data, such as size or colour. You can use these attributes in the shop sidebar using the "layered nav" widgets. Please note: you cannot rename an attribute later on.', 'woocommerce' ); ?></p>
|
||||
<form action="edit.php?post_type=product&page=product_attributes" method="post">
|
||||
<div class="form-field">
|
||||
<label for="attribute_label"><?php _e( 'Name', 'woocommerce' ); ?></label>
|
||||
<input name="attribute_label" id="attribute_label" type="text" value="" />
|
||||
|
@ -386,7 +402,7 @@ class WC_Admin_Attributes {
|
|||
<label for="attribute_type"><?php _e( 'Type', 'woocommerce' ); ?></label>
|
||||
<select name="attribute_type" id="attribute_type">
|
||||
<option value="select"><?php _e( 'Select', 'woocommerce' ) ?></option>
|
||||
<option value="text"><?php _e( 'Text', 'woocommerce' ) ?></option>
|
||||
<option value="text"><?php _e( 'Text', 'woocommerce' ); ?></option>
|
||||
<?php do_action('woocommerce_admin_attribute_types'); ?>
|
||||
</select>
|
||||
<p class="description"><?php _e( 'Determines how you select attributes for products. Under admin panel -> products -> product data -> attributes -> values, <strong>Text</strong> allows manual entry whereas <strong>select</strong> allows pre-configured terms in a drop-down list.', 'woocommerce' ); ?></p>
|
||||
|
@ -395,28 +411,29 @@ class WC_Admin_Attributes {
|
|||
<div class="form-field">
|
||||
<label for="attribute_orderby"><?php _e( 'Default sort order', 'woocommerce' ); ?></label>
|
||||
<select name="attribute_orderby" id="attribute_orderby">
|
||||
<option value="menu_order"><?php _e( 'Custom ordering', 'woocommerce' ) ?></option>
|
||||
<option value="name"><?php _e( 'Name', 'woocommerce' ) ?></option>
|
||||
<option value="id"><?php _e( 'Term ID', 'woocommerce' ) ?></option>
|
||||
<option value="menu_order"><?php _e( 'Custom ordering', 'woocommerce' ); ?></option>
|
||||
<option value="name"><?php _e( 'Name', 'woocommerce' ); ?></option>
|
||||
<option value="id"><?php _e( 'Term ID', 'woocommerce' ); ?></option>
|
||||
</select>
|
||||
<p class="description"><?php _e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
|
||||
</div>
|
||||
|
||||
<p class="submit"><input type="submit" name="add_new_attribute" id="submit" class="button" value="<?php _e( 'Add Attribute', 'woocommerce' ); ?>"></p>
|
||||
<p class="submit"><input type="submit" name="add_new_attribute" id="submit" class="button button-primary" value="<?php _e( 'Add Attribute', 'woocommerce' ); ?>"></p>
|
||||
<?php wp_nonce_field( 'woocommerce-add-new_attribute' ); ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
jQuery('a.delete').click(function(){
|
||||
var answer = confirm ("<?php _e( 'Are you sure you want to delete this attribute?', 'woocommerce' ); ?>");
|
||||
if (answer) return true;
|
||||
jQuery( 'a.delete' ).click( function() {
|
||||
if ( window.confirm( "<?php _e( 'Are you sure you want to delete this attribute?', 'woocommerce' ); ?>" ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -71,14 +71,11 @@ class WC_Admin_Post_Types {
|
|||
add_action( 'before_delete_post', array( $this, 'delete_order_items' ) );
|
||||
|
||||
// Edit post screens
|
||||
add_filter( 'media_view_strings', array( $this, 'media_view_strings' ), 10, 2 );
|
||||
add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 );
|
||||
add_action( 'edit_form_after_title', array( $this, 'edit_form_after_title' ) );
|
||||
add_filter( 'media_view_strings', array( $this, 'change_insert_into_post' ) );
|
||||
add_action( 'post_submitbox_misc_actions', array( $this, 'product_data_visibility' ) );
|
||||
|
||||
$this->change_featured_image_text();
|
||||
|
||||
// Uploads
|
||||
add_filter( 'upload_dir', array( $this, 'upload_dir' ) );
|
||||
add_action( 'media_upload_downloadable_product', array( $this, 'media_upload_downloadable_product' ) );
|
||||
|
@ -548,7 +545,11 @@ class WC_Admin_Post_Types {
|
|||
|
||||
break;
|
||||
case 'order_total' :
|
||||
echo esc_html( strip_tags( $the_order->get_formatted_order_total() ) );
|
||||
if ( $the_order->get_total_refunded() > 0 ) {
|
||||
echo '<del>' . strip_tags( $the_order->get_formatted_order_total() ) . '</del> <ins>' . wc_price( $the_order->get_total() - $the_order->get_total_refunded(), array( 'currency' => $the_order->get_order_currency() ) ) . '</ins>';
|
||||
} else {
|
||||
echo esc_html( strip_tags( $the_order->get_formatted_order_total() ) );
|
||||
}
|
||||
|
||||
if ( $the_order->payment_method_title ) {
|
||||
echo '<small class="meta">' . __( 'Via', 'woocommerce' ) . ' ' . esc_html( $the_order->payment_method_title ) . '</small>';
|
||||
|
@ -1914,42 +1915,6 @@ class WC_Admin_Post_Types {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change text without slow getext filter
|
||||
*/
|
||||
public function change_featured_image_text() {
|
||||
global $l10n;
|
||||
if ( isset( $l10n['default'] ) && isset( $l10n['default']->entries ) ) {
|
||||
foreach ( $l10n['default']->entries as $entry_key => $entries ) {
|
||||
foreach ( $entries->translations as $key => $value ) {
|
||||
if ( 'Featured Image' == $value ) {
|
||||
$l10n['default']->entries[ $entry_key ]->translations[ $key ] = __( 'Product Image', 'woocommerce' );
|
||||
} elseif ( 'Remove featured image' == $value ) {
|
||||
$l10n['default']->entries[ $entry_key ]->translations[ $key ] = __( 'Remove product image', 'woocommerce' );
|
||||
} elseif ( 'Set featured image' == $value ) {
|
||||
$l10n['default']->entries[ $entry_key ]->translations[ $key ] = __( 'Set product image', 'woocommerce' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change "Featured Image" to "Product Image" throughout media modals.
|
||||
*
|
||||
* @param array $strings Array of strings to translate.
|
||||
* @param object $post
|
||||
* @return array
|
||||
*/
|
||||
public function media_view_strings( $strings = array(), $post = null ) {
|
||||
if ( isset( $post->post_type ) && 'product' == $post->post_type ) {
|
||||
$strings['setFeaturedImageTitle'] = __( 'Set product image', 'woocommerce' );
|
||||
$strings['setFeaturedImage'] = __( 'Set product image', 'woocommerce' );
|
||||
}
|
||||
|
||||
return $strings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change title boxes in admin.
|
||||
* @param string $text
|
||||
|
|
|
@ -445,7 +445,7 @@ class WC_Meta_Box_Product_Data {
|
|||
// Any set?
|
||||
$has_terms = ( is_wp_error( $post_terms ) || ! $post_terms || sizeof( $post_terms ) == 0 ) ? 0 : 1;
|
||||
?>
|
||||
<div class="woocommerce_attribute wc-metabox closed taxonomy <?php echo $attribute_taxonomy_name; ?>" rel="<?php echo $position; ?>" <?php if ( ! $has_terms ) echo 'style="display:none"'; ?>>
|
||||
<div data-taxonomy="<?php echo esc_attr( $attribute_taxonomy_name ); ?>" class="woocommerce_attribute wc-metabox closed taxonomy <?php echo esc_attr( $attribute_taxonomy_name ); ?>" rel="<?php echo $position; ?>" <?php if ( ! $has_terms ) echo 'style="display:none"'; ?>>
|
||||
<h3>
|
||||
<button type="button" class="remove_row button"><?php _e( 'Remove', 'woocommerce' ); ?></button>
|
||||
<div class="handlediv" title="<?php _e( 'Click to toggle', 'woocommerce' ); ?>"></div>
|
||||
|
|
|
@ -64,7 +64,7 @@ class WC_Meta_Box_Product_Images {
|
|||
* Save meta box data
|
||||
*/
|
||||
public static function save( $post_id, $post ) {
|
||||
$attachment_ids = array_filter( explode( ',', wc_clean( $_POST['product_image_gallery'] ) ) );
|
||||
$attachment_ids = isset( $_POST['product_image_gallery'] ) ? array_filter( explode( ',', wc_clean( $_POST['product_image_gallery'] ) ) ) : array();
|
||||
|
||||
update_post_meta( $post_id, '_product_image_gallery', implode( ',', $attachment_ids ) );
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php echo wc_placeholder_img( 'shop_thumbnail' ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="name">
|
||||
<td class="name" data-sort-value="<?php echo esc_attr( $item['name'] ); ?>">
|
||||
|
||||
<?php echo ( $_product && $_product->get_sku() ) ? esc_html( $_product->get_sku() ) . ' – ' : ''; ?>
|
||||
|
||||
|
@ -155,7 +155,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
<?php do_action( 'woocommerce_admin_order_item_values', $_product, $item, absint( $item_id ) ); ?>
|
||||
|
||||
<td class="item_cost" width="1%">
|
||||
<td class="item_cost" width="1%" data-sort-value="<?php echo esc_attr( $order->get_item_subtotal( $item, false, true ) ); ?>">
|
||||
<div class="view">
|
||||
<?php
|
||||
if ( isset( $item['line_total'] ) ) {
|
||||
|
@ -187,7 +187,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
</div>
|
||||
</td>
|
||||
|
||||
<td class="line_cost" width="1%">
|
||||
<td class="line_cost" width="1%" data-sort-value="<?php echo esc_attr( isset( $item['line_total'] ) ? $item['line_total'] : '' ); ?>">
|
||||
<div class="view">
|
||||
<?php
|
||||
if ( isset( $item['line_total'] ) ) {
|
||||
|
|
|
@ -48,13 +48,13 @@ if ( wc_tax_enabled() ) {
|
|||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" class="check-column" /></th>
|
||||
<th class="item" colspan="2"><?php _e( 'Item', 'woocommerce' ); ?></th>
|
||||
<th class="item sortable" colspan="2" data-sort="string-ins"><?php _e( 'Item', 'woocommerce' ); ?></th>
|
||||
|
||||
<?php do_action( 'woocommerce_admin_order_item_headers' ); ?>
|
||||
|
||||
<th class="item_cost"><?php _e( 'Cost', 'woocommerce' ); ?></th>
|
||||
<th class="quantity"><?php _e( 'Qty', 'woocommerce' ); ?></th>
|
||||
<th class="line_cost"><?php _e( 'Total', 'woocommerce' ); ?></th>
|
||||
<th class="item_cost sortable" data-sort="float"><?php _e( 'Cost', 'woocommerce' ); ?></th>
|
||||
<th class="quantity sortable" data-sort="int"><?php _e( 'Qty', 'woocommerce' ); ?></th>
|
||||
<th class="line_cost sortable" data-sort="float"><?php _e( 'Total', 'woocommerce' ); ?></th>
|
||||
|
||||
<?php
|
||||
if ( empty( $legacy_order ) && wc_tax_enabled() ) :
|
||||
|
@ -74,7 +74,6 @@ if ( wc_tax_enabled() ) {
|
|||
endforeach;
|
||||
endif;
|
||||
?>
|
||||
|
||||
<th class="wc-order-edit-line-item" width="1%"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -173,7 +172,13 @@ if ( wc_tax_enabled() ) {
|
|||
<tr>
|
||||
<td class="label"><?php _e( 'Order Total', 'woocommerce' ); ?>:</td>
|
||||
<td class="total">
|
||||
<div class="view"><?php echo wc_price( $order->get_total(), array( 'currency' => $order->get_order_currency() ) ); ?></div>
|
||||
<div class="view"><?php
|
||||
if ( $order->get_total_refunded() > 0 ) {
|
||||
echo '<del>' . strip_tags( $order->get_formatted_order_total() ) . '</del> <ins>' . wc_price( $order->get_total() - $order->get_total_refunded(), array( 'currency' => $order->get_order_currency() ) ) . '</ins>';
|
||||
} else {
|
||||
echo esc_html( strip_tags( $order->get_formatted_order_total() ) );
|
||||
}
|
||||
?></div>
|
||||
<div class="edit" style="display: none;">
|
||||
<input type="text" class="wc_input_price" id="_order_total" name="_order_total" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $data['_order_total'][0] ) ) ? esc_attr( wc_format_localized_price( $data['_order_total'][0] ) ) : ''; ?>" />
|
||||
<div class="clear"></div>
|
||||
|
|
|
@ -230,6 +230,14 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
|
|||
'name' => 'order_item_qty'
|
||||
)
|
||||
),
|
||||
'where_meta' => array(
|
||||
array(
|
||||
'type' => 'order_item_meta',
|
||||
'meta_key' => '_line_subtotal',
|
||||
'meta_value' => '0',
|
||||
'operator' => '>'
|
||||
)
|
||||
),
|
||||
'order_by' => 'order_item_qty DESC',
|
||||
'group_by' => 'product_id',
|
||||
'limit' => 12,
|
||||
|
@ -252,6 +260,56 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
|
|||
?>
|
||||
</table>
|
||||
</div>
|
||||
<h4 class="section_title"><span><?php _e( 'Top Freebies', 'woocommerce' ); ?></span></h4>
|
||||
<div class="section">
|
||||
<table cellspacing="0">
|
||||
<?php
|
||||
$top_freebies = $this->get_order_report_data( array(
|
||||
'data' => array(
|
||||
'_product_id' => array(
|
||||
'type' => 'order_item_meta',
|
||||
'order_item_type' => 'line_item',
|
||||
'function' => '',
|
||||
'name' => 'product_id'
|
||||
),
|
||||
'_qty' => array(
|
||||
'type' => 'order_item_meta',
|
||||
'order_item_type' => 'line_item',
|
||||
'function' => 'SUM',
|
||||
'name' => 'order_item_qty'
|
||||
)
|
||||
),
|
||||
'where_meta' => array(
|
||||
array(
|
||||
'type' => 'order_item_meta',
|
||||
'meta_key' => '_line_subtotal',
|
||||
'meta_value' => '0',
|
||||
'operator' => '='
|
||||
)
|
||||
),
|
||||
'order_by' => 'order_item_qty DESC',
|
||||
'group_by' => 'product_id',
|
||||
'limit' => 12,
|
||||
'query_type' => 'get_results',
|
||||
'filter_range' => true,
|
||||
'order_types' => wc_get_order_types( 'order-count' ),
|
||||
'nocache' => true
|
||||
) );
|
||||
|
||||
if ( $top_freebies ) {
|
||||
foreach ( $top_freebies as $product ) {
|
||||
echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '">
|
||||
<td class="count">' . $product->order_item_qty . '</td>
|
||||
<td class="name"><a href="' . add_query_arg( 'product_ids', $product->product_id ) . '">' . get_the_title( $product->product_id ) . '</a></td>
|
||||
<td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'count' ) . '</td>
|
||||
</tr>';
|
||||
}
|
||||
} else {
|
||||
echo '<tr><td colspan="3">' . __( 'No products found in range', 'woocommerce' ) . '</td></tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<h4 class="section_title"><span><?php _e( 'Top Earners', 'woocommerce' ); ?></span></h4>
|
||||
<div class="section">
|
||||
<table cellspacing="0">
|
||||
|
|
|
@ -439,14 +439,18 @@ If enabled on your server, Suhosin may need to be configured to increase its dat
|
|||
$alt = 1;
|
||||
|
||||
foreach ( $check_pages as $page_name => $values ) {
|
||||
|
||||
echo '<tr><td>' . esc_html( $page_name ) . ':</td>';
|
||||
echo '<td class="help"><a href="#" class="help_tip" data-tip="' . esc_attr( $values['help'] ) . '">[?]</a></td><td>';
|
||||
|
||||
$error = false;
|
||||
|
||||
$error = false;
|
||||
$page_id = get_option( $values['option'] );
|
||||
|
||||
if ( $page_id ) {
|
||||
$page_name = '<a href="' . get_edit_post_link( $page_id ) . '" title="' . sprintf( _x( 'Edit %s page', '[WC Pages links in the System Status]', 'woocommerce' ), esc_html( $page_name ) ) . '">' . esc_html( $page_name ) . '</a>';
|
||||
} else {
|
||||
$page_name = esc_html( $page_name );
|
||||
}
|
||||
|
||||
echo '<tr><td>' . $page_name . ':</td>';
|
||||
echo '<td class="help"><a href="#" class="help_tip" data-tip="' . esc_attr( $values['help'] ) . '">[?]</a></td><td>';
|
||||
|
||||
// Page ID check
|
||||
if ( ! $page_id ) {
|
||||
echo '<mark class="error">' . __( 'Page not set', 'woocommerce' ) . '</mark>';
|
||||
|
|
|
@ -441,7 +441,7 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
|
||||
wc_delete_shop_order_transients( $order->id );
|
||||
|
||||
do_action( 'woocommerce_api_create_order', $order->id, $this );
|
||||
do_action( 'woocommerce_api_create_order', $order->id, $data );
|
||||
|
||||
return $this->get_order( $order->id );
|
||||
|
||||
|
@ -593,7 +593,7 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
|
||||
wc_delete_shop_order_transients( $order->id );
|
||||
|
||||
do_action( 'woocommerce_api_edit_order', $order->id, $this );
|
||||
do_action( 'woocommerce_api_edit_order', $order->id, $data );
|
||||
|
||||
return $this->get_order( $id );
|
||||
|
||||
|
|
|
@ -66,6 +66,11 @@ class WC_API_Products extends WC_API_Resource {
|
|||
array( array( $this, 'get_product_category' ), WC_API_Server::READABLE ),
|
||||
);
|
||||
|
||||
# GET /products/sku/<product sku>
|
||||
$routes[ $this->base . '/sku/(?P<sku>\w+)' ] = array(
|
||||
array( array( $this, 'get_product_by_sku' ), WC_API_Server::READABLE ),
|
||||
);
|
||||
|
||||
return $routes;
|
||||
}
|
||||
|
||||
|
@ -1808,4 +1813,22 @@ class WC_API_Products extends WC_API_Resource {
|
|||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product by SKU
|
||||
*
|
||||
* @since 2.3.0
|
||||
* @param int $sku the product SKU
|
||||
* @param string $fields
|
||||
* @return array
|
||||
*/
|
||||
public function get_product_by_sku( $sku, $fields = null ) {
|
||||
$id = wc_get_product_id_by_sku( $sku );
|
||||
|
||||
if ( empty( $id ) ) {
|
||||
return new WP_Error( 'woocommerce_api_invalid_product_sku', __( 'Invalid product SKU', 'woocommerce' ), array( 'status' => 404 ) );
|
||||
}
|
||||
|
||||
return $this->get_product( $id, $fields );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ class WC_AJAX {
|
|||
* AJAX update order review on checkout
|
||||
*/
|
||||
public static function update_order_review() {
|
||||
ob_start();
|
||||
|
||||
check_ajax_referer( 'update-order-review', 'security' );
|
||||
|
||||
|
@ -158,7 +159,14 @@ class WC_AJAX {
|
|||
}
|
||||
|
||||
if ( 0 == sizeof( WC()->cart->get_cart() ) ) {
|
||||
echo '<div class="woocommerce-error">' . __( 'Sorry, your session has expired.', 'woocommerce' ) . ' <a href="' . home_url() . '" class="wc-backward">' . __( 'Return to homepage', 'woocommerce' ) . '</a></div>';
|
||||
$data = array(
|
||||
'fragments' => apply_filters( 'woocommerce_update_order_review_fragments', array(
|
||||
'.woocommerce-checkout' => '<div class="woocommerce-error">' . __( 'Sorry, your session has expired.', 'woocommerce' ) . ' <a href="' . home_url() . '" class="wc-backward">' . __( 'Return to homepage', 'woocommerce' ) . '</a></div>'
|
||||
) )
|
||||
);
|
||||
|
||||
wp_send_json( $data );
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
|
@ -253,7 +261,22 @@ class WC_AJAX {
|
|||
|
||||
WC()->cart->calculate_totals();
|
||||
|
||||
do_action( 'woocommerce_checkout_order_review', true ); // Display review order table
|
||||
ob_start();
|
||||
woocommerce_order_review();
|
||||
$woocommerce_order_review = ob_get_clean();
|
||||
|
||||
ob_start();
|
||||
woocommerce_checkout_payment();
|
||||
$woocommerce_checkout_payment = ob_get_clean();
|
||||
|
||||
$data = array(
|
||||
'fragments' => apply_filters( 'woocommerce_update_order_review_fragments', array(
|
||||
'.woocommerce-checkout-review-order-table' => $woocommerce_order_review,
|
||||
'.woocommerce-checkout-payment' => $woocommerce_checkout_payment
|
||||
) )
|
||||
);
|
||||
|
||||
wp_send_json( $data );
|
||||
|
||||
die();
|
||||
}
|
||||
|
@ -311,32 +334,17 @@ class WC_AJAX {
|
|||
* Feature a product from admin
|
||||
*/
|
||||
public static function feature_product() {
|
||||
if ( ! current_user_can( 'edit_products' ) ) {
|
||||
wp_die( __( 'You do not have sufficient permissions to access this page.', 'woocommerce' ), '', array( 'response' => 403 ) );
|
||||
if ( current_user_can( 'edit_products' ) && check_admin_referer( 'woocommerce-feature-product' ) ) {
|
||||
$product_id = absint( $_GET['product_id'] );
|
||||
|
||||
if ( 'product' === get_post_type( $product_id ) ) {
|
||||
update_post_meta( $product_id, '_featured', get_post_meta( $product_id, '_featured', true ) === 'yes' ? 'no' : 'yes' );
|
||||
|
||||
delete_transient( 'wc_featured_products' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! check_admin_referer( 'woocommerce-feature-product' ) ) {
|
||||
wp_die( __( 'You have taken too long. Please go back and retry.', 'woocommerce' ), '', array( 'response' => 403 ) );
|
||||
}
|
||||
|
||||
$post_id = ! empty( $_GET['product_id'] ) ? (int) $_GET['product_id'] : '';
|
||||
|
||||
if ( ! $post_id || get_post_type( $post_id ) !== 'product' ) {
|
||||
die;
|
||||
}
|
||||
|
||||
$featured = get_post_meta( $post_id, '_featured', true );
|
||||
|
||||
if ( 'yes' === $featured ) {
|
||||
update_post_meta( $post_id, '_featured', 'no' );
|
||||
} else {
|
||||
update_post_meta( $post_id, '_featured', 'yes' );
|
||||
}
|
||||
|
||||
delete_transient( 'wc_featured_products' );
|
||||
|
||||
wp_safe_redirect( wp_get_referer() ? remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), wp_get_referer() ) : admin_url( 'edit.php?post_type=shop_order' ) );
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
|
@ -344,31 +352,17 @@ class WC_AJAX {
|
|||
* Mark an order with a status
|
||||
*/
|
||||
public static function mark_order_status() {
|
||||
if ( ! current_user_can( 'edit_shop_orders' ) ) {
|
||||
wp_die( __( 'You do not have sufficient permissions to access this page.', 'woocommerce' ), '', array( 'response' => 403 ) );
|
||||
if ( current_user_can( 'edit_shop_orders' ) && check_admin_referer( 'woocommerce-mark-order-status' ) ) {
|
||||
$status = sanitize_text_field( $_GET['status'] );
|
||||
$order_id = absint( $_GET['order_id'] );
|
||||
|
||||
if ( wc_is_order_status( 'wc-' . $status ) && $order_id ) {
|
||||
$order = wc_get_order( $order_id );
|
||||
$order->update_status( $status );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! check_admin_referer( 'woocommerce-mark-order-status' ) ) {
|
||||
wp_die( __( 'You have taken too long. Please go back and retry.', 'woocommerce' ), '', array( 'response' => 403 ) );
|
||||
}
|
||||
|
||||
$status = isset( $_GET['status'] ) ? esc_attr( $_GET['status'] ) : '';
|
||||
$order_statuses = wc_get_order_statuses();
|
||||
|
||||
if ( ! $status || ! isset( $order_statuses[ 'wc-' . $status ] ) ) {
|
||||
die();
|
||||
}
|
||||
|
||||
$order_id = isset( $_GET['order_id'] ) && (int) $_GET['order_id'] ? (int) $_GET['order_id'] : '';
|
||||
if ( ! $order_id ) {
|
||||
die();
|
||||
}
|
||||
|
||||
$order = wc_get_order( $order_id );
|
||||
$order->update_status( $status );
|
||||
|
||||
wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url( 'edit.php?post_type=shop_order' ) );
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
|
@ -403,28 +397,10 @@ class WC_AJAX {
|
|||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete variation via ajax function
|
||||
*/
|
||||
public static function remove_variation() {
|
||||
|
||||
check_ajax_referer( 'delete-variation', 'security' );
|
||||
|
||||
$variation_id = intval( $_POST['variation_id'] );
|
||||
$variation = get_post( $variation_id );
|
||||
|
||||
if ( $variation && 'product_variation' == $variation->post_type ) {
|
||||
wp_delete_post( $variation_id );
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete variations via ajax function
|
||||
*/
|
||||
public static function remove_variations() {
|
||||
|
||||
check_ajax_referer( 'delete-variations', 'security' );
|
||||
|
||||
$variation_ids = (array) $_POST['variation_ids'];
|
||||
|
|
|
@ -709,7 +709,7 @@ class WC_Cart {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a specific itme in the cart
|
||||
* Returns a specific item in the cart
|
||||
*
|
||||
* @return array item data
|
||||
*/
|
||||
|
|
|
@ -975,4 +975,4 @@ class WC_Countries {
|
|||
// Return
|
||||
return $address_fields;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -388,7 +388,7 @@ class WC_Form_Handler {
|
|||
}
|
||||
|
||||
wc_add_notice( sprintf( __( '%s removed. %sUndo?%s', 'woocommerce' ), $product->get_title(), '<a href="' . $undo . '">', '</a>' ) );
|
||||
$referer = wp_get_referer() ? remove_query_arg( array( 'remove_item' ), wp_get_referer() ) : WC()->cart->get_cart_url();
|
||||
$referer = wp_get_referer() ? remove_query_arg( array( 'remove_item', 'add-to-cart', 'added-to-cart' ), add_query_arg( 'removed_item', '1', wp_get_referer() ) ) : WC()->cart->get_cart_url();
|
||||
wp_safe_redirect( $referer );
|
||||
exit;
|
||||
|
||||
|
|
|
@ -151,6 +151,20 @@ class WC_Payment_Gateways {
|
|||
return apply_filters( 'woocommerce_available_payment_gateways', $_available_gateways );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current, active gateway
|
||||
*/
|
||||
public function set_current_gateway( $gateways ) {
|
||||
$default = get_option( 'woocommerce_default_gateway', current( array_keys( $gateways ) ) );
|
||||
$current = WC()->session->get( 'chosen_payment_method', $default );
|
||||
|
||||
if ( isset( $gateways[ $current ] ) ) {
|
||||
$gateways[ $current ]->set_current();
|
||||
} elseif ( isset( $gateways[ $default ] ) ) {
|
||||
$gateways[ $default ]->set_current();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save options in admin.
|
||||
*
|
||||
|
|
|
@ -171,10 +171,11 @@ class WC_Product_Variation extends WC_Product {
|
|||
/**
|
||||
* Wrapper for get_permalink. Adds this variations attributes to the URL.
|
||||
*
|
||||
* @param $cart item array If the cart item is passed, we can get a link containing the exact attributes selected for the variation, rather than the default attributes.
|
||||
* @return string
|
||||
*/
|
||||
public function get_permalink() {
|
||||
return add_query_arg( array_filter( $this->variation_data ), get_permalink( $this->id ) );
|
||||
public function get_permalink( $cart_item = null ) {
|
||||
return add_query_arg( array_filter( isset( $cart_item['variation'] ) ? $cart_item['variation'] : $this->variation_data ), get_permalink( $this->id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -500,7 +500,7 @@ class WC_Shortcodes {
|
|||
if ( ! empty( $atts['id'] ) ) {
|
||||
$product_data = get_post( $atts['id'] );
|
||||
} elseif ( ! empty( $atts['sku'] ) ) {
|
||||
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $atts['sku'] ) );
|
||||
$product_id = wc_get_product_id_by_sku( $atts['sku'] );
|
||||
$product_data = get_post( $product_id );
|
||||
} else {
|
||||
return '';
|
||||
|
@ -546,7 +546,7 @@ class WC_Shortcodes {
|
|||
if ( isset( $atts['id'] ) ) {
|
||||
$product_data = get_post( $atts['id'] );
|
||||
} elseif ( isset( $atts['sku'] ) ) {
|
||||
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $atts['sku'] ) );
|
||||
$product_id = wc_get_product_id_by_sku( $atts['sku'] );
|
||||
$product_data = get_post( $product_id );
|
||||
} else {
|
||||
return '';
|
||||
|
|
|
@ -510,11 +510,20 @@ class WC_Email extends WC_Settings_API {
|
|||
if ( wp_mkdir_p( dirname( get_stylesheet_directory() . '/woocommerce/' . $this->$template ) ) && ! file_exists( get_stylesheet_directory() . '/woocommerce/' . $this->$template ) ) {
|
||||
|
||||
// Locate template file
|
||||
$core_file = $this->template_base . $this->$template;
|
||||
$template_file = apply_filters( 'woocommerce_locate_core_template', $core_file, $this->$template, $this->template_base );
|
||||
$core_file = $this->template_base . $this->$template;
|
||||
$template_file = apply_filters( 'woocommerce_locate_core_template', $core_file, $this->$template, $this->template_base );
|
||||
|
||||
// Copy template file
|
||||
copy( $template_file, get_stylesheet_directory() . '/woocommerce/' . $this->$template );
|
||||
|
||||
/**
|
||||
* woocommerce_copy_email_template action hook
|
||||
*
|
||||
* @param string $template The copied template type
|
||||
* @param string $email The email object
|
||||
*/
|
||||
do_action( 'woocommerce_copy_email_template', $template, $this );
|
||||
|
||||
echo '<div class="updated fade"><p>' . __( 'Template file copied to theme.', 'woocommerce' ) . '</p></div>';
|
||||
}
|
||||
}
|
||||
|
@ -526,6 +535,15 @@ class WC_Email extends WC_Settings_API {
|
|||
|
||||
if ( file_exists( get_stylesheet_directory() . '/woocommerce/' . $this->$template ) ) {
|
||||
unlink( get_stylesheet_directory() . '/woocommerce/' . $this->$template );
|
||||
|
||||
/**
|
||||
* woocommerce_delete_email_template action hook
|
||||
*
|
||||
* @param string $template The deleted template type
|
||||
* @param string $email The email object
|
||||
*/
|
||||
do_action( 'woocommerce_delete_email_template', $template, $this->$template );
|
||||
|
||||
echo '<div class="updated fade"><p>' . __( 'Template file deleted from theme.', 'woocommerce' ) . '</p></div>';
|
||||
}
|
||||
}
|
||||
|
@ -538,10 +556,28 @@ class WC_Email extends WC_Settings_API {
|
|||
|
||||
<?php echo ( ! empty( $this->description ) ) ? wpautop( $this->description ) : ''; ?>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* woocommerce_email_settings_before action hook
|
||||
*
|
||||
* @param string $email The email object
|
||||
*/
|
||||
do_action( 'woocommerce_email_settings_before', $this );
|
||||
?>
|
||||
|
||||
<table class="form-table">
|
||||
<?php $this->generate_settings_html(); ?>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* woocommerce_email_settings_after action hook
|
||||
*
|
||||
* @param string $email The email object
|
||||
*/
|
||||
do_action( 'woocommerce_email_settings_after', $this );
|
||||
?>
|
||||
|
||||
<?php if ( ! empty( $this->template_html ) || ! empty( $this->template_plain ) ) { ?>
|
||||
<div id="template">
|
||||
<?php
|
||||
|
|
|
@ -17,10 +17,14 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
*/
|
||||
class WC_Gateway_BACS extends WC_Payment_Gateway {
|
||||
|
||||
/** @var array Array of locales */
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->id = 'bacs';
|
||||
$this->icon = apply_filters('woocommerce_bacs_icon', '');
|
||||
$this->has_fields = false;
|
||||
|
@ -57,12 +61,14 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
|
||||
// Customer Emails
|
||||
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields
|
||||
*/
|
||||
public function init_form_fields() {
|
||||
|
||||
$this->form_fields = array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||
|
@ -95,13 +101,22 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
'type' => 'account_details'
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* generate_account_details_html function.
|
||||
*/
|
||||
public function generate_account_details_html() {
|
||||
|
||||
ob_start();
|
||||
|
||||
$country = WC()->countries->get_base_country();
|
||||
$locale = $this->get_country_locale();
|
||||
|
||||
// Get sortcode label in the $locale array and use appropriate one
|
||||
$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort Code', 'woocommerce' );
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc"><?php _e( 'Account Details', 'woocommerce' ); ?>:</th>
|
||||
|
@ -113,7 +128,7 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
<th><?php _e( 'Account Name', 'woocommerce' ); ?></th>
|
||||
<th><?php _e( 'Account Number', 'woocommerce' ); ?></th>
|
||||
<th><?php _e( 'Bank Name', 'woocommerce' ); ?></th>
|
||||
<th><?php _e( 'Sort Code', 'woocommerce' ); ?></th>
|
||||
<th><?php echo $sortcode; ?></th>
|
||||
<th><?php _e( 'IBAN', 'woocommerce' ); ?></th>
|
||||
<th><?php _e( 'BIC / Swift', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
|
@ -168,12 +183,14 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
</tr>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Save account details table
|
||||
*/
|
||||
public function save_account_details() {
|
||||
|
||||
$accounts = array();
|
||||
|
||||
if ( isset( $_POST['bacs_account_name'] ) ) {
|
||||
|
@ -202,16 +219,19 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
}
|
||||
|
||||
update_option( 'woocommerce_bacs_accounts', $accounts );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Output for the order received page.
|
||||
*/
|
||||
public function thankyou_page( $order_id ) {
|
||||
|
||||
if ( $this->instructions ) {
|
||||
echo wpautop( wptexturize( wp_kses_post( $this->instructions ) ) );
|
||||
}
|
||||
$this->bank_details( $order_id );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,28 +244,42 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
* @return void
|
||||
*/
|
||||
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
|
||||
|
||||
if ( ! $sent_to_admin && 'bacs' === $order->payment_method && $order->has_status( 'on-hold' ) ) {
|
||||
if ( $this->instructions ) {
|
||||
echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
|
||||
}
|
||||
$this->bank_details( $order->id );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bank details and place into a list format
|
||||
*/
|
||||
private function bank_details( $order_id = '' ) {
|
||||
|
||||
if ( empty( $this->account_details ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get order and store in $order
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
// Get the order country and country $locale
|
||||
$country = $order->billing_country;
|
||||
$locale = $this->get_country_locale();
|
||||
|
||||
// Get sortcode label in the $locale array and use appropriate one
|
||||
$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort Code', 'woocommerce' );
|
||||
|
||||
echo '<h2>' . __( 'Our Bank Details', 'woocommerce' ) . '</h2>' . PHP_EOL;
|
||||
|
||||
$bacs_accounts = apply_filters( 'woocommerce_bacs_accounts', $this->account_details );
|
||||
|
||||
if ( ! empty( $bacs_accounts ) ) {
|
||||
foreach ( $bacs_accounts as $bacs_account ) {
|
||||
|
||||
$bacs_account = (object) $bacs_account;
|
||||
|
||||
if ( $bacs_account->account_name || $bacs_account->bank_name ) {
|
||||
|
@ -261,7 +295,7 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
'value' => $bacs_account->account_number
|
||||
),
|
||||
'sort_code' => array(
|
||||
'label' => __( 'Sort Code', 'woocommerce' ),
|
||||
'label' => $sortcode,
|
||||
'value' => $bacs_account->sort_code
|
||||
),
|
||||
'iban' => array(
|
||||
|
@ -283,6 +317,7 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
echo '</ul>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -309,5 +344,66 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
'result' => 'success',
|
||||
'redirect' => $this->get_return_url( $order )
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get country locale if localized
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function get_country_locale() {
|
||||
|
||||
if ( ! $this->locale ) {
|
||||
|
||||
// Locale information to be used - only those that are not 'Sort Code'
|
||||
$this->locale = apply_filters( 'woocommerce_get_bacs_locale', array(
|
||||
'AU' => array(
|
||||
'sortcode' => array(
|
||||
'label' => __( 'BSB', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'CA' => array(
|
||||
'sortcode' => array(
|
||||
'label' => __( 'Bank Transit Number', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'IN' => array(
|
||||
'sortcode' => array(
|
||||
'label' => __( 'IFSC', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'IT' => array(
|
||||
'sortcode' => array(
|
||||
'label' => __( 'Branch Sort', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'NZ' => array(
|
||||
'sortcode' => array(
|
||||
'label' => __( 'Bank Code', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'SE' => array(
|
||||
'sortcode' => array(
|
||||
'label' => __( 'Bank Code', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'US' => array(
|
||||
'sortcode' => array(
|
||||
'label' => __( 'Routing Number', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'ZA' => array(
|
||||
'sortcode' => array(
|
||||
'label' => __( 'Branch Code', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
return $this->locale;
|
||||
|
||||
}
|
||||
}
|
|
@ -33,6 +33,16 @@ function wc_get_order_statuses() {
|
|||
return apply_filters( 'wc_order_statuses', $order_statuses );
|
||||
}
|
||||
|
||||
/**
|
||||
* See if a string is an order status.
|
||||
* @param string $maybe_status Status, including any wc- prefix
|
||||
* @return bool
|
||||
*/
|
||||
function wc_is_order_status( $maybe_status ) {
|
||||
$order_statuses = wc_get_order_statuses();
|
||||
return isset( $order_statuses[ $maybe_status ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function for returning orders, uses the WC_Order_Factory class.
|
||||
*
|
||||
|
|
|
@ -523,3 +523,18 @@ function wc_product_has_unique_sku( $product_id, $sku ) {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get product ID by SKU.
|
||||
*
|
||||
* @since 2.3.0
|
||||
* @param string $sku
|
||||
* @return int
|
||||
*/
|
||||
function wc_get_product_id_by_sku( $sku ) {
|
||||
global $wpdb;
|
||||
|
||||
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku ) );
|
||||
|
||||
return ( $product_id ) ? intval( $product_id ) : 0;
|
||||
}
|
||||
|
|
|
@ -110,9 +110,7 @@ if ( ! function_exists( 'woocommerce_reset_loop' ) ) {
|
|||
/**
|
||||
* Reset the loop's index and columns when we're done outputting a product loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_reset_loop() {
|
||||
global $woocommerce_loop;
|
||||
|
@ -291,8 +289,6 @@ if ( ! function_exists( 'woocommerce_content' ) ) {
|
|||
* which people can add to their themes to add basic woocommerce support
|
||||
* without hooks or modifying core templates.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_content() {
|
||||
|
||||
|
@ -349,8 +345,6 @@ if ( ! function_exists( 'woocommerce_output_content_wrapper' ) ) {
|
|||
/**
|
||||
* Output the start of the page wrapper.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_output_content_wrapper() {
|
||||
wc_get_template( 'global/wrapper-start.php' );
|
||||
|
@ -361,8 +355,6 @@ if ( ! function_exists( 'woocommerce_output_content_wrapper_end' ) ) {
|
|||
/**
|
||||
* Output the end of the page wrapper.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_output_content_wrapper_end() {
|
||||
wc_get_template( 'global/wrapper-end.php' );
|
||||
|
@ -374,8 +366,6 @@ if ( ! function_exists( 'woocommerce_get_sidebar' ) ) {
|
|||
/**
|
||||
* Get the shop sidebar template.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_get_sidebar() {
|
||||
wc_get_template( 'global/sidebar.php' );
|
||||
|
@ -387,8 +377,6 @@ if ( ! function_exists( 'woocommerce_demo_store' ) ) {
|
|||
/**
|
||||
* Adds a demo store banner to the site if enabled
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_demo_store() {
|
||||
if ( !is_store_notice_showing() )
|
||||
|
@ -445,7 +433,6 @@ if ( ! function_exists( 'woocommerce_product_loop_start' ) ) {
|
|||
/**
|
||||
* Output the start of a product loop. By default this is a UL
|
||||
*
|
||||
* @access public
|
||||
* @param bool $echo
|
||||
* @return string
|
||||
*/
|
||||
|
@ -463,7 +450,6 @@ if ( ! function_exists( 'woocommerce_product_loop_end' ) ) {
|
|||
/**
|
||||
* Output the end of a product loop. By default this is a UL
|
||||
*
|
||||
* @access public
|
||||
* @param bool $echo
|
||||
* @return string
|
||||
*/
|
||||
|
@ -483,9 +469,7 @@ if ( ! function_exists( 'woocommerce_taxonomy_archive_description' ) ) {
|
|||
/**
|
||||
* Show an archive description on taxonomy archives
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Archives
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_taxonomy_archive_description() {
|
||||
if ( is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) == 0 ) {
|
||||
|
@ -501,9 +485,7 @@ if ( ! function_exists( 'woocommerce_product_archive_description' ) ) {
|
|||
/**
|
||||
* Show a shop page description on product archives
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Archives
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_archive_description() {
|
||||
if ( is_post_type_archive( 'product' ) && get_query_var( 'paged' ) == 0 ) {
|
||||
|
@ -523,9 +505,7 @@ if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) {
|
|||
/**
|
||||
* Get the add to cart template for the loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_loop_add_to_cart( $args = array() ) {
|
||||
wc_get_template( 'loop/add-to-cart.php' , $args );
|
||||
|
@ -536,9 +516,7 @@ if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
|
|||
/**
|
||||
* Get the product thumbnail for the loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_loop_product_thumbnail() {
|
||||
echo woocommerce_get_product_thumbnail();
|
||||
|
@ -549,9 +527,7 @@ if ( ! function_exists( 'woocommerce_template_loop_price' ) ) {
|
|||
/**
|
||||
* Get the product price for the loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_loop_price() {
|
||||
wc_get_template( 'loop/price.php' );
|
||||
|
@ -562,9 +538,7 @@ if ( ! function_exists( 'woocommerce_template_loop_rating' ) ) {
|
|||
/**
|
||||
* Display the average rating in the loop
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_loop_rating() {
|
||||
wc_get_template( 'loop/rating.php' );
|
||||
|
@ -575,9 +549,7 @@ if ( ! function_exists( 'woocommerce_show_product_loop_sale_flash' ) ) {
|
|||
/**
|
||||
* Get the sale flash for the loop.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_show_product_loop_sale_flash() {
|
||||
wc_get_template( 'loop/sale-flash.php' );
|
||||
|
@ -619,7 +591,6 @@ if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) {
|
|||
/**
|
||||
* Get the product thumbnail, or the placeholder if not set.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @param string $size (default: 'shop_catalog')
|
||||
* @param int $placeholder_width (default: 0)
|
||||
|
@ -642,9 +613,7 @@ if ( ! function_exists( 'woocommerce_result_count' ) ) {
|
|||
/**
|
||||
* Output the result count text (Showing x - x of x results).
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_result_count() {
|
||||
wc_get_template( 'loop/result-count.php' );
|
||||
|
@ -656,9 +625,7 @@ if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) {
|
|||
/**
|
||||
* Output the product sorting options.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_catalog_ordering() {
|
||||
global $wp_query;
|
||||
|
@ -695,9 +662,7 @@ if ( ! function_exists( 'woocommerce_pagination' ) ) {
|
|||
/**
|
||||
* Output the pagination.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_pagination() {
|
||||
wc_get_template( 'loop/pagination.php' );
|
||||
|
@ -711,9 +676,7 @@ if ( ! function_exists( 'woocommerce_show_product_images' ) ) {
|
|||
/**
|
||||
* Output the product image before the single product summary.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_show_product_images() {
|
||||
wc_get_template( 'single-product/product-image.php' );
|
||||
|
@ -724,9 +687,7 @@ if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) {
|
|||
/**
|
||||
* Output the product thumbnails.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_show_product_thumbnails() {
|
||||
wc_get_template( 'single-product/product-thumbnails.php' );
|
||||
|
@ -737,9 +698,7 @@ if ( ! function_exists( 'woocommerce_output_product_data_tabs' ) ) {
|
|||
/**
|
||||
* Output the product tabs.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_output_product_data_tabs() {
|
||||
wc_get_template( 'single-product/tabs/tabs.php' );
|
||||
|
@ -750,9 +709,7 @@ if ( ! function_exists( 'woocommerce_template_single_title' ) ) {
|
|||
/**
|
||||
* Output the product title.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_title() {
|
||||
wc_get_template( 'single-product/title.php' );
|
||||
|
@ -763,9 +720,7 @@ if ( ! function_exists( 'woocommerce_template_single_rating' ) ) {
|
|||
/**
|
||||
* Output the product rating.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_rating() {
|
||||
wc_get_template( 'single-product/rating.php' );
|
||||
|
@ -776,9 +731,7 @@ if ( ! function_exists( 'woocommerce_template_single_price' ) ) {
|
|||
/**
|
||||
* Output the product price.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_price() {
|
||||
wc_get_template( 'single-product/price.php' );
|
||||
|
@ -789,9 +742,7 @@ if ( ! function_exists( 'woocommerce_template_single_excerpt' ) ) {
|
|||
/**
|
||||
* Output the product short description (excerpt).
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_excerpt() {
|
||||
wc_get_template( 'single-product/short-description.php' );
|
||||
|
@ -802,9 +753,7 @@ if ( ! function_exists( 'woocommerce_template_single_meta' ) ) {
|
|||
/**
|
||||
* Output the product meta.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_meta() {
|
||||
wc_get_template( 'single-product/meta.php' );
|
||||
|
@ -815,9 +764,7 @@ if ( ! function_exists( 'woocommerce_template_single_sharing' ) ) {
|
|||
/**
|
||||
* Output the product sharing.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_sharing() {
|
||||
wc_get_template( 'single-product/share.php' );
|
||||
|
@ -828,9 +775,7 @@ if ( ! function_exists( 'woocommerce_show_product_sale_flash' ) ) {
|
|||
/**
|
||||
* Output the product sale flash.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_show_product_sale_flash() {
|
||||
wc_get_template( 'single-product/sale-flash.php' );
|
||||
|
@ -842,9 +787,7 @@ if ( ! function_exists( 'woocommerce_template_single_add_to_cart' ) ) {
|
|||
/**
|
||||
* Trigger the single product add to cart action.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_template_single_add_to_cart() {
|
||||
global $product;
|
||||
|
@ -856,9 +799,7 @@ if ( ! function_exists( 'woocommerce_simple_add_to_cart' ) ) {
|
|||
/**
|
||||
* Output the simple product add to cart area.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_simple_add_to_cart() {
|
||||
wc_get_template( 'single-product/add-to-cart/simple.php' );
|
||||
|
@ -869,9 +810,7 @@ if ( ! function_exists( 'woocommerce_grouped_add_to_cart' ) ) {
|
|||
/**
|
||||
* Output the grouped product add to cart area.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_grouped_add_to_cart() {
|
||||
global $product;
|
||||
|
@ -888,9 +827,7 @@ if ( ! function_exists( 'woocommerce_variable_add_to_cart' ) ) {
|
|||
/**
|
||||
* Output the variable product add to cart area.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_variable_add_to_cart() {
|
||||
global $product;
|
||||
|
@ -911,9 +848,7 @@ if ( ! function_exists( 'woocommerce_external_add_to_cart' ) ) {
|
|||
/**
|
||||
* Output the external product add to cart area.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_external_add_to_cart() {
|
||||
global $product;
|
||||
|
@ -935,8 +870,7 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
|
|||
*
|
||||
* @param array $args Args for the input
|
||||
* @param WC_Product|null $product
|
||||
* @param boolean $echo Whether to return or echo
|
||||
* @return void|string
|
||||
* @param boolean $echo Whether to return or echo|string
|
||||
*/
|
||||
function woocommerce_quantity_input( $args = array(), $product = null, $echo = true ) {
|
||||
if ( is_null( $product ) )
|
||||
|
@ -969,9 +903,7 @@ if ( ! function_exists( 'woocommerce_product_description_tab' ) ) {
|
|||
/**
|
||||
* Output the description tab content.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_description_tab() {
|
||||
wc_get_template( 'single-product/tabs/description.php' );
|
||||
|
@ -982,9 +914,7 @@ if ( ! function_exists( 'woocommerce_product_additional_information_tab' ) ) {
|
|||
/**
|
||||
* Output the attributes tab content.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_additional_information_tab() {
|
||||
wc_get_template( 'single-product/tabs/additional-information.php' );
|
||||
|
@ -995,9 +925,7 @@ if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) {
|
|||
/**
|
||||
* Output the reviews tab content.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product/Tabs
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_product_reviews_tab() {
|
||||
wc_get_template( 'single-product/tabs/reviews.php' );
|
||||
|
@ -1009,7 +937,6 @@ if ( ! function_exists( 'woocommerce_default_product_tabs' ) ) {
|
|||
/**
|
||||
* Add default product tabs to product pages.
|
||||
*
|
||||
* @access public
|
||||
* @param array $tabs
|
||||
* @return array
|
||||
*/
|
||||
|
@ -1052,7 +979,6 @@ if ( ! function_exists( 'woocommerce_sort_product_tabs' ) ) {
|
|||
/**
|
||||
* Sort tabs by priority
|
||||
*
|
||||
* @access public
|
||||
* @param array $tabs
|
||||
* @return array
|
||||
*/
|
||||
|
@ -1084,9 +1010,7 @@ if ( ! function_exists( 'woocommerce_comments' ) ) {
|
|||
/**
|
||||
* Output the Review comments template.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_comments( $comment, $args, $depth ) {
|
||||
$GLOBALS['comment'] = $comment;
|
||||
|
@ -1099,9 +1023,7 @@ if ( ! function_exists( 'woocommerce_output_related_products' ) ) {
|
|||
/**
|
||||
* Output the related products.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Product
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_output_related_products() {
|
||||
|
||||
|
@ -1120,11 +1042,9 @@ if ( ! function_exists( 'woocommerce_related_products' ) ) {
|
|||
/**
|
||||
* Output the related products.
|
||||
*
|
||||
* @access public
|
||||
* @param array Provided arguments
|
||||
* @param bool Columns argument for backwards compat
|
||||
* @param bool Order by argument for backwards compat
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_related_products( $args = array(), $columns = false, $orderby = false ) {
|
||||
if ( ! is_array( $args ) ) {
|
||||
|
@ -1156,11 +1076,9 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) {
|
|||
/**
|
||||
* Output product up sells.
|
||||
*
|
||||
* @access public
|
||||
* @param int $posts_per_page (default: -1)
|
||||
* @param int $columns (default: 2)
|
||||
* @param string $orderby (default: 'rand')
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 2, $orderby = 'rand' ) {
|
||||
wc_get_template( 'single-product/up-sells.php', array(
|
||||
|
@ -1178,9 +1096,7 @@ if ( ! function_exists( 'woocommerce_shipping_calculator' ) ) {
|
|||
/**
|
||||
* Output the cart shipping calculator.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Cart
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_shipping_calculator() {
|
||||
wc_get_template( 'cart/shipping-calculator.php' );
|
||||
|
@ -1192,9 +1108,7 @@ if ( ! function_exists( 'woocommerce_cart_totals' ) ) {
|
|||
/**
|
||||
* Output the cart totals.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Cart
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_cart_totals() {
|
||||
wc_get_template( 'cart/cart-totals.php' );
|
||||
|
@ -1224,9 +1138,7 @@ if ( ! function_exists( 'woocommerce_button_proceed_to_checkout' ) ) {
|
|||
/**
|
||||
* Output the proceed to checkout button.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Cart
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_button_proceed_to_checkout() {
|
||||
$checkout_url = WC()->cart->get_checkout_url();
|
||||
|
@ -1246,8 +1158,6 @@ if ( ! function_exists( 'woocommerce_mini_cart' ) ) {
|
|||
/**
|
||||
* Output the Mini-cart - used by cart widget
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_mini_cart( $args = array() ) {
|
||||
|
||||
|
@ -1268,9 +1178,7 @@ if ( ! function_exists( 'woocommerce_login_form' ) ) {
|
|||
/**
|
||||
* Output the WooCommerce Login Form
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Forms
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_login_form( $args = array() ) {
|
||||
|
||||
|
@ -1291,9 +1199,7 @@ if ( ! function_exists( 'woocommerce_checkout_login_form' ) ) {
|
|||
/**
|
||||
* Output the WooCommerce Checkout Login Form
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Checkout
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_checkout_login_form() {
|
||||
wc_get_template( 'checkout/form-login.php', array( 'checkout' => WC()->checkout() ) );
|
||||
|
@ -1305,8 +1211,6 @@ if ( ! function_exists( 'woocommerce_breadcrumb' ) ) {
|
|||
/**
|
||||
* Output the WooCommerce Breadcrumb
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_breadcrumb( $args = array() ) {
|
||||
|
||||
|
@ -1330,12 +1234,33 @@ if ( ! function_exists( 'woocommerce_order_review' ) ) {
|
|||
/**
|
||||
* Output the Order review table for the checkout.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Checkout
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_order_review( $is_ajax = false ) {
|
||||
wc_get_template( 'checkout/review-order.php', array( 'checkout' => WC()->checkout(), 'is_ajax' => $is_ajax ) );
|
||||
function woocommerce_order_review( $deprecated = false ) {
|
||||
wc_get_template( 'checkout/review-order.php', array( 'checkout' => WC()->checkout() ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'woocommerce_checkout_payment' ) ) {
|
||||
|
||||
/**
|
||||
* Output the Payment Methods on the checkout
|
||||
*
|
||||
* @subpackage Checkout
|
||||
*/
|
||||
function woocommerce_checkout_payment() {
|
||||
if ( WC()->cart->needs_payment() ) {
|
||||
$available_gateways = WC()->payment_gateways()->get_available_payment_gateways();
|
||||
WC()->payment_gateways()->set_current_gateway( $available_gateways );
|
||||
} else {
|
||||
$available_gateways = array();
|
||||
}
|
||||
|
||||
wc_get_template( 'checkout/payment.php', array(
|
||||
'checkout' => WC()->checkout(),
|
||||
'available_gateways' => WC()->payment_gateways()->get_available_payment_gateways(),
|
||||
'order_button_text' => apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) )
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1344,9 +1269,7 @@ if ( ! function_exists( 'woocommerce_checkout_coupon_form' ) ) {
|
|||
/**
|
||||
* Output the Coupon form for the checkout.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Checkout
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_checkout_coupon_form() {
|
||||
wc_get_template( 'checkout/form-coupon.php', array( 'checkout' => WC()->checkout() ) );
|
||||
|
@ -1358,7 +1281,6 @@ if ( ! function_exists( 'woocommerce_products_will_display' ) ) {
|
|||
/**
|
||||
* Check if we will be showing products or not (and not subcats only)
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -1438,7 +1360,6 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
|
|||
/**
|
||||
* Display product sub categories as thumbnails.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Loop
|
||||
* @param array $args
|
||||
* @return null|boolean
|
||||
|
@ -1550,10 +1471,8 @@ if ( ! function_exists( 'woocommerce_subcategory_thumbnail' ) ) {
|
|||
/**
|
||||
* Show subcategory thumbnails.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $category
|
||||
* @subpackage Loop
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_subcategory_thumbnail( $category ) {
|
||||
$small_thumbnail_size = apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' );
|
||||
|
@ -1582,10 +1501,8 @@ if ( ! function_exists( 'woocommerce_order_details_table' ) ) {
|
|||
/**
|
||||
* Displays order details in a table.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $order_id
|
||||
* @subpackage Orders
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_order_details_table( $order_id ) {
|
||||
if ( ! $order_id ) return;
|
||||
|
@ -1602,7 +1519,6 @@ if ( ! function_exists( 'woocommerce_order_again_button' ) ) {
|
|||
/**
|
||||
* Display an 'order again' button on the view order page.
|
||||
*
|
||||
* @access public
|
||||
* @param object $order
|
||||
* @subpackage Orders
|
||||
*/
|
||||
|
@ -1624,12 +1540,10 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
|
|||
/**
|
||||
* Outputs a checkout/address form field.
|
||||
*
|
||||
* @access public
|
||||
* @subpackage Forms
|
||||
* @param mixed $key
|
||||
* @param mixed $args
|
||||
* @param string $value (default: null)
|
||||
* @return void
|
||||
* @todo This function needs to be broken up in smaller pieces
|
||||
*/
|
||||
function woocommerce_form_field( $key, $args, $value = null ) {
|
||||
|
|
|
@ -172,6 +172,8 @@ add_filter( 'woocommerce_product_tabs', 'woocommerce_sort_product_tabs', 99 );
|
|||
add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_login_form', 10 );
|
||||
add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
|
||||
add_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
|
||||
add_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 );
|
||||
|
||||
|
||||
/**
|
||||
* Cart
|
||||
|
|
|
@ -35,8 +35,9 @@ function wc_get_product_terms( $product_id, $taxonomy, $args = array() ) {
|
|||
}
|
||||
|
||||
// Support ordering by parent
|
||||
if ( ! empty( $args['orderby'] ) && $args['orderby'] === 'parent' ) {
|
||||
$fields = isset( $args['fields'] ) ? $args['fields'] : 'all';
|
||||
if ( ! empty( $args['orderby'] ) && in_array( $args['orderby'], array( 'name_num', 'parent' ) ) ) {
|
||||
$fields = isset( $args['fields'] ) ? $args['fields'] : 'all';
|
||||
$orderby = $args['orderby'];
|
||||
|
||||
// Unset for wp_get_post_terms
|
||||
unset( $args['orderby'] );
|
||||
|
@ -44,7 +45,14 @@ function wc_get_product_terms( $product_id, $taxonomy, $args = array() ) {
|
|||
|
||||
$terms = wp_get_post_terms( $product_id, $taxonomy, $args );
|
||||
|
||||
usort( $terms, '_wc_get_product_terms_parent_usort_callback' );
|
||||
switch ( $orderby ) {
|
||||
case 'name_num' :
|
||||
usort( $terms, '_wc_get_product_terms_name_num_usort_callback' );
|
||||
break;
|
||||
case 'parent' :
|
||||
usort( $terms, '_wc_get_product_terms_parent_usort_callback' );
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( $fields ) {
|
||||
case 'names' :
|
||||
|
@ -83,6 +91,19 @@ function wc_get_product_terms( $product_id, $taxonomy, $args = array() ) {
|
|||
return $terms;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sort by name (numeric)
|
||||
* @param WP_POST object $a
|
||||
* @param WP_POST object $b
|
||||
* @return int
|
||||
*/
|
||||
function _wc_get_product_terms_name_num_usort_callback( $a, $b ) {
|
||||
if ( $a->name + 0 === $b->name + 0 ) {
|
||||
return 0;
|
||||
}
|
||||
return ( $a->name + 0 < $b->name + 0 ) ? -1 : 1;
|
||||
}
|
||||
/**
|
||||
* Sort by parent
|
||||
* @param WP_POST object $a
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"grunt-contrib-uglify": "^0.5.1",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-shell": "^1.1.1",
|
||||
"grunt-wp-i18n": "^0.4.8",
|
||||
"grunt-wp-i18n": "^0.4.9",
|
||||
"node-bourbon": "^1.2.3"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -138,6 +138,8 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Feature - Fresh new frontend design.
|
||||
* Feature - Undo link in message when removing products from the cart.
|
||||
* Feature - Compatibility with Twenty Fifteen default theme.
|
||||
* Feature - Added 'top freebies' to product report.
|
||||
* Feature - Added numeric sort for attributes.
|
||||
* Refactor - Removed deprecated methods from WC_Frontend_Scripts and rewrote script registration and localization to run once.
|
||||
* Refactor - Routing all email functionality through one send() method.
|
||||
* Refactor - Replaced existing email css inliner with Emogrifier.
|
||||
|
@ -157,9 +159,13 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Tweak - Removed quantity increment/decrement buttons.
|
||||
* Tweak - Moved 'Proceed to checkout' button on cart to beneath totals.
|
||||
* Tweak - Improved 'responsiveness' of product data tabs on add/edit product screen.
|
||||
* Tweak - Added 'stupidtable' script to allow order item sorting on the order screen (by name, cost, qty).
|
||||
* Tweak - In the cart, add variation selected data to the permalink.
|
||||
* Dev - API - Look up product by sku.
|
||||
* Dev - Made template debug mode set WC_TEMPLATE_DEBUG_MODE constant and remove all overrides for all template loading functions.
|
||||
* Dev - Switched to .scss from .less for all styles.
|
||||
* Dev - Included bourbon for scss mixins.
|
||||
* Dev - Decoupled the order summary and payments area. Both are updated independently via ajax fragments and can be moved around via actions. TEMPLATES OVERRIDING THESE TEMPLATES WILL NEED TO UPDATE THEIR FILES.
|
||||
* Localisation - Add Ukrainian currency and symbol.
|
||||
|
||||
= 2.2.5 - 07/10/2014 =
|
||||
|
|
|
@ -55,7 +55,7 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
if ( ! $_product->is_visible() )
|
||||
echo $thumbnail;
|
||||
else
|
||||
printf( '<a href="%s">%s</a>', $_product->get_permalink(), $thumbnail );
|
||||
printf( '<a href="%s">%s</a>', $_product->get_permalink( $cart_item ), $thumbnail );
|
||||
?>
|
||||
</td>
|
||||
|
||||
|
@ -64,7 +64,7 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
if ( ! $_product->is_visible() )
|
||||
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key );
|
||||
else
|
||||
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', $_product->get_permalink(), $_product->get_title() ), $cart_item, $cart_item_key );
|
||||
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', $_product->get_permalink( $cart_item ), $_product->get_title() ), $cart_item, $cart_item_key );
|
||||
|
||||
// Meta data
|
||||
echo WC()->cart->get_item_data( $cart_item );
|
||||
|
|
|
@ -31,14 +31,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
$product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key );
|
||||
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
|
||||
$product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
|
||||
|
||||
?>
|
||||
<li>
|
||||
<?php echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf( '<a href="%s" class="remove" title="%s">×</a>', esc_url( WC()->cart->get_remove_url( $cart_item_key ) ), __( 'Remove this item', 'woocommerce' ) ), $cart_item_key ); ?>
|
||||
<?php if ( ! $_product->is_visible() ) : ?>
|
||||
<?php echo str_replace( array( 'http:', 'https:' ), '', $thumbnail ) . $product_name; ?>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo get_permalink( $product_id ); ?>">
|
||||
<a href="<?php echo esc_url( $_product->get_permalink( $cart_item ) ); ?>">
|
||||
<?php echo str_replace( array( 'http:', 'https:' ), '', $thumbnail ) . $product_name; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
*
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.0.0
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit;
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
@ -24,26 +24,20 @@ if ( ! $checkout->enable_signup && ! $checkout->enable_guest_checkout && ! is_us
|
|||
// filter hook for include new pages inside the payment method
|
||||
$get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', WC()->cart->get_checkout_url() ); ?>
|
||||
|
||||
<form name="checkout" method="post" class="checkout" action="<?php echo esc_url( $get_checkout_url ); ?>" enctype="multipart/form-data">
|
||||
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( $get_checkout_url ); ?>" enctype="multipart/form-data">
|
||||
|
||||
<?php if ( sizeof( $checkout->checkout_fields ) > 0 ) : ?>
|
||||
|
||||
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
|
||||
|
||||
<div class="col2-set" id="customer_details">
|
||||
|
||||
<div class="col-1">
|
||||
|
||||
<?php do_action( 'woocommerce_checkout_billing' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
|
||||
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
|
||||
|
@ -52,7 +46,9 @@ $get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', WC()->cart->g
|
|||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_checkout_order_review' ); ?>
|
||||
<div id="order_review" class="woocommerce-checkout-review-order">
|
||||
<?php do_action( 'woocommerce_checkout_order_review' ); ?>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* Output a single payment method
|
||||
*
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<li class="payment_method_<?php echo $gateway->id; ?>">
|
||||
<input id="payment_method_<?php echo $gateway->id; ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> data-order_button_text="<?php echo esc_attr( $gateway->order_button_text ); ?>" />
|
||||
|
||||
<label for="payment_method_<?php echo $gateway->id; ?>">
|
||||
<?php echo $gateway->get_title(); ?> <?php echo $gateway->get_icon(); ?>
|
||||
</label>
|
||||
<?php if ( $gateway->has_fields() || $gateway->get_description() ) : ?>
|
||||
<div class="payment_box payment_method_<?php echo $gateway->id; ?>" <?php if ( ! $gateway->chosen ) : ?>style="display:none;"<?php endif; ?>>
|
||||
<?php $gateway->payment_fields(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</li>
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* Checkout Payment Section
|
||||
*
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_review_order_before_payment' ); ?>
|
||||
|
||||
<div id="payment" class="woocommerce-checkout-payment">
|
||||
<?php if ( WC()->cart->needs_payment() ) : ?>
|
||||
<ul class="payment_methods methods">
|
||||
<?php
|
||||
if ( ! empty( $available_gateways ) ) {
|
||||
foreach ( $available_gateways as $gateway ) {
|
||||
wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
|
||||
}
|
||||
} else {
|
||||
if ( ! WC()->customer->get_country() ) {
|
||||
$no_gateways_message = __( 'Please fill in your details above to see available payment methods.', 'woocommerce' );
|
||||
} else {
|
||||
$no_gateways_message = __( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' );
|
||||
}
|
||||
|
||||
echo '<p>' . apply_filters( 'woocommerce_no_available_payment_methods_message', $no_gateways_message ) . '</p>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-row place-order">
|
||||
|
||||
<noscript><?php _e( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ); ?><br/><input type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php _e( 'Update totals', 'woocommerce' ); ?>" /></noscript>
|
||||
|
||||
<?php wp_nonce_field( 'woocommerce-process_checkout' ); ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_before_submit' ); ?>
|
||||
|
||||
<?php echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?>
|
||||
|
||||
<?php if ( wc_get_page_id( 'terms' ) > 0 && apply_filters( 'woocommerce_checkout_show_terms', true ) ) : ?>
|
||||
<p class="form-row terms">
|
||||
<label for="terms" class="checkbox"><?php printf( __( 'I’ve read and accept the <a href="%s" target="_blank">terms & conditions</a>', 'woocommerce' ), esc_url( get_permalink( wc_get_page_id( 'terms' ) ) ) ); ?></label>
|
||||
<input type="checkbox" class="input-checkbox" name="terms" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) ), true ); ?> id="terms" />
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_after_submit' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_after_payment' ); ?>
|
|
@ -1,197 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
* Review order form
|
||||
* Review order table
|
||||
*
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.1.8
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<table class="shop_table woocommerce-checkout-review-order-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
|
||||
<th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
do_action( 'woocommerce_review_order_before_cart_contents' );
|
||||
|
||||
<?php if ( ! $is_ajax ) : ?><div id="order_review"><?php endif; ?>
|
||||
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
|
||||
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
|
||||
|
||||
<table class="shop_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
|
||||
<th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
do_action( 'woocommerce_review_order_before_cart_contents' );
|
||||
|
||||
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
|
||||
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
|
||||
|
||||
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
|
||||
?>
|
||||
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
|
||||
<td class="product-name">
|
||||
<?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ); ?>
|
||||
<?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '× %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); ?>
|
||||
<?php echo WC()->cart->get_item_data( $cart_item ); ?>
|
||||
</td>
|
||||
<td class="product-total">
|
||||
<?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_review_order_after_cart_contents' );
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
||||
<tr class="cart-subtotal">
|
||||
<th><?php _e( 'Cart Subtotal', 'woocommerce' ); ?></th>
|
||||
<td><?php wc_cart_totals_subtotal_html(); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php foreach ( WC()->cart->get_coupons( 'cart' ) as $code => $coupon ) : ?>
|
||||
<tr class="cart-discount coupon-<?php echo esc_attr( $code ); ?>">
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
|
||||
|
||||
<?php wc_cart_totals_shipping_html(); ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
|
||||
<tr class="fee">
|
||||
<th><?php echo esc_html( $fee->name ); ?></th>
|
||||
<td><?php wc_cart_totals_fee_html( $fee ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ( WC()->cart->tax_display_cart === 'excl' ) : ?>
|
||||
<?php if ( get_option( 'woocommerce_tax_total_display' ) === 'itemized' ) : ?>
|
||||
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
|
||||
<tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
|
||||
<th><?php echo esc_html( $tax->label ); ?></th>
|
||||
<td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<tr class="tax-total">
|
||||
<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
|
||||
<td><?php echo wc_price( WC()->cart->get_taxes_total() ); ?></td>
|
||||
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
|
||||
?>
|
||||
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
|
||||
<td class="product-name">
|
||||
<?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ); ?>
|
||||
<?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '× %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); ?>
|
||||
<?php echo WC()->cart->get_item_data( $cart_item ); ?>
|
||||
</td>
|
||||
<td class="product-total">
|
||||
<?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ( WC()->cart->get_coupons( 'order' ) as $code => $coupon ) : ?>
|
||||
<tr class="order-discount coupon-<?php echo esc_attr( $code ); ?>">
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
|
||||
|
||||
<tr class="order-total">
|
||||
<th><?php _e( 'Order Total', 'woocommerce' ); ?></th>
|
||||
<td><?php wc_cart_totals_order_total_html(); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
|
||||
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_before_payment' ); ?>
|
||||
|
||||
<div id="payment">
|
||||
<?php if ( WC()->cart->needs_payment() ) : ?>
|
||||
<ul class="payment_methods methods">
|
||||
<?php
|
||||
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
||||
if ( ! empty( $available_gateways ) ) {
|
||||
|
||||
// Chosen Method
|
||||
if ( isset( WC()->session->chosen_payment_method ) && isset( $available_gateways[ WC()->session->chosen_payment_method ] ) ) {
|
||||
$available_gateways[ WC()->session->chosen_payment_method ]->set_current();
|
||||
} elseif ( isset( $available_gateways[ get_option( 'woocommerce_default_gateway' ) ] ) ) {
|
||||
$available_gateways[ get_option( 'woocommerce_default_gateway' ) ]->set_current();
|
||||
} else {
|
||||
current( $available_gateways )->set_current();
|
||||
}
|
||||
|
||||
foreach ( $available_gateways as $gateway ) {
|
||||
?>
|
||||
<li class="payment_method_<?php echo $gateway->id; ?>">
|
||||
<input id="payment_method_<?php echo $gateway->id; ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> data-order_button_text="<?php echo esc_attr( $gateway->order_button_text ); ?>" />
|
||||
<label for="payment_method_<?php echo $gateway->id; ?>"><?php echo $gateway->get_title(); ?> <?php echo $gateway->get_icon(); ?></label>
|
||||
<?php
|
||||
if ( $gateway->has_fields() || $gateway->get_description() ) :
|
||||
echo '<div class="payment_box payment_method_' . $gateway->id . '" ' . ( $gateway->chosen ? '' : 'style="display:none;"' ) . '>';
|
||||
$gateway->payment_fields();
|
||||
echo '</div>';
|
||||
endif;
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
|
||||
if ( ! WC()->customer->get_country() )
|
||||
$no_gateways_message = __( 'Please fill in your details above to see available payment methods.', 'woocommerce' );
|
||||
else
|
||||
$no_gateways_message = __( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' );
|
||||
|
||||
echo '<p>' . apply_filters( 'woocommerce_no_available_payment_methods_message', $no_gateways_message ) . '</p>';
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_review_order_after_cart_contents' );
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
||||
<tr class="cart-subtotal">
|
||||
<th><?php _e( 'Cart Subtotal', 'woocommerce' ); ?></th>
|
||||
<td><?php wc_cart_totals_subtotal_html(); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php foreach ( WC()->cart->get_coupons( 'cart' ) as $code => $coupon ) : ?>
|
||||
<tr class="cart-discount coupon-<?php echo esc_attr( $code ); ?>">
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
|
||||
|
||||
<?php wc_cart_totals_shipping_html(); ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-row place-order">
|
||||
<?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
|
||||
<tr class="fee">
|
||||
<th><?php echo esc_html( $fee->name ); ?></th>
|
||||
<td><?php wc_cart_totals_fee_html( $fee ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<noscript><?php _e( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ); ?><br/><input type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php _e( 'Update totals', 'woocommerce' ); ?>" /></noscript>
|
||||
<?php if ( WC()->cart->tax_display_cart === 'excl' ) : ?>
|
||||
<?php if ( get_option( 'woocommerce_tax_total_display' ) === 'itemized' ) : ?>
|
||||
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
|
||||
<tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
|
||||
<th><?php echo esc_html( $tax->label ); ?></th>
|
||||
<td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<tr class="tax-total">
|
||||
<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
|
||||
<td><?php echo wc_price( WC()->cart->get_taxes_total() ); ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php wp_nonce_field( 'woocommerce-process_checkout' ); ?>
|
||||
<?php foreach ( WC()->cart->get_coupons( 'order' ) as $code => $coupon ) : ?>
|
||||
<tr class="order-discount coupon-<?php echo esc_attr( $code ); ?>">
|
||||
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
|
||||
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_before_submit' ); ?>
|
||||
<?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
|
||||
|
||||
<?php
|
||||
$order_button_text = apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) );
|
||||
<tr class="order-total">
|
||||
<th><?php _e( 'Order Total', 'woocommerce' ); ?></th>
|
||||
<td><?php wc_cart_totals_order_total_html(); ?></td>
|
||||
</tr>
|
||||
|
||||
echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' );
|
||||
?>
|
||||
<?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
|
||||
|
||||
<?php if ( wc_get_page_id( 'terms' ) > 0 && apply_filters( 'woocommerce_checkout_show_terms', true ) ) {
|
||||
$terms_is_checked = apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) );
|
||||
?>
|
||||
<p class="form-row terms">
|
||||
<label for="terms" class="checkbox"><?php printf( __( 'I’ve read and accept the <a href="%s" target="_blank">terms & conditions</a>', 'woocommerce' ), esc_url( get_permalink( wc_get_page_id( 'terms' ) ) ) ); ?></label>
|
||||
<input type="checkbox" class="input-checkbox" name="terms" <?php checked( $terms_is_checked, true ); ?> id="terms" />
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_after_submit' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php do_action( 'woocommerce_review_order_after_payment' ); ?>
|
||||
|
||||
<?php if ( ! $is_ajax ) : ?></div><?php endif; ?>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
|
@ -4,15 +4,14 @@
|
|||
*
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.1.0
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit;
|
||||
}
|
||||
|
||||
global $product, $post;
|
||||
|
||||
?>
|
||||
|
||||
<?php do_action( 'woocommerce_before_add_to_cart_form' ); ?>
|
||||
|
@ -40,28 +39,15 @@ global $product, $post;
|
|||
// Get terms if this is a taxonomy - ordered
|
||||
if ( taxonomy_exists( sanitize_title( $name ) ) ) {
|
||||
|
||||
$orderby = wc_attribute_orderby( sanitize_title( $name ) );
|
||||
|
||||
switch ( $orderby ) {
|
||||
case 'name' :
|
||||
$args = array( 'orderby' => 'name', 'hide_empty' => false, 'menu_order' => false );
|
||||
break;
|
||||
case 'id' :
|
||||
$args = array( 'orderby' => 'id', 'order' => 'ASC', 'menu_order' => false, 'hide_empty' => false );
|
||||
break;
|
||||
case 'menu_order' :
|
||||
$args = array( 'menu_order' => 'ASC', 'hide_empty' => false );
|
||||
break;
|
||||
}
|
||||
|
||||
$terms = get_terms( sanitize_title( $name ), $args );
|
||||
$terms = wc_get_product_terms( $post->ID, sanitize_title( $name ) );
|
||||
|
||||
foreach ( $terms as $term ) {
|
||||
if ( ! in_array( $term->slug, $options ) )
|
||||
if ( ! in_array( $term->slug, $options ) ) {
|
||||
continue;
|
||||
|
||||
}
|
||||
echo '<option value="' . esc_attr( $term->slug ) . '" ' . selected( sanitize_title( $selected_value ), sanitize_title( $term->slug ), false ) . '>' . apply_filters( 'woocommerce_variation_option_name', $term->name ) . '</option>';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
|
@ -72,8 +58,9 @@ global $product, $post;
|
|||
}
|
||||
?>
|
||||
</select> <?php
|
||||
if ( sizeof( $attributes ) == $loop )
|
||||
if ( sizeof( $attributes ) === $loop ) {
|
||||
echo '<a class="reset_variations" href="#reset">' . __( 'Clear selection', 'woocommerce' ) . '</a>';
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
|
|
Loading…
Reference in New Issue