Modify php shopping cart to support multiple drop down menus -


I have a shopping cart script that I am trying to modify to support multiple product selections. As soon as this is done, customers can select a product from a drop down menu. Now, I'd like to add several dropdown menus (all populated with the same option).

  if ($ eshopoptions ['options_num']> 1) {$ opt = $ eshopoptions ['options_num' ]; Replace $. = "\ N". '& Lt; Label for = "eopt." $ Theid. '"& Gt; & Lt; ID = "EOPT". $ Theid. '' For name = "option" & gt; '; ($ i = 1; $ i & lt; = $ opt; $ i ++) {$ option = $ eshop_product ['Product'] [$ i] ['option']; $ price = $ eshop_product ['product'] [$ i] ['price']; if ($ option! = '') {If ($ value! = '0.00') $. = '& Lt; Option value = "'. $ I. "& Gt; 'StripsSlabs (esc_tar ($ option)).' @ '.sprintf (_c ('% 1 $ s% 2 $ s | 1-Symbol Symbol 2-zodiac ',' Ashop ') , $ Currsymbol, number_format ($ price, 2)). ' & Lt; / option & gt; '.' "\ N"; Replace Else $. = '& Lt; Option Value = "' $ I. "" Gt; 'Strips slash (eska_edit ($ option)).' & Lt; / Options & gt; '.' \ "" \ N ";}}  

Is there an easy way to get the code to output the menu? Instead of 3 times to do it?

As long as you do not actually need redundancy, you can select multiple and, optionally, sizes in your selection tag By adding properties, users can choose to choose multiple options:

  if ($ eshopoptions ['options_num']> 1) {$ opt = $ eshopoptions ['options_num']; $ Substituted = "\ N". '& Lt; label for = "eopt. $ Theid. '"& Gt; & lt; ID Choose" eopt' $ Theid. '"Name =" option "multiple =" multiple "size ="'. $ Im. ' '& Gt;'; ($ I = 1; $ i & lt; = $ opt; $ i ++) {$ option = $ eshop_product ['product'] [$ i] ['option']; $ Price = $ eshop_product ['product'] [$ i] ['price']; If ($ option! = '') {If ($ value! = '0.00') replaces $ = '& Lt; Option value = "'. $ I." & Gt; '. Strips slabs (esc_art ($ option)). '@' .sprintf (_c ('% 1 $ s% 2 $ s | 1-currency symbol 2-amount', 'ashop'), $ currsymbol, number_format ($ price, 2)). ' & Lt; / Option & gt; '. "\ N"; Else $ Replace. = '& Lt; Option value = "'. $ I." "Gt; 'strips slash (eska_edit ($ option)).' & Lt; / option & gt; '.' \ "" \ N "; }}  

Comments