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)
-   -   2 Row Featured Products (https://forum.x-cart.com/showthread.php?t=1241)

jpsowin 01-21-2003 09:30 AM

2 Row Featured Products
 
Since I'm feeling nice and someone asked for it, here is the code I use to display my featured products in 2 seperate rows. This took me a while to do, since I'm not an expert in SMARTY tags. Anyhoo, here it is.

Code:

{* $Id: featured.tpl,v 1.13 2002/05/20 06:55:20 lucky Exp $ *}
{* petsupplyonline featured products template *}
{* not released under any licence, not allowed to sell this *}
{capture name=dialog}
{if $f_products ne ""}

{section name=product loop=$f_products}
{ if %product.first% }
<table border="0" width="500" align="center">
{/if}

{ if %product.index% is even }
<tr>
    <td><table width="250" border="0" >
        <tr>
          <td width="80" rowspan="5">
{* IMAGE *}
<a href=product.php?productid={$f_products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$f_products[product].productid product=$f_products[product].product}</a></td>
        </tr>
        <tr>
          <td>
{* NAME *}
{$f_products[product].product|escape}</font>
<font class=ProductTitle></font>
</td>
        </tr>
        <tr>
          <td>
{* DESCRIPTION *}
{$f_products[product].descr|truncate:135:"...":true}
</td>
        </tr>
        <tr>
          <td>
{* PRICE *}
<font class=ProductPriceTitle>Price: {include file="currency.tpl" value=$f_products[product].price}</font><font class=ProductPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$f_products[product].price}</font>
</td>
        </tr>
        <tr>
          <td>
<a href=product.php?productid={$f_products[product].productid}&cat={$cat}&page={$navigation_page}>
{ include file="buttons/more_info.tpl" }
</a>

 </td>
        </tr>
      </table>
</td>

{else}

    <td><table width="250" border="0">
        <tr>
          <td width="80" rowspan="5">
{* IMAGE *}
<a href=product.php?productid={$f_products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$f_products[product].productid product=$f_products[product].product}</a></td>
        </tr>
        <tr>
          <td>
{* NAME *}
{$f_products[product].product|escape}</font>
<font class=ProductTitle></font>
</td>
        </tr>
        <tr>
          <td>
{* DESCRIPTION *}
{$f_products[product].descr|truncate:135:"...":true}
</td>
        </tr>
        <tr>
          <td>
{* PRICE *}
<font class=ProductPriceTitle>Price: {include file="currency.tpl" value=$f_products[product].price}</font><font class=ProductPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$f_products[product].price}</font>
</td>
        </tr>
        <tr>
          <td>
<a href=product.php?productid={$f_products[product].productid}&cat={$cat}&page={$navigation_page}>
{ include file="buttons/more_info.tpl" }
</a>

 </td>
        </tr>
      </table>
</td>

</td>
  </tr>
{/if}
{ if %product.last% }
</table>
{/if}
{/section}

{else}
{$lng.txt_no_featured}
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_featured_products content=$smarty.capture.dialog extra="width=100%"}


chiringill@yahoo.com 01-29-2003 12:46 PM

thanks a lot !! that looks great ! keep up the good work on the site !

nev 02-04-2003 01:08 PM

Great
 
This is great, but whats with the more_info.tpl as I cannot find this in my installation?

Thanks
Nev

jpsowin 02-04-2003 02:04 PM

Oh sorry, that's my own thing... just take it out and it'll be fine.

Blackhawk 02-04-2003 02:17 PM

hmm
 
I copied this in to replace my featured.tpl since I hadn't done anything with it yet.. and it doesn't do anything at all.

I must be daft.

jpsowin 02-04-2003 05:26 PM

Did I mention to always make backups and that I'm not responsible for any explosions 8O

It works for 3.3.2, I'm not sure about the others.

Blackhawk 02-04-2003 06:13 PM

:)
 
Well that's no help!!

jpsowin 02-04-2003 06:44 PM

I don't know what to tell you... it should display something even if it's an error. Are you running 3.3.2?

Blackhawk 02-04-2003 09:49 PM

Featured
 
I'll check it out more.. I'm running 3.3.1

Blackhawk 02-04-2003 09:51 PM

Featured
 
Do I have to enable something?

My front page has a "Featured Products" section.. and nothing list.. no error.. nothing.. ??

ATKOgirl 02-04-2003 10:43 PM

Hi Blackhawk:

In your admin, choose "categories" and page all the way down. You should see the featured products section there.

;->

ATKOgirl

rockman 03-06-2003 10:22 PM

Hi all,

I tried this 2 column mod for featured products. However the mod grabs a larger image from somewhere and does not draw the thumb.

I have only uploaded one image for products 150x150 and other thumbs are all ok.

ideas???? what can I do?

Thanks

TelaFirma 03-07-2003 04:30 AM

In the {IMAGE} section there, change the code
Code:

{include file="product_thumbnail.tpl" productid=$f_products[product].productid product=$f_products[product].product}
to read
Code:

{include file="product_thumbnail.tpl" productid=$f_products[product].productid image_x=70 product=$f_products[product].product}

The difference is the addition of the image_x=70. This send the x demention for the image to the tumbnail template. Basically telling it to display the image 70 pixels wide.

Also, as logic would follow, you can specify AND/OR the "y" cordinate... image_y=70..

Really it depends on what you want to control, the height (y) or the width (x) if the thumbnail. But I would chose only one... not both... or you will ultimately end up with some funky looking pictures :lol:

rockman 03-07-2003 07:25 AM

thank you


All times are GMT -8. The time now is 02:32 AM.

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