public function onAfterRender() { if (!$this->_check()) { return; } $cart_hash = OPCcarthelper::hasProducts(); if (empty($cart_hash)) { return; } $session = JFactory::getSession(); $cart_hash2 = $session->get('opc_last_cart_hash', ''); // update db only when the cart has changed if ($cart_hash2 != $cart_hash) { $hash = $this->_getHash(); OPCcarthelper::storeProducts($hash); OPCcarthelper::removeOld($this->params->get('cookie_timeout', 2592000)); $session->set('opc_last_cart_hash', $cart_hash); } return; }
public static function storeProducts($hash) { if (!class_exists('VmConfig')) { require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; VmConfig::loadConfig(); } $cart = OPCcarthelper::hasProducts(true); OPCcarthelper::updateLine($hash, $cart); return; }