Bug on Create Product

Posts: 50
Joined: 09/09/2007

I tried to add a product. When previewing the node, I got

    * warning: Invalid argument supplied for foreach() in /home/web28743/domains/mysite.se/public_html/shop/modules/node/node.module on line 521.
    * warning: implode() [function.implode]: Bad arguments. in /home/web28743/domains/mysite.se.se/public_html/shop/modules/node/node.module on line 525.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/web28743/domains/mysite.se/public_html/shop/includes/database.mysql.inc on line 172.

And then when I save the node, I get:

    * warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: premature end of data segment in /home/web28743/domains/mysite.se/public_html/shop/includes/image.inc on line 308.
    * warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'files/tmp/producttmp_sQ2gL5' is not a valid JPEG file in /home/web28743/domains/mysite.se/public_html/shop/includes/image.inc on line 308.

Posts: 50
Joined: 09/09/2007

Seems the images are created, and the error only shows once.

Posts: 84
Joined: 08/31/2007
Bug FinderInternationalizationizerNot KulvikThe other woman.

we, seriously, seem to be experiencing the same problems. lookie and ryan's reply somewhere below it.

edit: just added the image-attachment of the error.

AttachmentSize
preview-bug.png196.87 KB
--

i plurk. i twit.

Posts: 50
Joined: 09/09/2007

And where the heckenbush is Ryan and Lyle? Laughing out loud Are they sleeping at this time of day? I must be 06.00 in the US. Aren't uberdudeprogrammers supposed to be up by then, hammering away? Smiling

Posts: 2267
Joined: 08/07/2007
AdministratoreLiTe!

We're at GMT -0400, so your post looks like it was made at 07:49 to me. I get in to work at 08:00 (usually Sticking out tongue) Don't know why Ryan's not here yet. There was talk about the office going to a BBQ place for lunch.

Focus.

I've known about the preview thing for a while now, but I haven't figured out what to do about it. It's probably got to do with the Add to Cart form and the lack of a node id. As far as I can tell, the errors don't actually affect anything (except your blood pressure, maybe), so it's not as critical as other issues. Like images. Sad

Posts: 5367
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

@Boletus - lol I woke up at 6:30 AM and turned off the alarms "so my wife wouldn't wake up." Worked good for me to sleep till 8, too. Sticking out tongue At least I worked an hour extra on Monday, but I imagine I'll still stay late today anyways. Evil

Posts: 50
Joined: 09/09/2007

Hehe. Just kidding guys, you need your beauty sleep.Eye-wink

Well. I've fiddled around and I can't get imagecache to work right.

Just to be sure, what should the correct file system variables be? I have "files" and "files/tmp" respectively.

Imagecache has created images in the following structure (as an exampel):
public_html/shop/files/imagecache/category/files/ubercart_images

Is that how it's supposed to be?

Posts: 50
Joined: 09/09/2007

Are the imagecache and the ubercart_images folders supposed to be created at install? I used the Uberinstaller, and I had to chmod the files folder to 777 after install (I guess?). I then created the ubercart_images folder in the files folder, and chmoded it to 777 as well. This is not the way it's supposed to be done, right?

Posts: 2267
Joined: 08/07/2007
AdministratoreLiTe!

When you upload the image through the form, it should put it in files/ubercart_images. Those are the default values anyway. Once you view the image on the page, like after you click submit, imagecache should find that image, modify it, and save the result in files/imagecache/preset name/files/ubercart_images.

That said...I'm not exactly sure what you meant by "I have created images the following structure".

Posts: 50
Joined: 09/09/2007

Sorry, I changed it to:

Imagecache has created images in the following structure (as an exampel):
public_html/shop/files/imagecache/category/files/ubercart_images

but not fast enough. I guess that is a correct file structure then.

I tried to install via Uberinstaller to another directory, and chmoded the files folder to 777 prior to running the site for the first time. It didn't seem to help though. Sad

Posts: 50
Joined: 09/09/2007

I tried the following:

1) created a "shop" folder
2) created a "files" folder in "shop", and chmoded it to 777.
3) used the Uberinstaller and pointed it to "shop"
4) let the Installer run its course
5) the ubercart_images folder was created as it should be in the files folder. This did not happen if I didn't chmod files folder to 777 prior to install with Uberinstaller
6) the error still shows - just once - when previewing, adding and viewing a product with an image, but it seems to be working otherwise

Pehaps the installer should set the files folder to 777? Or is that not possible or desirable?

Posts: 332
Joined: 08/07/2007
Administrator

This is a bug I get too with UberInstaller test installs. One issue I've been encountering is that whatever user logs in via FTP will automatically be the owner of all the Drupal/Ubercart files and folder. Because of that the files won't have the same permissions as apache or whatever your web server is. When the uberinstaller runs a install with a customized drupal profile, its suppose to report any errors encountered in enabling modules, or so I thought. Anyhoo, I'm looking into this and hope to have a fix for it soon.

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 50
Joined: 09/09/2007

It would be nice! Smiling

A related issue is when you delete a image from a product node, the files does not get deleted from the web server. This should not be a problem since php can chmod files that I can't chmod or delete when logged in to the FTP account. Are there erasing functionality for imagecache files missing in the product node?

Posts: 332
Joined: 08/07/2007
Administrator

UberInstaller should now have the files directory set to 777 now. As far as the imagecache files being removed, Lyle has informed that when you delete a product image it removes the original image from the files/ubercart_images directory. The imagecache files aren't delete until the cache is updated. You can manually flush the cache in admin/settings/imagecache if having those lingering images bothers you.

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 50
Joined: 09/09/2007

Aaaah! Flush! Smiling Thanks a lot.

cdiggity (not verified)

i saw this behaviour on preview too

Posts: 2267
Joined: 08/07/2007
AdministratoreLiTe!

Finally figured out what was causing the preview errors: uc_attribute.
There's a node_load() in _uc_attribute_alter_form() that's throws all those errors when the $node object doesn't have an nid.

The solution is to change line 1154 to

<?php
 
if ($node = node_load((int)$product['nid']['#value'])){
?>

and put an extra corresponding end brace before the return statement:
<?php
 
}
  return
$product;
?>

This change has been committed, so everyone following along with Bazaar should do a bzr update.

Posts: 50
Joined: 09/09/2007

Bazaar? Bizarre? Eye-wink

Works great! Thanks Lyle. You're the best. Smiling