Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Burt - Stock Query Indicator. Help Please.


CC

Recommended Posts

Hopefully this will have got Burts attention.

But if not I am sure many of yo0u out there can help me see what I am doing wrong here...

 

I have added this code to my site to give an indication of stock levels for each product.

 

<?php

switch ($prod_quantity) {

case 0:

print "Out of Stock";

break;

case 1:

print "We have 1 in stock";

break;

case 2:

print "We have 2 in stock";

break;

case 3:

print "We have 3 in stock";

break;

case 4:

print "We have 4 in stock";

break;

default:

print "We have 5+ in stock";

}

?>

 

Now, this works as far as the Out of Stock feature.

But when I have got stock of a product. i.e. I have 20 cable, it does not show 5+. It just stays on Out Of Stock.

It is as tho the code cant see the database and recognise that more than '0' is in stock.

 

Please help me if you can on this.

Especially Burt, cos he got me rolling on this to begin with.

 

Once it is complete I will badge it up as a Contribution and post it.

 

Thanks in advance.

 

CC.

Link to comment
Share on other sites

What page are you on for that peice of code?

 

It's valid if there is an array with that value in it for the products_id but if that is just stuck where ever ... then it is sending the wrong products_id to the function.

Link to comment
Share on other sites

Oh ok, I follow you a bit better now. I think... :lol:

 

This is currently posted into the products_info page.

I am just integrating it here first, then looking elsewhere to put it.

 

If you have a possible solution I am more than willing to give it a go.

 

Could you explain more what I would have to do, depending on where I put the code, to make it work on other pages please...?

 

Cheers

 

CC.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...