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! While you're at it, check out some resources Treehouse students have shared here.

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

Custom Tshirts

This question is directed towards either Mr. Hoyt or Mr. Chalkley. On a website where you can click and drag your own designs to create product in the browser is that built with JQuery for movement and PHP/MySQL for storage? I was thinking that if you pulled images from one location to another it would save it within a frame or box with recorded coordinates. That image would then be pulled into the cart for purchase.

James Barnett
James Barnett
39,199 Points

FYI - You can tag people, by using an @ before there full name.

3 Answers

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Hey Matthew,

I think the most common scenario would work like this:

  1. A visitor to the site would enter a web address in the browser and request the page to build a shirt.
  2. Some server-side code (like PHP) would get the list of all the options for a shirt (probably from a database like MySQL) and it would generate the page that displays the shirt builder will all of those options. It would send that page back to the browser. (That page would include all the JavaScript code that would get executed in the next step.)
  3. The shirt builder would load in the browser, and the visitor would be able to interact with it. All the clicking and dragging would execute JavaScript code (which might use the jQuery framework) to build the shirt without refreshing the page.
  4. When the visitor finished building the shirt, the visitor would click an Add to Cart button. That would submit a form back to the server, sending it all the information about the built shirt.
  5. Some more server-side code would get the information about the shirt and add it to the visitor's cart.

Does that all make sense?

(Of course, you could also use Ajax at various points in steps 3-5 to save the shirt configuration as the visitor builds it [instead of waiting until they say they are finished] and to add it to the cart, but I think the way I've laid it out is probably common enough.)

Like this? @randyhoyt @andrewchalkley

James Barnett
James Barnett
39,199 Points

No, like this Matthew McLennan

Once you use the @ and start typing their name there's a dropdown menu below the text box to select the name from.

Randy Hoyt Andrew Chalkley Please read above. Thank You.