Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra Product Field


lolawson

Recommended Posts

Would someone give me a little syntax help?

 

My goal is to have an additional product field that uses a drop down menu for entering product details in admin/categories.php It should function just like the Product Manufacturer drop down field.

 

The source table for the field's values is products_foobar, with products_foobar.products_foobar_id products_foobar.products_foobar_name fields.

 

The field in categories.php that I want entries to go into is products.products_foobar2.

 

All that is set up and ready to go. I can manually enter values into products.products_foobar2 and it appears in both the admin and catalog pages just fine.

 

Here's the code I've currently put in categories.php for the pull down, but it doesn't fully work. It successfully calls the products_foobar_name values from the source table into the drop down, but the selected data isn't being stored in products.products_foobar2.

 

What seems to be missing is setting products.products_foobar2=products_foobar.products_foobar_id, but I'm not sure how to incorporate that. I can't just change the products.products_foobar2 name to products.products_foobar_id, b/c ultimately I need to have this same thing multiple times, filling in several different fields with values from the same source table.

 

 $products_foobar2_array = array(array('id' => '', 'text' => TEXT_NONE));
$products_foobar2_query = tep_db_query("select products_foobar_id, products_foobar_name from " . TABLE_PRODUCTS_FOOBAR . " order by products_foobar_name");
while ($products_foobar2 = tep_db_fetch_array($products_foobar2_query)) {
  $products_foobar2_array[] = array('id' => $products_foobar2['products_foobar_id'],
								 'text' => $products_foobar2['products_foobar_name']);
}

 

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('products_foobar_id', $products_foobar2_array, $pInfo->products_foobar2); ?></td>

 

Thanks in advance for the help!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...