Hi,
I had the problem that no images would show up in the ubercart catalog view "mysite.com/catalog" & "mysite.com/catalog/[tid]" though showing up everywhere else.
I checked a lot of different solutions, which can be found on the net, but none of them worked. I always just saw "n/a", where the picture was supposed to be.

I finally tracked through the code to find the error in uc_product.module, within the function function uc_product_table().
The statement beginning on line 1323:
if (($field = variable_get('uc_image_'. $node->type, '')) && isset($node->$field) && file_exists($node->{$field}[0]['filepath']))
never validated until I changed
file_exists($node->{$field}[0]['filepath']) into file_exists($_SERVER['DOCUMENT_ROOT'].$node->{$field}[0]['filepath']).
That way, I got the full path of the file.

Afterwards I had the problem, that on line 1325, $image['filepath'] resolved to the full path (/sites/default/files/myfile.jpg), while Imagecache only wanted a filename. I solved this by using preg_split().

$my_filename = preg_split('/\//', $image[$filepath]);
$data['image'] = array('#value' => l(theme('imagecache', 'product_list',$my_filename[(count($my_filename))-1], $image[$alt], $image['title']), 'node/'. $node->nid, array('html' => TRUE)));

My final problem was not using the default Imagecache Field but my custom Imce Image Field.
Imce is not using the variable node->{$field}[0]['filepath'] but it's own node->{$field}[0]['imceimage_path']. My final solution looked as follows (all of the above solutions included):

  foreach ($args as $nid) {
    $data = array();
    $node = node_load($nid);
    if ($enabled['image']) {
      if (module_exists('imagecache')) {

	//Here comes IMCE_Image integration

	$field = variable_get('uc_image_'. $node->type, '');
	if (file_exists($_SERVER['DOCUMENT_ROOT'].$node->{$field}[0]['imceimage_path']))
	{
		$my_filepath = 'imceimage_path';
		$my_alt = 'imceimage_alt';
	}
	else
	{
		$my_filepath = 'filepath';
		$my_alt = 'alt';	
	}
        if (($field = variable_get('uc_image_'. $node->type, '')) && isset($node->$field) && file_exists($_SERVER['DOCUMENT_ROOT'].$node->{$field}[0][$my_filepath])) {
	  $image = $node->{$field}[0];
          $my_filename = preg_split('/\//', $image[$my_filepath]);
	  $data['image'] = array('#value' => l(theme('imagecache', 'product_list', $my_filename[(count($my_filename))-1], $image[$my_alt], $image['title']), 'node/'. $node->nid, array('html' => TRUE)));
        }

Hope I could help some people and thanks for the nice work.
Jakob

Comments

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sobi3ch’s picture

Assigned: jakob_dunning » Unassigned
Priority: Normal » Major
Status: Closed (fixed) » Needs work

Sorry but we need to open this issue again. Patch need to be made and then tested and then we can close.. I see nobody applied this the module up to now :(

longwave’s picture

Title: No images in Ubercart catalog view » Add support for IMCE as product image field
Category: bug » feature
Status: Needs work » Active

"My final problem was not using the default Imagecache Field but my custom Imce Image Field."

This seems to be the root cause of the original problem, as only Imagefield is supported at present. Changing this to a feature request.

@sobi3ch: if you are not using IMCE, then your problem lies somewhere else - please open another issue with more information.

tr’s picture

Version: 6.x-2.2 » 6.x-2.x-dev
Priority: Major » Normal
tr’s picture

Issue tags: -imagecache, -imce, -Ubercart, -catalog

As it says below:

Before adding tags read the issue tag guidelines.
longwave’s picture

Status: Active » Closed (won't fix)

Seems nobody else is interested in this, so I don't think it's worth supporting IMCE in core. This could be done in a contrib module that replaces uc_catalog, or you could use Views to build a catalog display.