Modify php shopping cart to support multiple drop down menus
Posted
by Thomas
on Stack Overflow
See other posts from Stack Overflow
or by Thomas
Published on 2010-05-18T16:00:10Z
Indexed on
2010/05/18
16:00 UTC
Read the original article
Hit count: 200
I have a shopping cart script that I am trying to modify to support multiple product selection. As it is now, the customer can select a product from a single drop down menu. Now, I would like to add multiple dropdown menus (all populated with the same options).
Here is the php that outputs the dropdown menu:
if($eshopoptions['options_num']>1){
$opt=$eshopoptions['options_num'];
$replace.="\n".'<label for="eopt'.$theid.'"><select id="eopt'.$theid.'" name="option">';
for($i=1;$i<=$opt;$i++){
$option=$eshop_product['products'][$i]['option'];
$price=$eshop_product['products'][$i]['price'];
if($option!=''){
if($price!='0.00')
$replace.='<option value="'.$i.'">'.stripslashes(esc_attr($option)).' @ '.sprintf( _c('%1$s%2$s|1-currency symbol 2-amount','eshop'), $currsymbol, number_format($price,2)).'</option>'."\n";
else
$replace.='<option value="'.$i.'">'.stripslashes(esc_attr($option)).'</option>'."\n";
}
}
Is there some really simple way of getting the code to output the menu say 3 times instead of once?
© Stack Overflow or respective owner