Multiple Images for Ubercart Products

I’m working on a Drupal site with the Ubercart package. I’m learning both at the same time, which is a challenge since they each offer so many options. Below I’ve listed some troubles I came across while I fighting to get multiple images for the UC Product content type.

Don’t Change Product’s Display Field “Image”

Well, you can if you know what you’re doing. But I had mistakenly updated the display fields for the product content type at Home › Administer › Content management › Product › Display Fields to be ‘product_full image linked to image’ for ‘full node’. The reason I shouldn’t have done this is because UberCart handles the images itself. Head over to Home › Administer › Store administration › Configuration › Product Settings to choose a Product Image Widget.

None available? Install one off the Lightbox2 or Thickbox modules to have an option.

Uploading Multiple Images

Oh! the pains of learning. Months ago I attempted to add another Image field to the Product content type. It led nowhere and took up a lot of my time. Today I learned that the CCK Image Field offers the option of multiple images. Simple!

Head over to Home › Administer › Content management › Product › Manage Fields › Image. Under “Global Settings” there is an option for number of images to allow.

Contemplates for UberCart Products

Now: my image fields are hidden from the product pages. I have an image widget set for UberCart. I’m using the Contemplate module for product node rendering. How do I show the image widget?

There is probably a better way, but I found it by using the get_defined_vars() function. Reviewing the output of that function from my product node template revealed the image widget to be in $content[‘image’][‘#value’]. I dropped that in the template and had the lightbox triggering widget showing all product images.

For easier review of get_defined_vars output, install the Devel module, and use this line of code:

<?php dpm(get_defined_vars()); ?>
This entry was posted in Computing and tagged , , , . Bookmark the permalink.

1 Response to Multiple Images for Ubercart Products

  1. Jeff Snider says:

    Hey Dibson,

    Thanks so much for this! I’ve been looking everywhere on how to add additional photos. I even have the Drupal Ubercart book and still it could not tell me what I needed to do.

    Thanks again.


Leave a Reply

Your email address will not be published.