Knowledgebase: Specific Products > ShopCart
How to pass comments from your customers into the Cart
Posted by Doug Sherman (Import), Last modified by on 21 Sep 06 11:22 AM

Item Attributes allow you to pass to our Cart customer selections of item characteristics that need to be part of the order. (Simple examples of this are size or color.) These attributes require your customer to select from a list of options. But what if you want your customer to be able to pass on a comment related to the item? Let's say that you allow your customers to include gift cards with their order, for example. Is there a way to accomplish this with our Cart?

Indeed, there is, by slightly modifying the item attribute feature. An item attribute for color, for example, using a radio button, will generate the following html:

<INPUT TYPE="hidden" NAME="on0" VALUE="color">
<INPUT TYPE="radio" NAME="os0" VALUE="red" CHECKED> red

In order to modify this to allow your customer to enter text, use this html instead:

<INPUT TYPE="hidden" NAME="on0" VALUE="message">
Enter your message: <INPUT TYPE="text" NAME="os0">

The "message" for the VALUE of the first form field is the prefix to your customer's text in the cart. Change it to whatever you prefer to show in the cart. "Enter your message" is the text that will appear on your product page next to the "Add to Cart" button. Change this to whatever you prefer. If you are already using "on0" and "os0" for an existing item attribute, then simply increase the "0" to the next unused number for both fields.

For a larger text box, you could use a "textarea", i.e.,

<INPUT TYPE="hidden" NAME="on0" VALUE="message">
Enter your Message:

Keep in mind, though, that PayPal imposes a 200 character limit on text for item attributes (per item).

That's it!

(1034 vote(s))
Not helpful

Comments (0)