Adding an Image Caption

Posts: 17
Joined: 05/03/2008

Hi,

First post here. So far, found everything I've needed answered, and I'm sure this question is answered (or probably too obvious), but I can't seem to track it down.

Thanks Ryan and Lyle and the other developers and members for this package and great support.

All I want to do is add a caption under the product image in 'product view' with something like 'click to enlarge'.

Is this possible?

Don't have a link to the site as I'm developing off a local wamp.

Thanks,

Jason.

Posts: 887
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

I did something similar by overriding theme_uc_product_image() - this is the function that generates the HTML for the display of the image. See http://www.ubercart.org/faq/617 for details of how to do this.

--

<tr>.

Posts: 17
Joined: 05/03/2008

Thanks TR,

You've pointed me in the right direction.

Any chance you could drop in a code snippet for me? Would really help. I'm not so good with coding.

Posts: 887
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Copy the function theme_uc_product_image from uc_product.module and paste it on the end of your template.php. If you don't have a template.php in your theme directory, create a new one just to hold this function.

Inside your template.php, rename theme_uc_product_image to phptemplate_uc_product_image. Now search for the following lines in your template.php:

  /* if (count($images)) {
    $output .= '<br />'. t('Click for more images.');
  } */

Delete those lines and replace them by:
    $output .= '<br />'. t('Click for larger image');

That should get you started. You will have to make more edits if you want to use a div or span instead of just a br, and you might want to make other changes to the HTML to get the look you want, but this is the basic procedure.

--

<tr>.