Hi
I have come up against a problem with changing the way stock levels are shown on my site.
I implemented the solution on page 13 of the Advanced users guide 6 months ago, but now wish to change it, so it shows actuall stock only if it is 1 or more.
To show you what I mean my first thought was that I could just show pItem like so
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function StockLevels(pItem)
<!--
{
var strIDs = 'Stock Message: '
{
if (pItem <= -1)
{
strIDs = ''
}
if (pItem == 0)
{
strIDs = 'Out of Stock.'
}
if (pItem >= 1)
{
strIDs = pItem ' in stock'
}
}
return strIDs
}
I was thinking if pItem is a number because it is tested in the if statement is would just be shown. That doesn't work.
If I place an additional NETQUOTEVAR:Stocklevels in Act_Productline as such:
NETQUOTEVAR:TEMPLATEENDXML<br>NETQUOTEVAR:STOCKLEVEL<script language="Javascript"> document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL))</script>
</td>
This works for product in stock, but I don't want the stock figure to be shown if 0 or less.
Any ideas?
Regards
Martin
I have come up against a problem with changing the way stock levels are shown on my site.
I implemented the solution on page 13 of the Advanced users guide 6 months ago, but now wish to change it, so it shows actuall stock only if it is 1 or more.
To show you what I mean my first thought was that I could just show pItem like so
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function StockLevels(pItem)
<!--
{
var strIDs = 'Stock Message: '
{
if (pItem <= -1)
{
strIDs = ''
}
if (pItem == 0)
{
strIDs = 'Out of Stock.'
}
if (pItem >= 1)
{
strIDs = pItem ' in stock'
}
}
return strIDs
}
I was thinking if pItem is a number because it is tested in the if statement is would just be shown. That doesn't work.
If I place an additional NETQUOTEVAR:Stocklevels in Act_Productline as such:
NETQUOTEVAR:TEMPLATEENDXML<br>NETQUOTEVAR:STOCKLEVEL<script language="Javascript"> document.write(StockLevels(NETQUOTEVAR:STOCKLEVEL))</script>
</td>
This works for product in stock, but I don't want the stock figure to be shown if 0 or less.
Any ideas?
Regards
Martin
Comment