View Single Post
  #1  
Old 10-05-2002, 06:09 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default Detailed Product Images Popup on Thumbnail click.

Okie, since I just finished doing this for another client heres what to do to make the detailed product images not appear in the details but rather appear only when the user clicks the thumbnail for more detailed pictures.

First step: Create a new php file under customer/ Lets call it product_detailed_images.php and then paste the entire code into it:
Code:
<? require "../smarty.php"; require "../config.php"; # # Collect product images # $images = func_query("select * from $sql_tbl[images] where productid='$productid' order by imageid"); $smarty->assign("images",$images); $smarty->display("modules/Detailed_Product_Images/product_images.tpl"); ?>

Now open customer/main/product.tpl in your skins directory. Add the following after the first javascript or at the top of the file:
Code:
{literal} <SCRIPT language=JavaScript1.2> <!-- function productimagedetail(product_id) { var w = "420"; //width var h = "420"; //height window.open('product_detailed_images.php?productid='+product_id,"detailedproduct","width="+w+",height="+h+",resizable,scrollbars=yes"); } --> </SCRIPT> {/literal}

You can edit the height and width of the new window popup by simply editing the variable w and h, which are both equal to 420 currently.

Now find the line that is pointing to the product thumbnail it should look something like this:

Code:
{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product}{if $active_modules.Detailed_Product_Images ne ""}

Highlight this entire line and replace it with this:


Now you'll want to remove the detailed product images from showing up in the product detail page, so scroll to the bottom of the file and find the line that looks like so:

Code:
{if $active_modules.Detailed_Product_Images ne ""} {include file="modules/Detailed_Product_Images/product_images.tpl" } {/if}

You can either remove this code OR comment it out with or {* smarty comments *}

Now moving on to the next step.

You'll probably want to create your own header or something to showup with the image popup, so edit modules/Detailed_Product_Images/product_images.tpl Here you will find the template that is being called from the newly created php file created on the first step.

You can also edit product_thumbnail.tpl in your skins directory and add an ALT description telling the user to click for a detailed image, here's how I did it:

Code:
{if $config.General.show_thumbnails eq "Y"}[img]../image.php?productid={$productid}[/img]{/if}

You can also insert a text reference underneath the product thumbnail in customer/main/product.tpl that informs the user to click for more details!

Anyhow, hope this works for anyone, if you wanting to make a donation please email me.

Thanks
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.