Page 1 of 1

[solved] file upload - help to show filename/thumbnail

Posted: Tue Apr 24, 2012 9:34 pm
by jonah
Hi I have products that users need to upload a file or small image to on the the product page and then order.

The only problem is when you upload an image and click ok you're back on the product page which doesn't show what you have uploaded or a filename etc so it can be confusing.

Is there a way that I can display the successfully uploaded image filenames next to the upload boxes on my product template page in the options section?

Thanks for any help, I think someone was trying this or similar here: http://forum.opencart.com/viewtopic.php?f=20&t=56460 - but they haven't replied to the thread in a while and I'm not sure they wanted the same end result.

Thanks again :)

Re: Product with file upload - help to show filename/thumbna

Posted: Wed Apr 25, 2012 3:36 am
by Avvici
by uksitebuilder ยป Tue Mar 20, 2012 3:40 pm
Well your first problem is getting the customer to upload when viewing the cart or during checkout as there is no default functionality to do this.

It will most likely require custom coding by a developer ( your best bet is to post on the commercial support forum or contact a partner from the partners page)

Re: Product with file upload - help to show filename/thumbna

Posted: Wed Apr 25, 2012 3:51 am
by jonah
Hi thanks.

I'm already using the functionality of a file option for the upload and it uploads ok on the product page. I don't need to do this at checkout, just with the product options which seems to be working fine. I just need to show the filename next to the upload to confirm it...

thanks again if anyone can help with this.

Re: Product with file upload - help to show filename/thumbna

Posted: Tue Nov 06, 2012 2:18 am
by 4thdesign
Would be nice for some support here. He isnt the only one wanting a fix or a workaround for this.

Its such a shame as the product is brilliant, but have noticed there is a lot of support that goes unanswered...... this is CRUCIAL for users and developers alike to help each other out and make the product even better.

It even puts people off when they soon realise, support seems to be lacking.

However..... I will say, you're all doing a great job for a great product.... please if you have time, users need a bit of help now and then.

Thanks :)

Re: Product with file upload - help to show filename/thumbna

Posted: Tue Nov 06, 2012 2:50 am
by Avvici
Does it not already give you an alert (success message) telling you that it was succesful?

Code: Select all

if (json.success) {

			alert(json.success);

Re: Product with file upload - help to show filename/thumbna

Posted: Tue Nov 06, 2012 3:30 am
by 4thdesign
Yes sorry, my fault.

But would be nice to see a thumbnail of the image file thats been uploaded just for a "good feel factor" and confirmation the customer is happy that they selected the correct file to upload.

Is this possible to do?

Re: Product with file upload - help to show filename/thumbna

Posted: Tue Nov 06, 2012 7:02 am
by Avvici
Certainly. For 1.5.4.1, Open product.tpl and find this code:

Code: Select all

<input type="hidden" name="option[<?php echo $option['product_option_id']; ?>]" value="" />
Right beneath it add this:

Code: Select all

<div id = "upload-message"></div>

Now find this line:

Code: Select all

alert(json['success']);
Below it add this:

Code: Select all

$('#upload-message').html(file + ': was uploaded');
And lastly find this:

Code: Select all

onComplete: function(file, json) {
Below it add this:

Code: Select all

$('#upload-message').html("");
If you want something fancier then you have the code to go to town with it.

Re: Product with file upload - help to show filename/thumbna

Posted: Wed Nov 07, 2012 5:41 am
by 4thdesign
Thank you very much.

That worked brilliantly..... very much appreciated :)

Re: Product with file upload - help to show filename/thumbna

Posted: Wed Nov 07, 2012 7:55 am
by Avvici
yw

Re: [solved] file upload - help to show filename/thumbnail

Posted: Tue Nov 19, 2013 4:33 am
by iomedesimo
works really well ... but if there are more than one file to upload it writes only the last loaded ... can you solve it?

Re: [solved] file upload - help to show filename/thumbnail

Posted: Tue Nov 19, 2013 4:39 am
by iomedesimo
iomedesimo wrote:works really well ... but if there are more than one file to upload it writes only the last loaded ... can you solve it?
I've already solved ....
instead of

Code: Select all

<div id = "upload-message"></div>
i write

Code: Select all

<div id = "<?php echo $option['product_option_id']; ?>"></div>
and instead of

Code: Select all

$('#upload-message').html(file + ': was uploaded');
i write

Code: Select all

$('#"<?php echo $option['product_option_id']; ?>').html(file + ': was uploaded');

Re: [solved] file upload - help to show filename/thumbnail

Posted: Thu Feb 13, 2014 10:00 pm
by miradoro
the first code block worked great on 1.5.6.1 but will the info appear on the order email notification?

Re: [solved] file upload - help to show filename/thumbnail

Posted: Mon Mar 30, 2015 10:09 pm
by Sokonomi
Ive tried applying this to my 2.0.1.1 build, but unfortunately they tweaked the ajax code a little so it doesnt seem to work. Any chance of taking a crack at 2.0.1.1 to make it do the same stuff?

Re: [solved] file upload - help to show filename/thumbnail

Posted: Thu Mar 03, 2016 4:50 am
by anand2064
Can someone help with OC2 method please?

Re: [solved] file upload - help to show filename/thumbnail

Posted: Fri Mar 27, 2020 4:45 am
by okeystm
Yes me too. I'm struggling with OC2 .. Please someone help us to get this done.