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)

jharwood 03-26-2009 08:19 PM

Re: Pictures in recommends.tpl for 3 column format
 
Is it a big deal to include specific extra field data in the recommended items display? What would be the format to call extra fields for v4.1.12?

Thanks

XCart 4.1.12

Learner 03-26-2009 09:45 PM

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

Originally Posted by balinor
Just a little update on this thread. Here's the code for 4.x that breaks the display up into rows of 3, allowing as many recommended products as you want (as set in General Settings/Modules Options). Just change the thumbnail width as you would like (in pixels). You can also adjust the number of columns by changing the width of the td and the 'div by x' where x is the number of columns:

Code:

{if $recommends}
{capture name=recommends}
{section name=num loop=$recommends}
{ if %num.first% }
<table border=0 width=100%>{/if}
{ if %num.index% is div by 3}<tr>{/if}

<td width="33%" align="center" valign="top">
<a href=product.php?productid={$recommends[num].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$recommends[num].productid image_x=100 product=$recommends[num].product tmbn_url=$recommends[num].tmbn_url}
 
<SPAN class="ItemsList">{$recommends[num].product}</SPAN>
 
</td>

{ if %num.last% }</tr>
</table>{/if}
{/section}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_recommends content=$smarty.capture.recommends extra="width=100%"}
{/if}



Thanks balinor for such a fine code.Is it possible to display all images in a revolving way in Recommended products list option?
Thanks to all.

dmic 04-22-2009 06:37 PM

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

This worked great for me in 4.1.11

Dave

aurimasdulskis 09-04-2009 06:37 AM

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

Maybe someone can help how to do correct "Market price", because with "Our price" all is ok, but "Market price" for all products is the same and this price is detail product price. If you can't understand, i think screenshot will helps.

Thank you so much! As you can see my version is 4.1.11

http://img44.imageshack.us/img44/1381/33404334.jpg

aurimasdulskis 09-04-2009 06:44 AM

Re: Pictures in recommends.tpl for 3 column format
 
MY code:

{* $Id: recommends.tpl,v 1.9 2006/03/21 07:17:18 svowl Exp $ *}
{if $recommends}
{capture name=recommends}
<table border=0 width=100%>
<tr>

{section name=num loop=3}
<td width=33% align=center valign=top>
<div style=" margin-bottom:5px;"><a href="product.php?productid={$recommends[num].productid}" class="ItemsList2">{$recommends[num].product}</a></font></div>
<a href="product.php?productid={$recommends[num].productid}">{include file="product_thumbnail.tpl" productid=$recommends[num].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url}</a>
<br>

<div style=" margin-top:5px;">

<span >Rinkos kaina:</span> <s><span>{include file="currency.tpl" value=$product.taxed_price}</span></s>
<span class="market-price">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.taxed_price}</span>
</div>
<font class="ProductPrice">
{$lng.lbl_our_price}: {include file="currency.tpl" value=$recommends[num].taxed_price}</font><font class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</font>



</td>
{/section}

</tr>
</table>

{/capture}
{include file="dialog.tpl" title=$lng.lbl_recommends content=$smarty.capture.recommends extra='width="100%"'}
{/if}

geckoday 09-05-2009 06:55 AM

Re: Pictures in recommends.tpl for 3 column format
 
You've mixed products.tpl, product.tpl and recommends.tpl variables. In recommends.tpl the product information for the recommended products list is in $recommends, not in $products or $product. To refer to the current product in the loop you should be using $recommends[num]. You need to change several things:

$products[product].product to $recommends[num].product
$products[product].tmbn_url to $recommends[num].tmbn_url
$products[product].taxed_price to $recommends[num].taxed_price

And finally the one which will actually fix the problem you are asking about:
$product.taxed_price to $recommends[num].list_price

hoosierglass 12-03-2009 03:30 PM

Re: Pictures in recommends.tpl for 3 column format
 
I was playing around with this for version 4.3

While it worked ok I was getting the word "array" for the alt on the product images. I did a little bit of altering and came up with a code that works just fine.

Code:


{*
$Id: recommends.tpl,v 1.16 2009/04/18 06:33:07 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{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=0 width="100%">
<tr>
{/if}
{if $smarty.section.num.index is div by 3}
</tr><tr valign="top">
{/if}
<td width="33%" align="center" valign="top">
<a href="product.php?productid={$recommends[num].productid}" class="ItemsList">{$recommends[num].product}</a>
<br />
<a href=product.php?productid={$recommends[num].productid}&cat={$cat}&page={$navigation_page}>
{include file="product_thumbnail.tpl" productid=$recommends[num].productid image_x=75 product=$recommends[num].product tmbn_url=$recommends[num].tmbn_url}</a>
<br />
<font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$recommends[num].taxed_price}</font>
</td>
{ if %num.last% }</tr>
</table>{/if}
{/section}
{/capture}
{include file="customer/dialog.tpl" title=$lng.lbl_recommends content=$smarty.capture.recommends extra="width=100%"}
{/if}


If you want the product images to be larger just change the image_x=75 to whatever size you want. Also if you want to go to four wide change the div number to 4 and the width to 25% and for two wide switch div number to 2 and the width to 50%

I hope this is of some use to those playing around with 4.3

DogByteMan 02-20-2010 08:27 PM

Re: Pictures in recommends.tpl for 3 column format
 
I used Balinor's code in 4.1.12 but I made it so it will verify as XHTML 1.0 Transitional

Code:

{if $recommends}
{capture name=recommends}
{section name=num loop=$recommends}
{ if %num.first% }

<h1>People who bought the {$product.manufacturer} {$extra_fields[0].field_value} were also interested in...</h1><p /><br /><p />
<table border="0" width="100%"><tr><td></td>{/if}
{if %num.index% is div by 3}</tr><tr>{/if}

<td width="33%" align="center" valign="top">
<a href="product.php?productid={$recommends[num].productid}&cat={$cat}&page={$navigation_page}">
{include file="product_thumbnail.tpl" productid=$recommends[num].productid image_x=90 product=$recommends[num].product tmbn_url=$recommends[num].tmbn_url}</a>
<br />
<a href="product.php?productid={$recommends[num].productid}&cat={$cat}&page={$navigation_page}">{$recommends[num].product|escape}</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%"'}
{/if}



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

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