public static function getTaxRate(&$product, &$config) { $prices = $product->prices; $taxes = array('DBTax', 'Tax', 'VatTax', 'DATax'); $taxes = array('DBTax', 'Tax', 'VatTax', 'DATax'); foreach ($prices as $key => $val) { if (!empty($val)) { if (is_array($val)) { foreach ($val as $atax) { if (in_array($key, $taxes)) { if ($atax[2] == '+%') { return (double) $atax[1]; } } } } } } $billtax = OPCXmlExport::getBillTaxes(); foreach ($billtax as $tax) { $match0 = $match1 = $match2 = false; if (!empty($tax['categories'])) { $cats = explode(',', $tax['categories']); if (!empty($cats)) { foreach ($product->categories as $cat_id) { if (in_array($cat_id, $cats)) { $match0 = (double) $tax['calc_value']; } } } else { $match0 = (double) $tax['calc_value']; } } else { $match0 = (double) $tax['calc_value']; } if (!empty($tax['manufacturers'])) { $msfs = explode(',', $tax['manufacturers']); if (!empty($msfs)) { if (in_array($product->virtuemart_manufacturer_id, $msfs)) { $match1 = (double) $tax['calc_value']; } } else { $match1 = (double) $tax['calc_value']; } } else { $match1 = (double) $tax['calc_value']; } if (!empty($tax['shoppergroups'])) { $sgs = explode(',', $tax['shoppergroups']); if (!empty($sgs)) { if (in_array($config->shopper_group, $sgs)) { $match2 = (double) $tax['calc_value']; } } else { $match2 = (double) $tax['calc_value']; } } else { $match2 = (double) $tax['calc_value']; } if (!empty($match1)) { if (!empty($match2)) { if (!empty($match0)) { return $match1; } } } } return (double) 0; }