Add a link to the product image
Archived from the Web Auction Discussion forum.
bobede — Thu Nov 08, 2007 10:43 am
I would like to make the product image thumbnail, link to a new page showing the full size image. Just in the view_product page, not the product list.
Is there a way to do that?
Bob
bobede — Thu Nov 08, 2007 11:51 am
I figured it out.
Code: Select all
It was a simple matter of adding the link to the above div.
Bob
bobede — Thu Nov 08, 2007 11:52 am
Not sure why, but my code isn’t posting correctly.
Bob
shannah — Thu Nov 08, 2007 2:31 pm
Yeah. I’m still getting used to PHPBB myself. It seems to strip attributes out of HTML tags… i’ll have to look into a fix.
So far it seems to be a little better for posting code than Plone was though.
bobede — Mon Nov 12, 2007 11:39 am
I expanded on the idea of having a link to a larger image. I created new fields in the products table for image_two, image_three etc. and made changes to the templates>view_product.html page so that multiple thumbnails can be seen, and each one can be clicked for an enlarged view in a new window.
This works OK, but I would like to tweak it a bit. Right now, If there is only one image for the product, then a missing image icon is displayed for any missing images. What I would like to do, is have the app check the products table to see if image_two is null, and if it is, use code to display only product_image, if it is not null then use code to display product_image and image_two.
I was thinking that an if else would probably work for this, but being new to php I don’t know the mechanics of checking the table for the values.
Any help would be appreciated.
Thanks
Bob
bobede — Mon Nov 12, 2007 12:59 pm
Wow. I’m surprising myself.
I managed to get the if and else working to display either multiple thumbnails or a single thumbnail.
I would like to post the complete code but much of it is getting stripped out by phpbb. Here is the basic info.
- Code: Select all
- `{if $product->val(‘image_two’) != NULL}
code to display two images here
{else}
code to display a single image here
{/if}`
I plan to expand this so that up to 4 thumbnails can be displayed by adding elseif sections.
Bob
shannah — Mon Nov 12, 2007 2:34 pm
Thanks for posting this Bob. I’m sure this will be helpful to other users. Given that PHPBB seems to be stripping some of the HTML out, perhaps I’ll set up a “snippets” section for people to post code snippets…