Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Seperate Thumbnail Image Uploads

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-24-2004, 11:30 PM
 
deonya deonya is offline
 

Member
  
Join Date: Oct 2003
Posts: 18
 

Default Seperate Thumbnail Image Uploads

I have see a few people on the forum looking for a way to have a different image view from the thumbnail upload. Well I have something that might help them accomplish this.

In your <xcart_dir>/skin1/custom/main/product.tpl file, find the following part of code:

Code:
<TD valign="top" align="left" rowspan="2" width="100"> {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"} </TD>
and replace it with this:
Code:
<TD valign="top" align="left" rowspan="2"> {if $images.0.avail eq "Y"} {if $images.0.tmbn_url} [img]{$images.0.tmbn_url}[/img] {else} [img]{$xcart_web_dir}/product_image.php?imageid={$images.0.imageid}[/img] {/if} {else} {include file="product_thumbnail.tpl" productid=$product.productid image_x=$config.Appearance.thumbnail_width product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail"} {/if} </TD>

This mod will make it so that on the product preview page instead of displaying the thumbnail again it will display the detailed image you upload. This will also create a small problem, your detailed image will be displayed on the page twice. To stop that from happening do this.

In your <xcart_dir>/skin1/modules/Detailed_Product_Images/product_images.tpl file replace the following:
Code:
{section name=image loop=$images}
with this
Code:
{section name=image loop=$images start=1}

Witch will make it skip over the first added detailed image and only display images added after the first.

If you decide not to upload a second detailed image the detailed image box will still appear with no content and you fix that by doing this.
In your <xcart_dir>/skin1/modules/Detailed_Product_Images/product_images.tpl file replace the following:
Code:
{if $images ne ""}
with this
Code:
{if $images ne "" and count($images) ne 1}

If done correctly when uploading a new product you can upload the thumbnail, then upload a detailed image to be displayed is the products main view, and you still have the ability to add more detailed images that will appear in the correct place.

I use this mod on my site now check it out the site is not compleat so theres only one product under logo templates.
http://www.pixellab.biz

Hope you all enjoy this as much as I did!

**MODERATOR EDIT - I have updated the code per the fix listed later in this post. Enjoy! - Padraic**
__________________
Deonya Fields
--------------------------
X-Cart Gold 4.0.4
--------------------------
http://www.pixellab.biz
Reply With Quote
  #2  
Old 09-25-2004, 12:13 AM
  EnriqueHavoc's Avatar 
EnriqueHavoc EnriqueHavoc is offline
 

eXpert
  
Join Date: Jul 2004
Posts: 232
 

Default

sweet! been looking for a way to do this for awhile, i will give it a try soon. very nice deonya!
__________________
X-Cart 4.0.12
PHP 4.3.11
MySQL 4.0.23
Linux/Apache
Net::SSLeay 1.25
libCURL libcurl/7.12.0 OpenSSL/0.9.7a zlib/1.1.4
www.ewdhosting.com
Reply With Quote
  #3  
Old 09-25-2004, 06:38 AM
 
deonya deonya is offline
 

Member
  
Join Date: Oct 2003
Posts: 18
 

Default

Quote:
Originally Posted by EnriqueHavoc
sweet! been looking for a way to do this for awhile, i will give it a try soon. very nice deonya!

Glad to help!
__________________
Deonya Fields
--------------------------
X-Cart Gold 4.0.4
--------------------------
http://www.pixellab.biz
Reply With Quote
  #4  
Old 09-26-2004, 09:49 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Deonya,

Thank you for providing this viable solution to the many workarounds. I have modified the tpls's with the code, but it receives a parse error when implementing:

Code:
{if $images ne ""}
with
Code:
{if $images ne "" and count($images) 1}

Quote:
Parse error: parse error, unexpected T_LNUMBER in /home/michael/public_html/store/templates_c/%%A2^A2B^A2BE44E9%%product_images.tpl.php on line 5

Ideas? Many thanks for your assistance.

- Mike
__________________
4.1.9
Reply With Quote
  #5  
Old 11-03-2004, 07:14 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Anyone know what the correct syntax of:

Code:
{if $images ne "" and count($images) 1}

I would love to be able to not have a blank detailed image box when there isn't a second one (per this post).
Thanks,

Mike.//
__________________
4.1.9
Reply With Quote
  #6  
Old 11-03-2004, 11:09 PM
 
cotc2001 cotc2001 is offline
 

X-Man
  
Join Date: Feb 2003
Location: Shrewsbury, UK
Posts: 2,351
 

Default

Very nice im going to try this , this mroning.
__________________
x-cart 4.0.5 (live and heavily modded)
Server: freebsd
Reply With Quote
  #7  
Old 11-04-2004, 12:16 AM
 
cotc2001 cotc2001 is offline
 

X-Man
  
Join Date: Feb 2003
Location: Shrewsbury, UK
Posts: 2,351
 

Default

Bizzare, still just seems to show the thumbnail image, even though there is a detailed image uploaded (4.0.5)
__________________
x-cart 4.0.5 (live and heavily modded)
Server: freebsd
Reply With Quote
  #8  
Old 11-04-2004, 05:51 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Works fine in all of my 4.x installs. Although without the image count code, you'll get a blank "Detailed Image" box when there is not a 2nd detailed image.

If you don't see anything, I suspect:

1. You product image is still scaling down to the desired thumbnail size or you only have 1 detailed image. You'll need three images for Deonya's code to be effective.

mike.//
__________________
4.1.9
Reply With Quote
  #9  
Old 11-04-2004, 06:08 AM
 
cotc2001 cotc2001 is offline
 

X-Man
  
Join Date: Feb 2003
Location: Shrewsbury, UK
Posts: 2,351
 

Default

K i'll try again.

Need to make it work with boomers tab mod as well
__________________
x-cart 4.0.5 (live and heavily modded)
Server: freebsd
Reply With Quote
  #10  
Old 01-23-2005, 06:35 PM
 
mustang mustang is offline
 

eXpert
  
Join Date: Nov 2003
Location: US
Posts: 210
 

Default

Quote:
Originally Posted by mffowler
Anyone know what the correct syntax of:

Code:
{if $images ne "" and count($images) 1}

I would love to be able to not have a blank detailed image box when there isn't a second one (per this post).
Thanks,

Mike.//

Deonya - Thanks! Works great!

One small error in the code is that last part that Mike noted above. The correct syntax of the last line should be
Code:
{if $images ne "" and count($images) ne 1}

(The last 'ne' was left out. )

Thanks again Deonya!
__________________
X-Cart Gold 4.2.3
-----
PHP 5.2.17 | MySQL 5.1.52
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:49 AM.

   

 
X-Cart forums © 2001-2020