sportstolen Posted September 16, 2011 Posted September 16, 2011 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.
Guest Posted September 16, 2011 Posted September 16, 2011 Johan, Take a look at QTPro, it has the abilities you are looking for. Chris
sportstolen Posted September 16, 2011 Author Posted September 16, 2011 Johan, Take a look at QTPro, it has the abilities you are looking for. Chris Thansk for answer, But isnt this only for attributes?
sportstolen Posted September 16, 2011 Author Posted September 16, 2011 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 ;)
sportstolen Posted September 17, 2011 Author Posted September 17, 2011 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
philsbpu Posted October 31, 2011 Posted October 31, 2011 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.
♥geoffreywalton Posted October 31, 2011 Posted October 31, 2011 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 ======>>>>>.
philsbpu Posted November 1, 2011 Posted November 1, 2011 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
philsbpu Posted November 2, 2011 Posted November 2, 2011 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.
philsbpu Posted November 13, 2011 Posted November 13, 2011 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.
doobey2doobey Posted February 20, 2012 Posted February 20, 2012 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.