Post by randomfactor » Wed Oct 15, 2008 7:16 am

This contribution supports customer uploaded image files.  It is appropriate for catalog items that require a customized photo file supplied by the customer (e.g. T-shirts, coffee cups, embroidered goods).

There are two distinct parts of the contribution -- the first enhances OpenCart with an extensible product option feature.  The second is the file upload contribution which extends the product option to support uploading files.  The product option enhancement is included as a zip file within the file upload contribution zip.

Features
  • Upload an image file for a product
  • Progress bar during upload
  • Preview a thumbnail of the uploaded image
  • Supports gif, jpeg, bmp, and png formats
  • Installation and setup instructions (and you'll need them!)
Requirements
  • OpenCart version 0.7.9
  • PHP v5.2.4 (or better)
  • Perl v5.8 (or better)
  • enabled cgi-bin scripts
Demo site: http://www.digispray.com/demo/store/

File Upload Contrib: http://www.opencart.com/contribution/in ... tion_id/73
Last edited by randomfactor on Wed Oct 15, 2008 7:22 am, edited 1 time in total.

New member

Posts

Joined
Mon Jul 07, 2008 1:43 am


Post by Qphoria » Wed Oct 15, 2008 7:40 am

awesome! I love how you got it in a lightbox style. Very modern :)

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by randomfactor » Wed Oct 15, 2008 2:38 pm

I've noticed that there is a bug when Use URL Alias: is set to Yes.  The progress bar and the thumbnails do not work under that condition.  I'll put out a new copy when I've fixed the problem.

New member

Posts

Joined
Mon Jul 07, 2008 1:43 am


Post by robgtheengineer » Thu Oct 16, 2008 2:38 am

When I try to upload an image it either just sits there or gives me a bunch of junk, what do you think? http://123picturethis.com/index.php?con ... duct_id=21


Posts

Joined
Thu Oct 02, 2008 9:20 am

Post by Qphoria » Thu Oct 16, 2008 3:17 am

robgtheengineer wrote: When I try to upload an image it either just sits there or gives me a bunch of junk, what do you think? http://123picturethis.com/index.php?con ... duct_id=21
Try the contrib using the new 0.7.9 RC2 version of opencart from the News & Announcements area. It fixes a problem with displaying html that might fix this.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by robgtheengineer » Thu Oct 16, 2008 6:09 am

now when i try to add to cart i get the following error:

Warning: Invalid argument supplied for foreach() in /home/capemb/public_html/library/cart/product_option.php on line 251

Warning: Cannot modify header information - headers already sent by (output started at /home/capemb/public_html/library/cart/product_option.php:251) in /home/capemb/public_html/library/environment/response.php on line 23


Posts

Joined
Thu Oct 02, 2008 9:20 am

Post by randomfactor » Thu Oct 16, 2008 9:34 am

robgtheengineer wrote: now when i try to add to cart i get the following error:

Warning: Invalid argument supplied for foreach() in /home/capemb/public_html/library/cart/product_option.php on line 251

Warning: Cannot modify header information - headers already sent by (output started at /home/capemb/public_html/library/cart/product_option.php:251) in /home/capemb/public_html/library/environment/response.php on line 23
What is your environment?  OS?  PHP version?  Perl version?

