_objectId = 'pk'; $this->_blockGroup = 'pacsoft'; $this->_controller = 'adminhtml_rates'; parent::__construct(); $helper = $this->_getHelper(); $this->_updateButton('save', 'label', $helper->__('Save Shipping Rate')); $this->_updateButton('delete', 'label', $helper->__('Delete Shipping Rate')); } protected function _getHelper() { return Mage::helper('pacsoft/rates'); } protected function getWebsite() { if (is_null($this->_website)) { $this->_website = $this->_getHelper()->getWebsite(); } return $this->_website; } public function getWebsiteId() { return $this->_getHelper()->getWebsiteId($this->getWebsite()); } protected function getSession() { return Mage::getSingleton('admin/session'); } protected function getModel() { return Mage::registry('pacsoft_rate'); } public function getHeaderText() { $helper = $this->_getHelper(); $model = $this->getModel(); if ($model && $model->getId()) { return $helper->__("Edit Rate '%s'", $this->htmlEscape($model->getTitle())); } else { return $helper->__('New Rate'); } } protected function _prepareLayout() { $json = $this->helper('directory')->getRegionJson(); $this->_formScripts[] = 'var updater = new RegionUpdater("pacsoft_rate_dest_country_id", "none", "pacsoft_rate_dest_region_id", '.$json.', "disable")'; return parent::_prepareLayout(); } protected function getURLParams() { return array('website' => $this->getWebsiteId()); } public function getBackUrl() { return $this->getUrl('*/*/', $this->getURLParams()); } public function getDeleteUrl() { return $this->getUrl('*/*/delete', array_merge( array($this->_objectId => $this->getRequest()->getParam($this->_objectId)), $this->getURLParams() )); } public function getFormActionUrl() { if ($this->hasFormActionUrl()) return $this->getData('form_action_url'); return $this->getUrl('*/*/save', $this->getURLParams()); } }