--- ps_product.php 2009-04-01 21:28:11.000000000 +0100 +++ ps_product.php.new 2009-04-29 21:53:53.000000000 +0100 @@ -1608,6 +1608,18 @@ // Get the product_parent_id for this product/item $product_parent_id = $this->get_field($product_id, "product_parent_id"); + // LW PATCH - Get the category of this product - used later to drive category-based multiple purchases + $sesq = "SELECT category_id FROM #__{vm}_product_category_xref WHERE product_id='$product_id'"; + $db->setQuery($sesq); $db->query(); + $db->next_record(); + $sesprodcat = $db->f("category_id"); + if ($sesprodcat == 28) { + $ses_cat_discount = TRUE; + } else { + $ses_cat_discount = FALSE; + } + // END LW PATCH + if( !$check_multiple_prices ) { /* Added for Volume based prices */ // This is an important decision: we add up all product quantities with the same product_id, @@ -1622,6 +1634,18 @@ $parent = false; } for ($i=0;$i<$cart["idx"];$i++) { + // LW PATCH - If any product in the cart is in the same category then treat as volume purchase + if ($ses_cat_discount) { + $sesq = "SELECT category_id FROM #__{vm}_product_category_xref WHERE product_id='".$cart[$i]["product_id"]."'"; + $db->setQuery($sesq); $db->query(); + $db->next_record(); + $sesprodchildcat = $db->f("category_id"); + if ($sesprodchildcat == $sesprodcat) { + $quantity += $cart[$i]["quantity"]; + } + + } else { + if ($cart[$i]["product_id"] == $product_id) { if ($parent) { $parent_id = $cart[$i]["parent_id"]; @@ -1631,6 +1655,8 @@ } } } + } + // END LW PATCH if ($parent) { for ($i=0;$i<$cart["idx"];$i++) { if (@$cart[$i]['parent_id'] == $parent_id) {