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)
-   -   Adding text to products.tpl (https://forum.x-cart.com/showthread.php?t=44615)

joannet 01-05-2009 06:54 PM

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

ARW VISIONS 01-05-2009 10:10 PM

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

joannet 01-06-2009 02:52 PM

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.

ARW VISIONS 01-06-2009 03:04 PM

Re: Adding text to products.tpl
 
not sure right off hand. I'll have to try and figure this one out.

joannet 01-06-2009 03:35 PM

Re: Adding text to products.tpl
 
Thanks!

joannet 01-07-2009 01:18 PM

Re: Adding text to products.tpl
 
Hi Ashley,

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

Thanks

Vetrivel 01-07-2009 10:49 PM

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

ARW VISIONS 01-07-2009 10:52 PM

Re: Adding text to products.tpl
 
that the problem. home.php is not getting the value but product.php is.

Vetrivel 01-07-2009 11:04 PM

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}

ARW VISIONS 01-07-2009 11:04 PM

Re: Adding text to products.tpl
 
how would I get that to be available to the product.tpl?


All times are GMT -8. The time now is 04:33 AM.

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