Forums / General Questions / Sold Out based on two quantity fields

Sold Out based on two quantity fields

Started by lanbo on 13 Feb 2012, 3:58 PM · Views: 1,418

Results 1 to 7 of 7
13 Feb 2012, 3:58 PM
#1
lanbo avatar

lanbo

New Zenner

Join Date:
Dec 2011
Posts:
48
Plugin Contributions:
0

Sold Out based on two quantity fields

Hello. It's me again.

I really like the way Zen Cart works with the "sold out" function. My problem is that I have two different stocking quantities, products_quantity and products_quantity2, each for different quantities available at a different location. Is there a way to have the "sold out" function/information show up based on checking to see if both of those quantities are 0?

Also, if possible, I would like to be able to mark the items like this:

If products_quantity > 0, no marking.
If products_quantity = 0 & products_quantity2 >0, mark it: WAREHOUSE ITEM.
If products_quantity = 0 & products_quantity2 =0, don't allow them to add it to the cart.

Thanks.

13 Feb 2012, 8:00 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sold Out based on two quantity fields

You could customize in the function_general.php the:
function zen_get_buy_now_button($product_id, $link, $additional_link = false) {

look through that code and look at all the return values and which relate to products_quantity ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

13 Feb 2012, 8:50 PM
#3
lanbo avatar

lanbo

New Zenner

Join Date:
Dec 2011
Posts:
48
Plugin Contributions:
0

Re: Sold Out based on two quantity fields

You and Zen Cart ROCK!!!

That is all.

13 Feb 2012, 11:20 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sold Out based on two quantity fields

Thanks for the update that you were able to solve this ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Feb 2012, 7:01 AM
#5
bn17311 avatar

bn17311

Zen Follower

Join Date:
Apr 2010
Posts:
319
Plugin Contributions:
0

Re: Sold Out based on two quantity fields

thanks ajeh
i was in a similar position and this worked, can you point me in right direction as to where the stock check is during checkout, as say i have no stock in zen quantity but have 1 item in my 2nd stock qty, i still want to limit the sale to 1 but at present it only checks zencart std stock qty

hope this makes sense

bryan

17 Feb 2012, 3:36 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Sold Out based on two quantity fields

You could look in the:
/includes/modules/pages/checkout_shipping/header_php.php

where the stock is validated and customize the code for your extra quantity field:

// Stock Check
  if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
    $products = $_SESSION['cart']->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
      if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
        zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
        break;
      }
    }
  }

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Feb 2012, 6:09 PM
#7
bn17311 avatar

bn17311

Zen Follower

Join Date:
Apr 2010
Posts:
319
Plugin Contributions:
0

Re: Sold Out based on two quantity fields

i ended up editing functions_lookup

in the Return a product's stock count section

does this sound ok, it seems to work and so far and i cant see it affecting anything else

bryan