Look for the following line in the cgi-bin/opencart_file_upload.cgi file (line 115) and remove the comment (# sign) at the beginning of the line:

Code: Select all

    #select(undef, undef, undef, 0.03125);	# sleep for 1/32 of a second.  1Mbit throttle
to

Code: Select all

    select(undef, undef, undef, 0.03125);	# sleep for 1/32 of a second.  1Mbit throttle
What is your Use URL Alias set to?  Can you turn it off just to test it out?  Make sure to clear your browser cache after changing the setting.

New member

Posts

Joined
Mon Jul 07, 2008 1:43 am


Post by robgtheengineer » Thu Oct 16, 2008 9:40 am

Apache version  2.0.63
PERL version 5.8.8
PHP version  5.2.6
MySQL version 5.0.51a-community
Turned off alias, still no luck.
I am using 0.7.9 rc2.


Posts

Joined
Thu Oct 02, 2008 9:20 am

Post by randomfactor » Thu Oct 16, 2008 9:46 am

robgtheengineer wrote: When I try to upload an image it either just sits there or gives me a bunch of junk, what do you think? http://123picturethis.com/index.php?con ... duct_id=21
Rob, your cgi-bin is not working.  It looks like your site is rewriting the url and redirecting to the OpenCart error page.

Your cgi-bin url:

    http://123picturethis.com/cgi-bin/openc ... f019097c08

should behave like this url:

    http://www.digispray.com/cgi-bin/openca ... f019097c08

New member

Posts

Joined
Mon Jul 07, 2008 1:43 am


Post by robgtheengineer » Thu Oct 16, 2008 9:55 am

what would cause this?


Posts

Joined
Thu Oct 02, 2008 9:20 am

Post by randomfactor » Thu Oct 16, 2008 12:54 pm

robgtheengineer wrote: what would cause this?
I don't know.  The top of the suspect list would be your .htaccess file in  /home/capemb/public_html.

Can you verify that you have correctly located your localized perl uploading script at

    /home/capemb/public_html/opencart_file_upload.cgi

and that the file permissions on it are 0775?

New member

Posts

Joined
Mon Jul 07, 2008 1:43 am


Post by robgtheengineer » Thu Oct 16, 2008 6:37 pm

Yeah everything is in the correct place.


Posts

Joined
Thu Oct 02, 2008 9:20 am

Post by Qphoria » Thu Oct 16, 2008 7:07 pm

Perhaps contact your webhost to see if they can figure it out. Sometimes its some mundane thing that you didn't realize. I know one host i had broke if you set your permissions higher than 755

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by robgtheengineer » Thu Oct 16, 2008 7:54 pm

It is not the permissions, I already talked to my host.  The weirdest thing is that when I installed the product option plugin, even without the upload, when I try to add anything to the cart,  it gives me php errors.  Should I try 0.7.8?


Posts

Joined
Thu Oct 02, 2008 9:20 am

Post by Qphoria » Thu Oct 16, 2008 8:07 pm

robgtheengineer wrote: Should I try 0.7.8?
this contrib was based on 0.7.9. using an older buggy version of opencart will not help. try a fresh install of rc2. then install only this contrib and see if that works.

if the error is cgibin tho, im inclined to think its still a webhost issue

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by robgtheengineer » Thu Oct 16, 2008 8:22 pm

This is the only one I installed.  Installing only the production option plugin breaks my cart.


Posts

Joined
Thu Oct 02, 2008 9:20 am

Post by randomfactor » Thu Oct 16, 2008 8:45 pm

robgtheengineer wrote: It is not the permissions, I already talked to my host.  The weirdest thing is that when I installed the product option plugin, even without the upload, when I try to add anything to the cart,  it gives me php errors.  Should I try 0.7.8?
Proposed experiment.  TEMPORARILY, move your top level .htaccess file to some other name.  Then hit the link to the cgi:

    http://123picturethis.com/cgi-bin/openc ... f019097c08

You should see this message (or something like it) in your browser:
The server encountered an unexpected condition which prevented it from fulfilling the request.
The script had an error or it did not produce any output. If there was an error, you should be able to see it in the error log.
In your server error log, you should see a message like this:
DBD::mysql::st execute failed: Column 'total_bytes' cannot be null at /home/capemb/public_html/cgi-bin/opencart_file_upload.cgi line 79.
That will at least indicate that control is being transferred to the cgi script and that it is being executed.  If you see your catalog site, then something out of your control is redirecting away from the cgi-bin.

Let me know what you find.

And don't forget to move the .htaccess file back into place afterwards.  ;)

Thanks!

New member

Posts

Joined
Mon Jul 07, 2008 1:43 am


Post by randomfactor » Thu Oct 16, 2008 8:53 pm

robgtheengineer wrote: now when i try to add to cart i get the following error:

Warning: Invalid argument supplied for foreach() in /home/capemb/public_html/library/cart/product_option.php on line 251

Warning: Cannot modify header information - headers already sent by (output started at /home/capemb/public_html/library/cart/product_option.php:251) in /home/capemb/public_html/library/environment/response.php on line 23
Doh!  I'm sorry.  I've got a bug when there are NO options for the product.  Now, why didn't I think of testing that?!!

OK, I have a reproducible case and I am working on a patch...

New member

Posts

Joined
Mon Jul 07, 2008 1:43 am


Post by Qphoria » Thu Oct 16, 2008 8:59 pm

HOW DARE YOU!  ;D

Good catch :)

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by randomfactor » Thu Oct 16, 2008 9:06 pm

Rob, edit .../library/cart/product_option.php and make the following change at line 248:

Change this:

Code: Select all

	// return error string array for invalid option values
	public static function validateProductOptions(&$locator, $product_id, $form_options) {
		$validation_errors = array();
		foreach ($form_options as $k => $v) {
			$opt = ProductOption::createByProductID($locator, $k, $product_id);
			if ($opt && ($err = $opt->validate($product_id, $v))) {
				$validation_errors[] = $err;
			}
		}
		return $validation_errors;
	}
To this:
// return error string array for invalid option values
public static function validateProductOptions(&$locator, $product_id, $form_options) {
$validation_errors = array();
if ($form_options) {
foreach ($form_options as $k => $v) {
$opt = ProductOption::createByProductID($locator, $k, $product_id);
if ($opt && ($err = $opt->validate($product_id, $v))) {
$validation_errors[] = $err;
}
}
}
return $validation_errors;
}
After a few more of my screwups like this are fixed, I'll post an updated zip for the contribution.  My apologies to those of you like Rob, who are playing along at home.

New member

Posts

Joined
Mon Jul 07, 2008 1:43 am

Who is online

Users browsing this forum: No registered users and 8 guests