Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

multiple selection list | html_output.php


Parikesit

Recommended Posts

Hi all,

 

I add a new function to make multiple selection list to admin/html_output.php to enable add more than one manufacturers of the products.

 

In the HTML it could be like this:

 

<form name="form1">

<select name="select" size="5">

<option selected>satu</option>

<option>dua</option>

<option selected>tiga</option>

<option selected>empat</option>

<option>lima</option>

</select>

</form>

 

I try the way like function tep_draw_pull_down_menu, and add $size and multiple to make it.

 

  function tep_draw_selection_menu($name, $size, $values, $default = '', $params = '', $required = false) {

   $field = '<select name="' . $name . '"';

   $field .= ' size="' . $size . '"';

   if ($params) $field .= ' ' . $params;

   $field .= ' multiple>';

   for ($i=0; $i<sizeof($values); $i++) {

     $field .= '<option value="' . $values[$i]['id'] . '"';

     if ( ((strlen($values[$i]['id']) > 0) && ($GLOBALS[$name] == $values[$i]['id'])) || ($default == $values[$i]['id']) ) {

       $field .= ' SELECTED';

     }

     $field .= '>' . $values[$i]['text'] . '</option>';

   }

   $field .= '</select>';



   if ($required) $field .= TEXT_FIELD_REQUIRED;



   return $field;

 }

 

I make a little change to admin/categories.php (near line 388):

 

tep_draw_selection_menu('manufacturers_id', '5', $manufacturers_array, $pInfo->manufacturers_id);

 

It's work on the browser, but when I submit the form it's only store one manufacturer_id to the database.

 

Anyone can help, please.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...