Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can i turn off stock control for some products?


sportstolen

Recommended Posts

Hi.

 

As we have our own stock i want to keep track of this so we could do a proper inventory and set a value on our stock for our accounting.

 

What i want to do:

 

In admin on editing or adding a new product, is to mark the item that it will be availible to buy even if the quantity is 0, (This is done)

 

In shopping cart i realize there must be an if statement to check if the product has this mark in the database. How? Should i edit the stock_check in functions or in shopping_cart, shipping and payment files?

 

 

 

Its pretty important for us that our customer can not order things with quantity 0 if we have not marked them with it in admin.

 

 

I really appreciate som advices.

Link to comment
Share on other sites

I dont use attributes for the moment in our store.

 

What i mean is that if a buy 10pcs from my supplier i want to add - qty:10 in admin when i add the product, but i want to be able to check a checkbox that will disable the stock check for this product if the qty has become 0, becaus on this certain product i can order the product back in just a few days, but for my other stock that i am importing myself i dont want this to happen..

 

its always hard to explain on other language ;)

Link to comment
Share on other sites

Well.

 

It seems like a managed to get this done, i havent tested so much but i will..

 

Here is how my stock check looks like in checkout_process.php

 

// Stock Check
 $any_out_of_stock = false;

 if (STOCK_CHECK == 'true') {
   for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
$stock_query = tep_db_query("select products_quantity, products_stock_update, products_buy_if_zero from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");


    $stock_values = tep_db_fetch_array($stock_query);
$products_buy = $stock_values['products_buy_if_zero'];



 if ($products_buy ==0)
 {
  if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
    $any_out_of_stock = true;
  }
   }
   // Out of Stock
   if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
  tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
   }
 }
}

 

Thanks

Link to comment
Share on other sites

  • 1 month later...

Hi This is exactly what I want to do.

 

Some products will always be stocked, but others need to disappear from listing, if stock qty hits 0.

 

But how did you mark the product in the first instance? Did you create a new custom attribute? Always In Stock. Then only enable it on specific products?

 

I am new to osCommerce and findiing my way around, so any additional information would be useful.

Link to comment
Share on other sites

I would add an extra field to the product and add maintenace to /admin/categories.php.

 

Then wherever active ind is checked also check that the stock is > 0 and must be in stock is set or always in stock is set before displaying product info.

 

HTH

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Tried it today, I created a new field stocked_item and added to db, tested and it stores correctly, but the scripting did not seem to work. Which variable did you use for this so I can see which one to replace in the script?

 

Many thanks

Link to comment
Share on other sites

Have found the place where stock check is performed for cart, shopping_cart.tpl.php I am trying out adjusted php code, similar to yours above, bit different though, as I need to use the newly created field stocked_item and allow order to to be processed if stocked_item = 1 even if product quantity = 0 I am pretty new here so any thoughts from anyone on how to implement would be appreciated. I have created a test stand alone version of the site, so I don't take down our main ecomm web site, testing code.

 

Any thoughs anyone has would be gratefully received.

Link to comment
Share on other sites

  • 2 weeks later...

Right I got it sorted, all running now. With a few adjustments of my /includes/functions/general.php so that now products_stocked overrides stock outage and always has stock, in additional update I have got the items that do go out of stock to go to discontinued so they remain viewable from search though cannot be purchased. had to do this for seo reasons.

 

I can post my changes if anyone is interested, though I do not know at this time, if this conform with programming standards. I have highly modded osCommerce to deal with, so I will be testing everything fully for a few days prior to implementing on the site but it works, re-using existing functions, with minor changes to code.

Link to comment
Share on other sites

  • 3 months later...

Right I got it sorted, all running now. With a few adjustments of my /includes/functions/general.php so that now products_stocked overrides stock outage and always has stock, in additional update I have got the items that do go out of stock to go to discontinued so they remain viewable from search though cannot be purchased. had to do this for seo reasons.

 

I can post my changes if anyone is interested, though I do not know at this time, if this conform with programming standards. I have highly modded osCommerce to deal with, so I will be testing everything fully for a few days prior to implementing on the site but it works, re-using existing functions, with minor changes to code.

I am looking for similar functionality. Could you please let us know the changes you made? Thanks.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...