Yireo_EmailOverride - Version 0.2.9

Version Notes

No notes

Download this release

Release Info

Developer Yireo
Extension Yireo_EmailOverride
Version 0.2.9
Comparing to
See all releases


Code changes from version 0.2.6 to 0.2.9

app/code/community/Yireo/EmailOverride/Helper/Data.php CHANGED
@@ -23,10 +23,17 @@ class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
23
  public function getLocaleOverrideFile($localeCode, $fileName, $store = null)
24
  {
25
  $paths = $this->getLocalePaths($store);
26
- foreach($paths as $path) {
27
- $filePath = $path.DS.$localeCode.DS.$fileName;
28
- if (!empty($filePath) && file_exists($filePath)) {
29
- return $filePath;
 
 
 
 
 
 
 
30
  }
31
  }
32
 
@@ -46,13 +53,15 @@ class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
46
  $paths[] = Mage::getBaseDir('design').DS.'frontend'.DS.$design['package'].DS.$design['theme'].DS.'locale';
47
 
48
  // Check for fallback support
49
- $fallbackModel = Mage::getModel('core/design_fallback');
50
- if(!empty($fallbackModel)) {
51
- $fallbackSchemes = $fallbackModel->getFallbackScheme('frontend', $design['package'], $design['theme']);
52
- if(!empty($fallbackSchemes)) {
53
- foreach($fallbackSchemes as $scheme) {
54
- if(!isset($scheme['_package']) || !isset($scheme['_theme'])) continue;
55
- $paths[] = Mage::getBaseDir('design').DS.'frontend'.DS.$scheme['_package'].DS.$scheme['_theme'].DS.'locale';
 
 
56
  }
57
  }
58
  }
@@ -113,4 +122,17 @@ class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
113
  'theme' => $theme,
114
  );
115
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
23
  public function getLocaleOverrideFile($localeCode, $fileName, $store = null)
24
  {
25
  $paths = $this->getLocalePaths($store);
26
+
27
+ $localCodes = $localeCode === 'en_US'
28
+ ? array($localeCode)
29
+ : array($localeCode, 'en_US');
30
+
31
+ foreach ($localCodes as $localeCode) {
32
+ foreach ($paths as $path) {
33
+ $filePath = $path . DS . $localeCode . DS . $fileName;
34
+ if (!empty($filePath) && file_exists($filePath)) {
35
+ return $filePath;
36
+ }
37
  }
38
  }
39
 
53
  $paths[] = Mage::getBaseDir('design').DS.'frontend'.DS.$design['package'].DS.$design['theme'].DS.'locale';
54
 
55
  // Check for fallback support
56
+ if ($this->supportsDesignFallback()) {
57
+ $fallbackModel = Mage::getModel('core/design_fallback');
58
+ if(!empty($fallbackModel)) {
59
+ $fallbackSchemes = $fallbackModel->getFallbackScheme('frontend', $design['package'], $design['theme']);
60
+ if(!empty($fallbackSchemes)) {
61
+ foreach($fallbackSchemes as $scheme) {
62
+ if(!isset($scheme['_package']) || !isset($scheme['_theme'])) continue;
63
+ $paths[] = Mage::getBaseDir('design').DS.'frontend'.DS.$scheme['_package'].DS.$scheme['_theme'].DS.'locale';
64
+ }
65
  }
66
  }
67
  }
122
  'theme' => $theme,
123
  );
124
  }
125
+
126
+ /**
127
+ * @return boolean
128
+ */
129
+ public function supportsDesignFallback()
130
+ {
131
+ // Check for the right file
132
+ if (file_exists(BP . '/app/code/core/Mage/Core/Model/Design/Fallback.php') == false) {
133
+ return false;
134
+ }
135
+
136
+ return true;
137
+ }
138
  }
app/code/community/Yireo/EmailOverride/Model/Translate.php CHANGED
@@ -118,12 +118,12 @@ class Yireo_EmailOverride_Model_Translate extends Mage_Core_Model_Translate
118
  protected function _loadThemeTranslation($forceReload = false)
