X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Enlarge product image popup (https://forum.x-cart.com/showthread.php?t=23459)

mikalou 07-21-2006 06:22 AM

Enlarge product image popup
 
This is for those who prefer to have a popup window to display an enlarged product image instead of the image thats displayed at the bottom of the product page.

All code is placed in: /skin1/customer/main/product.tpl

Step 1: Add this code above the code in step 2:
Code:

{php}
global $sql_tbl;
// Get the product id from the smarty var
$productid=$this->get_template_vars('productId');
// Get the rows from the extra_field_values table for this product id
if($productid) {
    $image_paths = func_query(
    "SELECT imageid, productid, image_path as path_value
    FROM $sql_tbl[images]
    WHERE productid = $productid");
}
$this->assign("image_paths",$image_paths);
{/php}


Step 2: Add the following code immediately after this code: {include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail"}:

Code:

{if $image_paths[0].path_value ne ""}
  [img]{$ImagesDir}/enlarge_img.gif[/img]
  Enlarge Image
{/if}


ALERT: You'll probably need to adjust the number values for: substr:28:30, in above code to match the length of your particular url.

Step 3 (optional): Create an image and name it "enlarge_img.gif" and place in /skin1/images sub directory. If you dont need or want an image then remove: [img]{$ImagesDir}/enlarge_img.gif[/img] from the code in step 2.

balinor 07-21-2006 07:28 AM

Moving to Custom Mods.


All times are GMT -8. The time now is 07:24 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.