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

Adding text to products.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-05-2009, 06:54 PM
 
joannet joannet is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 105
 

Default Adding text to products.tpl

Hi,

I would like to add text and appropriate links to the summary product template - customer/main/products.tpl

Currently, the following is on this template, which states that a product is in stock and links to the product page:

{if $config.General.unlimited_products eq "Y" or ($products[product].avail gt 0 and $products[product].avail ge $products[product].min_amount)}<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}" class="pl2_is"><b><u>IN-STOCK:</u></b> Ships immediately</a>{/if}<br />

I would also like to add similar linked text for out of stock and on pre-ordered items.

These are already on the individual product page - customer/main/product.tpl as follows:

{if $product.preorder eq "Y"}<font style="font-size: 14px; color: #004488"><u>PRE-ORDER</u>: </font><font style="font-size: 12px;">Release Date: {$product.dvd_release_date|date_format:"%e %b %Y"}</font>{elseif $product.avail gt 0}<font style="font-size: 14px; color: #C21C20"><u>IN-STOCK</u>: </font><font style="font-size: 12px;">Ships immediately</font>{else}<font style="font-size: 14px; color: #008000"><u>OUT OF STOCK</u>: </font><font style="font-size: 12px;">Normally ships within 14 days</font>{/if}<br />
{if $product.preorder eq "Y"}{elseif $product.avail gt 0}<font style="font-size: 9px;">Guaranteed to Ship next Business Day.</font>{else} {/if}<br />

Can anyone advice on how to do this please?

Thanks
__________________
/joannet/
X-Cart version 4.1.9 and above
Reply With Quote
  #2  
Old 01-05-2009, 10:10 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Adding text to products.tpl

I think you could use the same code just change it a bit.

place the entire code block it in products.tpl where ever you want it and where you see $product replace it with $products[product]

haven't tested this tho
__________________
xcart 5.1.2
Reply With Quote
  #3  
Old 01-06-2009, 02:52 PM
 
joannet joannet is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 105
 

Default Re: Adding text to products.tpl

Thanks for the advice Ashley.

For in stock and out of stock items, it works perfectly. However, the preorder items are displaying as out of stock.

This is the code I used:

{if $products[product].preorder eq "Y"}<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}" class="pl2_is"><b><u>PRE-ORDER</u>:</b> Release Date: {$products[product].dvd_release_date|date_format:"%e %b %Y"}</a>{elseif $products[product].avail gt 0}<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}" class="pl2_is"><b><u>IN-STOCK</u>:</b> Ships immediately</a>{elseif $products[product].preorder ne "Y" || $products[product].avail eq "0"}<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}" class="pl2_is"><b><u>OUT OF STOCK</u>:</b> Normally ships within 14 days</a>{/if}<br />


Can you please offer any further suggestions so that preorder items display as such, rather than as out of stock?

The preorder items have a zero stock level.

Thanks very much.
__________________
/joannet/
X-Cart version 4.1.9 and above
Reply With Quote
  #4  
Old 01-06-2009, 03:04 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Adding text to products.tpl

not sure right off hand. I'll have to try and figure this one out.
__________________
xcart 5.1.2
Reply With Quote
  #5  
Old 01-06-2009, 03:35 PM
 
joannet joannet is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 105
 

Default Re: Adding text to products.tpl

Thanks!
__________________
/joannet/
X-Cart version 4.1.9 and above
Reply With Quote
  #6  
Old 01-07-2009, 01:18 PM
 
joannet joannet is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 105
 

Default Re: Adding text to products.tpl

Hi Ashley,

I'm still struggling with this one. Can I pm you?

Thanks
__________________
/joannet/
X-Cart version 4.1.9 and above
Reply With Quote
  #7  
Old 01-07-2009, 10:49 PM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Arrow Re: Adding text to products.tpl

Quote:
Originally Posted by joannet

{if $products[product].preorder eq "Y"}<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}" class="pl2_is"><b><u>PRE-ORDER</u>:</b> Release Date: {$products[product].dvd_release_date|date_format:"%e %b %Y"}</a>{elseif $products[product].avail gt 0}<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}" class="pl2_is"><b><u>IN-STOCK</u>:</b> Ships immediately</a>{elseif $products[product].preorder ne "Y" || $products[product].avail eq "0"}<a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}" class="pl2_is"><b><u>OUT OF STOCK</u>:</b> Normally ships within 14 days</a>{/if}<br />




looks like you have custom coded for perorder.Are you sure you are getting value for $products[product].preorder as Y or N.Jus check this the conditions seems to be fine
Reply With Quote
  #8  
Old 01-07-2009, 10:52 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Adding text to products.tpl

that the problem. home.php is not getting the value but product.php is.
__________________
xcart 5.1.2
Reply With Quote
  #9  
Old 01-07-2009, 11:04 PM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Default Re: Adding text to products.tpl

You mentioned that stock level for the preodered product is zero.
Then why dont you try this:
{if $products[product].avail eq "0" or if $products[product].avail lt "0" }
Enter your text here..
{/if}
Reply With Quote
  #10  
Old 01-07-2009, 11:04 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Adding text to products.tpl

how would I get that to be available to the product.tpl?
__________________
xcart 5.1.2
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 02:24 PM.

   

 
X-Cart forums © 2001-2020