function getCachedShipping(&$cart, &$prices, $shipping_id, &$calc, $data = array()) { if (!isset(OPCloader::$totalIsZero)) { OPCloader::$totalIsZero = true; } // cache dimensions: // this is a product hash (quantity, attributes, weight, etc..) include JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'config' . DS . 'onepage.cfg.php'; self::$count++; $savedcoupon = $cart->couponCode; $data[] = $shipping_id; if (!empty($opc_calc_cache)) { $hash = OPCcache::getGeneralCacheHash('calc', $cart, $data); } $saved_id = $cart->virtuemart_shipmentmethod_id; //opc_request_cache if (class_exists('calculationHelperOPC')) { calculationHelperOPC::$_forhash = $hash; } // overrided class with the above hash knows if to re-fetch the shipping if (!empty($opc_request_cache)) { OPCcache::$cachedResult['currentshipping'] = $shipping_id; if (!empty(OPCcache::$cachedResult['shippingcache'][$shipping_id])) { $cart->virtuemart_shipmentmethod_id = (int) $cart->virtuemart_shipmentmethod_id; $cart->virtuemart_shipmentmethod_id = abs($cart->virtuemart_shipmentmethod_id) * -1; } } $vm2015 = false; if (method_exists($calc, 'getCheckoutPricesOPC')) { $prices = $calc->getCheckoutPricesOPC($cart, false); if (method_exists($calculator, 'getCartData')) { $cart->OPCCartData = $calc->getCartData(); } } else { $prices = OPCloader::getCheckoutPrices($cart, false, $vm2015, 'opc'); } if (!empty($prices['billTotal'])) { // special case for zero value orders, do not charge payment fee: if ($prices['billTotal'] == $prices['paymentValue']) { $savedp = $cart->virtuemart_paymentmethod_id; $cart->virtuemart_paymentmethod_id = 0; if (method_exists($calc, 'getCheckoutPricesOPC')) { $prices = $calc->getCheckoutPricesOPC($cart, false); } else { $prices = OPCloader::getCheckoutPrices($cart, false, $vm2015, 'opc'); } } } if (!empty($prices['billTotal'])) { OPCloader::$totalIsZero = false; } OPCloader::opcDebug('OPC: getCheckoutPrices from ajaxhelper.php'); OPCloader::opcDebug($prices); if (isset($cart->OPCCartData)) { OPCloader::opcDebug($cart->OPCCartData); } if (!empty($opc_request_cache)) { if (!empty($saved_id)) { $sprice['shipmentValue'] = $prices['shipmentValue']; $sprice['shipmentTax'] = $prices['shipmentTax']; $sprice['salesPriceShipment'] = $prices['salesPriceShipment']; $sprice['shipment_calc_id'] = $prices['shipment_calc_id']; $sprice['shipmentName'] = @$prices['shipmentName']; OPCcache::storeShipingCalculation($cart, $sprice, $sprice['shipmentName'], $shipping_id); } } // in case calculation invalidates it: $cart->virtuemart_shipmentmethod_id = $saved_id; $cart->couponCode = $savedcoupon; }