Discussions

Special instructions field

I created a new field for my products called category and I set up my test site's order page as a view that displays all items from a particular category in a table:

View:

Table:

I'm trying to find a way to add a button that pops up a text field that the customer can enter any special instructions they may want the store owner to know about that particular item (engraving instructions ect.)

Anyone have any idea where to start?

Thanks!
=>switch<=

Posted: Oct 26, 2011

Comments

switch on October 27, 2011

Here are my steps:
1. Configure store>Line item types>manage fields
2. Add new field>Label:Special instructions Field name:instructions field type: Long text
3. Check the Add to cart form setting box on the next screen
4. Created a .js file to have that field be hidden at the start and toggle on and off when the Special instructions label is clicked with the following code:
(function ($) {
// Store our function as a property of Drupal.behaviors.
Drupal.behaviors.mySpecialFeature = {
attach: function (context, settings) {
// Your jQuery code here

$(".field-name-field-instructions .form-textarea-wrapper").hide();
$(".field-name-field-instructions label").addClass("special-instructions-jquery");
$(".special-instructions-jquery").click(function() {
$(this).next(".field-name-field-instructions .form-textarea-wrapper").toggle("slow");
});

}
};
}(jQuery));

5. Called that .js file in the theme's .info file (this case mysite>themes>bartik>bartik.info) by placing the following line of code a the bottom of the .info file:
scripts[] = the-name-of-my-jquery-file.js