function sf_single_variation_add_to_cart_button()
{
    global $product;
    $loading_text = __('Adding...', 'swiftframework');
    $added_text = __('Item added', 'swiftframework');
    ?>
		<div class="variations_button">
			<?php 
    woocommerce_quantity_input(array('input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1));
    ?>
			<button type="submit" data-product_id="<?php 
    echo esc_attr($product->id);
    ?>
" data-quantity="1" data-default_text="<?php 
    echo esc_attr($product->single_add_to_cart_text());
    ?>
" data-default_icon="sf-icon-add-to-cart" data-loading_text="<?php 
    echo esc_attr($loading_text);
    ?>
" data-added_text="<?php 
    echo esc_attr($added_text);
    ?>
" class="single_add_to_cart_button button alt"><?php 
    echo apply_filters('sf_add_to_cart_icon', '<i class="sf-icon-add-to-cart"></i>');
    ?>
<span><?php 
    echo esc_attr($product->single_add_to_cart_text());
    ?>
</span></button>
			<input type="hidden" name="add-to-cart" value="<?php 
    echo absint($product->id);
    ?>
" />
			<input type="hidden" name="product_id" value="<?php 
    echo absint($product->id);
    ?>
" />
			<input type="hidden" name="variation_id" class="variation_id" value="" />
			<?php 
    echo sf_wishlist_button();
    ?>
		</div>
		<?php 
}
		<?php 
    do_action('woocommerce_before_add_to_cart_button');
    ?>

		<div class="single_variation_wrap" style="display:none;">
			<?php 
    do_action('woocommerce_before_single_variation');
    ?>

			<div class="single_variation"></div>

			<div class="variations_button">

				<?php 
    woocommerce_quantity_input(array('input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1));
    ?>
				<button type="submit" class="single_add_to_cart_button button alt"><?php 
    echo $product->single_add_to_cart_text();
    ?>
</button>
			</div>

			<input type="hidden" name="add-to-cart" value="<?php 
    echo absint($product->id);
    ?>
" />
			<input type="hidden" name="product_id" value="<?php 
    echo absint($product->id);
    ?>
" />
/**
 * Override the Output the add to cart button for variations.
 */
function woocommerce_single_variation_add_to_cart_button()
{
    global $product;
    ?>
    <div class="variations_button">
        <button type="submit" class="single_add_to_cart_button button alt"><?php 
    echo esc_html($product->single_add_to_cart_text());
    ?>
</button>
        <input type="hidden" name="add-to-cart" value="<?php 
    echo absint($product->id);
    ?>
" />
        <input type="hidden" name="product_id" value="<?php 
    echo absint($product->id);
    ?>
" />
        <input type="hidden" name="variation_id" class="variation_id" value="" />
        <?php 
    woocommerce_quantity_input(array('input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1));
    ?>
    </div>
    <?php 
}
Esempio n. 4
0
 }
 $start_date = null;
 if (!empty($ticket->start_date)) {
     $start_date = strtotime($ticket->start_date . $gmt_offset);
 }
 if ((empty($start_date) || time() > $start_date) && (empty($end_date) || time() < $end_date)) {
     $is_there_any_product = true;
     echo sprintf('<input type="hidden" name="product_id[]" value="%d">', $ticket->ID);
     echo '<tr>';
     echo '<td class="woocommerce">';
     if ($product->is_in_stock()) {
         // Max quantity will be left open if backorders allowed, restricted to 1 if the product is
         // constrained to be sold individually or else set to the available stock quantity
         $max_quantity = $product->backorders_allowed() ? '' : $product->get_stock_quantity();
         $max_quantity = $product->is_sold_individually() ? 1 : $max_quantity;
         woocommerce_quantity_input(array('input_name' => 'quantity_' . $ticket->ID, 'input_value' => 0, 'min_value' => 0, 'max_value' => $max_quantity));
         $is_there_any_product_to_sell = true;
     } else {
         echo '<span class="tickets_nostock">' . esc_html__('Out of stock!', 'tribe-wootickets') . '</span>';
     }
     echo '</td>';
     echo '<td nowrap="nowrap" class="tickets_name">';
     echo $ticket->name;
     echo '</td>';
     echo '<td class="tickets_price">';
     echo $this->get_price_html($product);
     //echo '<a class="member_discount nav_login" href="';
     //echo esc_url(home_url('/'));
     //echo 'wp-admin';
     //echo '">Login for member discount</a>';
     if (!is_user_logged_in()) {
Esempio n. 5
0
function khore_woocommerce_before_shop_loop_item()
{
    global $post;
    echo '<td class="title">';
    do_action('woocommerce_before_shop_loop_item_title');
    echo '<h3>' . get_the_title() . '</h3>';
    do_action('woocommerce_after_shop_loop_item_title');
    echo '</td>';
    echo '<td class="description">';
    echo '<span class="short-description">' . $post->post_excerpt . '</span>';
    echo '</td>';
    echo '<td class="price">';
    woocommerce_template_loop_price();
    echo '</td>';
    echo '<td class="quantity">';
    woocommerce_quantity_input();
    echo '<input type="hidden" name="product_id" value="' . $post->ID . '" />';
    echo '</td>';
}
Esempio n. 6
0
	<?php 
    do_action('woocommerce_before_add_to_cart_form');
    ?>

	<form action="<?php 
    echo esc_url($product->add_to_cart_url());
    ?>
" class="qty-product-single clearfix cart" method="post" enctype='multipart/form-data'>

	 	<?php 
    do_action('woocommerce_before_add_to_cart_button');
    ?>

	 	<?php 
    if (!$product->is_sold_individually()) {
        woocommerce_quantity_input(array('min_value' => 1, 'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity()));
    }
    ?>

	 	<button type="submit" class="single_add_to_cart_button button3 fr alt"><?php 
    echo apply_filters('single_add_to_cart_text', __('Add to cart', 'qns'), $product->product_type);
    ?>
</button>

	 	<?php 
    do_action('woocommerce_after_add_to_cart_button');
    ?>

	</form>

	<?php 
<?php 
if ($product->is_in_stock()) {
    ?>

	<?php 
    do_action('woocommerce_before_add_to_cart_form');
    ?>

	<form class="cart" method="post" enctype='multipart/form-data'>
	 	<?php 
    do_action('woocommerce_before_add_to_cart_button');
    ?>

	 	<?php 
    if (!$product->is_sold_individually()) {
        woocommerce_quantity_input(array('min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product)));
    }
    ?>

	 	<input type="hidden" name="add-to-cart" value="<?php 
    echo esc_attr($product->id);
    ?>
" />

	 	<button type="submit" class="single_add_to_cart_button button alt btn btn-default"><?php 
    echo wp_kses_post($product->single_add_to_cart_text());
    ?>
</button>

		<?php 
    do_action('woocommerce_after_add_to_cart_button');
Esempio n. 8
0
    /**
     * Output the add to cart button for variations.
     */
    function cr_single_variation_add_to_cart_button()
    {
        global $product;
        ?>
        <div class="variations_button point-of-action">
            <div class="quantity">
                <label>Qty:</label>
                <?php 
        woocommerce_quantity_input(array('input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1));
        ?>
            </div>
            <div class="add-to-cart">
                <button type="submit" class="single_add_to_cart_button button alt btn btn-primary"><i class="fa fa-shopping-cart"></i> <?php 
        echo esc_html($product->single_add_to_cart_text());
        ?>
</button>
            </div>
            <input type="hidden" name="add-to-cart" value="<?php 
        echo absint($product->id);
        ?>
" />
            <input type="hidden" name="product_id" value="<?php 
        echo absint($product->id);
        ?>
" />
            <input type="hidden" name="variation_id" class="variation_id" value="" />
        </div>
        <?php 
    }
Esempio n. 9
0
    setup_postdata($post);
    ?>
          <tr>
            <td>
              <?php 
    if ($product->is_sold_individually() || !$product->is_purchasable()) {
        ?>
                <?php 
        woocommerce_template_loop_add_to_cart();
        ?>
              <?php 
    } else {
        ?>
                <?php 
        $quantites_required = true;
        woocommerce_quantity_input(array('input_name' => 'quantity[' . $product_id . ']', 'input_value' => isset($_POST['quantity'][$product_id]) ? wc_stock_amount($_POST['quantity'][$product_id]) : 0, 'min_value' => apply_filters('woocommerce_quantity_input_min', 0, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product)));
        ?>
              <?php 
    }
    ?>
            </td>

            <td class="label">
              <label for="product-<?php 
    echo $product_id;
    ?>
">
                <?php 
    echo $product->is_visible() ? '<a href="' . esc_url(apply_filters('woocommerce_grouped_product_list_link', get_permalink(), $product_id)) . '">' . esc_html(get_the_title()) . '</a>' : esc_html(get_the_title());
    ?>
              </label>
Esempio n. 10
0
<?php 
if ($product->is_in_stock()) {
    ?>

	<?php 
    do_action('woocommerce_before_add_to_cart_form');
    ?>

	<form class="cart" method="post" enctype='multipart/form-data'>
	 	<?php 
    do_action('woocommerce_before_add_to_cart_button');
    ?>

	 	<?php 
    if (!$product->is_sold_individually()) {
        woocommerce_quantity_input(array('min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product), 'input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : 1));
    }
    ?>

	 	<input type="hidden" name="add-to-cart" value="<?php 
    echo esc_attr($product->id);
    ?>
" />

	 	<button type="submit" class="single_add_to_cart_button button alt"><?php 
    echo esc_html($product->single_add_to_cart_text());
    ?>
</button>

		<?php 
    do_action('woocommerce_after_add_to_cart_button');
Esempio n. 11
0
                $item_data[] = array('key' => $label, 'value' => $value);
            }
        }
        // Output flat or in list format
        if (sizeof($item_data) > 0) {
            foreach ($item_data as $data) {
                echo esc_html($data['key']) . ': ' . wp_kses_post($data['value']) . "\n";
            }
        }
        ?>
				</td>


				<td class="product-quantity">
					<?php 
        $product_quantity = woocommerce_quantity_input(array('input_name' => "raq[{$key}][qty]", 'input_value' => $raq['quantity'], 'max_value' => apply_filters('ywraq_quantity_max_value', $_product->backorders_allowed() ? '' : $_product->get_stock_quantity()), 'min_value' => '0'), $_product, false);
        echo $product_quantity;
        ?>
				</td>

                <td class="product-subtotal">
                    <?php 
        echo apply_filters('yith_ywraq_hide_price_template', WC()->cart->get_product_subtotal($_product, $raq['quantity']));
        ?>
                </td>
			</tr>

	<?php 
    }
    ?>
Esempio n. 12
0
    setup_postdata($post);
    ?>
					<tr>
						<td>
							<?php 
    if ($product->is_sold_individually() || !$product->is_purchasable()) {
        ?>
								<?php 
        mango_add_to_cart($product_id);
        ?>
							<?php 
    } else {
        ?>
								<?php 
        $quantites_required = true;
        woocommerce_quantity_input(array('input_name' => 'quantity[' . $product_id . ']', 'input_value' => '0', 'min_value' => apply_filters('woocommerce_quantity_input_min', 0, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product)));
        ?>
							<?php 
    }
    ?>
						</td>

						<td class="label margin_top_20">
							<label class="input-desc" for="product-<?php 
    echo $product_id;
    ?>
">
								<?php 
    echo $product->is_visible() ? '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' : get_the_title();
    ?>
							</label>
Esempio n. 13
0
 if (!empty($ticket->end_date)) {
     $end_date = strtotime($ticket->end_date . $gmt_offset);
 } else {
     $end_date = strtotime(tribe_get_end_date(get_the_ID(), false, 'Y-m-d G:i') . $gmt_offset);
 }
 $start_date = null;
 if (!empty($ticket->start_date)) {
     $start_date = strtotime($ticket->start_date . $gmt_offset);
 }
 if ((empty($start_date) || time() > $start_date) && (empty($end_date) || time() < $end_date)) {
     $is_there_any_product = true;
     echo sprintf("<input type='hidden' name='product_id[]' value='%d'>", $ticket->ID);
     echo "<tr>";
     echo "<td class='woocommerce'>";
     if ($product->is_in_stock()) {
         woocommerce_quantity_input(array('input_name' => 'quantity_' . $ticket->ID, 'input_value' => 0, 'min_value' => 0, 'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity()));
         $is_there_any_product_to_sell = true;
     } else {
         echo "<span class='tickets_nostock'>" . esc_html__('Out of stock!', 'tribe-wootickets') . "</span>";
     }
     echo "</td>";
     echo "<td nowrap='nowrap' class='tickets_name'>";
     echo $ticket->name;
     echo "</td>";
     echo "<td class='tickets_price'>";
     echo $this->get_price_html($product);
     echo "</td>";
     echo "<td class='tickets_description'>";
     echo $ticket->description;
     echo "</td>";
     echo "</tr>";
 /**
  * Add the pricing calculator and quantity input if the user can view the price
  *
  * @since 3.7.0
  */
 public function catalog_visibility_options_pricing_calculator_quantity_input()
 {
     global $product;
     // bail if the calculator is not enabled for this product
     if (!$product || !WC_Price_Calculator_Product::calculator_enabled($product)) {
         return;
     }
     // bail if current user can't view the price
     if (class_exists('WC_Catalog_Restrictions_Filters') && !WC_Catalog_Restrictions_Filters::instance()->user_can_view_price($product)) {
         return;
     }
     // render pricing calculator
     wc_measurement_price_calculator()->get_product_page_instance()->render_price_calculator();
     // render quantity input
     if (!$product->is_sold_individually()) {
         woocommerce_quantity_input(array('min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product)));
     }
 }
    /**
     * Gets cart contents as formatted HTML.
     * Used in KCO widget.
     *
     * @since  2.0
     **/
    function klarna_checkout_get_cart_contents_html($atts)
    {
        global $woocommerce;
        ob_start();
        if (!defined('WOOCOMMERCE_CART')) {
            define('WOOCOMMERCE_CART', true);
        }
        $woocommerce->cart->calculate_shipping();
        $woocommerce->cart->calculate_fees();
        $woocommerce->cart->calculate_totals();
        $hide_columns = array();
        if ('' != $atts['hide_columns']) {
            $hide_columns = explode(',', $atts['hide_columns']);
        }
        ?>
		<div>
			<table id="klarna-checkout-cart">
				<tbody>
				<tr>
					<?php 
        if (!in_array('remove', $hide_columns)) {
            ?>
						<th class="product-remove kco-leftalign"></th>
					<?php 
        }
        ?>
					<th class="product-name kco-leftalign"><?php 
        _e('Product', 'woocommerce-gateway-klarna');
        ?>
</th>
					<?php 
        if (!in_array('price', $hide_columns)) {
            ?>
						<th class="product-price kco-centeralign"><?php 
            _e('Price', 'woocommerce-gateway-klarna');
            ?>
</th>
					<?php 
        }
        ?>
					<th class="product-quantity kco-centeralign"><?php 
        _e('Quantity', 'woocommerce-gateway-klarna');
        ?>
</th>
					<th class="product-total kco-rightalign"><?php 
        _e('Total', 'woocommerce-gateway-klarna');
        ?>
</th>
				</tr>
				<?php 
        // Cart items
        foreach ($woocommerce->cart->get_cart() as $cart_item_key => $cart_item) {
            $_product = $cart_item['data'];
            echo '<tr>';
            if (!in_array('remove', $hide_columns)) {
                echo '<td class="kco-product-remove kco-leftalign"><a href="#">x</a></td>';
            }
            echo '<td class="product-name kco-leftalign">';
            if (!$_product->is_visible()) {
                echo apply_filters('woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key) . '&nbsp;';
            } else {
                echo apply_filters('woocommerce_cart_item_name', sprintf('<a href="%s">%s </a>', $_product->get_permalink($cart_item), $_product->get_title()), $cart_item, $cart_item_key);
            }
            // Meta data
            echo $woocommerce->cart->get_item_data($cart_item);
            echo '</td>';
            if (!in_array('price', $hide_columns)) {
                echo '<td class="product-price kco-centeralign"><span class="amount">';
                echo $woocommerce->cart->get_product_price($_product);
                echo '</span></td>';
            }
            echo '<td class="product-quantity kco-centeralign" data-cart_item_key="' . $cart_item_key . '">';
            if ($_product->is_sold_individually()) {
                $product_quantity = sprintf('1 <input type="hidden" name="cart[%s][qty]" value="1" />', esc_attr($cart_item_key));
            } else {
                $product_quantity = woocommerce_quantity_input(array('input_name' => "cart[{$cart_item_key}][qty]", 'input_value' => $cart_item['quantity'], 'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), 'min_value' => '1'), $_product, false);
            }
            echo apply_filters('woocommerce_cart_item_quantity', $product_quantity, $cart_item_key);
            echo '</td>';
            echo '<td class="product-total kco-rightalign"><span class="amount">';
            echo apply_filters('woocommerce_cart_item_subtotal', $woocommerce->cart->get_product_subtotal($_product, $cart_item['quantity']), $cart_item, $cart_item_key);
            echo '</span></td>';
            echo '</tr>';
        }
        ?>
				</tbody>
			</table>
		</div>
		<?php 
        return ob_get_clean();
    }
            public function set_simple_add_to_cart()
            {
                global $woocommerce, $product, $post;
                if (!$product->is_purchasable()) {
                    return;
                }
                $availability = $product->get_availability();
                /* CHECK IF DISPLAY IN_STOCK */
                $show_if_stocked = get_post_meta($post->ID, self::ID . '_show_stock_product', true);
                $stock_override = get_option(self::ID . '_show_stocks');
                $is_virtual = get_post_meta($post->ID, '_virtual', true);
                $show_stock = true;
                if ($stock_override != '1' && $stock_override != 'yes') {
                    $show_stock = false;
                }
                if ($show_if_stocked == 'show') {
                    $show_stock = true;
                } else {
                    $show_stock = false;
                    if ($stock_override == '1' || $stock_override == 'yes') {
                        $show_stock = true;
                    }
                }
                if ($is_virtual == '1' || $is_virtual == 'yes') {
                    $show_stock = false;
                }
                if ($show_stock) {
                    if ($availability['availability']) {
                        echo apply_filters('woocommerce_stock_html', '<p class="stock paywhatyouwant ' . esc_attr($availability['class']) . '">' . esc_html($availability['availability']) . '</p>', $availability['availability']);
                    }
                }
                if ($product->is_in_stock()) {
                    do_action('woocommerce_before_add_to_cart_form');
                    ?>

            <form class="cart paywhatyouwant" method="post" enctype='multipart/form-data'>
            <?php 
                    do_action('woocommerce_before_add_to_cart_button');
                    ?>
            <?php 
                    if (!$product->is_sold_individually()) {
                        $itemproduct = array('min_value' => apply_filters('woocommerce_quantity_input_min', 1, $product), 'max_value' => apply_filters('woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product));
                        woocommerce_quantity_input($itemproduct);
                    }
                    ?>
            <input type="hidden" name="add-to-cart" value="<?php 
                    echo esc_attr($product->id);
                    ?>
" />
            <?php 
                    $pwyw_amount = self::get_single_item_price();
                    /*<button type="submit" class="single_add_to_cart_button button alt"><?php echo $product->single_add_to_cart_text(); ?></button> */
                    echo '<input type="button" data-amount="' . $pwyw_amount . '" data-pid="' . $post->ID . '" onclick="pwyw_add_to_cart(' . $post->ID . ');" class="single_add_to_cart_button button alt pwyw_price_input" value="' . $product->add_to_cart_text() . '" >';
                    //echo '<input type="button" id="single_add_to_cart_button" data-pid="' . $post->ID . '" class="single_add_to_cart_button button alt" value="' . $product->add_to_cart_text() . '" >';
                    do_action('woocommerce_after_add_to_cart_button');
                    ?>
            </form>

            <?php 
                    do_action('woocommerce_after_add_to_cart_form');
                }
                self::set_product_meta();
            }
 function dvin_qlist_quantity_input($input_name, $input_value, $args = array(), $product = null, $echo = true)
 {
     if (is_null($product)) {
         $product = $GLOBALS['product'];
     }
     $product_quantity = woocommerce_quantity_input(array('input_name' => $input_name, 'input_value' => $input_value, 'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity(), 'min_value' => '1'), $product, false);
     $output = apply_filters('woocommerce_cart_item_quantity', $product_quantity, '');
     if ($echo) {
         echo $output;
     } else {
         return $output;
     }
 }
        /**
         * single variation template for variable_wccl
         *
         * @since 1.2
         * @author Francesco Licandro
         */
        public function single_variation()
        {
            global $product, $woocommerce;
            if (version_compare(preg_replace('/-beta-([0-9]+)/', '', $woocommerce->version), '2.4', '>=')) {
                return;
            }
            ob_start();
            ?>

            <div class="single_variation"></div>
            <div class="variations_button">

                <?php 
            woocommerce_quantity_input();
            ?>
                <button type="submit" class="single_add_to_cart_button button alt"><?php 
            echo apply_filters('single_add_to_cart_text', __('Add to cart', 'woocommerce'), $product->product_type);
            ?>
</button>
            </div>

            <input type="hidden" name="add-to-cart" value="<?php 
            echo $product->id;
            ?>
" />
            <input type="hidden" name="product_id" value="<?php 
            echo esc_attr($product->ID);
            ?>
" />
            <input type="hidden" name="variation_id" class="variation_id" value="" />

            <?php 
            echo ob_get_clean();
        }
Esempio n. 19
0
        echo $bundled_item_id;
        ?>
]" value="" /><?php 
        foreach ($attributes[$bundled_item_id] as $name => $options) {
            ?>
							<input type="hidden" name="bundle_attribute_<?php 
            echo sanitize_title($name) . '[' . $bundled_item_id . ']';
            ?>
" value=""><?php 
        }
    }
    ?>
				<?php 
}
if (!$product->is_sold_individually()) {
    woocommerce_quantity_input(array('min_value' => 1));
}
?>
				<button type="submit" class="button alt"><?php 
echo apply_filters('single_add_to_cart_text', __('Add to cart', 'woocommerce'), $product->product_type);
?>
</button>
			</div>
			<input type="hidden" name="add-to-cart" value="<?php 
echo $product->id;
?>
" />
		</div>

		<?php 
do_action('woocommerce_after_add_to_cart_button');
 /**
  * Composited item quantities may be changed between min_q and max_q.
  *
  * @param  string 	$quantity
  * @param  string 	$cart_item_key
  * @return string
  */
 public function wc_cp_cart_item_quantity($quantity, $cart_item_key)
 {
     $cart_item = WC()->cart->cart_contents[$cart_item_key];
     if (isset($cart_item['composite_data']) && !empty($cart_item['composite_parent'])) {
         $component_id = $cart_item['composite_item'];
         if ($cart_item['composite_data'][$component_id]['quantity_min'] === $cart_item['composite_data'][$component_id]['quantity_max']) {
             $quantity = $cart_item['quantity'];
         } elseif (isset($cart_item['composite_parent']) && isset(WC()->cart->cart_contents[$cart_item['composite_parent']])) {
             $parent = WC()->cart->cart_contents[$cart_item['composite_parent']];
             $parent_quantity = $parent['quantity'];
             $max_stock = $cart_item['data']->backorders_allowed() ? '' : $cart_item['data']->get_stock_quantity();
             if ($max_stock !== '') {
                 $max_qty = $cart_item['composite_data'][$component_id]['quantity_max'] !== '' ? min($max_stock, $parent_quantity * $cart_item['composite_data'][$component_id]['quantity_max']) : $max_stock;
             } else {
                 $max_qty = $cart_item['composite_data'][$component_id]['quantity_max'] !== '' ? $parent_quantity * $cart_item['composite_data'][$component_id]['quantity_max'] : '';
             }
             $min_qty = $parent_quantity * $cart_item['composite_data'][$component_id]['quantity_min'];
             if (($max_qty > $min_qty || $max_qty === '') && !$cart_item['data']->is_sold_individually()) {
                 $component_quantity = woocommerce_quantity_input(array('input_name' => "cart[{$cart_item_key}][qty]", 'input_value' => $cart_item['quantity'], 'min_value' => $min_qty, 'max_value' => $max_qty, 'step' => $parent_quantity), $cart_item['data'], false);
                 $quantity = $component_quantity;
             } else {
                 $quantity = $cart_item['quantity'];
             }
         } else {
             $quantity = $cart_item['quantity'];
         }
     }
     return $quantity;
 }
Esempio n. 21
0
    setup_postdata($post);
    ?>
					<tr>
						<td>
							<?php 
    if ($product->is_sold_individually() || !$product->is_purchasable()) {
        ?>
								<?php 
        woocommerce_template_loop_add_to_cart();
        ?>
							<?php 
    } else {
        ?>
								<?php 
        $quantites_required = true;
        woocommerce_quantity_input(array('input_name' => 'quantity[' . $product_id . ']', 'input_value' => '0'));
        ?>
							<?php 
    }
    ?>
						</td>

						<td class="label">
							<label for="product-<?php 
    echo $product_id;
    ?>
">
								<?php 
    echo $product->is_visible() ? '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' : get_the_title();
    ?>
							</label>
Esempio n. 22
0
        ?>

							<a href="<?php 
        echo esc_url($child_product['product']->add_to_cart_url());
        ?>
" rel="nofollow" class="single_add_to_cart_button button alt"><?php 
        echo apply_filters('single_add_to_cart_text', __('Add to cart', 'woocommerce'), $child_product['product']->product_type);
        ?>
</a>

						<?php 
    } else {
        ?>

							<?php 
        woocommerce_quantity_input(array('input_name' => 'quantity[' . $child_product['product']->id . ']', 'input_value' => '0'));
        ?>

						<?php 
    }
    ?>
					</td>

					<td class="label"><label for="product-<?php 
    echo $child_product['product']->id;
    ?>
"><?php 
    if ($child_product['product']->is_visible()) {
        echo '<a href="' . get_permalink($child_product['product']->id) . '">' . $child_product['product']->post->post_title . '</a>';
    } else {
        echo $child_product['product']->post->post_title;
    if (!$_product->needs_shipping()) {
        continue;
    }
    for ($x = 0; $x < $value['quantity']; $x++) {
        ?>
            <tr>
                <td>
                    <?php 
        echo get_the_title($value['product_id']);
        echo $woocommerce->cart->get_item_data($value);
        ?>
                </td>
                <td>
                    <?php 
        //$qty = array_count_values($relations[$x]);
        $product_quantity = woocommerce_quantity_input(array('input_name' => "items[{$key}][qty][]", 'input_value' => 1, 'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity()), $_product, false);
        echo $product_quantity;
        ?>
                </td>
                <?php 
        do_action('wc_ms_multiple_address_table_row', $key, $value);
        ?>
                <td>
                    <select name="items[<?php 
        echo $key;
        ?>
][address][]" class="address-select">
                    <?php 
        $option_selected = false;
        foreach ($addresses as $addr_key => $address) {
            $formatted = $address['shipping_first_name'] . ' ' . $address['shipping_last_name'] . ',';
Esempio n. 24
0
<?php

/**
 * Bundled Product Quantity Template.
 *
 * @version 4.8.8
 */
// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
$quantity_min = $bundled_item->get_quantity();
$quantity_max = $bundled_item->get_quantity('max');
if ($quantity_min == $quantity_max || $bundled_item->is_out_of_stock()) {
    ?>
<div class="quantity quantity_hidden" style="display:none;"><input class="qty bundled_qty" type="hidden" name="<?php 
    echo $bundle_fields_prefix;
    ?>
bundle_quantity_<?php 
    echo $bundled_item->item_id;
    ?>
" value="<?php 
    echo $quantity_min;
    ?>
" /></div><?php 
} else {
    $input_name = $bundle_fields_prefix . 'bundle_quantity_' . $bundled_item->item_id;
    ob_start();
    woocommerce_quantity_input(array('input_name' => $input_name, 'min_value' => $quantity_min, 'max_value' => $quantity_max, 'input_value' => isset($_POST[$input_name]) ? $_POST[$input_name] : apply_filters('woocommerce_bundled_product_quantity', $quantity_min, $quantity_min, $quantity_max, $bundled_item)), $bundled_item->product);
    echo str_replace('qty text', 'qty text bundled_qty', ob_get_clean());
}
 public function tm_woocommerce_cart_after_row($cart_item_key = "", $cart_item = "", $_product = "", $product_id = "")
 {
     $out = '';
     $other_data = array();
     if ($this->tm_epo_hide_options_in_cart == "normal") {
         $other_data = $this->get_item_data_array(array(), $cart_item);
     }
     $odd = 1;
     foreach ($other_data as $key => $value) {
         $zebra_class = "odd ";
         if (!$odd) {
             $zebra_class = "even ";
             $odd = 2;
         }
         $out .= '<tr class="tm-epo-cart-row ' . $zebra_class . esc_attr(apply_filters('woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key)) . '">';
         $out .= '<td class="product-remove">&nbsp;</td>';
         $thumbnail = '&nbsp;';
         $out .= '<td class="product-thumbnail">' . $thumbnail . '</td>';
         $name = '<div class="tm-epo-cart-option-value tm-epo-cart-no-label">' . $value['tm_value'] . '</div>';
         if (!empty($value['tm_label'])) {
             $name = '<div class="tm-epo-cart-option-label">' . $value['tm_label'] . '</div>' . '<div class="tm-epo-cart-option-value">' . $value['tm_value'] . '</div>';
         }
         $out .= '<td class="product-name">' . $name . '</td>';
         $out .= '<td class="product-price">' . $value['tm_price'] . '</td>';
         $out .= '<td class="product-quantity">' . apply_filters('wc_tm_epo_ac_qty', $value['tm_quantity'] * $cart_item['quantity'], $cart_item_key, $cart_item, $value, $_product, $product_id) . '</td>';
         $out .= '<td class="product-subtotal">' . $value['tm_total_price'] . '</td>';
         $out .= '</tr>';
         $odd--;
     }
     if (is_array($other_data) && count($other_data) > 0) {
         $out .= '<tr class="tm-epo-cart-row tm-epo-cart-row-total ' . esc_attr(apply_filters('woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key)) . '">';
         $out .= '<td class="product-remove">&nbsp;</td>';
         $out .= '<td class="product-thumbnail">&nbsp;</td>';
         $out .= '<td class="product-name">&nbsp;</td>';
         $out .= '<td class="product-price">&nbsp;</td>';
         if ($_product->is_sold_individually()) {
             $product_quantity = sprintf('1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key);
         } else {
             $product_quantity = woocommerce_quantity_input(array('input_name' => "cart[{$cart_item_key}][qty]", 'input_value' => $cart_item['quantity'], 'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), 'min_value' => '0'), $_product, false);
         }
         $out .= '<td class="product-quantity">' . apply_filters('woocommerce_cart_item_quantity', $product_quantity, $cart_item_key) . '</td>';
         $out .= '<td class="product-subtotal">' . apply_filters('woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal($_product, $cart_item['quantity']), $cart_item, $cart_item_key) . '</td>';
         $out .= '</tr>';
     }
     echo $out;
 }
Esempio n. 26
0
					}
				endif;
			}
		?>
		<?php if ( $show_price ) :
			$variation = $product->get_child( $attribute_id );?>
            <div class="sc_add_to_cart_price">
			    <?php echo $variation->get_price_html();?>
            </div>
		<?php endif ?>
		<?php if ( $show_cart ) : ?>
			<form data-product_id="<?php echo $id ?>" enctype="multipart/form-data" method="post" class="variations_form cart group" action="<?php echo esc_url( $product->add_to_cart_url() ); ?>">
				<input type="hidden" value="1" name="quantity">
			    <div class="variations">	    		
	            	<?php echo $select ?>    
			    </div>

                <div class="variations_button">
                    <?php woocommerce_quantity_input(); ?>
                    <button type="submit" class="single_add_to_cart_button button alt <?php echo $btn_added_classes;?>"><?php echo $product->single_add_to_cart_text(); ?></button>
                </div>

                <input type="hidden" name="add-to-cart" value="<?php echo $product->id; ?>" />
                <input type="hidden" name="product_id" value="<?php echo esc_attr( $id ); ?>" />
                <input type="hidden" value="<?php echo $attribute_id ?>" name="variation_id">

			</form>
		<?php endif; ?>
	<?php endif; ?>
<?php endif; ?>
</div>
Esempio n. 27
0
<?php

/**
 * Composited Product Quantity.
 *
 * Override this template by copying it to 'yourtheme/woocommerce/composited-product/quantity.php'.
 *
 * On occasion, this template file may need to be updated and you (the theme developer) will need to copy the new files to your theme to maintain compatibility.
 * We try to do this as little as possible, but it does happen.
 * When this occurs the version of the template file will be bumped and the readme will list any important changes.
 *
 * @version  3.2.3
 */
// Exit if accessed directly.
if (!defined('ABSPATH')) {
    exit;
}
ob_start();
woocommerce_quantity_input(array('input_name' => 'wccp_component_quantity[' . $component_id . ']', 'min_value' => $quantity_min, 'max_value' => $quantity_max, 'input_value' => isset($_REQUEST['wccp_component_quantity'][$component_id]) ? $_REQUEST['wccp_component_quantity'][$component_id] : apply_filters('woocommerce_composited_product_quantity', max($quantity_min, 1), $quantity_min, $quantity_max, $product, $component_id, $composite_product)), $product);
$quantity_input = ob_get_clean();
if ($quantity_max !== '' && $quantity_min == $quantity_max) {
    echo str_replace('class="quantity"', 'class="quantity quantity_hidden"', $quantity_input);
} else {
    echo $quantity_input;
}
Esempio n. 28
0
        }
        ?>
                                        </td>

                                        <td class="product-price">
                                            <?php 
        echo apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $cart_item, $cart_item_key);
        ?>
                                        </td>

                                        <td class="product-quantity">
                                            <?php 
        if ($_product->is_sold_individually()) {
            $product_quantity = sprintf('1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key);
        } else {
            $product_quantity = woocommerce_quantity_input(array('input_name' => "cart[{$cart_item_key}][qty]", 'input_value' => $cart_item['quantity'], 'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), 'min_value' => '0'), $_product, false);
        }
        echo apply_filters('woocommerce_cart_item_quantity', $product_quantity, $cart_item_key);
        ?>
                                        </td>

                                        <td class="product-subtotal">
                                            <?php 
        echo apply_filters('woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal($_product, $cart_item['quantity']), $cart_item, $cart_item_key);
        ?>
                                        </td>
                                    </tr>
                                    <?php 
    }
}
do_action('woocommerce_cart_contents');
 /**
  * @param $_product
  * @param $cart_item_key
  * @param $cart_item
  * @param array $data
  */
 function hwoo_cart_item_quantity_input($_product, $cart_item_key, $cart_item, $data = array())
 {
     if ($_product->is_sold_individually()) {
         $product_quantity = sprintf('1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key);
     } else {
         $product_quantity = woocommerce_quantity_input(array('input_name' => "cart[{$cart_item_key}][qty]", 'input_value' => $cart_item['quantity'], 'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), 'min_value' => '0'), $_product, false);
     }
     echo apply_filters('woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item);
 }
Esempio n. 30
-1
		</table>

		<?php 
    do_action('woocommerce_before_add_to_cart_button');
    ?>

		<div class="single_variation_wrap" style="display:none;">
			<?php 
    do_action('woocommerce_before_single_variation');
    ?>

			<div class="single_variation"></div>

			<div class="variations_button">
				<?php 
    woocommerce_quantity_input();
    ?>
				<button type="submit" class="single_add_to_cart_button btn btn-primary alt"><?php 
    echo $product->single_add_to_cart_text();
    ?>
</button>
			</div>

			<input type="hidden" name="add-to-cart" value="<?php 
    echo $product->id;
    ?>
" />
			<input type="hidden" name="product_id" value="<?php 
    echo esc_attr($post->ID);
    ?>
" />