Merge pull request #197 from lukecarbis/patch-1

Variation select filter
This commit is contained in:
Mike Jolley 2011-11-15 04:10:31 -08:00
commit 96b5064ead
1 changed files with 2 additions and 1 deletions

View File

@ -353,6 +353,7 @@ if (!function_exists('woocommerce_variable_add_to_cart')) {
$attributes = $_product->get_available_attribute_variations();
$default_attributes = (array) maybe_unserialize(get_post_meta( $post->ID, '_default_attributes', true ));
$selected_attributes = apply_filters( 'woocommerce_product_default_attributes', $default_attributes );
// Put available variations into an array and put in a Javascript variable (JSON encoded)
$available_variations = array();
@ -406,7 +407,7 @@ if (!function_exists('woocommerce_variable_add_to_cart')) {
<option value=""><?php echo __('Choose an option', 'woothemes') ?>&hellip;</option>
<?php if(is_array($options)) : ?>
<?php
$selected_value = (isset($default_attributes[sanitize_title($name)])) ? $default_attributes[sanitize_title($name)] : '';
$selected_value = (isset($selected_attributes[sanitize_title($name)])) ? $selected_attributes[sanitize_title($name)] : '';
// Get terms if this is a taxonomy - ordered
if (taxonomy_exists(sanitize_title($name))) :
$args = array('menu_order' => 'ASC');