commit
510cddad8b
|
@ -19,18 +19,18 @@ if ( $existing_file_paths ) {
|
|||
|
||||
foreach( $existing_file_paths as $existing_file_path ) {
|
||||
|
||||
$existing_file_path->meta_value = trim( $existing_file_path->meta_value );
|
||||
$old_file_path = trim( $existing_file_path->meta_value );
|
||||
|
||||
if ( $existing_file_path->meta_value )
|
||||
$file_paths = maybe_serialize( array( md5( $existing_file_path->meta_value ) => $existing_file_path->meta_value ) );
|
||||
else
|
||||
$file_paths = '';
|
||||
if ( ! empty( $old_file_path ) ) {
|
||||
$file_paths = maybe_serialize( array( md5( $old_file_path ) => $old_file_path ) );
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = '_file_paths', meta_value = %s WHERE meta_id = %d", $file_paths, $existing_file_path->meta_id ) );
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}woocommerce_downloadable_product_permissions SET download_id = %s WHERE product_id = %d", md5( $existing_file_path->meta_value ), $existing_file_path->post_id ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = '_file_paths', meta_value = %s WHERE meta_id = %d", $file_paths, $existing_file_path->meta_id ) );
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}woocommerce_downloadable_product_permissions SET download_id = %s WHERE product_id = %d", md5( $old_file_path ), $existing_file_path->post_id ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Update table primary keys
|
||||
|
@ -94,78 +94,80 @@ if ( get_option( 'woocommerce_show_subcategories' ) == 'yes' ) {
|
|||
$loop = 0;
|
||||
$tax_rates = get_option( 'woocommerce_tax_rates' );
|
||||
|
||||
foreach ( $tax_rates as $tax_rate ) {
|
||||
if ( $tax_rates )
|
||||
foreach ( $tax_rates as $tax_rate ) {
|
||||
|
||||
foreach ( $tax_rate['countries'] as $country => $states ) {
|
||||
foreach ( $tax_rate['countries'] as $country => $states ) {
|
||||
|
||||
$states = array_reverse( $states );
|
||||
$states = array_reverse( $states );
|
||||
|
||||
foreach ( $states as $state ) {
|
||||
foreach ( $states as $state ) {
|
||||
|
||||
if ( $state == '*' )
|
||||
$state = '';
|
||||
if ( $state == '*' )
|
||||
$state = '';
|
||||
|
||||
$wpdb->insert(
|
||||
$wpdb->prefix . "woocommerce_tax_rates",
|
||||
array(
|
||||
'tax_rate_country' => $country,
|
||||
'tax_rate_state' => $state,
|
||||
'tax_rate' => $tax_rate['rate'],
|
||||
'tax_rate_name' => $tax_rate['label'],
|
||||
'tax_rate_priority' => 1,
|
||||
'tax_rate_compound' => $tax_rate['compound'] == 'yes' ? 1 : 0,
|
||||
'tax_rate_shipping' => $tax_rate['shipping'] == 'yes' ? 1 : 0,
|
||||
'tax_rate_order' => $loop,
|
||||
'tax_rate_class' => $tax_rate['class']
|
||||
)
|
||||
);
|
||||
$wpdb->insert(
|
||||
$wpdb->prefix . "woocommerce_tax_rates",
|
||||
array(
|
||||
'tax_rate_country' => $country,
|
||||
'tax_rate_state' => $state,
|
||||
'tax_rate' => $tax_rate['rate'],
|
||||
'tax_rate_name' => $tax_rate['label'],
|
||||
'tax_rate_priority' => 1,
|
||||
'tax_rate_compound' => $tax_rate['compound'] == 'yes' ? 1 : 0,
|
||||
'tax_rate_shipping' => $tax_rate['shipping'] == 'yes' ? 1 : 0,
|
||||
'tax_rate_order' => $loop,
|
||||
'tax_rate_class' => $tax_rate['class']
|
||||
)
|
||||
);
|
||||
|
||||
$loop++;
|
||||
$loop++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$local_tax_rates = get_option( 'woocommerce_local_tax_rates' );
|
||||
|
||||
foreach ( $local_tax_rates as $tax_rate ) {
|
||||
if ( $local_tax_rates )
|
||||
foreach ( $local_tax_rates as $tax_rate ) {
|
||||
|
||||
$location_type = $tax_rate['location_type'] == 'postcode' ? 'postcode' : 'city';
|
||||
$location_type = $tax_rate['location_type'] == 'postcode' ? 'postcode' : 'city';
|
||||
|
||||
if ( $tax_rate['state'] == '*' )
|
||||
$tax_rate['state'] = '';
|
||||
|
||||
$wpdb->insert(
|
||||
$wpdb->prefix . "woocommerce_tax_rates",
|
||||
array(
|
||||
'tax_rate_country' => $tax_rate['country'],
|
||||
'tax_rate_state' => $tax_rate['state'],
|
||||
'tax_rate' => $tax_rate['rate'],
|
||||
'tax_rate_name' => $tax_rate['label'],
|
||||
'tax_rate_priority' => 2,
|
||||
'tax_rate_compound' => $tax_rate['compound'] == 'yes' ? 1 : 0,
|
||||
'tax_rate_shipping' => $tax_rate['shipping'] == 'yes' ? 1 : 0,
|
||||
'tax_rate_order' => $loop,
|
||||
'tax_rate_class' => $tax_rate['class']
|
||||
)
|
||||
);
|
||||
|
||||
$tax_rate_id = $wpdb->insert_id;
|
||||
|
||||
foreach ( $tax_rate['locations'] as $location ) {
|
||||
if ( $tax_rate['state'] == '*' )
|
||||
$tax_rate['state'] = '';
|
||||
|
||||
$wpdb->insert(
|
||||
$wpdb->prefix . "woocommerce_tax_rate_locations",
|
||||
$wpdb->prefix . "woocommerce_tax_rates",
|
||||
array(
|
||||
'location_code' => $location,
|
||||
'tax_rate_id' => $tax_rate_id,
|
||||
'location_type' => $location_type,
|
||||
'tax_rate_country' => $tax_rate['country'],
|
||||
'tax_rate_state' => $tax_rate['state'],
|
||||
'tax_rate' => $tax_rate['rate'],
|
||||
'tax_rate_name' => $tax_rate['label'],
|
||||
'tax_rate_priority' => 2,
|
||||
'tax_rate_compound' => $tax_rate['compound'] == 'yes' ? 1 : 0,
|
||||
'tax_rate_shipping' => $tax_rate['shipping'] == 'yes' ? 1 : 0,
|
||||
'tax_rate_order' => $loop,
|
||||
'tax_rate_class' => $tax_rate['class']
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
$tax_rate_id = $wpdb->insert_id;
|
||||
|
||||
$loop++;
|
||||
}
|
||||
foreach ( $tax_rate['locations'] as $location ) {
|
||||
|
||||
$wpdb->insert(
|
||||
$wpdb->prefix . "woocommerce_tax_rate_locations",
|
||||
array(
|
||||
'location_code' => $location,
|
||||
'tax_rate_id' => $tax_rate_id,
|
||||
'location_type' => $location_type,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$loop++;
|
||||
}
|
||||
|
||||
update_option( 'woocommerce_tax_rates_backup', $tax_rates );
|
||||
update_option( 'woocommerce_local_tax_rates_backup', $local_tax_rates );
|
||||
|
|
|
@ -92,4 +92,63 @@ function woocommerce_custom_coupon_columns( $column ) {
|
|||
}
|
||||
}
|
||||
|
||||
add_action( 'manage_shop_coupon_posts_custom_column', 'woocommerce_custom_coupon_columns', 2 );
|
||||
add_action( 'manage_shop_coupon_posts_custom_column', 'woocommerce_custom_coupon_columns', 2 );
|
||||
|
||||
/**
|
||||
* Show custom filters to filter coupons by type.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function woocommerce_restrict_manage_coupons() {
|
||||
global $woocommerce, $typenow, $wp_query;
|
||||
|
||||
if ( $typenow != 'shop_coupon' )
|
||||
return;
|
||||
|
||||
// Type
|
||||
?>
|
||||
<select name='coupon_type' id='dropdown_shop_coupon_type'>
|
||||
<option value=""><?php _e( 'Show all statuses', 'woocommerce' ); ?></option>
|
||||
<?php
|
||||
$types = $woocommerce->get_coupon_discount_types();
|
||||
|
||||
foreach ( $types as $name => $type ) {
|
||||
echo '<option value="' . esc_attr( $name ) . '"';
|
||||
|
||||
if ( isset( $_GET['coupon_type'] ) )
|
||||
selected( $name, $_GET['coupon_type'] );
|
||||
|
||||
echo '>' . esc_html__( $type, 'woocommerce' ) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
|
||||
$woocommerce->add_inline_js( "
|
||||
jQuery('select#dropdown_shop_coupon_type, select[name=m]').css('width', '150px').chosen();
|
||||
" );
|
||||
}
|
||||
|
||||
add_action( 'restrict_manage_posts', 'woocommerce_restrict_manage_coupons' );
|
||||
|
||||
/**
|
||||
* Filter the coupons by the type.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $vars
|
||||
* @return array
|
||||
*/
|
||||
function woocommerce_coupons_by_type_query( $vars ) {
|
||||
global $typenow, $wp_query;
|
||||
if ( $typenow == 'shop_coupon' && ! empty( $_GET['coupon_type'] ) ) {
|
||||
|
||||
$vars['meta_key'] = 'discount_type';
|
||||
$vars['meta_value'] = woocommerce_clean( $_GET['coupon_type'] );
|
||||
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
add_filter( 'request', 'woocommerce_coupons_by_type_query' );
|
|
@ -283,10 +283,6 @@ function variable_product_type_options() {
|
|||
|
||||
var count = parseInt( response );
|
||||
|
||||
if (count>0) {
|
||||
jQuery('.woocommerce_variations').load( window.location + ' .woocommerce_variations > *' );
|
||||
}
|
||||
|
||||
if (count==1) {
|
||||
alert( count + ' <?php _e( "variation added", 'woocommerce' ); ?>');
|
||||
} else if (count==0 || count>1) {
|
||||
|
@ -295,7 +291,17 @@ function variable_product_type_options() {
|
|||
alert('<?php _e( "No variations added", 'woocommerce' ); ?>');
|
||||
}
|
||||
|
||||
jQuery('#variable_product_options').unblock();
|
||||
if (count>0) {
|
||||
var this_page = window.location.toString();
|
||||
|
||||
this_page = this_page.replace( 'post-new.php?', 'post.php?post=<?php echo $post->ID; ?>&action=edit&' );
|
||||
|
||||
$('#variable_product_options').load( this_page + ' #variable_product_options_inner', function() {
|
||||
$('#variable_product_options').unblock();
|
||||
} );
|
||||
} else {
|
||||
$('#variable_product_options').unblock();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ function woocommerce_attributes() {
|
|||
|
||||
check_admin_referer( 'woocommerce-add-new_attribute' );
|
||||
|
||||
$attribute_name = sanitize_title( esc_attr( $_POST['attribute_name'] ) );
|
||||
$attribute_name = woocommerce_sanitize_taxonomy_name( stripslashes( $_POST['attribute_name'] ) );
|
||||
$attribute_type = esc_attr( $_POST['attribute_type'] );
|
||||
$attribute_label = esc_attr( $_POST['attribute_label'] );
|
||||
$attribute_orderby = esc_attr( $_POST['attribute_orderby'] );
|
||||
|
@ -39,6 +39,9 @@ function woocommerce_attributes() {
|
|||
if ( ! $attribute_name )
|
||||
$attribute_name = sanitize_title( $attribute_label );
|
||||
|
||||
if ( strlen( $attribute_name ) >= 30 )
|
||||
echo '<div id="woocommerce_errors" class="error fade"><p>' . sprintf( __( 'Slug %s is too long', 'woocommerce' ), sanitize_title( $attribute_name ) ) . '</p></div>';
|
||||
|
||||
if ( $attribute_name && strlen( $attribute_name ) < 30 && $attribute_type && ! taxonomy_exists( $woocommerce->attribute_taxonomy_name( $attribute_name ) ) ) {
|
||||
|
||||
$wpdb->insert(
|
||||
|
@ -60,7 +63,7 @@ function woocommerce_attributes() {
|
|||
$edit = absint( $_GET['edit'] );
|
||||
check_admin_referer( 'woocommerce-save-attribute_' . $edit );
|
||||
|
||||
$attribute_name = sanitize_title( esc_attr( $_POST['attribute_name'] ) );
|
||||
$attribute_name = woocommerce_sanitize_taxonomy_name( stripslashes( $_POST['attribute_name'] ) );
|
||||
$attribute_type = esc_attr( $_POST['attribute_type'] );
|
||||
$attribute_label = esc_attr( $_POST['attribute_label'] );
|
||||
$attribute_orderby = esc_attr( $_POST['attribute_orderby'] );
|
||||
|
@ -71,7 +74,7 @@ function woocommerce_attributes() {
|
|||
if ( ! $attribute_name )
|
||||
$attribute_name = sanitize_title( $attribute_label );
|
||||
|
||||
$old_attribute_name = sanitize_title( $wpdb->get_var( "SELECT attribute_name FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = $edit" ) );
|
||||
$old_attribute_name = woocommerce_sanitize_taxonomy_name( $wpdb->get_var( "SELECT attribute_name FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = $edit" ) );
|
||||
|
||||
if ( $old_attribute_name != $attribute_name && taxonomy_exists( $woocommerce->attribute_taxonomy_name( $attribute_name ) ) ) {
|
||||
|
||||
|
|
|
@ -1918,7 +1918,7 @@ function woocommerce_category_sales() {
|
|||
$current_year = isset( $_POST['show_year'] ) ? $_POST['show_year'] : date( 'Y', current_time( 'timestamp' ) );
|
||||
$start_date = strtotime( $current_year . '0101' );
|
||||
|
||||
$categories = get_terms( 'product_cat', array( 'parent' => 0 ) );
|
||||
$categories = get_terms( 'product_cat', array( 'orderby' => 'name' ) );
|
||||
?>
|
||||
<form method="post" action="" class="report_filters">
|
||||
<p>
|
||||
|
@ -1932,14 +1932,16 @@ function woocommerce_category_sales() {
|
|||
|
||||
<select multiple="multiple" class="chosen_select" id="show_categories" name="show_categories[]" style="width: 300px;">
|
||||
<?php
|
||||
foreach ( $categories as $category ) {
|
||||
if ( $category->parent > 0 )
|
||||
$prepend = '— ';
|
||||
else
|
||||
$prepend = '';
|
||||
$r = array();
|
||||
$r['pad_counts'] = 1;
|
||||
$r['hierarchal'] = 1;
|
||||
$r['hide_empty'] = 1;
|
||||
$r['value'] = 'id';
|
||||
$r['selected'] = isset( $_POST['show_categories'] ) ? $_POST['show_categories'] : '';
|
||||
|
||||
echo '<option value="' . $category->term_id . '" ' . selected( ! empty( $_POST['show_categories'] ) && in_array( $category->term_id, $_POST['show_categories'] ), true ) . '>' . $prepend . $category->name . '</option>';
|
||||
}
|
||||
include_once( $woocommerce->plugin_path() . '/classes/walkers/class-product-cat-dropdown-walker.php' );
|
||||
|
||||
echo woocommerce_walk_category_dropdown_tree( $categories, 0, $r );
|
||||
?>
|
||||
</select>
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -113,7 +113,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
|
||||
@media
|
||||
(-webkit-min-device-pixel-ratio: 2),
|
||||
(min-resolution: 192dpi) {
|
||||
#woocommerce_extensions {
|
||||
background-image: url(../images/icons/wc_icon@2x.png);
|
||||
background-size: 16px 17px;
|
||||
|
@ -140,7 +142,9 @@
|
|||
background-size: auto !important;
|
||||
}
|
||||
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
|
||||
@media
|
||||
(-webkit-min-device-pixel-ratio: 2),
|
||||
(min-resolution: 192dpi) {
|
||||
#icon-woocommerce, .woocommerce_icon, .icon32-posts-product, .icon32-posts-shop_order, .icon32-posts-shop_coupon, .icon32-posts-product_variation {
|
||||
background-image: url(../images/icons/woocommerce-icons-x2.png) !important;
|
||||
background-size: 986px 91px !important;
|
||||
|
@ -1013,7 +1017,9 @@ table.wp-list-table {
|
|||
.column-is_in_stock {
|
||||
text-align: left !important;
|
||||
}
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
|
||||
@media
|
||||
(-webkit-min-device-pixel-ratio: 2),
|
||||
(min-resolution: 192dpi) {
|
||||
span.product-type {
|
||||
background-image: url(../images/product_types-x2.png) !important;
|
||||
background-size:96px 16px !important;
|
||||
|
@ -1666,7 +1672,9 @@ img.help_tip {
|
|||
}
|
||||
}
|
||||
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
|
||||
@media
|
||||
(-webkit-min-device-pixel-ratio: 2),
|
||||
(min-resolution: 192dpi) {
|
||||
#woocommerce-product-data ul.product_data_tabs li {
|
||||
&.general_options, &.tax_options, &.inventory_options, &.shipping_options, &.linked_product_options, &.attribute_options, &.variation_options, &.advanced_options {
|
||||
a {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -583,6 +583,7 @@ p.demo_store {
|
|||
right: -26px;
|
||||
text-indent: 0;
|
||||
background: url(../images/success.png) no-repeat;
|
||||
background-size:16px 14px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ jQuery( function($){
|
|||
// TABS
|
||||
$('ul.wc-tabs').show();
|
||||
$('div.panel-wrap').each(function(){
|
||||
$('div.panel:not(div.panel:first)', this).hide();
|
||||
$(this).find('div.panel:not(:first)').hide();
|
||||
});
|
||||
$('ul.wc-tabs a').click(function(){
|
||||
var panel_wrap = $(this).closest('div.panel-wrap');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -225,7 +225,7 @@ class WC_Coupon {
|
|||
|
||||
// Expired
|
||||
if ( $this->expiry_date ) {
|
||||
if ( strtotime( 'NOW' ) > $this->expiry_date ) {
|
||||
if ( current_time( 'timestamp' ) > $this->expiry_date ) {
|
||||
$valid = false;
|
||||
$error = __( 'This coupon has expired.', 'woocommerce' );
|
||||
}
|
||||
|
|
|
@ -589,7 +589,7 @@ class WC_Customer {
|
|||
}
|
||||
|
||||
// order exists and downloads permitted?
|
||||
if ( ! $order->id || ! $order->is_download_permitted() ) continue;
|
||||
if ( ! $order->id || ! $order->is_download_permitted() || $order->status != 'publish' ) continue;
|
||||
|
||||
if ( ! $_product || $_product->id != $result->product_id ) :
|
||||
// new product
|
||||
|
|
|
@ -35,7 +35,9 @@ class WC_Product_Factory {
|
|||
$product_id = absint( $the_product->ID );
|
||||
$post_type = $the_product->post_type;
|
||||
|
||||
if ( 'product_variation' == $post_type ) {
|
||||
if ( isset( $args['product_type'] ) ) {
|
||||
$product_type = $args['product_type'];
|
||||
} elseif ( 'product_variation' == $post_type ) {
|
||||
$product_type = 'variation';
|
||||
} else {
|
||||
$terms = get_the_terms( $product_id, 'product_type' );
|
||||
|
|
|
@ -174,21 +174,21 @@ class WC_Product_Variable extends WC_Product {
|
|||
*/
|
||||
function get_children() {
|
||||
|
||||
if (!is_array($this->children)) :
|
||||
if ( ! is_array( $this->children ) ) {
|
||||
|
||||
$this->children = array();
|
||||
|
||||
$transient_name = 'wc_product_children_ids_' . $this->id;
|
||||
|
||||
if ( false === ( $this->children = get_transient( $transient_name ) ) ) :
|
||||
if ( false === ( $this->children = get_transient( $transient_name ) ) ) {
|
||||
|
||||
$this->children = get_posts( 'post_parent=' . $this->id . '&post_type=product_variation&orderby=menu_order&order=ASC&fields=ids&post_status=any&numberposts=-1' );
|
||||
|
||||
set_transient( $transient_name, $this->children );
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
return (array) $this->children;
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ class WC_Tax {
|
|||
) );
|
||||
|
||||
// Put results into array
|
||||
$matched_tax_rates = array();
|
||||
foreach ( $found_rates as $found_rate )
|
||||
$matched_tax_rates[ $found_rate->tax_rate_id ] = array(
|
||||
'rate' => $found_rate->tax_rate,
|
||||
|
|
|
@ -29,16 +29,19 @@ class WC_Product_Cat_Dropdown_Walker extends Walker {
|
|||
$pad = str_repeat(' ', $depth * 3);
|
||||
|
||||
$cat_name = apply_filters( 'list_product_cats', $cat->name, $cat );
|
||||
$output .= "\t<option class=\"level-$depth\" value=\"" . $cat->slug . "\"";
|
||||
|
||||
if ( $cat->slug == $args['selected'] )
|
||||
$value = isset( $args['value'] ) && $args['value'] == 'id' ? $cat->term_id : $cat->slug;
|
||||
|
||||
$output .= "\t<option class=\"level-$depth\" value=\"" . $value . "\"";
|
||||
|
||||
if ( $value == $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'] ) ) )
|
||||
$output .= ' selected="selected"';
|
||||
|
||||
$output .= '>';
|
||||
|
||||
$output .= $pad . __( $cat_name, 'woocommerce' );
|
||||
|
||||
if ( $args['show_count'] )
|
||||
if ( ! empty( $args['show_count'] ) )
|
||||
$output .= ' (' . $cat->count . ')';
|
||||
|
||||
$output .= "</option>\n";
|
||||
|
|
|
@ -186,6 +186,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Feature - Zip code restriction for local pickup.
|
||||
* Feature - New free shipping logic - coupon, min-amount, Both or Either.
|
||||
* Feature - Taxes can be based on shipping, billing, or shop base.
|
||||
* Feature - Filter coupons in admin by type.
|
||||
|
||||
* Templating - Revised pagination, sorting areas (sorting is now above products, numbered pagination below) and added a result count.
|
||||
* Templating - email-order-items.php change get_downloadable_file_url() to get_downloadable_file_urls() to support multiple files.
|
||||
|
|
|
@ -57,7 +57,7 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
<tr class="fee fee-<?php echo $fee->id ?>">
|
||||
<th colspan="2"><?php echo $fee->name ?></th>
|
||||
<td><?php
|
||||
if ( $this->tax_display_cart == 'excl' )
|
||||
if ( $woocommerce->cart->tax_display_cart == 'excl' )
|
||||
echo woocommerce_price( $fee->amount );
|
||||
else
|
||||
echo woocommerce_price( $fee->amount + $fee->tax );
|
||||
|
@ -68,7 +68,7 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
|
||||
<?php
|
||||
// Show the tax row if showing prices exlcusive of tax only
|
||||
if ( $this->tax_display_cart == 'excl' ) {
|
||||
if ( $woocommerce->cart->tax_display_cart == 'excl' ) {
|
||||
|
||||
$taxes = $woocommerce->cart->get_formatted_taxes();
|
||||
|
||||
|
@ -137,7 +137,7 @@ $available_methods = $woocommerce->shipping->get_available_shipping_methods();
|
|||
<strong><?php echo $woocommerce->cart->get_total(); ?></strong>
|
||||
<?php
|
||||
// If prices are tax inclusive, show taxes here
|
||||
if ( $this->tax_display_cart == 'incl' ) {
|
||||
if ( $woocommerce->cart->tax_display_cart == 'incl' ) {
|
||||
$tax_string_array = array();
|
||||
$taxes = $woocommerce->cart->get_formatted_taxes();
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@ if ( ! $product->is_visible() )
|
|||
$woocommerce_loop['loop']++;
|
||||
?>
|
||||
<li class="product<?php
|
||||
if ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1)
|
||||
echo ' first';
|
||||
if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
|
||||
echo ' last';
|
||||
elseif ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 )
|
||||
echo ' first';
|
||||
?>">
|
||||
|
||||
<?php do_action( 'woocommerce_before_shop_loop_item' ); ?>
|
||||
|
|
|
@ -25,10 +25,10 @@ if ( empty( $woocommerce_loop['columns'] ) )
|
|||
$woocommerce_loop['loop']++;
|
||||
?>
|
||||
<li class="product <?php
|
||||
if ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1)
|
||||
echo 'first';
|
||||
if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
|
||||
echo 'last';
|
||||
elseif ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 )
|
||||
echo 'first';
|
||||
?>">
|
||||
|
||||
<?php do_action( 'woocommerce_before_subcategory', $category ); ?>
|
||||
|
|
|
@ -53,10 +53,10 @@ $order = new WC_Order( $order_id );
|
|||
|
||||
if ( $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted() ) :
|
||||
|
||||
$download_file_urls = $order->get_downloadable_file_urls( $item['product_id'], $item['variation_id'], $item );
|
||||
foreach ( $download_file_urls as $i => $download_file_url ) :
|
||||
echo '<br/><small><a href="' . $download_file_url . '">' . sprintf( __( 'Download file %s →', 'woocommerce' ), ( count( $download_file_urls ) > 1 ? $i + 1 : '' ) ) . '</a></small>';
|
||||
endforeach;
|
||||
$download_file_urls = $order->get_downloadable_file_urls( $item['product_id'], $item['variation_id'], $item );
|
||||
foreach ( $download_file_urls as $i => $download_file_url ) :
|
||||
echo '<br/><small><a href="' . $download_file_url . '">' . sprintf( __( 'Download file %s →', 'woocommerce' ), ( count( $download_file_urls ) > 1 ? $i + 1 : '' ) ) . '</a></small>';
|
||||
endforeach;
|
||||
|
||||
endif;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ global $post, $product;
|
|||
|
||||
<p itemprop="price" class="price"><?php echo $product->get_price_html(); ?></p>
|
||||
|
||||
<meta itemprop="priceCurrency" content="<?php echo get_woocommerce_currency(); ?>" />
|
||||
<link itemprop="availability" href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />
|
||||
|
||||
</div>
|
|
@ -640,7 +640,7 @@ function woocommerce_link_all_variations() {
|
|||
|
||||
$variations = array();
|
||||
|
||||
$_product = get_product( $post_id );
|
||||
$_product = get_product( $post_id, array( 'product_type' => 'variable' ) );
|
||||
|
||||
// Put variation attributes into an array
|
||||
foreach ( $_product->get_attributes() as $attribute ) {
|
||||
|
@ -662,13 +662,12 @@ function woocommerce_link_all_variations() {
|
|||
$options = array_map('trim', $options);
|
||||
|
||||
$variations[ $attribute_field_name ] = $options;
|
||||
|
||||
}
|
||||
|
||||
// Quit out if none were found
|
||||
if ( sizeof( $variations ) == 0 ) die();
|
||||
|
||||
// Get existing variations so we don't create duplicated
|
||||
// Get existing variations so we don't create duplicates
|
||||
$available_variations = array();
|
||||
|
||||
foreach( $_product->get_children() as $child_id ) {
|
||||
|
@ -1922,6 +1921,12 @@ function woocommerce_product_images_box_upload() {
|
|||
$attachment_data = wp_generate_attachment_metadata( $attachment_id, $upload['file'] );
|
||||
wp_update_attachment_metadata( $attachment_id, $attachment_data );
|
||||
|
||||
// Set featured image
|
||||
$post_thumb_id = get_post_meta( $post_id, '_thumbnail_id', true );
|
||||
|
||||
if ( empty( $post_thumb_id ) )
|
||||
update_post_meta( $post_id, '_thumbnail_id', $attachment_id );
|
||||
|
||||
// Return the result
|
||||
$image = wp_get_attachment_image_src( $attachment_id, 'full' );
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@ function get_product( $the_product = false, $args = array() ) {
|
|||
return $woocommerce->product_factory->get_product( $the_product, $args );
|
||||
}
|
||||
|
||||
function woocommerce_sanitize_taxonomy_name( $taxonomy ) {
|
||||
return str_replace( array( ' ', '_' ), '-', strtolower( $taxonomy ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* woocommerce_get_dimension function.
|
||||
*
|
||||
|
@ -976,8 +980,10 @@ function woocommerce_downloadable_product_permissions( $order_id ) {
|
|||
$product_id = ($item['variation_id']>0) ? $item['variation_id'] : $item['product_id'];
|
||||
|
||||
$file_download_paths = apply_filters( 'woocommerce_file_download_paths', get_post_meta( $product_id, '_file_paths', true ), $product_id, $order_id, $item );
|
||||
foreach ( $file_download_paths as $download_id => $file_path ) {
|
||||
woocommerce_downloadable_file_permission( $download_id, $product_id, $order );
|
||||
if ( ! empty( $file_download_paths ) ) {
|
||||
foreach ( $file_download_paths as $download_id => $file_path ) {
|
||||
woocommerce_downloadable_file_permission( $download_id, $product_id, $order );
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
|
|
|
@ -414,13 +414,13 @@ function woocommerce_add_to_cart_message( $product_id ) {
|
|||
// Output success messages
|
||||
if ( get_option( 'woocommerce_cart_redirect_after_add' ) == 'yes' ) :
|
||||
|
||||
$return_to = wp_get_referer() ? wp_get_referer() : home_url();
|
||||
$return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wp_get_referer() ? wp_get_referer() : home_url() );
|
||||
|
||||
$message = sprintf('<a href="%s" class="button">%s</a> %s', $return_to, __( 'Continue Shopping →', 'woocommerce' ), $added_text );
|
||||
|
||||
else :
|
||||
|
||||
$message = sprintf('<a href="%s" class="button">%s</a> %s', get_permalink(woocommerce_get_page_id('cart')), __( 'View Cart →', 'woocommerce' ), $added_text );
|
||||
$message = sprintf('<a href="%s" class="button">%s</a> %s', get_permalink( woocommerce_get_page_id( 'cart' ) ), __( 'View Cart →', 'woocommerce' ), $added_text );
|
||||
|
||||
endif;
|
||||
|
||||
|
@ -610,18 +610,17 @@ function woocommerce_process_login() {
|
|||
$woocommerce->add_error( $user->get_error_message() );
|
||||
else :
|
||||
|
||||
if (isset($_POST['redirect']) && $_POST['redirect']) :
|
||||
wp_safe_redirect( esc_attr($_POST['redirect']) );
|
||||
exit;
|
||||
endif;
|
||||
if (isset($_POST['redirect']) && $_POST['redirect']) {
|
||||
$redirect = esc_attr($_POST['redirect']);
|
||||
} else if ( wp_get_referer() ) {
|
||||
$redirect = wp_safe_redirect( wp_get_referer() );
|
||||
} else {
|
||||
$redirect = get_permalink(woocommerce_get_page_id('myaccount'));
|
||||
}
|
||||
|
||||
if ( wp_get_referer() ) :
|
||||
wp_safe_redirect( wp_get_referer() );
|
||||
exit;
|
||||
endif;
|
||||
|
||||
wp_redirect(get_permalink(woocommerce_get_page_id('myaccount')));
|
||||
wp_redirect(apply_filters('woocommerce_login_redirect', $redirect, $user));
|
||||
exit;
|
||||
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
@ -904,7 +903,7 @@ function woocommerce_download_product() {
|
|||
if ( $order_id ) {
|
||||
$order = new WC_Order( $order_id );
|
||||
|
||||
if ( ! $order->is_download_permitted() && $order->status != 'publish' )
|
||||
if ( ! $order->is_download_permitted() || $order->status != 'publish' )
|
||||
wp_die( __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . home_url() . '">' . __( 'Go to homepage →', 'woocommerce' ) . '</a>' );
|
||||
}
|
||||
|
||||
|
|
|
@ -797,7 +797,7 @@ class Woocommerce {
|
|||
if ( $attribute_taxonomies ) {
|
||||
foreach ($attribute_taxonomies as $tax) {
|
||||
|
||||
$name = $this->attribute_taxonomy_name($tax->attribute_name);
|
||||
$name = $this->attribute_taxonomy_name( $tax->attribute_name );
|
||||
$hierarchical = true;
|
||||
if ($name) {
|
||||
|
||||
|
@ -831,7 +831,7 @@ class Woocommerce {
|
|||
'assign_terms' => 'assign_product_terms',
|
||||
),
|
||||
'show_in_nav_menus' => $show_in_nav_menus,
|
||||
'rewrite' => array( 'slug' => $product_attribute_base . strtolower( sanitize_title( $tax->attribute_name ) ), 'with_front' => false, 'hierarchical' => $hierarchical ),
|
||||
'rewrite' => array( 'slug' => $product_attribute_base . sanitize_title( $tax->attribute_name ), 'with_front' => false, 'hierarchical' => $hierarchical ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ class Woocommerce {
|
|||
* @return string
|
||||
*/
|
||||
function attribute_taxonomy_name( $name ) {
|
||||
return 'pa_' . sanitize_title( $name );
|
||||
return 'pa_' . woocommerce_sanitize_taxonomy_name( $name );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1464,11 +1464,12 @@ class Woocommerce {
|
|||
global $wpdb;
|
||||
|
||||
if ( strstr( $name, 'pa_' ) ) {
|
||||
$name = str_replace( 'pa_', '', sanitize_title( $name ) );
|
||||
$name = woocommerce_sanitize_taxonomy_name( str_replace( 'pa_', '', $name ) );
|
||||
|
||||
$label = $wpdb->get_var( $wpdb->prepare( "SELECT attribute_label FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s;", $name ) );
|
||||
|
||||
if ( ! $label ) $label = ucfirst( $name );
|
||||
if ( ! $label )
|
||||
$label = ucfirst( $name );
|
||||
} else {
|
||||
$label = $name;
|
||||
}
|
||||
|
@ -1507,7 +1508,7 @@ class Woocommerce {
|
|||
$attribute_taxonomies = $this->get_attribute_taxonomies();
|
||||
if ( $attribute_taxonomies ) {
|
||||
foreach ( $attribute_taxonomies as $tax ) {
|
||||
$taxonomy_names[] = $this->attribute_taxonomy_name( strtolower( sanitize_title( $tax->attribute_name ) ) );
|
||||
$taxonomy_names[] = $this->attribute_taxonomy_name( $tax->attribute_name );
|
||||
}
|
||||
}
|
||||
return $taxonomy_names;
|
||||
|
|
Loading…
Reference in New Issue