ecommerce file upload

Permalink
I'm sure there's a simpler solution to this than the one's i'm trying...but has anyone a way to do this.

After the client has paid for the service they are given the generic form upload box. As I have the order number at this point I want to append it to filename that is being uploaded.

ie img1.png

becomes

0000034_img1.png

any help /hacks appreciated.

leertes
 
JohntheFish replied on at Permalink Reply
JohntheFish
I think you need to clarify just what you are trying to do and what your problem is.
leertes replied on at Permalink Reply
leertes
Ok!

I need to add an image upload at a certain point in the ecommerce checkout.

That point will be the finish.php page. This page is reached when payment has been taken and the client is returned back to the C5 ecommerce site.

I can add the form block to the page without any issue (obvio!) On the finish.php page the orderID is available as $. The client will upload their image at this point as part of their order and it will be placed in the file manager in a 'customers' set.

I want to append the order number to the start of the image file name so that it can be easily retrieved against the order when the site owner has to look for the image.

ie. client uploads img1.jpg

and before this is stored in the file manager it is changed to

xxxxxx_img1.jpg where xxxxxx is the orderID.


any help with this would be greatly appreciated.
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
You wont be able to do this without writing some code.

If you actually want the order number in the file name, you will need to write php to override the upload handling and change the file name there, or to catch a file add event and change the filename in the event handler.
http://www.concrete5.org/documentation/developers/system/events...

A simpler solution would be to attach the order number as an attribute to the file. There is less code involved and it can still be easily searched in the file manager.

Easier still would be to attach the order number to the form submission, then just use the submitted form answers page to cross reference.

That could be done in php with a custom view for the form block to add the order number into a hidden field, or with javascript to paste in into the field after the page is in the browser.
leertes replied on at Permalink Reply
leertes
John

Thank you for all your tips...there are things there that I have yet to play with!

I realised that I could just list the uploaded image file in the dashboard->ecommerce->order page by adding a few lines of code..and that really was all I needed.

Again your time is much appreciated.

best regards