Starting with that function as a potential starting-point, one could possibly use something like this as an additional function (method) added to that class:
Code:
function in_cart_check_value_for_manufacturer($mfg_id = 0, $check_threshold=0) {
global $db;
// if nothing is in cart return 0
if (!is_array($this->contents)) return 0;
// if no mfg, abort
if ($mfg_id == 0) return 0;
// compute total for field
$in_cart_check_value=0;
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$testing_id = zen_get_prid($products_id);
$result = $db->Execute("select * from " . TABLE_PRODUCTS . " where products_id='" . $testing_id . "' and manufacturers_id = '" . (int)$mfg_id . "' limit 1");
$in_cart_check_value += number_format($this->contents[$products_id]['qty'] * $result->fields['products_price'], 2);
}
return $in_cart_check_value;
}
This calculates based on the product's primary price, agnostic of any discounts such as sales or specials, and ignores the addition of any taxes (or if tax-included pricing is turned on, it will of course include taxes because tax is included in prices in that case).
Bookmarks