/** * Event onBeforeBuildMageBridge */ public function onBeforeBuildMageBridge() { // Get base variables $application = JFactory::getApplication(); // Get the current Magento request $request = MageBridgeUrlHelper::getRequest(); // Check for the logout-page if ($request == 'customer/account/logoutSuccess') { $application->logout(); } // When visiting the checkout/cart/add URL without a valid session, the action will fail because the session does not exist yet // The following workaround makes sure we first redirect to another page (to initialize the session) after which we can add the product if (preg_match('/checkout\\/cart\\/add\\//', $request) && !preg_match('/redirect=1/', $request)) { $bridge = MageBridgeModelBridge::getInstance(); $session = $bridge->getMageSession(); // Check for the Magento session-key stored in the Joomla! session // Session is NOT yet initialized, therefor addtocart is not working yet either if (empty($session) && !empty($_COOKIE)) { // Redirect the client to an intermediate page to properly initialize the session $bridge->setHttpReferer(MageBridgeUrlHelper::route($request . '?redirect=1')); MageBridgeUrlHelper::setRequest('magebridge/redirect/index/url/' . base64_encode($request)); MageBridgeModelBridgeMeta::getInstance()->reset(); } } }
/** * Method to return the pending register-entries * * @param null * @return array */ public function getPendingRegister() { $data = array(); // Collect all the segments that do not have data if (!empty($this->data)) { foreach ($this->data as $id => $segment) { // Do not return segments that already have data if (isset($segment['status']) && $segment['status'] == self::MAGEBRIDGE_SEGMENT_STATUS_SYNCED) { continue; } // Do not return segments that already have data inside them if (!empty($segment['data'])) { continue; } $data[$id] = $segment; } } // If this pending register is not empty, we need to add the register to it if (!empty($data) && empty($data['meta'])) { $data['meta'] = array('type' => 'meta', 'name' => null, 'arguments' => MageBridgeModelBridgeMeta::getInstance()->getRequestData()); } // Handle exceptions like with Dynamic404 // @todo: implement and test this hack-function //$data = $this->doCorrectRequest($data); return $data; }
public function getMeta() { return MageBridgeModelBridgeMeta::getInstance()->getRequestData(); }