I'm only seeing the default image for my related products. The normal image isn't being loaded.

Here's what is outputted on the page:

<img src="/sites/default/files/imagecache/uc_category/files/default_product.jpg" alt="test product" title="test product"  class="buy-related-item" />

The product image is shown everywhere else normally.

any ideas are appreciated.

Comments

walden’s picture

I solved my own problem. If you use a cck field besides the default "field_image_cache" then upsell can't find your image.

Possible this could be a setting like it is in the product content type?

firfin’s picture

Thank you for posting back your solution. I was experiencing the same problem and this also solved it for me.

torgospizza’s picture

Interesting, I'll take a look and see if I can hook into CCK for the product image.

walden’s picture

cool. I have a hunch that this installation doesn't use the default field name because I didn't have all of the image handling modules enabled when I installed Ubercart.

torgospizza’s picture

Yeah, that's most likely the case. But it makes sense to either a) use the same product field that the main "product" type uses, or b) allow users to select which imagefield they are using. Either one should be fairly straight forward to do.

torgospizza’s picture

Status: Active » Postponed

Marking this as postponed so that I know to revisit it.

anative’s picture

I'm having this same issue. How do I switch the product image to a non-cck version that will work with Upsell?

torgospizza’s picture

What's the field_name of your product image?

anative’s picture

It is "field_image"

torgospizza’s picture

Ah, interesting. Thanks. I still need to dig into this code to find a suitable fix. I think I'll look at how uc_product handles... and it'll be in the next release. Thanks for the push :)

torgospizza’s picture

Status: Postponed » Needs review

Just committed a new version to Dev that addresses this issue. Basically it looks for a configured setting from within Upsell config for a specific field to use (so the default can be overridden). Otherwise, it uses the uc_product image that was configured automatically for that particular node type.

If neither are found then it uses the old default, which was field_image_cache.

Please test and let me know if this works for you.

torgospizza’s picture

Status: Needs review » Fixed

Haven't heard anything so I'll assume it's fixed. If this breaks again in the new stable release please re-open this issue or start a new one.

Status: Fixed » Closed (fixed)

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

j0rd’s picture

Not fixed in what ever version I'm using. Also the hard coded path doesn't exist in my install. Instead of made the code use the default image associated with the imagefield, which seems like a better option. Personally, I'd just take out this option all together in the config and if the user has the default image set on their imagecache field, just use it.

Here's my theme change

function cwgminitries_zen_upsell_item($node) {
  $config = uc_upsell_get_config();
  
  // Get the imagefield to use (or use the default if it's not configured)
  $imagefield_fieldname = (isset($config['global']['upsell_image'])) ? $config['global']['upsell_image'] : variable_get('uc_image_'. $node->type, 'field_image_cache');
  $imagefield = $node->{$imagefield_fieldname[0]}[0]['filepath'];
  
  $output = '';

  if (module_exists('imagecache')) {
    // If we are configured to show the default image because none exists..
    if ($imagefield && file_exists($node->image['filepath'] . $imagefield)) {
      $output .= l(theme('imagecache', uc_upsell_get_imagecache_preset(), $node->image['filepath'] . $imagefield, $node->title, $node->title, array('class' => 'buy-related-item')), 'node/'. $node->nid, array('attributes' => array('class' => 'buy-related-item'), 'html' => TRUE));
    }
    elseif ($config['block']['use_default'] == TRUE && !$imagefield) {
      // Use the default image, if we're configured to do so
      $field = content_fields($imagefield_fieldname[0], $node->type);

      $output .= l(theme('imagecache', uc_upsell_get_imagecache_preset(), $field['widget']['default_image']['filepath'], $node->title, $node->title, array('class' => 'buy-related-item')), 'node/'. $node->nid, array('attributes' => array('class' => 'buy-related-item'), 'html' => TRUE));
    }
  }
...

--
Drupal Commerce