Fixed quotes in variation data

This commit is contained in:
Mike Jolley 2011-09-28 13:34:41 +01:00
parent e7b205bc6d
commit 8613ad5a92
6 changed files with 27 additions and 21 deletions

View File

@ -575,7 +575,7 @@ function process_product_meta_variable( $post_id ) {
foreach ($attributes as $attribute) :
if ( $attribute['is_variation'] ) :
$value = trim($_POST[ 'attribute_' . sanitize_title($attribute['name']) ][$i]);
$value = esc_attr(trim($_POST[ 'attribute_' . sanitize_title($attribute['name']) ][$i]));
if ($value) :
$title[] = $woocommerce->attribute_label($attribute['name']).': '.$value;
endif;
@ -618,7 +618,7 @@ function process_product_meta_variable( $post_id ) {
if ( $attribute['is_variation'] ) :
$value = trim($_POST[ 'attribute_' . sanitize_title($attribute['name']) ][$i]);
$value = esc_attr(trim($_POST[ 'attribute_' . sanitize_title($attribute['name']) ][$i]));
update_post_meta( $variation_id, 'attribute_' . sanitize_title($attribute['name']), $value );

View File

@ -2,7 +2,7 @@ jQuery( function($){
// Prevent enter submitting post form
jQuery("form#post").bind("keypress", function(e) {
if (e.keyCode == 34 || e.keyCode == 13) return false;
if (e.keyCode == 13) return false;
});
// TABS

File diff suppressed because one or more lines are too long

View File

@ -359,7 +359,12 @@ jQuery(document).ready(function($) {
if ($(this).val().length == 0) {
all_set = false;
}
current_settings[$(this).attr('name')] = $(this).val();
// Get value
value = $(this).val();
value = value.replace('"', '"');
// Add to settings array
current_settings[$(this).attr('name')] = value;
});
var matching_variations = find_matching_variations(current_settings);
@ -368,6 +373,7 @@ jQuery(document).ready(function($) {
var variation = matching_variations.pop();
$('form input[name=variation_id]').val(variation.variation_id);
show_variation(variation);
} else {
update_variation_values(matching_variations);
@ -542,20 +548,20 @@ jQuery(document).ready(function($) {
url: woocommerce_params.checkout_url,
data: $(form).serialize(),
success: function( code ) {
$('.woocommerce_error, .woocommerce_message').remove();
try {
success = $.parseJSON( code );
window.location = decodeURI(success.redirect);
}
catch(err) {
$(form).prepend( code );
$(form).unblock();
$('html, body').animate({
scrollTop: ($('form.checkout').offset().top - 100)
}, 1000);
}
},
$('.woocommerce_error, .woocommerce_message').remove();
try {
success = $.parseJSON( code );
window.location = decodeURI(success.redirect);
}
catch(err) {
$(form).prepend( code );
$(form).unblock();
$('html, body').animate({
scrollTop: ($('form.checkout').offset().top - 100)
}, 1000);
}
},
dataType: "html"
});
return false;

File diff suppressed because one or more lines are too long

View File

@ -462,7 +462,7 @@ function woocommerce_add_to_cart_action( $url = false ) {
$taxonomy = 'attribute_' . sanitize_title($attribute['name']);
if (!empty($_POST[$taxonomy])) :
$variations[$taxonomy] = $_POST[$taxonomy];
$variations[$taxonomy] = esc_attr(stripslashes($_POST[$taxonomy]));
else :
$all_variations_set = false;
endif;