Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Tabular Format products.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-07-2005, 11:16 AM
 
fearnothing fearnothing is offline
 

Senior Member
  
Join Date: Jun 2005
Location: North East England
Posts: 124
 

Default 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.
__________________
www.smartchoicemusic.com
Smart Choice Music - Import CD and DVD Specialists
4.6.0
MySQL 5.5.34
PHP 5.4.24
Apache/2.2.26
Multiple homegrown and paid-for mods
Reply With Quote
  #2  
Old 07-07-2005, 12:13 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

http://forum.x-cart.com/viewtopic.php?t=12234
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 07-07-2005, 12:45 PM
 
fearnothing fearnothing is offline
 

Senior Member
  
Join Date: Jun 2005
Location: North East England
Posts: 124
 

Default

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
__________________
www.smartchoicemusic.com
Smart Choice Music - Import CD and DVD Specialists
4.6.0
MySQL 5.5.34
PHP 5.4.24
Apache/2.2.26
Multiple homegrown and paid-for mods
Reply With Quote
  #4  
Old 07-07-2005, 12:49 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Don't worry about it, the search function on the forum sucks so it isn't always easy to find stuff
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 01-22-2006, 09:27 AM
 
cigarbox cigarbox is offline
 

Advanced Member
  
Join Date: Dec 2004
Location: Boston, Ma
Posts: 31
 

Default

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

Thanks
__________________
X-cart Gold - 4.08
Reply With Quote
  #6  
Old 01-31-2006, 11:49 AM
 
fearnothing fearnothing is offline
 

Senior Member
  
Join Date: Jun 2005
Location: North East England
Posts: 124
 

Default

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}
__________________
www.smartchoicemusic.com
Smart Choice Music - Import CD and DVD Specialists
4.6.0
MySQL 5.5.34
PHP 5.4.24
Apache/2.2.26
Multiple homegrown and paid-for mods
Reply With Quote
  #7  
Old 02-01-2006, 08:05 AM
 
cigarbox cigarbox is offline
 

Advanced Member
  
Join Date: Dec 2004
Location: Boston, Ma
Posts: 31
 

Default

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

Chris
__________________
X-cart Gold - 4.08
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:27 AM.

   

 
X-Cart forums © 2001-2020