Modify php shopping cart to support multiple drop down menus
- by Thomas
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?