Image thumbnail on my cart page.

Project:Ubercart Contributions
Component:Code
Category:
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

I have the the latest versions of ubercart w/ images etc... installed. For some reason the full size image is displayed on the cart page instead of the thumbnail. This does not occur when viewing the individual products. This seems to be a bug with ubercart. Any suggestions??

Josiah_R's picture
Offline
Joined: 08/13/2008
Juice: 13
Recommended Solution

Imagecache cart does not have a thumbnail set in the default configuration. It would be nice if it did.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Recommended Solution
Assigned to:Josiah_R» Lyle

It's certainly supposed to. But I've never seen it happen that just one of the default presets is messed up. Usually when something goes wrong, none of the presets work right.

At least it's an easy fix. Just make an imagecache preset called "cart" and give it a scale action with whatever dimensions you want.

Josiah_R's picture
Offline
Joined: 08/13/2008
Juice: 13
Coding Error??
Assigned to:Lyle» Josiah_R

Only one was wrong, I do not know why. I thought that this may be some kind of coding error and wanted to let you guys know.

mach5_kel's picture
Offline
Joined: 03/25/2008
Juice: 79
Same
Assigned to:Josiah_R» mach5_kel

I found the same problem after an update. All the image cache types were already there. I just needed to head over to image cache settings and change it from default to the image cache I wanted. Wasn't a big deal really.

bwv
bwv's picture
Offline
Uber DonorBug FinderEarly adopter... addicted to alphas.Spreading the word - Ubercart for president.
Joined: 08/07/2007
Juice: 417
Re: Same
Assigned to:mach5_kel» bwv

I am having some difficulties with this as well. If you add an item to the cart, then go to the /cart page, the images do not show. I have deleted and rebuilt a preset called "cart" but to no avail.

I am starting to think it might be best to remove that field from the cart display entirely. That way only four fields will display (Remove, Products (name/link only), Qty. and Total.

Any assistance would be greatly appreciated. thanks

ron_s's picture
Offline
Joined: 09/11/2008
Juice: 173
Here is a solution
Assigned to:bwv» ron_s

I think I have found the problem. I did some debugging and seems to be a coding issue.

The issue is in the uc_product_get_picture function in the uc_product.module file (this sits in the uc_product subfolder within Ubercart). Approximately around line 2542 is the following line of code:

$path = $product->field_image_cache[0]['filepath'];

When I place a "print_r" statement for the $product array right above this line (print_r($product);), I'm able to see the entire dataset for each product. The issue is the subarray "filepath" no longer exists in array "0". Instead, it can be found in array "1". So if you change the line above to the following, the images start to be displayed on the cart checkout:

$path = $product->field_image_cache[1]['filepath'];

Hope this helps.

Ron

ron_s's picture
Offline
Joined: 09/11/2008
Juice: 173
A problem in uc_catalog too

I have notice this same problem exists in the uc_catalog.module file. The use of array "0" is causing images to not be displayed when the catalog is shown as a grid.

Around line 988 in the theme_uc_catalog_product_grid function, the following code exists:

    if (module_exists('imagecache') && isset($product->field_image_cache) && file_exists($product->field_image_cache[0]['filepath'])) {
      $imagelink = l(theme('imagecache', 'product_list', $product->field_image_cache[0]['filepath']), "node/$nid", array(), null, null, false, true);
    }

This needs to be modified to the following:

    if (module_exists('imagecache') && isset($product->field_image_cache) && file_exists($product->field_image_cache[1]['filepath'])) {
      $imagelink = l(theme('imagecache', 'product_list', $product->field_image_cache[1]['filepath']), "node/$nid", array(), null, null, false, true);
    }

Can any of the Ubercart owners explain why this array numbering changed in Ubercart 1.6?

bwv
bwv's picture
Offline
Uber DonorBug FinderEarly adopter... addicted to alphas.Spreading the word - Ubercart for president.
Joined: 08/07/2007
Juice: 417
Re: Here is a solution
Assigned to:ron_s» bwv

Ron, this fix did not work for me. Do I need to clear the cache, perhaps? I tried rebuilding all the cart images in imagecache, but nothing showed up on the /cart page. Thanks, david (PS: This reply applies to post #6 above apologies for the confusion.)

http://classicvinyl.biz
http://music.bwv810.com

ron_s's picture
Offline
Joined: 09/11/2008
Juice: 173
Re: Re: Here is a solution
Assigned to:bwv» ron_s

I'm curious to know, are you using Ubercart 1.6 and Imagecache 5.x-2.2? These are the modules I'm using and referring to in this solution. You might have to clear out the cache from the database ... did you give that a try?

bwv
bwv's picture
Offline
Uber DonorBug FinderEarly adopter... addicted to alphas.Spreading the word - Ubercart for president.
Joined: 08/07/2007
Juice: 417
Re: Re: Re: Here is a solution
Assigned to:ron_s» bwv

Hi, no, and that indubitably is the problem. I am using ImageCache 5.x-1.x-dev; I have not upgraded because I am loathe to mess things up (I have had trouble with the latest releases of Imagecache and thickbox, so have decided to leave things along, as the combination that i am using now works). I am, however, using UC 1.6.

http://classicvinyl.biz
http://music.bwv810.com