Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2011
    Posts
    48
    Plugin Contributions
    0

    Default Check Stock From Two Quantities

    Okay guys, I've been trying to figure this one out and not having much luck so I think I'm overlooking something. A while back I setup my shop to check two quantities (products_quantity AND products_rsr) to determine whether or not to show the sold out image or to allow it to add to the cart. products_rsr is updated hourly from my distributor's inventory. A few months ago I zeroed out products_rsr and stopped updating it and changed the cart to not allow you to checkout unless I had enough inventory in stock. I was getting too many orders for items that I could not obtain because too many orders were coming in during that hour. And other times I would have none but my distributor would have 1 and people would order 5. I'd like to open up special orders again but to do so I would like to make it to where you can only order up to the total quantity available from both quantities (products_quantity AND products_rsr) and I'm having trouble figuring that out.

    I want to leave the cart like it is and not allow you to order more than available, but I want it to basically check both of those values and add them together to allow that quantity. I still want it to deduct the quantity from products_quantity just like it does now (even if it goes below zero to a negative number). This way if my distributor has 10 and someone orders 10 it will make my inventory -10 which should cancel out the distributor until their inventory updates the next hour. Then I can manually update my inventory when I place the order with the distributor. I feel this will be the best way to avoid not being able to fill orders. I realize there will still be times when it happens, but I don't see a foolproof way around it.

    Any help would be greatly appreciated.

    Also, I have it now where it flags "out of stock" items as ***Special Order***. If possible, I would still like it to do that if they are ordering more than the quantity in products_quantity. That's not a deal breaker though.

  2. #2
    Join Date
    Dec 2011
    Posts
    48
    Plugin Contributions
    0

    Default Re: Check Stock From Two Quantities

    UPDATE: I managed to figure this all out myself, but went about it a different way than originally intended. I basically setup a new field in zen_products called `available_for_order`. Then I added functions to the functions_lookups.php file that are identical to zen_check_stock and zen_get_products_stock called zen_check_stock_total and zen_get_products_stock_total that check the `available_for_order` field to get the necessary number. It also runs a query each time the function is called to add the two fields together to get the correct number for the `available_for_order` field. This allows me to use those new functions to allow an order to be processed or not (by using them on the checkout pages to determine if it needs to redirect back to the cart or not). Then I can still use the original functions to decide which message (OUT_OF_STOCK_CANT_CHECKOUT or OUT_OF_STOCK_CAN_CHECKOUT) to display during checkout for items not in stock at my store. I also added an additional if statement in the shopping cart template file to make sure it picks the correct message based on whether you're ordering special order items or whether you're ordering more than available. So far it works perfectly. If anyone needs any help with something similar, let me know and I'll do my best to help.

 

 

Similar Threads

  1. v151 Three products, two related quantities
    By giftmeister in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 21 Oct 2013, 02:05 PM
  2. How can I dispaly stock quantities only if quantity in stock is greater than zero?
    By Liamv in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 22 Feb 2013, 12:39 AM
  3. v139h in-stock quantities
    By lisat in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 16 Apr 2012, 03:18 PM
  4. Remove Stock Quantities from Products
    By mtrantas in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 5 Feb 2008, 01:29 PM
  5. Configuring two sites to keep product quantities up to date
    By SteveCollins in forum General Questions
    Replies: 1
    Last Post: 18 Jul 2007, 08:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR