Version Notes
No notes
Download this release
Release Info
Developer | Yireo |
Extension | Yireo_EmailOverride |
Version | 0.2.11 |
Comparing to | |
See all releases |
Code changes from version 0.2.9 to 0.2.11
- app/code/community/Yireo/EmailOverride/Helper/Data.php +76 -35
- app/code/community/Yireo/EmailOverride/Model/Email/Template.php +6 -2
- app/code/community/Yireo/EmailOverride/Model/Translate.php +61 -23
- app/code/community/Yireo/EmailOverride/etc/config.xml +3 -3
- app/etc/modules/Yireo_EmailOverride.xml +2 -2
- package.xml +1 -1
app/code/community/Yireo/EmailOverride/Helper/Data.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Yireo EmailOverride for Magento
|
4 |
*
|
5 |
* @package Yireo_EmailOverride
|
6 |
-
* @author Yireo (
|
7 |
-
* @copyright Copyright 2015 Yireo (
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
@@ -14,8 +14,8 @@
|
|
14 |
class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
|
15 |
{
|
16 |
/**
|
17 |
-
* @param string
|
18 |
-
* @param string
|
19 |
* @param string|integer|Mage_Core_Model_Store $store (optional)
|
20 |
*
|
21 |
* @return string|null
|
@@ -23,12 +23,9 @@ 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 |
-
|
27 |
-
$localCodes = $localeCode === 'en_US'
|
28 |
-
? array($localeCode)
|
29 |
-
: array($localeCode, 'en_US');
|
30 |
|
31 |
-
foreach ($
|
32 |
foreach ($paths as $path) {
|
33 |
$filePath = $path . DS . $localeCode . DS . $fileName;
|
34 |
if (!empty($filePath) && file_exists($filePath)) {
|
@@ -40,6 +37,20 @@ class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
|
|
40 |
return null;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* @param string|integer|Mage_Core_Model_Store $store (optional)
|
45 |
*
|
@@ -50,26 +61,49 @@ class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
|
|
50 |
$paths = array();
|
51 |
|
52 |
$design = $this->getDesign($store);
|
53 |
-
$paths[] = Mage::getBaseDir('design').DS.'frontend'.DS
|
54 |
|
55 |
// Check for fallback support
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
if ($this->supportsDesignFallback()) {
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
-
|
69 |
-
$paths[] = Mage::getBaseDir('design').DS.'frontend'.DS.$design['package'].DS.'default'.DS.'locale';
|
70 |
-
$paths[] = Mage::getBaseDir('design').DS.'frontend'.DS.'default'.DS.'default'.DS.'locale';
|
71 |
-
$paths[] = Mage::getBaseDir('design').DS.'frontend'.DS.'base'.DS.'default'.DS.'locale';
|
72 |
-
$paths[] = Mage::getBaseDir('locale');
|
73 |
|
74 |
return $paths;
|
75 |
}
|
@@ -81,7 +115,7 @@ class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
|
|
81 |
*/
|
82 |
public function getDesign($store = null)
|
83 |
{
|
84 |
-
if(empty($store)) {
|
85 |
$store = Mage::registry('emailoverride.store');
|
86 |
}
|
87 |
|
@@ -89,11 +123,13 @@ class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
|
|
89 |
$theme = null;
|
90 |
|
91 |
if (Mage::app()->getStore()->isAdmin() == false) {
|
|
|
|
|
92 |
$package = Mage::getSingleton('core/design_package');
|
93 |
$originalArea = $package->getArea();
|
94 |
$originalStore = $package->getStore();
|
95 |
|
96 |
-
if(!empty($store)) $package->setStore($store);
|
97 |
$package->setArea('frontend');
|
98 |
$packageName = $package->getPackageName();
|
99 |
$theme = $package->getTheme('default');
|
@@ -102,20 +138,25 @@ class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
|
|
102 |
$package->setStore($originalStore);
|
103 |
}
|
104 |
|
105 |
-
if(empty($packageName) || in_array($theme, array('base', 'default'))) {
|
106 |
$packageName = Mage::getStoreConfig('design/package/name', $store);
|
107 |
}
|
108 |
-
|
109 |
-
if(empty($theme)) {
|
|
|
|
|
|
|
|
|
110 |
$theme = Mage::getStoreConfig('design/theme/default', $store);
|
111 |
}
|
112 |
|
113 |
-
if(empty($
|
114 |
-
$
|
115 |
}
|
116 |
|
117 |
-
if(empty($
|
118 |
-
|
|
|
119 |
|
120 |
return array(
|
121 |
'package' => $packageName,
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Yireo EmailOverride for Magento
|
4 |
*
|
5 |
* @package Yireo_EmailOverride
|
6 |
+
* @author Yireo (https://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (https://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
14 |
class Yireo_EmailOverride_Helper_Data extends Mage_Core_Helper_Abstract
|
15 |
{
|
16 |
/**
|
17 |
+
* @param string $localeCode
|
18 |
+
* @param string $fileName
|
19 |
* @param string|integer|Mage_Core_Model_Store $store (optional)
|
20 |
*
|
21 |
* @return string|null
|
23 |
public function getLocaleOverrideFile($localeCode, $fileName, $store = null)
|
24 |
{
|
25 |
$paths = $this->getLocalePaths($store);
|
26 |
+
$localeCodes = $this->getLocaleCodesAsArray($localeCode);
|
|
|
|
|
|
|
27 |
|
28 |
+
foreach ($localeCodes as $localeCode) {
|
29 |
foreach ($paths as $path) {
|
30 |
$filePath = $path . DS . $localeCode . DS . $fileName;
|
31 |
if (!empty($filePath) && file_exists($filePath)) {
|
37 |
return null;
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* @param $localeCode
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
protected function getLocaleCodesAsArray($localeCode)
|
46 |
+
{
|
47 |
+
if ($localeCode === 'en_US') {
|
48 |
+
return array($localeCode);
|
49 |
+
}
|
50 |
+
|
51 |
+
return array($localeCode, 'en_US');
|
52 |
+
}
|
53 |
+
|
54 |
/**
|
55 |
* @param string|integer|Mage_Core_Model_Store $store (optional)
|
56 |
*
|
61 |
$paths = array();
|
62 |
|
63 |
$design = $this->getDesign($store);
|
64 |
+
$paths[] = Mage::getBaseDir('design') . DS . 'frontend' . DS . $design['package'] . DS . $design['theme'] . DS . 'locale';
|
65 |
|
66 |
// Check for fallback support
|
67 |
+
$paths = array_merge($paths, $this->getLocalePathsForFallbackScheme($design));
|
68 |
+
|
69 |
+
// Default paths
|
70 |
+
$paths[] = Mage::getBaseDir('design') . DS . 'frontend' . DS . $design['package'] . DS . 'default' . DS . 'locale';
|
71 |
+
$paths[] = Mage::getBaseDir('design') . DS . 'frontend' . DS . 'default' . DS . 'default' . DS . 'locale';
|
72 |
+
$paths[] = Mage::getBaseDir('design') . DS . 'frontend' . DS . 'base' . DS . 'default' . DS . 'locale';
|
73 |
+
$paths[] = Mage::getBaseDir('locale');
|
74 |
+
|
75 |
+
return $paths;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @param $design
|
80 |
+
*
|
81 |
+
* @return array
|
82 |
+
*/
|
83 |
+
public function getLocalePathsForFallbackScheme($design)
|
84 |
+
{
|
85 |
if ($this->supportsDesignFallback()) {
|
86 |
+
return array();
|
87 |
+
}
|
88 |
+
|
89 |
+
$paths = array();
|
90 |
+
|
91 |
+
/** @var Mage_Core_Model_Design_Fallback $fallbackModel */
|
92 |
+
$fallbackModel = Mage::getModel('core/design_fallback');
|
93 |
+
|
94 |
+
if (empty($fallbackModel)) {
|
95 |
+
return array();
|
96 |
+
}
|
97 |
+
|
98 |
+
$fallbackSchemes = $fallbackModel->getFallbackScheme('frontend', $design['package'], $design['theme']);
|
99 |
+
if (!empty($fallbackSchemes)) {
|
100 |
+
return array();
|
101 |
+
}
|
102 |
+
|
103 |
+
foreach ($fallbackSchemes as $scheme) {
|
104 |
+
if (!isset($scheme['_package']) || !isset($scheme['_theme'])) continue;
|
105 |
+
$paths[] = Mage::getBaseDir('design') . DS . 'frontend' . DS . $scheme['_package'] . DS . $scheme['_theme'] . DS . 'locale';
|
106 |
}
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
return $paths;
|
109 |
}
|
115 |
*/
|
116 |
public function getDesign($store = null)
|
117 |
{
|
118 |
+
if (empty($store)) {
|
119 |
$store = Mage::registry('emailoverride.store');
|
120 |
}
|
121 |
|
123 |
$theme = null;
|
124 |
|
125 |
if (Mage::app()->getStore()->isAdmin() == false) {
|
126 |
+
|
127 |
+
/** @var Mage_Core_Model_Design_Package $package */
|
128 |
$package = Mage::getSingleton('core/design_package');
|
129 |
$originalArea = $package->getArea();
|
130 |
$originalStore = $package->getStore();
|
131 |
|
132 |
+
if (!empty($store)) $package->setStore($store);
|
133 |
$package->setArea('frontend');
|
134 |
$packageName = $package->getPackageName();
|
135 |
$theme = $package->getTheme('default');
|
138 |
$package->setStore($originalStore);
|
139 |
}
|
140 |
|
141 |
+
if (empty($packageName) || in_array($theme, array('base', 'default'))) {
|
142 |
$packageName = Mage::getStoreConfig('design/package/name', $store);
|
143 |
}
|
144 |
+
|
145 |
+
if (empty($theme) || in_array($theme, array('default'))) {
|
146 |
+
$theme = Mage::getStoreConfig('design/theme/locale', $store);
|
147 |
+
}
|
148 |
+
|
149 |
+
if (empty($theme)) {
|
150 |
$theme = Mage::getStoreConfig('design/theme/default', $store);
|
151 |
}
|
152 |
|
153 |
+
if (empty($packageName)) {
|
154 |
+
$packageName = 'default';
|
155 |
}
|
156 |
|
157 |
+
if (empty($theme)) {
|
158 |
+
$theme = 'default';
|
159 |
+
}
|
160 |
|
161 |
return array(
|
162 |
'package' => $packageName,
|
app/code/community/Yireo/EmailOverride/Model/Email/Template.php
CHANGED
@@ -3,16 +3,20 @@
|
|
3 |
* Yireo EmailOverride for Magento
|
4 |
*
|
5 |
* @package Yireo_EmailOverride
|
6 |
-
* @author Yireo (
|
7 |
-
* @copyright Copyright 2015 Yireo (
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
11 |
// Allow for an override of Aschroder_SMTPPro_Model_Email_Template
|
12 |
if (Mage::helper('core')->isModuleEnabled('Aschroder_SMTPPro') && class_exists('Aschroder_SMTPPro_Model_Email_Template')) {
|
13 |
class Yireo_EmailOverride_Model_Email_Template_Wrapper extends Aschroder_SMTPPro_Model_Email_Template {}
|
|
|
|
|
14 |
}elseif (Mage::helper('core')->isModuleEnabled('Ebizmarts_Mandrill') && class_exists('Ebizmarts_Mandrill_Model_Email_Template')) {
|
15 |
class Yireo_EmailOverride_Model_Email_Template_Wrapper extends Ebizmarts_Mandrill_Model_Email_Template {}
|
|
|
|
|
16 |
} else {
|
17 |
class Yireo_EmailOverride_Model_Email_Template_Wrapper extends Mage_Core_Model_Email_Template {}
|
18 |
}
|
3 |
* Yireo EmailOverride for Magento
|
4 |
*
|
5 |
* @package Yireo_EmailOverride
|
6 |
+
* @author Yireo (https://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2015 Yireo (https://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
11 |
// Allow for an override of Aschroder_SMTPPro_Model_Email_Template
|
12 |
if (Mage::helper('core')->isModuleEnabled('Aschroder_SMTPPro') && class_exists('Aschroder_SMTPPro_Model_Email_Template')) {
|
13 |
class Yireo_EmailOverride_Model_Email_Template_Wrapper extends Aschroder_SMTPPro_Model_Email_Template {}
|
14 |
+
}elseif (Mage::helper('core')->isModuleEnabled('Aschroder_Email') && class_exists('Aschroder_Email_Model_Email_Template')) {
|
15 |
+
class Yireo_EmailOverride_Model_Email_Template_Wrapper extends Aschroder_Email_Model_Email_Template {}
|
16 |
}elseif (Mage::helper('core')->isModuleEnabled('Ebizmarts_Mandrill') && class_exists('Ebizmarts_Mandrill_Model_Email_Template')) {
|
17 |
class Yireo_EmailOverride_Model_Email_Template_Wrapper extends Ebizmarts_Mandrill_Model_Email_Template {}
|
18 |
+
}elseif (Mage::helper('core')->isModuleEnabled('FreeLunchLabs_MailGun') && class_exists('FreeLunchLabs_MailGun_Model_Email_Template')) {
|
19 |
+
class Yireo_EmailOverride_Model_Email_Template_Wrapper extends FreeLunchLabs_MailGun_Model_Email_Template {}
|
20 |
} else {
|
21 |
class Yireo_EmailOverride_Model_Email_Template_Wrapper extends Mage_Core_Model_Email_Template {}
|
22 |
}
|
app/code/community/Yireo/EmailOverride/Model/Translate.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Yireo EmailOverride for Magento
|
4 |
*
|
5 |
* @package Yireo_EmailOverride
|
6 |
-
* @author Yireo (
|
7 |
-
* @copyright Copyright
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
@@ -23,21 +23,23 @@ class Yireo_EmailOverride_Model_Translate extends Mage_Core_Model_Translate
|
|
23 |
*/
|
24 |
protected function _getModuleFilePath($module, $fileName)
|
25 |
{
|
26 |
-
|
|
|
27 |
return parent::_getModuleFilePath($module, $fileName);
|
28 |
}
|
29 |
|
|
|
30 |
$localeCode = $this->getLocale();
|
31 |
if (empty($localeCode)) {
|
32 |
return parent::_getModuleFilePath($module, $fileName);
|
33 |
}
|
34 |
|
35 |
$filePath = $this->getLocaleOverrideFile($localeCode, $fileName);
|
36 |
-
if (
|
37 |
-
return $
|
38 |
}
|
39 |
|
40 |
-
return
|
41 |
}
|
42 |
|
43 |
/**
|
@@ -47,23 +49,35 @@ class Yireo_EmailOverride_Model_Translate extends Mage_Core_Model_Translate
|
|
47 |
* @param string $file
|
48 |
* @param string $type
|
49 |
* @param string $localeCode
|
|
|
50 |
* @return string
|
51 |
*/
|
52 |
-
public function getTemplateFile($file, $type, $localeCode=null)
|
53 |
{
|
54 |
if (is_null($localeCode) || preg_match('/[^a-zA-Z_]/', $localeCode)) {
|
55 |
$localeCode = $this->getLocale();
|
56 |
}
|
57 |
|
58 |
-
$filePath = $this->getLocaleOverrideFile($localeCode, 'template'.DS
|
59 |
if (empty($filePath) || !file_exists($filePath)) {
|
60 |
return parent::getTemplateFile($file, $type, $localeCode);
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
$ioAdapter = new Varien_Io_File();
|
64 |
-
$ioAdapter->open(array('path' =>
|
65 |
-
|
66 |
-
return (string)
|
67 |
}
|
68 |
|
69 |
/**
|
@@ -77,20 +91,19 @@ class Yireo_EmailOverride_Model_Translate extends Mage_Core_Model_Translate
|
|
77 |
protected function getLocaleOverrideFile($localeCode, $fileName)
|
78 |
{
|
79 |
$store = null;
|
80 |
-
if(!empty($this->_config['store'])) {
|
81 |
$store = $this->_config['store'];
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
return Mage::helper('emailoverride')->getLocaleOverrideFile($localeCode, $fileName, $store);
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
* Loading data from module translation files
|
90 |
*
|
91 |
* @param string $moduleName
|
92 |
-
* @param
|
93 |
-
* @param bool
|
94 |
*
|
95 |
* @return Mage_Core_Model_Translate
|
96 |
*/
|
@@ -100,11 +113,13 @@ class Yireo_EmailOverride_Model_Translate extends Mage_Core_Model_Translate
|
|
100 |
$file = $this->_getModuleFilePath($moduleName, $file);
|
101 |
$baseFile = basename($file);
|
102 |
$overrideFile = Mage::getDesign()->getLocaleFileName($baseFile);
|
103 |
-
|
|
|
104 |
$file = $overrideFile;
|
105 |
}
|
106 |
$this->_addData($this->_getFileData($file), $moduleName, $forceReload);
|
107 |
}
|
|
|
108 |
return $this;
|
109 |
}
|
110 |
|
@@ -118,18 +133,24 @@ class Yireo_EmailOverride_Model_Translate extends Mage_Core_Model_Translate
|
|
118 |
protected function _loadThemeTranslation($forceReload = false)
|
119 |
{
|
120 |
// Check for fallback support
|
121 |
-
if (
|
122 |
return parent::_loadThemeTranslation($forceReload);
|
123 |
}
|
124 |
|
125 |
-
|
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 |
|
130 |
-
foreach ($fallbacks as $fallback)
|
131 |
-
|
132 |
-
|
|
|
|
|
133 |
$fallbackFile = $designPackage->getLocaleFileName('translate.csv', array('_package' => $fallback['_package']));
|
134 |
$this->_addData($this->_getFileData($fallbackFile), false, $forceReload);
|
135 |
}
|
@@ -137,6 +158,23 @@ class Yireo_EmailOverride_Model_Translate extends Mage_Core_Model_Translate
|
|
137 |
// Now add current package translate.csv
|
138 |
$file = Mage::getDesign()->getLocaleFileName('translate.csv');
|
139 |
$this->_addData($this->_getFileData($file), false, $forceReload);
|
|
|
140 |
return $this;
|
141 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Yireo EmailOverride for Magento
|
4 |
*
|
5 |
* @package Yireo_EmailOverride
|
6 |
+
* @author Yireo (https://www.yireo.com/)
|
7 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
8 |
* @license Open Source License (OSL v3)
|
9 |
*/
|
10 |
|
23 |
*/
|
24 |
protected function _getModuleFilePath($module, $fileName)
|
25 |
{
|
26 |
+
// If this is the backend, we return to the default
|
27 |
+
if ($this->isAdmin() == true) {
|
28 |
return parent::_getModuleFilePath($module, $fileName);
|
29 |
}
|
30 |
|
31 |
+
// If no locale is set, we return to the default
|
32 |
$localeCode = $this->getLocale();
|
33 |
if (empty($localeCode)) {
|
34 |
return parent::_getModuleFilePath($module, $fileName);
|
35 |
}
|
36 |
|
37 |
$filePath = $this->getLocaleOverrideFile($localeCode, $fileName);
|
38 |
+
if (empty($filePath) || file_exists($filePath) == false) {
|
39 |
+
return parent::_getModuleFilePath($module, $fileName);
|
40 |
}
|
41 |
|
42 |
+
return $filePath;
|
43 |
}
|
44 |
|
45 |
/**
|
49 |
* @param string $file
|
50 |
* @param string $type
|
51 |
* @param string $localeCode
|
52 |
+
*
|
53 |
* @return string
|
54 |
*/
|
55 |
+
public function getTemplateFile($file, $type, $localeCode = null)
|
56 |
{
|
57 |
if (is_null($localeCode) || preg_match('/[^a-zA-Z_]/', $localeCode)) {
|
58 |
$localeCode = $this->getLocale();
|
59 |
}
|
60 |
|
61 |
+
$filePath = $this->getLocaleOverrideFile($localeCode, 'template' . DS . $type . DS . $file);
|
62 |
if (empty($filePath) || !file_exists($filePath)) {
|
63 |
return parent::getTemplateFile($file, $type, $localeCode);
|
64 |
}
|
65 |
|
66 |
+
return $this->readFileContents($filePath, Mage::getBaseDir('locale'));
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @param $filePath
|
71 |
+
* @param $path
|
72 |
+
*
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
protected function readFileContents($filePath, $path)
|
76 |
+
{
|
77 |
$ioAdapter = new Varien_Io_File();
|
78 |
+
$ioAdapter->open(array('path' => $path));
|
79 |
+
|
80 |
+
return (string)$ioAdapter->read($filePath);
|
81 |
}
|
82 |
|
83 |
/**
|
91 |
protected function getLocaleOverrideFile($localeCode, $fileName)
|
92 |
{
|
93 |
$store = null;
|
94 |
+
if (!empty($this->_config['store'])) {
|
95 |
$store = $this->_config['store'];
|
96 |
}
|
97 |
|
98 |
+
return $this->getModuleHelper()->getLocaleOverrideFile($localeCode, $fileName, $store);
|
|
|
99 |
}
|
100 |
|
101 |
/**
|
102 |
* Loading data from module translation files
|
103 |
*
|
104 |
* @param string $moduleName
|
105 |
+
* @param array $files
|
106 |
+
* @param bool $forceReload (optional)
|
107 |
*
|
108 |
* @return Mage_Core_Model_Translate
|
109 |
*/
|
113 |
$file = $this->_getModuleFilePath($moduleName, $file);
|
114 |
$baseFile = basename($file);
|
115 |
$overrideFile = Mage::getDesign()->getLocaleFileName($baseFile);
|
116 |
+
|
117 |
+
if (file_exists($overrideFile)) {
|
118 |
$file = $overrideFile;
|
119 |
}
|
120 |
$this->_addData($this->_getFileData($file), $moduleName, $forceReload);
|
121 |
}
|
122 |
+
|
123 |
return $this;
|
124 |
}
|
125 |
|
133 |
protected function _loadThemeTranslation($forceReload = false)
|
134 |
{
|
135 |
// Check for fallback support
|
136 |
+
if ($this->getModuleHelper()->supportsDesignFallback() == false) {
|
137 |
return parent::_loadThemeTranslation($forceReload);
|
138 |
}
|
139 |
|
140 |
+
/** @var Mage_Core_Model_Design_Fallback $fallbackModel */
|
141 |
$fallbackModel = Mage::getModel('core/design_fallback');
|
142 |
+
|
143 |
+
/** @var Mage_Core_Model_Design_Package $designPackage */
|
144 |
$designPackage = Mage::getSingleton('core/design_package');
|
145 |
+
|
146 |
+
// First add fallback package translate.csv files
|
147 |
$fallbacks = $fallbackModel->getFallbackScheme($designPackage->getArea(), $designPackage->getPackageName(), $designPackage->getTheme('layout'));
|
148 |
|
149 |
+
foreach ($fallbacks as $fallback) {
|
150 |
+
if (!isset($fallback['_package']) || !isset($fallback['_theme'])) {
|
151 |
+
continue;
|
152 |
+
}
|
153 |
+
|
154 |
$fallbackFile = $designPackage->getLocaleFileName('translate.csv', array('_package' => $fallback['_package']));
|
155 |
$this->_addData($this->_getFileData($fallbackFile), false, $forceReload);
|
156 |
}
|
158 |
// Now add current package translate.csv
|
159 |
$file = Mage::getDesign()->getLocaleFileName('translate.csv');
|
160 |
$this->_addData($this->_getFileData($file), false, $forceReload);
|
161 |
+
|
162 |
return $this;
|
163 |
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* @return bool
|
167 |
+
*/
|
168 |
+
protected function isAdmin()
|
169 |
+
{
|
170 |
+
return (bool) Mage::app()->getStore()->isAdmin();
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* @return Yireo_EmailOverride_Helper_Data
|
175 |
+
*/
|
176 |
+
protected function getModuleHelper()
|
177 |
+
{
|
178 |
+
return Mage::helper('emailoverride');
|
179 |
+
}
|
180 |
}
|
app/code/community/Yireo/EmailOverride/etc/config.xml
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
* Yireo EmailOverride for Magento
|
5 |
*
|
6 |
* @package Yireo_EmailOverride
|
7 |
-
* @author Yireo (
|
8 |
-
* @copyright Copyright
|
9 |
* @license Open Source License (OSL v3)
|
10 |
*/
|
11 |
-->
|
@@ -13,7 +13,7 @@
|
|
13 |
|
14 |
<modules>
|
15 |
<Yireo_EmailOverride>
|
16 |
-
<version>0.2.
|
17 |
</Yireo_EmailOverride>
|
18 |
</modules>
|
19 |
|
4 |
* Yireo EmailOverride for Magento
|
5 |
*
|
6 |
* @package Yireo_EmailOverride
|
7 |
+
* @author Yireo (https://www.yireo.com/)
|
8 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
9 |
* @license Open Source License (OSL v3)
|
10 |
*/
|
11 |
-->
|
13 |
|
14 |
<modules>
|
15 |
<Yireo_EmailOverride>
|
16 |
+
<version>0.2.11</version>
|
17 |
</Yireo_EmailOverride>
|
18 |
</modules>
|
19 |
|
app/etc/modules/Yireo_EmailOverride.xml
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
* Yireo EmailOverride-module for Magento
|
5 |
*
|
6 |
* @package Yireo_EmailOverride
|
7 |
-
* @author Yireo (
|
8 |
-
* @copyright Copyright 2015 Yireo (
|
9 |
* @license Open Software License
|
10 |
*/
|
11 |
-->
|
4 |
* Yireo EmailOverride-module for Magento
|
5 |
*
|
6 |
* @package Yireo_EmailOverride
|
7 |
+
* @author Yireo (https://www.yireo.com/)
|
8 |
+
* @copyright Copyright 2015 Yireo (https://www.yireo.com/)
|
9 |
* @license Open Software License
|
10 |
*/
|
11 |
-->
|
package.xml
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>Yireo_EmailOverride</name><version>0.2.
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>Yireo_EmailOverride</name><version>0.2.11</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>2016-03-04</date><time>0:07:37</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="c362a63c4444a6533173324ed9b05bdd"/></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="EmailOverride"><dir name="etc"><file name="config.xml" hash="d4dbefa61d5ca93dd7ecbe799fe7eb26"/></dir><dir name="Model"><file name="Translate.php" hash="71a4af18e761a0cc99c00433123f5562"/><dir name="Email"><file name="Template.php" hash="e67050598865c59bdf75ca8b40130cba"/></dir></dir><dir name="Helper"><file name="Data.php" hash="5e05260ef4d6a4f4ba71ebffb0546e3f"/></dir></dir></dir></dir></dir></dir></target></contents></package>
|