Forums / General Questions / Product Quantities as Drop Downs?

Product Quantities as Drop Downs?

Views: 1,943

Results 1 to 4 of 4
24 May 2011, 1:22 PM
#1
ehdesign avatar

ehdesign

New Zenner

Join Date:
Nov 2006
Posts:
56
Plugin Contributions:
0

Product Quantities as Drop Downs?

I want to change the QUANTITY on both the category listing pages and on the product details pages to HTML SELECT drop down instead of the text entries.

Any ideas on HOW?

ALSO - I would then like to customize these drop downs for certain products - for example PRODUCT X can only be bough in packs of 10, so I want the drop down to say 10, 20, 30, etc.

I realize this second request will take some custom coding, and I'm OK with that if I could get pointed in the right direction.

Any thought on either / both ????

Thanks.

24 May 2011, 4:12 PM
#2
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: Product Quantities as Drop Downs?

Not available in Zen Cart.

The question was asked plenty of times. I don't think there is an easy fix for it.

You have to get it custom.

21 Jun 2011, 3:52 PM
#3
buna avatar

buna

New Zenner

Join Date:
Dec 2010
Posts:
1
Plugin Contributions:
0

Re: Product Quantities as Drop Downs?

Please give an advice if below code is correct to achieve the drop down quantities on product info page.

Original code from tpl_product_info_display.php

 $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);

Replace with below code:

/* Drop Down Quantity Box - Begin */
for ($i=0; $i<7; $i++) {
$qty_array[] = array('id' => $i+1, 'text' =>  $i+1);
}
$the_button = PRODUCTS_ORDER_QTY_TEXT . zen_draw_pull_down_menu('cart_quantity', $qty_array, 1) .'<br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
/* Drop Down Quantity Box - End */

Please correct me if I'm wrong.:smile:

25 Jun 2011, 5:21 PM
#4
eranariel avatar

eranariel

Zen Follower

Join Date:
Dec 2010
Location:
NYC
Posts:
104
Plugin Contributions:
4

Re: Product Quantities as Drop Downs?

Hi Buna,

I have been trying to get this capability to work for some time, however, to no avail...

Here is some code that was posted not too long ago and which I tried to apply, however, there are some bugs that I have been unable to fix...

It is supposed to work with the Qty Min/Unit Mix capability... my product can be purchased in increments of 0.5, whereas the minimum purchase varies between 0.5 to 1.5 (in increments of 0.5). I can adjust the $optvalues of $i to 0.5, however, if I choose minimum quantity of 1 (for example), still 0.5 appears in the drop down list and that is extremely confusing to customers - if I select any option and send to the cart, once the process is completed, the drop down "miraculously" adjusts itself to the proper minimum imcrement. If I choose minimum purchase of 1.5, then the drop down list completely goes haywire...

<!--bof Add to Cart Box --> <?php if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') { // do nothing } else { ?>
        <?php
		$optvalues = '';
			for ($i = 1; $i < 76; $i++) {
				$optvalues .= '<option value="' . ((zen_get_buy_now_qty($_GET['products_id'])) * $i) . '">'. ((zen_get_buy_now_qty($_GET['products_id'])) * $i) .'</option>';	
			}
		
		
$display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
        if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
          // hide the quantity box and default to 1
          $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
        } else {
          // show the quantity box
$the_button = PRODUCTS_ORDER_QTY_TEXT . '<select name="cart_quantity">'. $optvalues .'</select><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
        }
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);

?>

<?php if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAdd">
<?php
  echo $display_qty;
  echo $display_button;
        ?>
      </div>
<?php } // display qty and button ?> <?php } // CUSTOMERS_APPROVAL == 3 ?> <!--eof Add to Cart Box-->nable to resolve with it... perhaps you can have a look at it...