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)
-   -   Pictures in recommends.tpl for 3 column format (https://forum.x-cart.com/showthread.php?t=7506)

TJ Stephens 10-24-2006 04:03 PM

Re: Pictures in recommends.tpl for 3 column format
 
Tuan,

Thanks for your post #37. Worked great on 4.1.3!

TJ Stephens 10-24-2006 09:12 PM

Re: Pictures in recommends.tpl for 3 column format
 
I am testing 4.1.3 right now. I am using the code on post #37 and was getting a smarty error when there were no bestsellers or related products (I have incorporated this mod into my related products). In order to fix the smarty error, I had to wrap some of the language in modules/Bestsellers/bestsellers.php in an if statement. I used the following code and it seemed to work.
Put this at the bottom of modules/Bestsellers/bestsellers.php
Code:

if ($bestsellers) {
        foreach ($bestsellers as $i=>$item) {
        $bestsellers[$i]["tmbn_url"] = func_get_image_url($item[productid],"T");
        }
}

$smarty->assign("bestsellers",$bestsellers);
?>

I also added a similar line to the bottom of my modules/Upselling_Products/related_products.php file so that a tmbn_url would get passed so I could have images on my related products.
Code:

if ($product_links) {
        foreach ($product_links as $i=>$item) {
        $product_links[$i]["tmbn_url"] = func_get_image_url($item[productid],"T");
        }
}

$smarty->assign("product_links",$product_links);
?>

Hope this helps.

SusanMoore 11-10-2006 11:43 AM

Re: Pictures in recommends.tpl for 3 column format
 
I took Balinor's "fix" and was nearly satisfied with the results. However, I moved the <a href> link higher in the code so that the user could click the figure as well as the text to go to the upsell product, and I inserted a <br> to force the text to the following line: Here's my modified code that seems to work fine in 4.0.19:

{* $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">

<a href="product.php?productid={ $product_links[cat_num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>

{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}

<BR>
<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%"}

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

Cheers,
Susan

summitmn 11-20-2006 10:10 AM

Re: Pictures in recommends.tpl for 3 column format
 
Quote:

Originally Posted by mlfnet
I was looking around the forums to display pictures in the recommends.tpl and came across some code, but it had prices and was setup for 1 column. I edited it so it would display in a 3 colums with just the picture and title.


Where did you find this original set of code? I have searched but cannot find it. I want to add prices and pictures but for only 1 column.

Cankus 01-24-2007 08:12 AM

Re: Pictures in recommends.tpl for 3 column format
 
skin1/modules/Recommended_Products/recommends.tpl

This is workign on 4.3.1



{* $Id: recommends.tpl,v 1.9 2006/03/21 07:17:18 svowl Exp $ *}
{if $recommends}
{capture name=recommends}

{assign var="tmp" value="0"}

{section name=num loop=$recommends}
{if $recommends[num].productid}{assign var="tmp" value="1"}{/if}
{/section}

{section name=num loop=$recommends}

{ if %num.first% }
<table border=1 cellspacing=5 width=100%>
{/if}

{if $smarty.section.num.index is div by 3}
</tr><tr valign="top">
{/if}

<td width="250" align="center">


{include file="product_thumbnail.tpl" productid=$recommends[num].productid image_x=100 product=$recommends[num].product tmbn_url=$recommends[num].tmbn_url}
<a href="product.php?productid={ $recommends[num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>

<BR>

<span class="ProductTitle">{ $recommends[num].product|escape}</span><br>

</a></td>
{ if %num.last% }
</tr></table>
{/if}
{/section}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_recommends content=$smarty.capture.recommends extra='width="100%"'}
{else}
{capture name=dialog}
No related products.
{/capture}
{include file="dialog.tpl" title=$lng.lbl_recommends content=$smarty.capture.recommends extra='width="100%"'}
{/if}

Acquamarina 02-04-2007 09:33 AM

Re: Pictures in recommends.tpl for 3 column format
 
Cankus,

Did you mean 4.1.3? Has anyone tested it in 4.1.6? Also, can this be used for the Related Products?

I don't use the recommended products because they are random. I only use the related products that are chosen to appear on the product page (upselling links) and I really need to add columns there.
If this code does not work, does any one know where I can find the right one?

Thanks!

Cankus 02-04-2007 11:41 PM

Re: Pictures in recommends.tpl for 3 column format
 
This code for related products and working on 4.3.1

File : skin1/modules/Upselling_Products/related_products.tpl


{* $Id: recommends.tpl,v 1.9 2006/03/21 07:17:18 svowl Exp $ *}
{if $recommends}
{capture name=recommends}

{assign var="tmp" value="0"}

{section name=num loop=$product_links}
{if $$product_links[num].productid}{assign var="tmp" value="1"}{/if}
{/section}

{section name=num loop=$product_links}

{ if %num.first% }
<table border=0 cellspacing=5 width=100%>
{/if}

{if $smarty.section.num.index is div by 3}
</tr><tr valign="top">
{/if}

<td width="250" align="center">

{include file="product_thumbnail.tpl" productid=$product_links[num].productid image_x=100 product=$product_links[num].product tmbn_url=$product_links[num].tmbn_url}
<a href="product.php?productid={ $product_links[num].productid }"{if $config.Modules.upselling_new_window eq 'Y'} target="_blank"{/if}>

<BR>

<span class="ProductTitle">{ $product_links[num].product|escape}</span><br>

</a></td>
{ if %num.last% }
</tr></table>
{/if}
{/section}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.recommends extra='width="100%"'}
{else}
{capture name=dialog}
No related products.
{/capture}
{include file="dialog.tpl" title=$lng.lbl_related_products content=$smarty.capture.recommends extra='width="100%"'}
{/if}

Pantalonas 02-19-2007 03:42 AM

Re: Pictures in recommends.tpl for 3 column format
 
Thank you for the code, works great!

Mark

Warwick 02-20-2007 01:10 PM

Re: Pictures in recommends.tpl for 3 column format
 
Sorry if this has been covered already but is it possible to just show related products from the same category of the page it is on?

mitash 04-21-2007 05:26 PM

Re: Pictures in recommends.tpl for 3 column format
 
This mod is great... I just installed it on 4.1.6 and looks great.

Thanks!!


All times are GMT -8. The time now is 04:08 PM.

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