Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Stock


Rogaondeweb

Recommended Posts

Posted

Hi to everyone,

 

i would like to make orders over the stock impossible and to hide items when they are over.

Is it possible?

 

Thanks in advance

 

Fulvio

Posted

Hi

 

Yes you edit your prefs. in Admin> Configuration >Stock

Posted
Hi

 

Yes you edit your prefs. in Admin> Configuration >Stock

 

Thanks...but i tried and all i could do is that the customer can see "***" (or what i want) when items are out of stock.

I would want that he could not order (not only checkout) when there is not stock: e.g when stock is 2 order could be maximum 2.

I would want that if stock is 0 the item would not be in the catalog (or be widt "Sold Out" and without possibility to order.

 

Thanks

 

Fulvio

Posted
Thanks...but i tried and all i could do is that the customer can see "***" (or what i want) when items are out of stock.

I would want that he could not order (not only checkout) when there is not stock: e.g when stock is 2 order could be maximum 2.

I would want that if stock is 0 the item would not be in the catalog (or be widt "Sold Out" and without possibility to order.

 

Thanks

 

Fulvio

 

I did it on myself changing the code.

If this could be useful i changed:

 

1) index.php

 

In all the lines with a SELECT on TABLE_PRODUCTS i changed the WHERE clause from "where p.products_status = '1'....." to "where p.products_quantity>0 and p.products_status = '1' ..."

 

I changed the line

 

$categories_products_query = tep_db_query("select count(*) as total from .....

 

into

 

$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " c left join " . TABLE_PRODUCTS . " p on p.products_id = c.products_id " . " where p.products_quantity>0 and categories_id = '" . (int)$current_category_id . "'");

 

2) functions/general.php i changed the function tep_count_products_in_category adding to the WHERE CLAUSE of the 2 $products_query into

where p.products_quantity>0 and p.products_id....

 

Hope this helps to someone.

 

I am working now on the code to let people order only quantities not over the stock. Then I will post a contribution.

 

Fulvio

Posted

In admin configuration stock set

check stock level true

subtract stock true

allow checkout false

 

When sutracting the stock level gets to zero, the product status should be marked out of stock or 1 like it is your above query.

where p.products_status = '1'

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...