File tree Expand file tree Collapse file tree 2 files changed +28
-26
lines changed Expand file tree Collapse file tree 2 files changed +28
-26
lines changed Original file line number Diff line number Diff line change @@ -22,4 +22,30 @@ public function getSelectedCountryId()
2222 {
2323 return Mage::getSingleton ('checkout/session ' )->getQuote ()->getShippingAddress ()->getCountryId ();
2424 }
25- }
25+
26+ public function getCountryHtmlSelect ($ defValue =null , $ name ='country_id ' , $ id ='country ' , $ title ='Country ' )
27+ {
28+ if (is_null ($ defValue )) {
29+ $ defValue = $ this ->getCountryId ();
30+ }
31+ $ cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_ ' .Mage::app ()->getStore ()->getCode ();
32+ if (Mage::app ()->useCache ('config ' ) && $ cache = Mage::app ()->loadCache ($ cacheKey )) {
33+ $ options = unserialize ($ cache );
34+ } else {
35+ $ options = $ this ->getCountryCollection ()->toOptionArray ();
36+ if (Mage::app ()->useCache ('config ' )) {
37+ Mage::app ()->saveCache (serialize ($ options ), $ cacheKey , array ('config ' ));
38+ }
39+ }
40+ $ html = $ this ->getLayout ()->createBlock ('core/html_select ' )
41+ ->setName ($ name )
42+ ->setId ($ id )
43+ ->setTitle (Mage::helper ('directory ' )->__ ($ title ))
44+ ->setClass ('validate-select ' )
45+ ->setValue ($ defValue )
46+ ->setOptions ($ options )
47+ ->getHtml ();
48+
49+ return $ html ;
50+ }
51+ }
Original file line number Diff line number Diff line change 1212
1313class IntegerNet_Autoshipping_Helper_Data extends Mage_Core_Helper_Abstract
1414{
15- public function getCountryHtmlSelect ($ defValue =null , $ name ='country_id ' , $ id ='country ' , $ title ='Country ' )
16- {
17- if (is_null ($ defValue )) {
18- $ defValue = $ this ->getCountryId ();
19- }
20- $ cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_ ' .Mage::app ()->getStore ()->getCode ();
21- if (Mage::app ()->useCache ('config ' ) && $ cache = Mage::app ()->loadCache ($ cacheKey )) {
22- $ options = unserialize ($ cache );
23- } else {
24- $ options = $ this ->getCountryCollection ()->toOptionArray ();
25- if (Mage::app ()->useCache ('config ' )) {
26- Mage::app ()->saveCache (serialize ($ options ), $ cacheKey , array ('config ' ));
27- }
28- }
29- $ html = $ this ->getLayout ()->createBlock ('core/html_select ' )
30- ->setName ($ name )
31- ->setId ($ id )
32- ->setTitle (Mage::helper ('directory ' )->__ ($ title ))
33- ->setClass ('validate-select ' )
34- ->setValue ($ defValue )
35- ->setOptions ($ options )
36- ->getHtml ();
37-
38- return $ html ;
39- }
15+
4016}
4117
You can’t perform that action at this time.
0 commit comments