diff --git a/app/code/community/IntegerNet/Autoshipping/Block/Country.php b/app/code/community/IntegerNet/Autoshipping/Block/Country.php index 77cecc6..e2c3ade 100644 --- a/app/code/community/IntegerNet/Autoshipping/Block/Country.php +++ b/app/code/community/IntegerNet/Autoshipping/Block/Country.php @@ -22,4 +22,30 @@ public function getSelectedCountryId() { return Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCountryId(); } -} \ No newline at end of file + + public function getCountryHtmlSelect($defValue=null, $name='country_id', $id='country', $title='Country') + { + if (is_null($defValue)) { + $defValue = $this->getCountryId(); + } + $cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_'.Mage::app()->getStore()->getCode(); + if (Mage::app()->useCache('config') && $cache = Mage::app()->loadCache($cacheKey)) { + $options = unserialize($cache); + } else { + $options = $this->getCountryCollection()->toOptionArray(); + if (Mage::app()->useCache('config')) { + Mage::app()->saveCache(serialize($options), $cacheKey, array('config')); + } + } + $html = $this->getLayout()->createBlock('core/html_select') + ->setName($name) + ->setId($id) + ->setTitle(Mage::helper('directory')->__($title)) + ->setClass('validate-select') + ->setValue($defValue) + ->setOptions($options) + ->getHtml(); + + return $html; + } +} diff --git a/app/code/community/IntegerNet/Autoshipping/Helper/Data.php b/app/code/community/IntegerNet/Autoshipping/Helper/Data.php index 0379a6b..47679f0 100644 --- a/app/code/community/IntegerNet/Autoshipping/Helper/Data.php +++ b/app/code/community/IntegerNet/Autoshipping/Helper/Data.php @@ -12,30 +12,6 @@ class IntegerNet_Autoshipping_Helper_Data extends Mage_Core_Helper_Abstract { - public function getCountryHtmlSelect($defValue=null, $name='country_id', $id='country', $title='Country') - { - if (is_null($defValue)) { - $defValue = $this->getCountryId(); - } - $cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_'.Mage::app()->getStore()->getCode(); - if (Mage::app()->useCache('config') && $cache = Mage::app()->loadCache($cacheKey)) { - $options = unserialize($cache); - } else { - $options = $this->getCountryCollection()->toOptionArray(); - if (Mage::app()->useCache('config')) { - Mage::app()->saveCache(serialize($options), $cacheKey, array('config')); - } - } - $html = $this->getLayout()->createBlock('core/html_select') - ->setName($name) - ->setId($id) - ->setTitle(Mage::helper('directory')->__($title)) - ->setClass('validate-select') - ->setValue($defValue) - ->setOptions($options) - ->getHtml(); - - return $html; - } + }