Guest Posted October 17, 2003 Share Posted October 17, 2003 Hi, I am using the Quantity Price Breaks Module (Version 1.1) but am having 1 issue with it. Basically, the quantity breaks work excellent and I have modified it to work with multiple tiers (wholesale, retail, etc.). Everything works fine except the quantity blocks are not being enforced. Here is the code where I think the issue is: In PriceFormatter.php, this code works correctly and returns the proper "adjusted" quantity according to the breaks: function adjustQty($qty) { // Force QTY_BLOCKS granularity $qb = $this->getQtyBlocks(); if ($qty < 1) $qty = 1; if ($qb >= 1) { if ($qty < $qb) $qty = $qb; if (($qty % $qb) != 0) $qty += ($qb - ($qty % $qb)); } return $qty; } However, when it is called by the shopping_cart.php class it does not work and returns nothing: function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) { global $new_products_id_in_cart, $customer_id, $customer_status_for_discount; $pf = new PriceFormatter; $pf->loadProduct($products_id, $language_id, $customer_status_for_discount); // problem is here!! $qty = $pf->adjustQty($qty); // ?? $products_id = tep_get_uprid($products_id, $attributes); if ($notify == true) { $new_products_id_in_cart = $products_id; tep_session_register('new_products_id_in_cart'); } if ($this->in_cart($products_id)) { $this->update_quantity($products_id, $qty, $attributes); } else { if ($qty == '') $qty = '1'; // if no quantity is supplied, then add '1' to the customers basket When I echo out the $qty in the last bit of code, it gives me whatever was in the quantity box of the shopping cart form, not the updated qty from the adjustQty function. Any ideas? Thanks! Zac Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.