Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dropdown quantity box


toto46

Recommended Posts

Hi

I have set up the "easy way add Qty box in your product_info.php" Contribution

http://www.oscommerce.com/community/contri...rop+down/page,2

 

It works nice for me but I need to set it up so that the drop down only shows 1, 3, 6, 12 values so far I have only been able to change the intial value from 15 to 12, here is the piece of code concerned, if somebody knows this and would be kind enough to put me on the right track

<tr>

<?php

for ($i=0; $i<12; $i++) {

$qty_array[] = array('id' => $i+1, 'text' => $i+1);

}

?>

<td align="center" class="main"><br><b><?php echo QUANTITY_WISH . ' : ' . tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td>

</tr>

 

thanks

Link to comment
Share on other sites

Hi

I have set up the "easy way add Qty box in your product_info.php" Contribution

http://www.oscommerce.com/community/contri...rop+down/page,2

 

It works nice for me but I need to set it up so that the drop down only shows 1, 3, 6, 12 values so far I have only been able to change the intial value from 15 to 12, here is the piece of code concerned, if somebody knows this and would be kind enough to put me on the right track

 

 

thanks

 

Try this:

 

$max_products = 12; // Maximum products that can be bought

$count = 0;

while ($count <= $max_products) {

if($count == 0){

$qty_array[] = array('id' => $count +1, 'text' => $count +1); // add 1 if count is 0

}else{

$qty_array[] = array('id' => $count, 'text' => $count);

}

$count = $count + 3; // increment count by 3 [ 3,6,9,12,15 ....

}

Link to comment
Share on other sites

Abseloute dynamite!

 

Thank you very much this works very nice for me.

Not the least it has helped me understand some more about PHP

 

Merci beaucoup!!

:)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...