119
  {
120
  // Check for fallback support
121
- $fallbackModel = Mage::getModel('core/design_fallback');
122
- if(empty($fallbackModel)) {
123
  return parent::_loadThemeTranslation($forceReload);
124
  }
125
 
126
  // First add fallback package translate.csv files
 
127
  $designPackage = Mage::getSingleton('core/design_package');
128
  $fallbacks = $fallbackModel->getFallbackScheme($designPackage->getArea(), $designPackage->getPackageName(), $designPackage->getTheme('layout'));
129
 
118
  protected function _loadThemeTranslation($forceReload = false)
119
  {
120
  // Check for fallback support
121
+ if (Mage::helper('emailoverride')->supportsDesignFallback() == false) {
 
122
  return parent::_loadThemeTranslation($forceReload);
123
  }
124
 
125
  // First add fallback package translate.csv files
126
+ $fallbackModel = Mage::getModel('core/design_fallback');
127
  $designPackage = Mage::getSingleton('core/design_package');
128
  $fallbacks = $fallbackModel->getFallbackScheme($designPackage->getArea(), $designPackage->getPackageName(), $designPackage->getTheme('layout'));
129
 
app/code/community/Yireo/EmailOverride/etc/config.xml CHANGED
@@ -13,7 +13,7 @@
13
 
14
  <modules>
15
  <Yireo_EmailOverride>
16
- <version>0.2.6</version>
17
  </Yireo_EmailOverride>
18
  </modules>
19
 
13
 
14
  <modules>
15
  <Yireo_EmailOverride>
16
+ <version>0.2.9</version>
17
  </Yireo_EmailOverride>
18
  </modules>
19
 
app/etc/modules/Yireo_EmailOverride.xml CHANGED
@@ -15,7 +15,7 @@
15
  <active>true</active>
16
  <codePool>community</codePool>
17
  <depends>
18
- <Mage_Core />
19
  </depends>
20
  </Yireo_EmailOverride>
21
  </modules>
15
  <active>true</active>
16
  <codePool>community</codePool>
17
  <depends>
18
+ <Mage_Core/>
19
  </depends>
20
  </Yireo_EmailOverride>
21
  </modules>
package.xml CHANGED
@@ -1,2 +1,2 @@
1
  <?xml version="1.0"?>
2
- <package><name>Yireo_EmailOverride</name><version>0.2.6</version><stability>stable</stability><license>Open Source License</license><channel>community</channel><extends></extends><summary>No summary</summary><description>No description</description><notes>No notes</notes><authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors><date>2015-05-07</date><time>0:11:23</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_EmailOverride.xml" hash="fe22ada4c2be9373c3b0dc15cf2f805b"/></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="EmailOverride"><dir name="etc"><file name="config.xml" hash="4a74ba00765dfe9f4fe3899bfdff4823"/></dir><dir name="Model"><file name="Translate.php" hash="9cc0cc71596d3ddc06ca5b9c7df1ba6a"/><dir name="Email"><file name="Template.php" hash="7a4b950edadb943ff644a6383d224150"/></dir></dir><dir name="Helper"><file name="Data.php" hash="28767abdaaf1ae5c6e8b672b020ec289"/></dir></dir></dir></dir></dir></dir></target></contents></package>
1
  <?xml version="1.0"?>
2
+ <package><name>Yireo_EmailOverride</name><version>0.2.9</version><stability>stable</stability><license>Open Source License</license><channel>community</channel><extends></extends><summary>No summary</summary><description>No description</description><notes>No notes</notes><authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors><date>2015-09-21</date><time>0:23:26</time><compatible></compatible><dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_EmailOverride.xml" hash="f1b6fc4c44c28a755009414115848036"/></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="EmailOverride"><dir name="etc"><file name="config.xml" hash="b9ef025f6fd86fad39f4800e873fda5c"/></dir><dir name="Model"><file name="Translate.php" hash="eb13e7c126a8dcd0e31e95201a2a0fcd"/><dir name="Email"><file name="Template.php" hash="7a4b950edadb943ff644a6383d224150"/></dir></dir><dir name="Helper"><file name="Data.php" hash="7fad567ecb1174bbb9a4e7d006dba17b"/></dir></dir></dir></dir></dir></dir></target></contents></package>