boxtel Posted December 23, 2004 Posted December 23, 2004 this is the function in your shopping_cart.php class to update the quantity: function update_quantity($products_id, $quantity = '', $attributes = '') { global $customer_id; if (empty($quantity)) return true; // nothing needs to be updated if theres no quantity, so we return true.. if ($quantity < (tep_get_products_stock($products_id)+1)) { $this->contents[$products_id] = array('qty' => $quantity); // update database if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $this->contents[$products_id]['attributes'][$option] = $value; // update database if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and products_options_id = '" . (int)$option . "'"); } } } } as you can see, I have added the condition : if ($quantity < (tep_get_products_stock($products_id)+1)) { that means that I will not add more than I have in stock. you can also say : if ($quantity <= 999) { if there is no limit to the quantity, you can order 99999999999999999999999 items while the price reverts back to the price of 1 item. And you can even checkout with that amount and price. Treasurer MFC
TCwho Posted January 3, 2005 Posted January 3, 2005 This is great modification. I thought about that problem a few weeks ago..... all this modifying is making me kinda worry about upgrading to milestone3..... >_< Drop_Shadow How Did You Hear About Us Email HTML Order Link ---- GMT -5:00
Recommended Posts
Archived
This topic is now archived and is closed to further replies.