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

3 column layout with thumbnail for Related Products

 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 12-06-2004, 07:08 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 3 column layout with thumbnail for Related Products

I just installed the mod from mlfnet that displays the Recommended Products in 3 columns with a product icon, and I thought it would be nice to have the Related Products do the same thing. Tested in version 3.5.13, but should work for previous 3.5.x versions as well. Replace your /modules/Upselling_Products/related_products.tpl with this:

Code:
{* $Id: related_products.tpl,v 1.7.6.1 2004/12/06 svowl Exp $ *} {if $product_links ne ""} {capture name=dialog} {assign var="tmp" value="0"} {section name=cat_num loop=$product_links} {if $product_links[cat_num].productid}{assign var="tmp" value="1"}{/if} {/section} {section name=cat_num loop=$product_links} { if %cat_num.first% } <table border=0 cellspacing=5 width=100%> {/if} {if $smarty.section.cat_num.index is div by 3} </tr><tr valign="top"> {/if} <td width="250" align="center"> {include file="product_thumbnail.tpl" productid=$product_links[cat_num].productid image_x=$config.Appearance.thumbnail_width product=$product_links[cat_num].product tmbn_url=$product_links[cat_num].tmbn_url} <a href="product.php?productid={ $product_links[cat_num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}> <span class="ProductTitle">{ $product_links[cat_num].product|escape}</span> </a></td> { if %cat_num.last% } </tr></table> {/if} {/section} {/capture} {include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra="width=100%"} {/if}
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #2  
Old 12-07-2004, 03:18 PM
 
sportruck sportruck is offline
 

Advanced Member
  
Join Date: Dec 2003
Posts: 70
 

Default

Awesome mod! This seems to work with 4.0.8 as well.
Reply With Quote
  #3  
Old 12-08-2004, 01:44 AM
  PhilJ's Avatar 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Location: UK
Posts: 3,699
 

Default

Thanks, I would add in

Code:
{else} {capture name=dialog} No related products. {/capture} {include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.dialog extra="width=100%"}

just before the last {/if} in case there is no upselling products, otherwise it's blank.
Reply With Quote
  #4  
Old 12-08-2004, 06:38 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Oops...my bad. Nice catch Philj, thanks!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 02-27-2005, 03:33 AM
 
Bella Forma Bella Forma is offline
 

Senior Member
  
Join Date: Nov 2004
Location: Australia
Posts: 150
 

Default

Thanks for this mod. Works in 4.0.11
__________________
X-Cart Gold 4.0.12
X-AOM, X-RMA, X-FancyCat
Apache/Linux Server
PHP 4.3.8
Reply With Quote
  #6  
Old 02-27-2005, 04:04 AM
 
Bella Forma Bella Forma is offline
 

Senior Member
  
Join Date: Nov 2004
Location: Australia
Posts: 150
 

Default

Very small change needed to make sure that if you have the 'open in new window' option selected in modules admin the thumbnail as well as the link opens in a new window.

__________________
X-Cart Gold 4.0.12
X-AOM, X-RMA, X-FancyCat
Apache/Linux Server
PHP 4.3.8
Reply With Quote
  #7  
Old 03-06-2005, 10:34 PM
 
mffowler mffowler is offline
 

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

Default

Thanks balinor! This mod is great and I put in below the product details and removed the dialog. Looks (and works) great.

PhilJ- not sure why you need an else statement there ... related products are manually added and there already is an if statement in the product.tpl for the module (if active). If there aren't related products then there is no header.

Thanks,

- Mike
__________________
4.1.9
Reply With Quote
  #8  
Old 05-14-2005, 03:11 PM
 
Lingerieblowout Lingerieblowout is offline
 

X-Adept
  
Join Date: Sep 2003
Location: Annapolis, MD
Posts: 415
 

Default

Works great in v3.4.6

Thanks Balinor
__________________
http://www.lingerieblowout.com
Version 4.1.10

http://www.topnichewebsites.com
Version 4.4.5

Michael
Reply With Quote
  #9  
Old 07-17-2005, 06:14 PM
 
whsu716 whsu716 is offline
 

Senior Member
  
Join Date: Jun 2005
Posts: 168
 

Default

this is great!

Is there a way to include a part of the product detail?
--

got it - simple modification of the related_products.php

replace the sql code with this
Quote:
$product_links = func_query("SELECT DISTINCT $sql_tbl[products].descr, $sql_tbl[products].productid, $sql_tbl[products].productcode, MIN($sql_tbl[pricing].price) AS price, IF ($sql_tbl[products_lng].product IS NOT NULL,$sql_tbl[products_lng].product, $sql_tbl[products].product) AS product FROM $sql_tbl[products], $sql_tbl[pricing], $sql_tbl[product_links] LEFT JOIN $sql_tbl[products_lng] ON $sql_tbl[products_lng].productid = $sql_tbl[products].productid AND $sql_tbl[products_lng].code='$store_language' WHERE $sql_tbl[products].productid=$sql_tbl[product_links].productid2 AND $sql_tbl[product_links].productid1='$productid' AND $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[pricing].quantity=1 AND $sql_tbl[pricing].variantid = 0 AND ($sql_tbl[pricing].membership='$membership' OR $sql_tbl[pricing].membership='') AND $sql_tbl[products].forsale='Y' GROUP BY $sql_tbl[products].productid ORDER BY $sql_tbl[product_links].orderby, product");

and in your related_products.tpl you just need to add this wherever you want:

Quote:
{$product_links[cat_num].descr}

hope that helps!

-edit-
and if the description is too long..then add this:

Quote:
{$product_links[cat_num].descr|truncate:150:"...":true}


and then add a 'read more here' link to the end of the dots...

Quote:
<a href="product.php?productid={ $product_links[cat_num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>
<span class="ProductTitle">View details</span>
</A>

you can see the example here:
http://www.yoyonation.com/product.php?productid=63&cat=0&page=1 - it's still in testing and we haven't loaded in our yoyo products yet...

if anyone can help me out with the comment thing below..
would like to add an edit/delete option in the admins..having trouble programming that - but if i get it, will definitely add it into the mod page.!
__________________
...
v 4.0.18; 4.1
Reply With Quote
  #10  
Old 03-11-2006, 05:26 AM
  stevep's Avatar 
stevep stevep is offline
 

Advanced Member
  
Join Date: Jul 2005
Location: uk
Posts: 58
 

Default

no luck using with a two column
__________________
X-Cart version 4.4.5
PHP 5.2.13
MySQL server 5.0.51a-community-log
MySQL client 5.0.51a
Web server Apache/2.2.8 (Unix) mod_ssl/2.2.8
Operation system Linux
Perl 5.008008

http://temptinglysexy.co.uk
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:20 AM.

   

 
X-Cart forums © 2001-2020