![]() |
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}&cat={$cat}&page={$navigation_p age}{if $featured eq 'Y'}&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 |
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 |
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}&cat={$cat}&page={$navigation_p age}{if $featured eq 'Y'}&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}&cat={$cat}&page={$navigation_p age}{if $featured eq 'Y'}&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}&cat={$cat}&page={$navigation_p age}{if $featured eq 'Y'}&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. |
Re: Adding text to products.tpl
not sure right off hand. I'll have to try and figure this one out.
|
Re: Adding text to products.tpl
Thanks!
|
Re: Adding text to products.tpl
Hi Ashley,
I'm still struggling with this one. Can I pm you? Thanks |
Re: Adding text to products.tpl
Quote:
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 |
Re: Adding text to products.tpl
that the problem. home.php is not getting the value but product.php is.
|
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} |
Re: Adding text to products.tpl
how would I get that to be available to the product.tpl?
|
Re: Adding text to products.tpl
that would be the out of stock items.
|
Re: Adding text to products.tpl
In product page:
Try this: {if $product.avail eq "0" or if $product.avail lt "0" } Enter your text here.. {/if} |
Re: Adding text to products.tpl
that didn't work. There has to be a way to get the pre-order value because product.tpl is getting it just fine but products.tpl isn't.
|
Re: Adding text to products.tpl
Hi,once you said i have tested it in both products.tpl and product_t.tpl.
It is coming up. So try it again.Even you can see the $products[product].avail in theabove mentioned file by default because xcart have already used that value to check some other condition. Quote:
|
Re: Adding text to products.tpl
Aren't you kind of beating yourself up on this? What it seems you are trying to do is sell a product that is out of stock (pre-order IS out of stock). Wouldn't the easy solution be to add the number you have on order for the pre-ordered items and sell them normally as you would a "backordered" item?
|
All times are GMT -8. The time now is 11:25 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.