Skip to content

Commit

Permalink
Merge branch 'master' into fix-13498
Browse files Browse the repository at this point in the history
# Conflicts:
#	includes/class-wc-order.php
#	tests/unit-tests/crud/data.php
  • Loading branch information
mikejolley committed Mar 15, 2017
2 parents 943c507 + 0ea5c52 commit d55653a
Show file tree
Hide file tree
Showing 68 changed files with 805 additions and 396 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ matrix:
env: WP_VERSION=latest WP_MULTISITE=1 PHP_LATEST_STABLE=7.1

before_script:
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
- bash tests/bin/travis.sh before

Expand Down
31 changes: 16 additions & 15 deletions assets/js/frontend/add-to-cart-variation.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
this.$attributeFields.unbind( 'change ' );

// Methods.
this.getChosenAttributes = this.getChosenAttributes.bind( this );
this.getChosenAttributes = this.getChosenAttributes.bind( this );
this.findMatchingVariations = this.findMatchingVariations.bind( this );
this.isMatch = this.isMatch.bind( this );
this.toggleResetLink = this.toggleResetLink.bind( this );
this.isMatch = this.isMatch.bind( this );
this.toggleResetLink = this.toggleResetLink.bind( this );

// Events.
$form.on( 'click', '.reset_variations', { variationForm: this }, this.onReset );
Expand Down Expand Up @@ -527,7 +527,9 @@
* Reset the slide position if the variation has a different image than the current one
*/
$.fn.wc_maybe_trigger_slide_position_reset = function( variation ) {
var $form = $( this ),
var $form = $( this ),
$product = $form.closest( '.product' ),
$product_gallery = $product.find( '.images' ),
reset_slide_position = false,
new_image_id = ( variation && variation.image_id ) ? variation.image_id : '';

Expand All @@ -538,7 +540,7 @@
$form.attr( 'current-image', new_image_id );

if ( reset_slide_position ) {
$( 'body' ).trigger( 'woocommerce_gallery_reset_slide_position' );
$product_gallery.trigger( 'woocommerce_gallery_reset_slide_position' );
}
};

Expand All @@ -548,9 +550,9 @@
$.fn.wc_variations_image_update = function( variation ) {
var $form = this,
$product = $form.closest( '.product' ),
$product_gallery = $product.find( '.images' ),
$gallery_img = $product.find( '.flex-control-nav li:eq(0) img' ),
$gallery_wrapper = $product.find( '.woocommerce-product-gallery__wrapper ' ),
$product_img_wrap = $gallery_wrapper.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ),
$product_img_wrap = $product_gallery.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ),
$product_img = $product_img_wrap.find( '.wp-post-image' );

if ( variation && variation.image && variation.image.src && variation.image.src.length > 1 ) {
Expand All @@ -561,9 +563,9 @@
$product_img.wc_set_variation_attr( 'sizes', variation.image.sizes );
$product_img.wc_set_variation_attr( 'title', variation.image.title );
$product_img.wc_set_variation_attr( 'alt', variation.image.alt );
$product_img.wc_set_variation_attr( 'data-large-image', variation.image.full_src );
$product_img.wc_set_variation_attr( 'data-large-image-width', variation.image.full_src_w );
$product_img.wc_set_variation_attr( 'data-large-image-height', variation.image.full_src_h );
$product_img.wc_set_variation_attr( 'data-large_image', variation.image.full_src );
$product_img.wc_set_variation_attr( 'data-large_image_width', variation.image.full_src_w );
$product_img.wc_set_variation_attr( 'data-large_image_height', variation.image.full_src_h );
$product_img_wrap.wc_set_variation_attr( 'data-thumb', variation.image.src );
$gallery_img.wc_set_variation_attr( 'src', variation.image.src );
} else {
Expand All @@ -574,16 +576,15 @@
$product_img.wc_reset_variation_attr( 'sizes' );
$product_img.wc_reset_variation_attr( 'title' );
$product_img.wc_reset_variation_attr( 'alt' );
$product_img.wc_reset_variation_attr( 'data-large-image' );
$product_img.wc_reset_variation_attr( 'data-large-image-width' );
$product_img.wc_reset_variation_attr( 'data-large-image-height' );
$product_img.wc_reset_variation_attr( 'data-large_image' );
$product_img.wc_reset_variation_attr( 'data-large_image_width' );
$product_img.wc_reset_variation_attr( 'data-large_image_height' );
$product_img_wrap.wc_reset_variation_attr( 'data-thumb' );
$product_img.wc_reset_variation_attr( 'large-image' );
$gallery_img.wc_reset_variation_attr( 'src' );
}

window.setTimeout( function() {
$( 'body' ).trigger( 'woocommerce_init_gallery' );
$product_gallery.trigger( 'woocommerce_gallery_init_zoom' );
$form.wc_maybe_trigger_slide_position_reset( variation );
$( window ).trigger( 'resize' );
}, 10 );
Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/add-to-cart-variation.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit d55653a

Please sign in to comment.