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

Products.tpl - What is safe to get rid of?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 05-15-2006, 08:33 AM
 
Grant Grant is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 171
 

Default

Ok I've sorted it out now. I'm using multiple templates for both products and catergories. Here is the products_t.tpl I played around with below just in case it's at all useful to anybody else and a little screen shot of how it renders.

http://www.wyzeshop.com/screenshot5.jpg

Quote:
{* $Id: products_t.tpl,v 1.10.2.12 2006/02/27 08:53:50 svowl Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0"><TR><TD class="TableThumbnailBorder">

<TABLE border="0" width="100%" cellpadding="5" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<TR>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<TD align="center" valign="top" width="{$width}%" class="DialogBox">
<TABLE cellpadding="3" cellspacing="0" border="0" height="120">
<TR>
<TD height="100" width="60"> <A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}">{i nclude
file="product_thumbnail.tpl" productid=$products[product].productid
image_x=$config.Appearance.thumbnail_width product=$products[product].product
tmbn_url=$products[product].tmbn_url}</A>
</TD>
<TD width="439">{$products[product].product}

{$lng.lbl_sku}: {$products[product].productcode}

{if $active_modules.Special_Offers ne "" and $products[product].have_offers}
{include file="modules/Special_Offers/customer/product_offer_thumb.tpl"
product=$products[product]} {else}{/if} {if $products[product].product_type
ne "C"} </TD>
<TD width="150">{if $active_modules.Subscriptions ne "" and ($products[product].catalogprice
gt 0 or $products[product].sub_priceplan gt 0)} {include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else} {if $products[product].taxed_price ne 0} {if $products[product].list_price
gt 0 and $products[product].taxed_price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].taxed_price
lprice=$products[product].list_price format="%3.0f" assign=discount}
{if $discount gt 0} <FONT class="MarketPrice">{$lng.lbl_market_price}:
<S> {include file="currency.tpl" value=$products[product].list_price}
</S></FONT>

