Fixed "All" variations
This commit is contained in:
parent
e5b87570bf
commit
64c0bf6007
|
@ -21,8 +21,8 @@ function variable_product_type_options() {
|
|||
|
||||
// See if any are set
|
||||
$variation_attribute_found = false;
|
||||
foreach($attributes as $attribute){
|
||||
if ($attribute['is_variation']) :
|
||||
if ($attributes) foreach($attributes as $attribute){
|
||||
if (isset($attribute['is_variation'])) :
|
||||
$variation_attribute_found = true;
|
||||
break;
|
||||
endif;
|
||||
|
@ -65,8 +65,6 @@ function variable_product_type_options() {
|
|||
// Get current value for variation (if set)
|
||||
$variation_selected_value = get_post_meta( $variation->ID, 'attribute_' . sanitize_title($attribute['name']), true );
|
||||
|
||||
if (!is_array($options)) $options = explode(',', $options);
|
||||
|
||||
// Name will be something like attribute_pa_color
|
||||
echo '<select name="attribute_' . sanitize_title($attribute['name']).'['.$loop.']"><option value="">'.__('Any ', 'woothemes').$woocommerce->attribute_label($attribute['name']).'…</option>';
|
||||
|
||||
|
|
|
@ -436,7 +436,11 @@ function woocommerce_process_product_meta( $post_id, $post ) {
|
|||
);
|
||||
else :
|
||||
// Format values
|
||||
$values = trim(htmlspecialchars(stripslashes($attribute_values[$i])));
|
||||
$values = htmlspecialchars(stripslashes($attribute_values[$i]));
|
||||
// Text based, separate by pipe
|
||||
$values = explode('|', $values);
|
||||
$values = array_map('trim', $values);
|
||||
$values = implode('|', $values);
|
||||
|
||||
// Custom attribute - Add attribute to array and set the values
|
||||
$attributes[ sanitize_title( $attribute_names[$i] ) ] = array(
|
||||
|
|
|
@ -304,7 +304,11 @@ jQuery(document).ready(function($) {
|
|||
var attr_val = attributes[attr_name];
|
||||
|
||||
if(attr_name == current_attr_name) {
|
||||
current_attr_select.find('option[value="'+attr_val+'"]').removeAttr('disabled');
|
||||
if (attr_val) {
|
||||
current_attr_select.find('option[value="'+attr_val+'"]').removeAttr('disabled');
|
||||
} else {
|
||||
current_attr_select.find('option').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue