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)
-   -   Easy dynamic thumbnail generation (https://forum.x-cart.com/showthread.php?t=22308)

JWait 02-12-2007 05:07 AM

Re: Easy dynamic thumbnail generation
 
I have this working (kind of) in 4.1.6 and it is sweet. I do have one problem though. What I did was added your "mouseover" routine to product.tpl uisng "if" statements as to whether the boxes were checked in "Product Detail Options options" in order to move my "detail" photos into the main display next to the description and pricing, and it really works well with products that have detail photos.

By using the "add thumbnail" routine in x-cart and specifying my main photo, it generates the thumbnail and shows it where appropriate. In product.tpl it shows the full size image, which works great for me.

The problem I am having is that for products with detail photos, it also shows the main photo, so in essence it is duplicated. I know this is because of the "include product_thumbnail.tpl" but if I remove it, nothing is displayed for products not having detail photos. I'm pretty sure I need a "if/else" statement that specifies "if" there are detail photos do "mouseover" routine "else" include product_thumbnail.tpl, but don't know the field to check in sql, or the correct syntax. Can you help?

here is what I have...

{if $active_modules.Detailed_Product_Images ne "" && $config.Detailed_Product_Images.det_image_popup eq 'Y' && $images ne '' && $js_enabled eq 'Y'}
{include file="modules/Detailed_Product_Images/popup_image.tpl"}
{/if}
{* Added Dynamic Image Mod *}
{if $active_modules.Detailed_Product_Images ne "" && ($config.Detailed_Product_Images.det_image_popup ne 'Y' || $js_enabled ne 'Y')}
{include file="modules/Detailed_Product_Images/mod_product_images.tpl" }
{/if}
{* / Added Dynamic Image Mod *}

{include file="product_thumbnail.tpl" sharpen="false" overlay="files/cache/trademark.png" overlay_position="9" class="NoBorder" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="P"}

Alltribes 02-14-2007 07:22 AM

Re: Easy dynamic thumbnail generation
 
Without digging into the templates myself, I would assume that wrapping the main product image in {if $images eq""}{/if} should do the trick.

JWait 02-14-2007 01:55 PM

Re: Easy dynamic thumbnail generation
 
I haven't throughly tested it but, yes it looks like that did it. Thanks.

Cefko 04-19-2007 06:43 AM

Re: Easy dynamic thumbnail generation
 
Do i need something special for this plugin, like GD library or something?

It seems it does that {thumb} does not work.. I have all permissions setup to right folder and path in function.thumb.php is correct.

mitash 04-19-2007 11:46 PM

Re: Easy dynamic thumbnail generation
 
I would not use this mod.
You would be better of using thickbox.

Search for "thickbox" or "lightbox" from 7dana.

Cefko 04-19-2007 11:55 PM

Re: Easy dynamic thumbnail generation
 
And why not?

JWait 04-20-2007 04:33 AM

Re: Easy dynamic thumbnail generation
 
Quote:

Originally Posted by mitash
I would not use this mod.
You would be better of using thickbox.

Search for "thickbox" or "lightbox" from 7dana.


They don't do the same thing.

Alltribes 04-20-2007 08:59 AM

Re: Easy dynamic thumbnail generation
 
Quote:

Originally Posted by Cefko
Do i need something special for this plugin, like GD library or something?

It seems it does that {thumb} does not work.. I have all permissions setup to right folder and path in function.thumb.php is correct.


Yes, you need GD installed.

Cefko 04-20-2007 10:07 AM

Re: Easy dynamic thumbnail generation
 
Thanks, I have installed GD...

But I can't make {thumb} to work.
Smarty keeps reporting error:
[20-Apr-2007 19:48:49] Error: Smarty error: thumb: image file does not exist in /var/www/html/Smarty-2.6.12/Smarty.class.php on line 1095

It seems that something is wrong with image PATH.... i have tried everything, but it does not work!

{thumb file="images/P/t_16131.jpg" width="850" link="false" hint="false"}

I have tried many instances, full http path, with leading /, but nothing! Still same error

My product.thumbnail

{strip}
{* Strip out http prefix from Full URL *}
{if $usertype eq 'A' || $usertype eq 'P'}
{assign var="tfile" value=$tmbn_url|replace:"`$http_location`/":"../"|replace:"`$https_location`/":"../"}
{else}
{assign var="tfile" value=$tmbn_url|replace:"`$http_location`/":""|replace:"`$https_location`/":""}
{/if}
{if !$class}
{assign var="class" value=""}
{/if}
{if !$sharpen}
{assign var="sharpen" value="true"}
{/if}
{if !overlay_position}
{assign var="overlay_position" value="9"}
{/if}

{if $config.Appearance.show_thumbnails eq "Y"}
{if $tmbn_url}
{thumb file="images/P/t_16131.jpg" width="850" link="false" hint="false"} {*overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" html="class=\"$class\" alt=\"$product|escape\""} *}
{$tfile|replace:" ":""}
{*$product.tmbn_url*}
{else}
<img {if $id}id="{$id}" {/if}src="
{if $full_url}
{$http_location}
{else}
{$xcart_web_dir}
{/if}
/image.php?productid={$productid}
{if $file_upload_data.file_path}&tmp=y{/if}
"
{if $image_x ne 0} width="{$image_x}"{/if}
{if $image_y ne 0} height="{$image_y}"{/if} alt="{$product|escape}" border="0"
{if $align} align="{$align}"{/if}{if $class} class="{$class}"{/if}>
{/if}
{/if}
{/strip}

Cefko 04-20-2007 10:19 AM

Re: Easy dynamic thumbnail generation
 
I managed to make it work with hardcoded path:

{thumb file="images/T/t_70.jpg" longside="850" link="false" hint="false" overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" html="class=\"$class\" alt=\"$product|escape\""}

but it does not work with dynamic path:

{thumb file="tfile" longside="850" link="false" hint="false" overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" html="class=\"$class\" alt=\"$product|escape\""}

Any clues?

My product_thumbnail.tpl
{* $Id: product_thumbnail.tpl,v 1.19 2007/04/19 06:55:36 max Exp $ Custom mod *}

{strip}
{* Strip out http prefix from Full URL *}
{if $usertype eq 'A' || $usertype eq 'P'}
{assign var="tfile" value=$tmbn_url|replace:"`$http_location`/":"../"|replace:"`$https_location`/":"../"}
{else}
{assign var="tfile" value=$tmbn_url|replace:"`$http_location`/":""|replace:"`$https_location`/":""}
{/if}
{if !$class}
{assign var="class" value=""}
{/if}
{if !$sharpen}
{assign var="sharpen" value="true"}
{/if}
{if !overlay_position}
{assign var="overlay_position" value="9"}
{/if}

{if $config.Appearance.show_thumbnails eq "Y"}
{if $tmbn_url}
{thumb file="images/T/t_70.jpg" longside="850" link="false" hint="false" overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" html="class=\"$class\" alt=\"$product|escape\""}
{$tfile}
{*$tfile|replace:" ":""*}
{*$product.tmbn_url*}
{else}
<img {if $id}id="{$id}" {/if}src="
{if $full_url}
{$http_location}
{else}
{$xcart_web_dir}
{/if}
/image.php?productid={$productid}
{if $file_upload_data.file_path}&tmp=y{/if}
"
{if $image_x ne 0} width="{$image_x}"{/if}
{if $image_y ne 0} height="{$image_y}"{/if} alt="{$product|escape}" border="0"
{if $align} align="{$align}"{/if}{if $class} class="{$class}"{/if}>
{/if}
{/if}
{/strip}


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

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