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)
-   -   Stock level in Colors? (https://forum.x-cart.com/showthread.php?t=31613)

futurac 06-03-2007 05:07 AM

Stock level in Colors?
 
Is there a mod shows Stock level in Colors?
Ex: 0 - Red, 1-10 Yellow, 10+ Green

Looking for such mod.

PhilJ 06-03-2007 05:18 AM

Re: Stock level in Colors?
 
skin1/customer/main/product.tpl
Code:

{if $product.avail eq 0}
 <img src="red.jpg" align="absmiddle" alt="Out of Stock">
{elseif $product.avail gt 1 and $product.avail lt 10}
 <img src="yellow.jpg" align="absmiddle" alt="Low Stock">
{elseif $product.avail gt 10}
 <img src="green.jpg" align="absmiddle" alt="In Stock">
{/if}

skin1/customer/main/products.tpl OR skin1/customer/main/products_t.tpl
Code:

{if $products[product].avail eq 0}
 <img src="red.jpg" align="absmiddle" alt="Out of Stock">
{elseif $products[product].avail gt 1 and $products[product].avail lt 10}
 <img src="yellow.jpg" align="absmiddle" alt="Low Stock">
{elseif $products[product].avail gt 10}
 <img src="green.jpg" align="absmiddle" alt="In Stock">
{/if}


balinor 06-03-2007 10:29 AM

Re: Stock level in Colors?
 
Please don't post questions in the Completed Custom Mods forum. Moving to Template Editing.

donmck 07-29-2007 02:30 PM

Re: Stock level in Colors?
 
two possible code variants, and 2 possible file locations are given for this mod, and no indication is given, as to where in the file(s) to place the code.

It is a mod I would really like to have running. Have tried many variants, but unable to get it working to date.

Is there any more information available?

Thanks in advance,

Don...

donmck 08-01-2007 05:37 PM

Re: Stock level in Colors?
 
Quote:

Originally Posted by donmck
two possible code variants, and 2 possible file locations are given for this mod, and no indication is given, as to where in the file(s) to place the code.

It is a mod I would really like to have running. Have tried many variants, but unable to get it working to date.

Is there any more information available?

Thanks in advance,

Don...


Answering my own questions here.

Thanks, after a little perseverance, I got this to work fine. Below is a summary of what I needed to do:

skin1/customer/main/products_t.tpl (Main Index)
skin1/customer/main/buy_now.tpl (Category Listing)
skin1/customer/main/product.tpl (Individual Product)


skin1/customer/main/products_t.tpl Code: (Main Index)
========================================
{if $products[product].avail eq 0}
Out of Stock <img src="http://www.dontronics-shop.com/red.gif" align="absmiddle" alt="Out of Stock">
{elseif $products[product].avail gt 0 and $products[product].avail lt 10}
Low Stock <img src="http://www.dontronics-shop.com/yellow.gif" align="absmiddle" alt="Low Stock">
{elseif $products[product].avail gt 9}
In Stock<img src="http://www.dontronics-shop.com/green.gif" align="absmiddle" alt="In Stock">
{/if}

skin1/customer/main/buy_now.tpl Code: (Category Listing)
=====================================
{if $product.avail eq 0}
Out of Stock <img src="http://www.dontronics-shop.com/red.gif" align="absmiddle" alt="Out of Stock">
{elseif $product.avail gt 0 and $product.avail lt 10}
Low Stock <img src="http://www.dontronics-shop.com/yellow.gif" align="absmiddle" alt="Low Stock">
{elseif $product.avail gt 9}
In Stock<img src="http://www.dontronics-shop.com/green.gif" align="absmiddle" alt="In Stock">
{/if}

skin1/customer/main/product.tpl Code: (Individual Product)
=====================================
{if $product.avail eq 0}
Out of Stock <img src="http://www.dontronics-shop.com/red.gif" align="absmiddle" alt="Out of Stock">
{elseif $product.avail gt 0 and $product.avail lt 10}
Low Stock <img src="http://www.dontronics-shop.com/yellow.gif" align="absmiddle" alt="Low Stock">
{elseif $product.avail gt 9}
In Stock<img src="http://www.dontronics-shop.com/green.gif" align="absmiddle" alt="In Stock">
{/if}
======================================

I simply added the code in line, at the point I wanted the stock levels to appear. This wasn't difficult.

Original code masked a stock of 10, I had to change it a little.

Don...


All times are GMT -8. The time now is 04:02 PM.

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