Tying Image Uploads to Orders

Questions and answers about ShopSite Custom Templates

Tying Image Uploads to Orders

Postby OldSalt » Wed Apr 28, 2010 8:26 am

Hello,

A shop owner wants me to modify their shopsite so customers can upload images with their order (products are flyers and posters).

I can write a file upload cgi script easy enough, but have no clue how I could associate the image filename with the order.

Any ideas?

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

Postby loren_d_c » Wed Apr 28, 2010 9:22 am

This is not strictly a custom template question.

Basically, I can think of a few options. All involve putting your own image upload form on the thank you screen so that the shopper sees it once they have completed their ShopSite order. You can have a hidden form field in the form that contains the ShopSite order number.

1) you can do it via the shopping cart template, in the DEFINE THANKYOU section you can use the template tag [-- ThankYouOrderNumber --] to get the order number to populate the hidden form field.

2) you can use JavaScript to populate the hidden form field. If the store is ShopSite Manager or Pro you should be able to use the ss_ordernum variable in your JavaScript code, see: http://www.shopsite.com/help/10.1/en-US ... ables.html
You could put your form an custom JavaScript on the thank you screen via a custom shopping cart template, or you could put it on one of the text areas in Commerce Setup -> Order System -> Thank You.

3) if the store is Pro, you could use the Order API feature to create your own custom cgi to write your own HTML 'thank you' page that includes your form. And of course the order number is one of the values provided to the custom cgi via the Order API, see: http://www.shopsite.com/help/10.1/en-US ... r.api.html

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

Postby OldSalt » Wed Apr 28, 2010 9:46 am

Hi Loren,

Thanks for your quick reply!

Yes, I wasn't sure this was the right forum. :?

I have worked several shopsite projects, but am not an expert.

In the past, I noticed that orders do not appear in the shopsite_db, at least not in ss_Order, until the store owner acknowledges the order.

So if I do option 3, provide a cgi script for uploading the image file and then make an sql update ... what table would I update?

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

Postby loren_d_c » Wed Apr 28, 2010 9:57 am

You do not need to (nor should you) muck with the ShopSite database for option 3 (or any other options). Any custom cgi you may make to use the Order API feature will be executed AFTER the order is already completed (which is why the order number has already been assigned to the order and is available to your cgi), so there is nothing you need to (or can) insert into the order via your cgi. You can only get information from the already-completed order and use it for your own purposes (sending custom emails, update your own SQL database, create a custom thank you screen, etc).

Really, if the only piece of order information that you need in your upload form is the order number, I would suggest one of the first two options rather than writing a custom Order API cgi that would have to recreate the entire content of the thank you screen just to display the form on it.

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

Postby OldSalt » Wed Apr 28, 2010 10:11 am

OK, how about this approach:
1) place a custom text input field in the shopping cart for the image filename, so it will be associated with the order and
2) place the image file upload cgi script in the thank you page.

Does this make sense?
OldSalt
 
Posts: 23
Joined: Mon Sep 28, 2009 4:37 pm
Location: MA

Postby loren_d_c » Wed Apr 28, 2010 12:19 pm

Sure, this works too, if you think the shopper can be trusted to enter the correct filename.

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


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 18 guests

cron