/** * Return url for checkout * * @return url */ public function getCheckoutUrl() { $mageSessHandler = Mage::GetSingleton('vbw_punchout/session'); if ($mageSessHandler->getPunchoutId()) { return $this->_getUrl('checkout/punchout'); // , array('_secure'=>true)); } else { return parent::getCheckoutUrl(); } }
/** * Add link on checkout page to parent block * * @return Mage_Checkout_Block_Links */ public function addCheckoutLink() { $poSession = Mage::GetSingleton("vbw_punchout/session"); // $poSession->reviewSession(); if ($parentBlock = $this->getParentBlock()) { $label = Mage::helper('vbw_punchout/config')->getConfig('display/checkout_nav_button'); $text = $this->__(!empty($label) ? $label : 'Punchout'); $parentBlock->addLink($text, 'checkout/cart', $text, true, array('_secure' => true), 60, null, 'class="top-link-checkout"'); } return $this; }
/** * exit the session. * */ public function exitAction() { $response = $this->getResponse(); if ($response->isRedirect()) { return true; } /** * @var $session Vbw_Punchout_Model_Session */ $helper = Mage::helper('vbw_punchout/config'); if (Mage::getSingleton('vbw_punchout/session')->isPunchoutSession()) { $session = Mage::GetSingleton("vbw_punchout/session"); $punchoutOrder = $session->getPunchoutOrder(); $url = $helper->getConfig('display/return_url'); if (empty($url)) { $session = Mage::GetSingleton("vbw_punchout/session"); $url = $session->getRemoteHost() . "/gateway/link/return/id/" . $session->getPunchoutId() . "/?redirect=1"; //$url = Mage::getSingleton('vbw_punchout/session')->getPunchoutRequest()->getBody()->getPostForm(); } $target = $helper->getConfig('display/return_target'); $string = '<form action="' . $url . '" method=GET name="punchoutSend" id="punchoutSend" target="' . $target . '">'; $string .= '</form>'; $html = "<html>\n"; $html .= "<head><title>Closing your punchout session...</title></head>\n"; $html .= "<body onload=\"self.document.forms[0].submit()\">\n"; $html .= $string; //$html .= "<script>self.document.forms[0].submit()</script>"; $html .= "</body>\n"; $html .= "</html>"; $this->getResponse()->setBody($html); } }