Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra product fields


jaymz77

Recommended Posts

I have been fortunate to have found out about OSC many years ago, it is truly awesome. Anyways, this may be something that can't be discussed because it modifies the OSC shell but here goes nothing.. I have been adding new fields to the product_info page for awhile but have come accross a problem with a new site I am building. When I add the field to the catagories.php, I have only been able to add text fields.. (please note I am not very good with php) .. how would I add a drop down box or a radio button to slect a specific option that is static with the product. Example : This web site is an RV Dealership, all RV's have different options just like cars.. A/C, DVD player, LCD TV .. etc.. I would like to be able to select a radio button for each option that is availble for that product and have those results displayed on the product_info page.

 

Here is the code from catagories.php that displayes the entry field:

<tr>
<td class="main"><?php echo TEXT_PRODUCTS_CLASS_XML; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_class_xml', 'Class ' . $pInfo->products_class_xml); ?></td>
</tr>

 

I know it has to do with the tep_draw_input_field but can't figue it out.

 

I hope someone can help, this would make things SO much easier! Thanks in Advanced!

 

-James

Link to comment
Share on other sites

Take a look at catalog/includes/functions/html_output.php. You'll find your tep_draw_input_field() there, plus functions like tep_draw_checkbox_field(), tep_draw_radio_field(), and tep_draw_pull_down_menu(). Just pick whichever you want to use.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Thanks Jim! Although with my limited PHP I am still unsure how to accomplish this. I See how the string works but I will have to keep playing with it, maybe I can get it working. Thanks again, if you or anyone else can give me a little more insight, I would greatly appreciate it.

 

- James

Link to comment
Share on other sites

Each one of those functions is slightly different, so I can't give you a cookie-cutter approach that will always work. Basically, each one has a set of variables that need to be filled. You can look at the tep_draw_input_field() you currently have and see that it supplies only two values for the variables:

$name is set to 'products_class_xml'

$value is set to 'Class ' . $pInfo->products_class_xml

and the rest are left at the default.

 

Now, if you want to use tep_draw_radio_field() or tep_draw_checkbox_field(), you can just give them the same value for $name. You can't do the same for $value: That's a default for a textbox, but the Radio and Checkbox types need to be explicitly set. You need to give each one a set value, e.g. 'Class 1', 'Class 2', etc. Whatever the values are that the code expects. I'm not familiar with your example so I can't give you the exact values.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Jim, I really appreciate your time on this, it is greatly appreciated. I have a better insight on it now, I kinda figured something of the sort. I will just play around with it a bit and I'm sure I can eventually figure it out :)

 

Thanks again! This forum has been such a nice tool for all us OSC'ers .. I am so greatful.

 

- James

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...