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)
-   -   3 column layout with thumbnail for Related Products (https://forum.x-cart.com/showthread.php?t=10773)

balinor 12-06-2004 07:08 AM

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}


sportruck 12-07-2004 03:18 PM

Awesome mod! This seems to work with 4.0.8 as well.

PhilJ 12-08-2004 01:44 AM

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.

balinor 12-08-2004 06:38 AM

Oops...my bad. Nice catch Philj, thanks! :)

Bella Forma 02-27-2005 03:33 AM

Thanks for this mod. Works in 4.0.11 :D

Bella Forma 02-27-2005 04:04 AM

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.


mffowler 03-06-2005 10:34 PM

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

Lingerieblowout 05-14-2005 03:11 PM

Works great in v3.4.6

Thanks Balinor

whsu716 07-17-2005 06:14 PM

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.!

stevep 03-11-2006 05:26 AM

no luck using with a two column


All times are GMT -8. The time now is 12:25 PM.

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