Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Timothy Boland
Timothy Boland
18,237 Points

Integrating with PayPal - Extra Credit #2 - Adding a Gift Message - Recommendations

At this point in the tutorial, it seems silly to add a "Gift Message" text area to Every Shirt before they add it to the cart...it seems best to add a "Gift Message" in a Custom Paypal Checkout Page...but I haven't hit that video yet...Im just curious if anyone came up with any interesting solutions for this Exercise at this point in the tutorial. Please Share. Thanks.

2 Answers

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Ah, you're right: a "Gift Message" would make sense on the order as a whole and not on the shirt. I actually had in mind something like custom embroidery on a shirt, maybe the person's name like on a bowling shirt. Before adding the shirt to the cart, you'd specify the name you wanted embroidered on it on the Shirt Detail page.

Think about how the value in entry fields get sent from the form to the PayPal servers. What attributes exist on the select element that lets PayPal know the field is called "Size" and the value for it is whatever item is selected in the dropdown? You'll need an input element with a type of text (instead of a select element) for a text field, but can you use some of the same attributes to get the value in there submitted to PayPal in the same way?

Timothy Boland
Timothy Boland
18,237 Points

Awesome...Thanks....I added an Embroidery field and the field is successfully being sent over to Paypal....One problem though, I would like the field to be optional...and it appears that the field needs to contain text in order for the Add Cart button to work....

It seems like the field is required by PayPal, since the fields created in contact.php earlier, can be empty for submit.

Are there any suggestions as to how I can make that so?

Randy Hoyt
Randy Hoyt
Treehouse Guest Teacher

Hmmm ... I just tried out a couple of fields, and it appears to work even if the field is left blank. The entry just looks like this:

Logo Shirt, Red
Item #101
Name: 

Would you mind posting the final HTML for one of these buttons so I can see the issue? What error do you receive when it is left blank?

Timothy Boland
Timothy Boland
18,237 Points

ahhh...its working now....not sure what it was....Thank You.