Hooks for quantity selectors and data-min tweaks
This commit is contained in:
parent
32675c2964
commit
2851642b6c
|
@ -128,6 +128,18 @@ jQuery(document).ready(function($) {
|
|||
// Quantity buttons
|
||||
$("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass('buttons_added').append('<input type="button" value="+" id="add1" class="plus" />').prepend('<input type="button" value="-" id="minus1" class="minus" />');
|
||||
|
||||
$("div.quantity, td.quantity").find('.qty').each(function(){
|
||||
|
||||
var min = parseInt($(this).attr('data-min'));
|
||||
|
||||
if (min && min > 1 && parseInt($(this).val()) < min) {
|
||||
|
||||
$(this).val(min);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(".plus").live('click', function() {
|
||||
var currentVal = parseInt($(this).prev(".qty").val());
|
||||
if (!currentVal || currentVal=="" || currentVal == "NaN") currentVal = 0;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -156,6 +156,8 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Filters to override default country and state on checkout form
|
||||
* Added item_number to paypal standard (sku)
|
||||
* Errors can be loaded into any page though wc_error query string var
|
||||
* Fix for default value when data-min is used
|
||||
* Hooks for quantity selectors
|
||||
|
||||
= 1.4.4 - 18/02/2012 =
|
||||
* Fix for remove coupon links after ajax update of shipping
|
||||
|
|
|
@ -56,7 +56,15 @@ global $woocommerce;
|
|||
endif;
|
||||
|
||||
?></td>
|
||||
<td class="product-quantity"><div class="quantity"><input name="cart[<?php echo $cart_item_key; ?>][qty]" data-max="<?php echo ($_product->backorders_allowed()) ? '' : $_product->get_stock_quantity(); ?>" value="<?php echo esc_attr( $values['quantity'] ); ?>" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div></td>
|
||||
<td class="product-quantity"><div class="quantity"><input name="cart[<?php echo $cart_item_key; ?>][qty]" data-min="<?php
|
||||
|
||||
echo apply_filters('woocommerce_cart_item_data_min', '', $_product);
|
||||
|
||||
?>" data-max="<?php
|
||||
|
||||
echo apply_filters('woocommerce_cart_item_data_max', ($_product->backorders_allowed()) ? '' : $_product->get_stock_quantity(), $_product);
|
||||
|
||||
?>" value="<?php echo esc_attr( $values['quantity'] ); ?>" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div></td>
|
||||
<td class="product-subtotal"><?php
|
||||
|
||||
echo $woocommerce->cart->get_product_subtotal( $_product, $values['quantity'] ) ;
|
||||
|
|
|
@ -366,7 +366,7 @@ if (!function_exists('woocommerce_quantity_input')) {
|
|||
'min_value' => '0'
|
||||
);
|
||||
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
$args = apply_filters('woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ));
|
||||
|
||||
woocommerce_get_template('single-product/add-to-cart/quantity.php', $args);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue