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.
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 ...
Re: Sold Out based on two quantity fields
You and Zen Cart ROCK!!!
That is all.
Re: Sold Out based on two quantity fields
Thanks for the update that you were able to solve this ... :smile:
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
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:
Code:
// 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;
}
}
}
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