woocommerce_quantity_input function

This commit is contained in:
Mike Jolley 2011-12-05 19:16:55 +00:00
parent bce591b75f
commit 86fd956072
1 changed files with 12 additions and 5 deletions

View File

@ -304,9 +304,7 @@ if (!function_exists('woocommerce_simple_add_to_cart')) {
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
<?php if (!$_product->is_downloadable()) : ?>
<div class="quantity"><input name="quantity" value="1" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>
<?php endif; ?>
<?php if (!$_product->is_downloadable()) woocommerce_quantity_input(); ?>
<button type="submit" class="button alt"><?php _e('Add to cart', 'woothemes'); ?></button>
@ -332,7 +330,7 @@ if (!function_exists('woocommerce_grouped_add_to_cart')) {
<tbody>
<?php foreach ($_product->get_children() as $child_id) : $child_product = $_product->get_child( $child_id ); $cavailability = $child_product->get_availability(); ?>
<tr>
<td><div class="quantity"><input name="quantity[<?php echo $child_product->id; ?>]" value="0" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div></td>
<td><?php woocommerce_quantity_input( 'quantity['.$child_product->id.']' ); ?></td>
<td><label for="product-<?php echo $child_product->id; ?>"><?php
if ($child_product->is_visible()) echo '<a href="'.get_permalink($child_product->id).'">';
echo $child_product->get_title();
@ -448,7 +446,7 @@ if (!function_exists('woocommerce_variable_add_to_cart')) {
<div class="single_variation"></div>
<div class="variations_button">
<input type="hidden" name="variation_id" value="" />
<div class="quantity"><input name="quantity" value="1" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>
<?php woocommerce_quantity_input(); ?>
<button type="submit" class="button alt"><?php _e('Add to cart', 'woothemes'); ?></button>
</div>
</div>
@ -482,6 +480,15 @@ if (!function_exists('woocommerce_external_add_to_cart')) {
}
}
/**
* Quantity inputs
**/
if (!function_exists('woocommerce_quantity_input')) {
function woocommerce_quantity_input( $name = 'quantity' ) {
echo '<div class="quantity"><input name="'.$name.'" value="1" size="4" title="Qty" class="input-text qty text" maxlength="12" /></div>';
}
}
/**
* Product Add to Cart forms