frontend add to cart variation jshinted and coding standards

This commit is contained in:
splashingpixels 2014-03-16 22:19:58 -07:00 committed by Mike Jolley
parent 2fed8e3f53
commit 1396e9179a
2 changed files with 303 additions and 305 deletions

View File

@ -16,6 +16,7 @@
matching.push( variation );
}
}
return matching;
};
@ -23,13 +24,16 @@
var match = true;
for ( var attr_name in attrs1 ) {
if ( attrs1.hasOwnProperty( attr_name ) ) {
var val1 = attrs1[ attr_name ];
var val2 = attrs2[ attr_name ];
if ( val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 != val2 ) {
if ( val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 !== val2 ) {
match = false;
}
}
}
return match;
};
@ -108,7 +112,7 @@
any_set = true;
}
if ( exclude && $( this ).attr( 'name' ) == exclude ) {
if ( exclude && $( this ).attr( 'name' ) === exclude ) {
all_set = false;
current_settings[$( this ).attr( 'name' )] = '';
@ -129,9 +133,9 @@
// Fallback to window property if not set - backwards compat
if ( ! all_variations )
all_variations = window[ 'product_variations' ][ product_id ];
all_variations = window.product_variations.product_id;
if ( ! all_variations )
all_variations = window[ 'product_variations' ];
all_variations = window.product_variations;
if ( ! all_variations )
all_variations = window['product_variations_' + product_id ];
@ -252,7 +256,7 @@
var attributes = variations[ num ].attributes;
for ( var attr_name in attributes ) {
if ( attributes.hasOwnProperty( attr_name ) ) {
var attr_val = attributes[ attr_name ];
if ( attr_name == current_attr_name ) {
@ -274,13 +278,10 @@
current_attr_select.find( 'option:gt(0)' ).addClass( 'active' );
}
}
}
}
}
}
// Detach inactive

File diff suppressed because one or more lines are too long