X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Tabular Format products.tpl (https://forum.x-cart.com/showthread.php?t=15059)

fearnothing 07-07-2005 11:16 AM

Tabular Format products.tpl
 
I have made a copy of products.tpl, stripped out a lot of surplus (for my needs) code and reformatted it into a tabular display.

This template (products_tab.tpl) is called from subcategories.tpl replacing the existing call to products.tpl and works fine. It is particularly effective for cats with a significant number of items for sale.

My question is this - There are some of my categories that don't hold a vast number of products, where the original products.tpl would be more effective.

Is there a smart way of calling the standard or revised templates depending on which cat is selected?

The cat IDs in question are completely random, for example cats 6, 19, 20 and 22 are where I would like the standard template to be called, the rest calling the tabular version.

What would be the syntax for an {if}{else} hard-coded statement?

Thanks in anticipation, FN.

balinor 07-07-2005 12:13 PM

http://forum.x-cart.com/viewtopic.php?t=12234

fearnothing 07-07-2005 12:45 PM

Excellent!

I've seen that post on my travels around the forum, but didn't get the significance of it.

{if $product.categoryid == 4 or $product.categoryid == 5}{/if}

is the snippet that works for subcategories.tpl

Note to oneself: Pay more attention in future and don't bug forumistas for answers that have already been posted!

Many thanks, FN

balinor 07-07-2005 12:49 PM

Don't worry about it, the search function on the forum sucks so it isn't always easy to find stuff :)

cigarbox 01-22-2006 09:27 AM

Fearnothing ...the mod you made to the product display is exactly what I have been looking for. Can you post the code ?

Thanks

fearnothing 01-31-2006 11:49 AM

Okay - here goes if anyone can use it.

This is the code for my products_tab.tpl template

The cycle command just alternates between a white and colored background to each row to make it easier to read.

There's an if/then in there that either displays the product thumbnail or a link to an audio sample depending on whether the extra field is empty. If empty it means on my system that this is a full CD so we just want the thumbnail, or if it has an entry it is a single track mp3 download so we want the preview clip link.

I think I've already credited elsewhere the thread on the forum that helped me display the extra field.

I seem to remember different elements in the original products.tpl caused the extra fields to not display so this is very much stripped down to the bare essentials that I need for my store.

Sorry it isn't better commented ..........

Code:

{* $Id: products_tab.tpl,v 1.45.2.12 2005/07/05 05:18:43 mclap Exp $ *}
{if $products}
{section name=product loop=$products}
{assign var="discount" value=0}
<TABLE cellpadding="3" border="0" width="100%">
<TR bgcolor="{cycle values="#EEEEEE,#FFFFFF"}">
<TD valign="middle" align="left">
{$products[product].product}


{$products[product].manufacturer}

</TD>
<TD valign="middle" align="center" width="55">
{* RJS:extra_fields start *}
{assign var="pid" value=$products[product].productid}
{foreach from=$extra_fields[$pid] item=field}
 {if $field.field_value ne ""}
 [img]{$ImagesDir}/speaker2.gif[/img]
 {else}
<A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}{if $featured eq 'Y'}&featured{/if}">
 {include file="tab_thumbnail.tpl" productid=$products[product].productid image_x=50}
</A>
 {/if}
{/foreach}
{* RJS:extra_fields end *}
</td>
<td valign="middle" align="right" width="55">
{if $products[product].taxed_price ne 0}
<FONT class="ProductPrice">{include file="currency.tpl" value=$products[product].taxed_price}</FONT>
{else}
<FONT class="ProductPrice">{$lng.lbl_enter_your_price}</FONT>
{/if}
</TD>
<td valign="middle" align="center" width="70">
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"}
{include file="customer/main/buy_now_tab.tpl" product=$products[product]}
{/if}
</td>
</TR></TABLE>
{/section}
{/if}


cigarbox 02-01-2006 08:05 AM

Thank you very much .... It has really helped a great deal

Chris


All times are GMT -8. The time now is 07:13 AM.

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