@@ -51,7 +51,21 @@ public function getPostUrl()
51
51
52
52
public function getPostInfo ()
53
53
{
54
- $ stores = Mage::app ()->getWebsites ();
54
+ $ websiteCode = Mage::app ()->getRequest ()->getParam ('website ' );
55
+ if ($ websiteCode ) {
56
+ $ website = Mage::getModel ('core/website ' )->load ($ websiteCode );
57
+ } else {
58
+ $ website = Mage::getModel ('core/website ' )->getCollection ()
59
+ ->addFieldToFilter ('is_default ' , 1 )
60
+ ->getFirstItem ();
61
+ }
62
+
63
+ $ storeCode = Mage::app ()->getRequest ()->getParam ('store ' );
64
+ if ($ storeCode ) {
65
+ $ store = Mage::getModel ('core/store ' )->load ($ storeCode );
66
+ } else {
67
+ $ store = $ website ->getDefaultStore ();
68
+ }
55
69
56
70
$ info = array (
57
71
'magento_domain ' => Mage::getBaseUrl (Mage_Core_Model_Store::URL_TYPE_WEB ),
@@ -61,23 +75,10 @@ public function getPostInfo()
61
75
'magento_callback ' => Mage::helper ('adminhtml ' )->getUrl ('adminhtml/zendesk/redirect ' , array ('type ' => 'settings ' , 'id ' => 'zendesk ' )),
62
76
'magento_locale ' => Mage::getStoreConfig ('general/locale/code ' ),
63
77
'magento_timezone ' => Mage::getStoreConfig ('general/locale/timezone ' ),
64
- 'magento_api_url ' => Mage::getUrl ('zendesk/api ' , array ('_store ' => $ stores [1 ]->getDefaultStore ()->getCode ()))
78
+ 'magento_api_url ' => Mage::getUrl ('zendesk/api ' , array ('_store ' => $ store ->getCode ())),
79
+ 'magento_store_name ' => $ website ->getName (),
65
80
);
66
81
67
- $ storeName = Mage::getStoreConfig ('general/store_information/name ' );
68
-
69
- if (!$ storeName ) {
70
- $ websites = Mage::getModel ('core/website ' )->getCollection ();
71
- foreach ($ websites as $ website ) {
72
- // Skip admin website
73
- if ($ website ->getName () == 'Admin ' || $ website ->getName () == 'Main Website ' ) continue ;
74
-
75
- $ storeName = $ website ->getName ();
76
- }
77
- }
78
-
79
- $ info ['magento_store_name ' ] = (string )$ storeName ;
80
-
81
82
return $ info ;
82
83
}
83
84
}
0 commit comments