Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Products model number dropdown


14steve14

Recommended Posts

Each of the categories and sub categories in my store will be using a sequential model number. What i am trying to do is to create a drop down list of the currently used model numbers so i can then manually add in the next number in the series.

 

I have entered into my categories.php file

 

$products_model_array = array(array('id' => '', 'text' => TEXT_NONE));
   $products_model_query = tep_db_query("select products_model, products_model from " . TABLE_PRODUCTS . " order by products_model");
   while ($products_model = tep_db_fetch_array($products_model_query)) {
  $manufacturers_array[] = array('id' => $products_model['products_model_id'],
								 'text' => $products_model['products_model']);
   }

 

and then added to create the box and title

 

<tr>
	    <td class="main"><?php echo TEXT_PRODUCTS_MODEL; ?></td>
	    <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('products_model_id', $products_model_array,$pInfo->products_model_id); ?></td>
	  </tr>

 

The trouble being now that i get a dropdown box as i should, but the only option available is NONE.

 

I take it i have something wrong somewhere but i cant figure it out,.. Is there anyone who may be able to add a bit of help on this.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

Burt, many thanks for taking the time to respond.

 

I will try to explain again. Each sub category and every item within that sub category will have a two part model number. The first three digits will let me know what category the item is in, and the last three digits will be a specific item number. So the number for one item would be 000-111 and another could be 999-001

 

I have currently created a list of the current products in the store and am slowly updating all the model numbers.

 

When a new product is entered i wish to have a drop down list of all the model numbers used in the store, not necessarily the specific category, so i can see what would be the next number in the sequence. I could keep a seperate file with this information on, but i am not the only one who has access to the admin section.

 

There is a column within the current products database that lists the model number already entered. I am trying to get the information from the database into a dropdown box.

 

The code i have modified currently gives an additional boc on the categories pagebut is empty. I need it to be filled. I will keep playing with this and see how it progresses.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

After a break i got it to work. Sould have been

 

$products_model_array = array(array('id' => '', 'text' => TEXT_NONE));   
   $products_model_query = tep_db_query("select products_model, products_model from " . TABLE_PRODUCTS . " order by products_model");   
   while ($products_model = tep_db_fetch_array($products_model_query)) {		 
  $products_model_array[] = array('id' => $products['products_model'],
								  'text' => $products_model['products_model']);
   }

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

Steve, glad you got the dropdown working. I guess if that worked, then that's it. I wonder though if you have explored a simple input box with the next number automatically written to it. Perhaps I am simplifying things a little too much, as I don;t know what your DB looks like. Anyway, it's an idea for you to chew on.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...