_title($this->__('ShipStation')); return parent::preDispatch(); } /** * Display a launch page, or redirect to setup page if necessary */ public function indexAction() { if (Mage::helper('auctaneshipstation')->setupRequired()) { $this->_redirect('*/shipstation/setup'); return; } $this->loadLayout(); $this->renderLayout(); } /** * Launch page needs a GMT value and javascript is not timezone aware * This is an AJAX action * * @deprecated */ public function timestampAction() { $timestamp = new DateTime(); $timestamp->setTimezone(new DateTimeZone('UTC')); $this->getResponse()->setBody($timestamp->format('m/d/Y H:i:s')); } /** * Display a setup page for registering */ public function setupAction() { $this->_title($this->__('Register')); $this->loadLayout(); $this->renderLayout(); } /** * The setup's "linkup" button goes here, register with shipstation server. */ public function linkupAction() { try { $user = Mage::getModel('auctaneshipstation/user'); $user->setData($this->getRequest()->getPost()); $user->setRequestUrl(Mage::helper('auctaneshipstation')->getStoreDomain($user->getStoreId())); $user->authenticate(); // If there is an error it will abort here, no save. $user->save(); $this->_redirect('*/shipstation'); } catch (Exception $e) { $this->_getSession()->addException($e, $e->getMessage()); $this->_redirect('*/shipstation/setup'); } } }