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

Stock level in Colors?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-03-2007, 05:07 AM
 
futurac futurac is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 209
 

Default 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.
__________________
X-Cart version 4.6 with reboot
Many mods...
Reply With Quote
  #2  
Old 06-03-2007, 05:18 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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}
__________________
xcartmods.co.uk
Reply With Quote
  #3  
Old 06-03-2007, 10:29 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Stock level in Colors?

Please don't post questions in the Completed Custom Mods forum. Moving to Template Editing.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #4  
Old 07-29-2007, 02:30 PM
 
donmck donmck is offline
 

Senior Member
  
Join Date: Dec 2005
Location: Australia
Posts: 137
 

Default 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...
__________________
Don McKenzie

http://www.dontronics-shop.com/
X-Cart 4.0.17 [Unix]

█ Hosting by www.totalserversolutions.com The very best home for your X-Cart. (was ewdhosting.com)
Reply With Quote
  #5  
Old 08-01-2007, 05:37 PM
 
donmck donmck is offline
 

Senior Member
  
Join Date: Dec 2005
Location: Australia
Posts: 137
 

Default 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...
__________________
Don McKenzie

http://www.dontronics-shop.com/
X-Cart 4.0.17 [Unix]

█ Hosting by www.totalserversolutions.com The very best home for your X-Cart. (was ewdhosting.com)
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 03:29 PM.

   

 
X-Cart forums © 2001-2020