Adding File Upload to Shopping Cart

General ShopSite user discussion

Adding File Upload to Shopping Cart

Postby OldSalt » Tue Jul 27, 2010 12:37 pm

Hello,

I am trying to add an image upload feature if certain products are being purchased.

I know I will need to somehow modify the form tag to include
enctype="multipart/form-data"


Any suggestions on how I would go about this?

Thanks!
OldSalt
 
Posts: 23
Joined: Mon Sep 28, 2009 4:37 pm
Location: MA

Postby loren_d_c » Tue Jul 27, 2010 12:50 pm

You can't add this to the form tags on the ShopSite shopping cart or checkout screens, and even if you could you would not be able to have a shopper upload images at the same time as they purchase the products.

What you can do is add your own upload form on the Thank You screen so that after the shopper has completed the purchase they can upload their image through your custom form (and of course you would need a custom script backing up this form to actually upload and create the file on your server). You can put the HTML for your custom form in the DEFINE ThankYou section of a custom shopping cart template, or in one of the text areas on the Commerce Setup -> Order System -> Thank You menu, if you are using a default cart template.

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Postby OldSalt » Tue Jul 27, 2010 2:09 pm

Oh, that's too bad.

Do you know how I will be able to identify the product SKU and Order number for the purchased item(s) that I can tie into the image uploads?

Also, seems to me you suggested against including additional info into the shopsite DB on a past project ... will I need to create a separate db to collect product SKU, Order number and image filename?

Thanks!
OldSalt
 
Posts: 23
Joined: Mon Sep 28, 2009 4:37 pm
Location: MA

Postby loren_d_c » Wed Jul 28, 2010 9:01 am

If you put your form code in the DEFINE ThankYou section of a custom cart template, then you could put the order number in a hidden form field using the [-- ThankYouOrderNumber --] template tag as the value. There is no way to get the product SKU's via custom template tags, so you would have to get those into additional hidden form field values via JavaScript using the Shopping Cart JavaScript Variables feature of ShopSite Pro (you can also get the order number from this JavaScript), see the list of variables/arrays available through this ShopSite Pro feature in the docs at:

http://www.shopsite.com/help/10.2/en-US/sc/pro/cart.variables.html

As far as identifying the file uploaded, you could use a separate db for this, but I think using a db could be overkill, your upload script could just add the order number and SKU to the beginning of the filename of the uploaded file.

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere


Return to User Forum

Who is online

Users browsing this forum: Google [Bot] and 71 guests