Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cart displays quantity in listings but I want pulldown to match


Gazonice

Recommended Posts

Posted

Hello,

 

I have added the following code to my products_new.php to display the quantity in stock of any particular item:

 

We have <b>' . tep_get_products_stock($products_new['products_id']) . '</b> in stock as of: ' . date('j M Y g:i A') . '

 

And I have added the following code to my specials.php, also to display the number of items in stock:

 

We have <b>' . tep_get_products_stock($specials['products_id']) . '</b> in stock as of: ' . date('j M Y g:i A') . '

 

An example of it's insertion in specials.php:

 

<td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '"><b><u>' . $specials['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($specials['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $specials['manufacturers_name'] . '<br><br>We have <b>' . tep_get_products_stock($specials['products_id']) . '</b> in stock as of: ' . date('j M Y g:i A') . '<br><br><b>' . TEXT_PRICE . ' ' . $products_price . '</b>'; ?></td>

 

I have added the following code to products_info.php so that I can have a stock quantity box, combined with a pull down quantity selector which drops to the max number of items in stock at the time:

 

<?php echo 'We have <b>' . tep_get_products_stock($product_info['products_id']) . '</b> available in stock<br>as of: ' . date('j M Y g:i A'); ?>

 

and:

 

<table border="0" cellspacing="0" cellpadding="0">

<tr align="left" valign="middle">

<td>

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

</td>

<td>

<?php echo tep_draw_separator('pixel_trans.gif', '5', '10'); ?></td>

<td class="main">

<?php echo 'Quantity:'; ?>

</td>

<td>

<?php echo tep_draw_separator('pixel_trans.gif', '5', '10'); ?></td>

<td>

<?php for ($i=0; $i<tep_get_products_stock($product_info['products_id']); $i++) { $qty_array[] = array('id' => $i+1, 'text' => $i+1); } ?><?php echo tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td></tr></table>

 

What I want to try and achieve, is a quantity pull down box both in specials.php and products_new.php which drops to the max number of items in stock.

 

Can anyone help me with this please?

 

Many Thanks.

 

Garry

 

Incidentally, for a pull down quantity in the shopping cart I use (on shopping_cart.php) the following:

 

on Line 125:

 

$options = '';

for ($s=0 ; $s<tep_get_products_stock($products[$i]['id']); $s++) { $z = $s+1; $options[] = array('id' => $z, 'text' => $z); }

 

on Line 168:

 

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="top"',

'text' => tep_draw_pull_down_menu('cart_quantity[]', $options, $products[$i]['quantity'], 'onChange="this.form.submit()" style="width:46px"').tep_draw_hidden_field('products_id[]', $products[$i]['id']));

Garry

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...