{/if} {/if} <FONT class="ProductPrice">{include file="currency.tpl"
value=$products[product].taxed_price}</FONT><FONT class="MarketPrice">{include
file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</FONT>{if
$discount gt 0}{if $config.General.alter_currency_symbol ne
""}, {/if}{$lng.lbl_save_price} {$discount}%{/if} {if $products[product].taxes}

{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}{/if}
{else} <FONT class="ProductPrice">{$lng.lbl_enter_your_price}</FONT>
{/if} {/if} {if $active_modules.Feature_Comparison ne '' &&
$products[product].fclassid > 0}

{include file="modules/Feature_Comparison/compare_checkbox.tpl"
id=$products[product].productid} {/if}</TD>
<TD width="100">{if $usertype eq "C" and $config.Appearance.buynow_button_enabled
eq "Y"}
<form style="margin:0;" name="orderform_{$products[product].productid}_{$products[product].add_date}" method="post" action="cart.php?mode=add">
<input type="hidden" name="productid2" value="{$products[product].productid}">
<input type="hidden" name="cat2" value="{$smarty.get.cat|escape:"html"}">
<input type="hidden" name="page2" value="{$smarty.get.page|escape:"html"}">
<input type="hidden" name="amount2" value="1">
<input name="button" type="button" value="{$lng.lbl_add_to_cart}" onclick="document.orderform_{$products[product].productid}_{$products[product].add_date}.submit();">
</form>
{/if}</TD>
</TR>
</TABLE>

{/if} </TD>

{capture name=prod_index}
{math equation="index+x+1" index=%product.index% x=$config.Appearance.products_per_row}
{/capture}
{if $smarty.capture.prod_index is div by $config.Appearance.products_per_row }
</TR>
{/if}

{/section}

{if $cell_counter lt $config.Appearance.products_per_row}
{section name=rest_cells loop=$config.Appearance.products_per_row start=$cell_counter}
<TD class="DialogBox"></TD>
{/section}
</TR>
{/if}

</TABLE>
</TD></TR></TABLE>
{if $active_modules.Feature_Comparison ne '' && $products && $printable ne 'Y'}
{include file="modules/Feature_Comparison/compare_selected_button.tpl"}
{/if}
__________________
X-Cart version : 4.0.18
Mod : Customer Also Bought
Mod : Custom catergory Templates
Mod : Custon Product Templates
Reply With Quote
  #12  
Old 05-16-2006, 08:51 AM
 
Grant Grant is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 171
 

Default

Zaja,

The code you so generously supplied is working like a charm, again thank you so much. But I have a little problem with it that I can't figure out. I'm sure it's a simple one - well I hope it's a simple one

The 'add to cart' button displays in product listings even if the item is out of stock. Is there a simple fix for this?

Cheers,

G

Quote:
Originally Posted by Zaja
Grant, do you feel lucky today?

Replace products.tpl code with this:
Code:
{* $Id: products.tpl,v 1.45.2.17 2006/04/21 08:53:50 svowl Exp $ *} {if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")} {include file="customer/main/products_t.tpl" products=$products} {else} {if $products} {section name=product loop=$products} {assign var="discount" value=0} <table border="0" cellpadding="5" cellspacing="1" width="100%"> <tr style="background-color:{cycle values="#eee,#fff};"> <td style="width:300px;"> <font class="ProductTitle">{$products[product].product}</font> </td> <td> {if $products[product].product_type eq "C"} {include file="buttons/details.tpl" href="product.php?productid=`$products[product].productid`&cat=`$cat`&page=`$navigation_page`"} {else} {if $active_modules.Subscriptions ne "" and ($products[product].catalogprice gt 0 or $products[product].sub_priceplan gt 0)} {include file="modules/Subscriptions/subscription_info_inlist.tpl"} {else} {if $products[product].taxed_price ne 0} <font class="ProductPrice">{include file="currency.tpl" value=$products[product].taxed_price}</font> {/if} {/if} </td> <td style="text-align:right;width:110px;"> {if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"} <form style="margin:0;" name="orderform_{$products[product].productid}_{$products[product].add_date}" method="post" action="cart.php?mode=add"> <input type="hidden" name="productid" value="{$products[product].productid}"> <input type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}"> <input type="hidden" name="page" value="{$smarty.get.page|escape:"html"}"> <input type="hidden" name="amount" value="1"> <input type="button" value="{$lng.lbl_add_to_cart}" onclick="document.orderform_{$products[product].productid}_{$products[product].add_date}.submit();"> </form> {/if} </td> {/if} </tr> </table> {/section} {else} {$lng.txt_no_products_found} {/if} {/if}
__________________
X-Cart version : 4.0.18
Mod : Customer Also Bought
Mod : Custom catergory Templates
Mod : Custon Product Templates
Reply With Quote
  #13  
Old 05-16-2006, 09:26 AM
  Zaja's Avatar 
Zaja Zaja is offline
 

X-Adept
  
Join Date: Mar 2004
Location: The Universe is my home
Posts: 420
 

Default

Try to replace:
Code:
<input type="button" value="{$lng.lbl_add_to_cart}" onclick="document.orderform_{$products[product].productid}_{$products[product].add_date}.submit();">
with(not tested):
Code:
{if $product.avail gt 0} <input type="button" value="{$lng.lbl_add_to_cart}" onclick="document.orderform_{$products[product].productid}_{$products[product].add_date}.submit();"> {else} {$lng.txt_out_of_stock} {/if}
__________________
_/ _/ _/ _/ _/ _/ _/ _/ _/

7dana.com
Reply With Quote
  #14  
Old 05-16-2006, 09:41 AM
 
Grant Grant is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 171
 

Default

Quote:
Originally Posted by Zaja
Try to replace:
Code:
<input type="button" value="{$lng.lbl_add_to_cart}" onclick="document.orderform_{$products[product].productid}_{$products[product].add_date}.submit();">
with(not tested):
Code:
{if $config.General.unlimited_products ne "Y" and ($product.avail le 0 or $product.avail lt $product.min_amount)} {$lng.txt_out_of_stock} {else} <input type="button" value="{$lng.lbl_add_to_cart}" onclick="document.orderform_{$products[product].productid}_{$products[product].add_date}.submit();"> {/if}

Oooppps! Now everything is out of stock?
__________________
X-Cart version : 4.0.18
Mod : Customer Also Bought
Mod : Custom catergory Templates
Mod : Custon Product Templates
Reply With Quote
  #15  
Old 05-16-2006, 09:46 AM
  Zaja's Avatar 
Zaja Zaja is offline
 

X-Adept
  
Join Date: Mar 2004
Location: The Universe is my home
Posts: 420
 

Default

I have changed the code, try again please.
__________________
_/ _/ _/ _/ _/ _/ _/ _/ _/

7dana.com
Reply With Quote
  #16  
Old 05-16-2006, 09:56 AM
 
Grant Grant is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 171
 

Default

Nope still out of stock?

Just in case i'm being a spaz here is my products_t.tpl

Quote:
{* $Id: products_t.tpl,v 1.10.2.12 2006/02/27 08:53:50 svowl Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0"><TR><TD class="TableThumbnailBorder">

<TABLE border="0" width="100%" cellpadding="3" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<TR>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<TD align="center" valign="top" width="{$width}%" class="DialogBox">
<TABLE cellpadding="3" cellspacing="0" border="0" height="55">
<TR>
<TD height="50" width="60"> <A href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}">{i nclude
file="product_thumbnail.tpl" productid=$products[product].productid
image_x=$config.Appearance.thumbnail_width product=$products[product].product
tmbn_url=$products[product].tmbn_url}</A>
</TD>
<TD width="439">{$products[product].product}

{$lng.lbl_sku}: {$products[product].productcode}

{if $active_modules.Special_Offers ne "" and $products[product].have_offers}
{include file="modules/Special_Offers/customer/product_offer_thumb.tpl"
product=$products[product]} {else}{/if} {if $products[product].product_type
ne "C"} </TD>
<TD width="60"><div align="center">{if $active_modules.Subscriptions
ne "" and ($products[product].catalogprice gt 0 or $products[product].sub_priceplan
gt 0)} {include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else} {if $products[product].taxed_price ne 0} {if $products[product].list_price
gt 0 and $products[product].taxed_price lt $products[product].list_price}
{math equation="100-(price/lprice)*100" price=$products[product].taxed_price
lprice=$products[product].list_price format="%3.0f" assign=discount}
{if $discount gt 0} <FONT class="MarketPrice">{$lng.lbl_market_price}:
<S> {include file="currency.tpl" value=$products[product].list_price}
</S></FONT>

{/if} {/if} <FONT class="ProductPrice">{include file="currency.tpl"
value=$products[product].taxed_price}</FONT><FONT class="MarketPrice">

<font size="1" face="Geneva, Arial, Helvetica, sans-serif">{include
file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</font>
</FONT><font size="1" face="Geneva, Arial, Helvetica, sans-serif">{if
$discount gt 0}{if $config.General.alter_currency_symbol ne
""}, {/if}</font>
{$lng.lbl_save_price} {$discount}%{/if}
{/if} {/if} {if $active_modules.Feature_Comparison ne '' &&
$products[product].fclassid > 0}

{include file="modules/Feature_Comparison/compare_checkbox.tpl"
id=$products[product].productid} {/if}</div></TD>
<TD width="100">{if $usertype eq "C" and $config.Appearance.buynow_button_enabled
eq "Y"}
<form style="margin:0;" name="orderform_{$products[product].productid}_{$products[product].add_date}" method="post" action="cart.php?mode=add">
<input type="hidden" name="productid" value="{$products[product].productid}">
<input type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}">
<input type="hidden" name="page" value="{$smarty.get.page|escape:"html"}">
<input type="hidden" name="amount" value="1">
{if $product.avail gt 0}
<input type="button" value="{$lng.lbl_add_to_cart}" onclick="document.orderform_{$products[product].productid}_{$products[product].add_date}.submit();">
{else}
{$lng.txt_out_of_stock}
{/if}
</form>

{/if}</TD>
</TR>
</TABLE>{/if}</TD>
{capture name=prod_index}
{math equation="index+x+1" index=%product.index% x=$config.Appearance.products_per_row}
{/capture}
{if $smarty.capture.prod_index is div by $config.Appearance.products_per_row }
</TR>
{/if}
{/section}
{if $cell_counter lt $config.Appearance.products_per_row}
{section name=rest_cells loop=$config.Appearance.products_per_row start=$cell_counter}
<TD class="DialogBox" height="29"></TD>
{/section}
</TR>
{/if}
</TABLE>
</TD></TR></TABLE>
{if $active_modules.Feature_Comparison ne '' && $products && $printable ne 'Y'}
{include file="modules/Feature_Comparison/compare_selected_button.tpl"}
{/if}
__________________
X-Cart version : 4.0.18
Mod : Customer Also Bought
Mod : Custom catergory Templates
Mod : Custon Product Templates
Reply With Quote
  #17  
Old 05-16-2006, 10:03 AM
  Zaja's Avatar 
Zaja Zaja is offline
 

X-Adept
  
Join Date: Mar 2004
Location: The Universe is my home
Posts: 420
 

Default

fixed, replace(in products.tpl):
Code:
{if $product.avail gt 0}
with:
Code:
{if $products[product].avail gt 0}
__________________
_/ _/ _/ _/ _/ _/ _/ _/ _/

7dana.com
Reply With Quote
  #18  
Old 05-16-2006, 10:06 AM
 
Grant Grant is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 171
 

Default

You are officially THE man!

It be workin' harder than a $5 hooker...

Thanks so much bro
__________________
X-Cart version : 4.0.18
Mod : Customer Also Bought
Mod : Custom catergory Templates
Mod : Custon Product Templates
Reply With Quote
  #19  
Old 05-16-2006, 10:10 AM
  Zaja's Avatar 
Zaja Zaja is offline
 

X-Adept
  
Join Date: Mar 2004
Location: The Universe is my home
Posts: 420
 

Default

Quote:
Originally Posted by Grant
You are officially THE man!

It be workin' harder than a $5 hooker...

__________________
_/ _/ _/ _/ _/ _/ _/ _/ _/

7dana.com
Reply With Quote
  #20  
Old 05-16-2006, 10:12 AM
 
Grant Grant is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 171
 

Default

I don't wanna take the piss but would you also know the code for placing a form button that is linked to 'show product details'?

As i'm using custom templates I have different things set up all over the place. I'm having a problem as everything that is searched for displays using the same template containing the 'add to cart' button when some products require the customer to select options before hitting the buy button.

I just want to replace the 'add to cart' button with a 'show details' button for the cat listings pulled from a search.
__________________
X-Cart version : 4.0.18
Mod : Customer Also Bought
Mod : Custom catergory Templates
Mod : Custon Product Templates
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 08:22 AM.

   

 
X-Cart forums © 2001-2020