Version Notes
# Installation
We STRONGLY recommend installing and testing the plugin in a test environment before going live. Please back up your database before installing.
Further information can be found at http://eurotext.screenstepslive.com/s/translationmanager
# Update
Only install once all ongoing projects have been completed / successfully imported.
We STRONGLY recommend installing and testing the update in a test environment before going live. Please back up your database before installing.
Further information can be found at http://eurotext.screenstepslive.com/s/translationmanager
# General terms & conditions for Eurotext AG software applications
http://eurotext.de/en/contact/terms-and-conditions/
Download this release
Release Info
Developer | Eurotext AG |
Extension | eurotext_translationMANAGER |
Version | 3.2.16 |
Comparing to | |
See all releases |
Code changes from version 3.2.14 to 3.2.16
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Grid/Massaction.php +5 -5
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Main.php +1 -79
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Products.php +9 -9
- app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Products/CategoryTreeAjax.php +1 -0
- app/code/community/Eurotext/TranslationManager/Block/Status.php +11 -10
- app/code/community/Eurotext/TranslationManager/Helper/Data.php +9 -9
- app/code/community/Eurotext/TranslationManager/Helper/Eurotext.php +21 -22
- app/code/community/Eurotext/TranslationManager/Helper/Filesystem.php +10 -16
- app/code/community/Eurotext/TranslationManager/Model/EurotextLanguages.php +4 -4
- app/code/community/Eurotext/TranslationManager/Model/Export/Project.php +9 -10
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/Attribute.php +16 -16
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/Category.php +19 -17
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/CmsBlock.php +15 -16
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/CmsPage.php +20 -20
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/CreateControlFile.php +25 -35
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/EmailDatabaseTemplates.php +7 -7
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/EmailFileTemplates.php +6 -6
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/FtpUpload.php +12 -12
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/LocaleCsvFiles.php +9 -8
- app/code/community/Eurotext/TranslationManager/Model/Export/Project/Product.php +41 -39
- app/code/community/Eurotext/TranslationManager/Model/Extractor.php +1 -1
- app/code/community/Eurotext/TranslationManager/Model/Import/Project.php +15 -27
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/Attributes.php +8 -8
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/Categories.php +5 -5
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/CmsBlocks.php +6 -7
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/CmsPages.php +7 -6
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/EmailTemplates.php +2 -2
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/LocaleCsvFiles.php +4 -5
- app/code/community/Eurotext/TranslationManager/Model/Import/Project/Product.php +22 -25
- app/code/community/Eurotext/TranslationManager/Model/Import/Queue.php +2 -1
- app/code/community/Eurotext/TranslationManager/Model/Import/Validator.php +2 -2
- app/code/community/Eurotext/TranslationManager/Model/Observer.php +8 -8
- app/code/community/Eurotext/TranslationManager/Model/ProductLoader.php +19 -2
- app/code/community/Eurotext/TranslationManager/Model/Project.php +1 -5
- app/code/community/Eurotext/TranslationManager/Model/Resource/Csv/Collection.php +3 -4
- app/code/community/Eurotext/TranslationManager/Model/Xml/Import/Cms/BlockReader.php +4 -5
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/.DS_Store +0 -0
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Project/ExportController.php +6 -6
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/Project/ImportController.php +5 -7
- app/code/community/Eurotext/TranslationManager/controllers/Adminhtml/Eurotext/ProjectController.php +34 -12
- app/code/community/Eurotext/TranslationManager/etc/config.xml +1 -1
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/install-3.0.0.php +1 -1
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/mysql4-install-1.0.0.0.php +68 -68
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/mysql4-upgrade-1.0.0.5-1.0.0.6.php +7 -7
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/mysql4-upgrade-1.0.0.7-1.0.0.8.php +1 -1
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.1.2.1-1.2.0.0.php +8 -8
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.0.0-1.2.0.1.php +3 -3
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.0.1-1.2.0.2.php +9 -9
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.0.2-1.2.0.3.php +12 -12
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.1-1.2.2.php +3 -3
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-1.2.2-2.0.0.php +2 -2
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.0-2.0.1.php +2 -2
- app/code/community/Eurotext/TranslationManager/sql/eurotext_translationmanager_setup/upgrade-2.0.1-2.0.2.php +2 -2
- app/code/community/Eurotext/Uploader/Block/Abstract.php +4 -4
- app/code/community/Eurotext/Uploader/Helper/File.php +0 -1
- app/code/community/Eurotext/Uploader/Model/Config/Abstract.php +2 -4
- app/design/adminhtml/base/default/template/eurotext/translationmanager/export/overview.phtml +2 -2
- app/design/adminhtml/base/default/template/eurotext/translationmanager/help.phtml +58 -24
- package.xml +5 -124
app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Grid/Massaction.php
CHANGED
@@ -31,10 +31,10 @@ class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Grid
|
|
31 |
$this->getParentBlock()->getSelected()
|
32 |
);
|
33 |
if ($selected) {
|
34 |
-
return
|
35 |
-
} else {
|
36 |
-
return '';
|
37 |
}
|
|
|
|
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -51,8 +51,8 @@ class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Grid
|
|
51 |
$selected = explode(',', $selected);
|
52 |
|
53 |
return $selected;
|
54 |
-
} else {
|
55 |
-
return [];
|
56 |
}
|
|
|
|
|
57 |
}
|
58 |
}
|
31 |
$this->getParentBlock()->getSelected()
|
32 |
);
|
33 |
if ($selected) {
|
34 |
+
return implode(',', $selected);
|
|
|
|
|
35 |
}
|
36 |
+
|
37 |
+
return '';
|
38 |
}
|
39 |
|
40 |
/**
|
51 |
$selected = explode(',', $selected);
|
52 |
|
53 |
return $selected;
|
|
|
|
|
54 |
}
|
55 |
+
|
56 |
+
return [];
|
57 |
}
|
58 |
}
|
app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Main.php
CHANGED
@@ -109,85 +109,7 @@ class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Main
|
|
109 |
$fieldset = $form->addFieldset(
|
110 |
'exported_data',
|
111 |
[
|
112 |
-
'legend' => $helper->__('
|
113 |
-
]
|
114 |
-
);
|
115 |
-
|
116 |
-
$fieldset->addField(
|
117 |
-
'comment',
|
118 |
-
'note',
|
119 |
-
[
|
120 |
-
'text' => '<b>' . $helper->__('Only data is exported, which is not translated yet.') . '</b>',
|
121 |
-
]
|
122 |
-
);
|
123 |
-
|
124 |
-
$fieldset->addField('productmode_hidden', 'hidden', ['name' => 'productmode', 'value' => 0]);
|
125 |
-
$fieldset->addField(
|
126 |
-
'productmode',
|
127 |
-
'checkbox',
|
128 |
-
[
|
129 |
-
'name' => 'productmode',
|
130 |
-
'label' => $helper->__('Products'),
|
131 |
-
'value' => 1,
|
132 |
-
'checked' => $project->getProductmode(),
|
133 |
-
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
134 |
-
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
135 |
-
]
|
136 |
-
);
|
137 |
-
|
138 |
-
$fieldset->addField('categorymode_hidden', 'hidden', ['name' => 'categorymode', 'value' => 0]);
|
139 |
-
$fieldset->addField(
|
140 |
-
'categorymode',
|
141 |
-
'checkbox',
|
142 |
-
[
|
143 |
-
'name' => 'categorymode',
|
144 |
-
'label' => $helper->__('Categories'),
|
145 |
-
'value' => 1,
|
146 |
-
'checked' => $project->getCategorymode(),
|
147 |
-
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
148 |
-
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
149 |
-
]
|
150 |
-
);
|
151 |
-
|
152 |
-
$fieldset->addField('cmsmode_hidden', 'hidden', ['name' => 'cmsmode', 'value' => 0]);
|
153 |
-
$fieldset->addField(
|
154 |
-
'cmsmode',
|
155 |
-
'checkbox',
|
156 |
-
[
|
157 |
-
'name' => 'cmsmode',
|
158 |
-
'label' => $helper->__('CMS Pages and Blocks'),
|
159 |
-
'value' => 1,
|
160 |
-
'checked' => $project->getCmsmode(),
|
161 |
-
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
162 |
-
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
163 |
-
]
|
164 |
-
);
|
165 |
-
|
166 |
-
$fieldset->addField('templatemode_hidden', 'hidden', ['name' => 'templatemode', 'value' => 0]);
|
167 |
-
$fieldset->addField(
|
168 |
-
'templatemode',
|
169 |
-
'checkbox',
|
170 |
-
[
|
171 |
-
'name' => 'templatemode',
|
172 |
-
'label' => $helper->__('Email Templates'),
|
173 |
-
'value' => 1,
|
174 |
-
'checked' => $project->getTemplatemode(),
|
175 |
-
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
176 |
-
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
177 |
-
]
|
178 |
-
);
|
179 |
-
|
180 |
-
$fieldset->addField('langfilesmode_hidden', 'hidden', ['name' => 'langfilesmode', 'value' => 0]);
|
181 |
-
$fieldset->addField(
|
182 |
-
'langfilesmode',
|
183 |
-
'checkbox',
|
184 |
-
[
|
185 |
-
'name' => 'langfilesmode',
|
186 |
-
'label' => $helper->__('Translation files'),
|
187 |
-
'value' => 1,
|
188 |
-
'checked' => $project->getLangfilesmode(),
|
189 |
-
'disabled' => !$project->isEditable() ? 'disabled="disabled"' : '',
|
190 |
-
'onclick' => 'this.value = this.checked ? 1 : 0;',
|
191 |
]
|
192 |
);
|
193 |
|
109 |
$fieldset = $form->addFieldset(
|
110 |
'exported_data',
|
111 |
[
|
112 |
+
'legend' => $helper->__('Export all data of the following selection'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
]
|
114 |
);
|
115 |
|
app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Products.php
CHANGED
@@ -303,17 +303,17 @@ class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Prod
|
|
303 |
if (!$category->getIsAnchor()) {
|
304 |
$collection = $category->getProductCollection();
|
305 |
|
306 |
-
return $collection;
|
307 |
-
} else {
|
308 |
-
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
|
309 |
-
->addPathFilter("^{$category->getPath()}/[0-9]*quot;);
|
310 |
-
$categories = $categoryCollection->getAllIds();
|
311 |
-
$categories[] = $category->getId();
|
312 |
-
$collection->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id')
|
313 |
-
->addAttributeToFilter('category_id', ['in' => $categories]);
|
314 |
-
|
315 |
return $collection;
|
316 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
}
|
318 |
|
319 |
return $collection;
|
303 |
if (!$category->getIsAnchor()) {
|
304 |
$collection = $category->getProductCollection();
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
return $collection;
|
307 |
}
|
308 |
+
|
309 |
+
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
|
310 |
+
->addPathFilter("^{$category->getPath()}/[0-9]*quot;);
|
311 |
+
$categories = $categoryCollection->getAllIds();
|
312 |
+
$categories[] = $category->getId();
|
313 |
+
$collection->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id')
|
314 |
+
->addAttributeToFilter('category_id', ['in' => $categories]);
|
315 |
+
|
316 |
+
return $collection;
|
317 |
}
|
318 |
|
319 |
return $collection;
|
app/code/community/Eurotext/TranslationManager/Block/Adminhtml/Eurotext/Project/Edit/Tab/Products/CategoryTreeAjax.php
CHANGED
@@ -12,6 +12,7 @@ class Eurotext_TranslationManager_Block_Adminhtml_Eurotext_Project_Edit_Tab_Prod
|
|
12 |
|
13 |
protected function _getNodeJson($node, $level = 0)
|
14 |
{
|
|
|
15 |
$item = parent::_getNodeJson($node, $level);
|
16 |
if (in_array($node->getId(), $this->getSelectedCategories())) {
|
17 |
$item['checked'] = true;
|
12 |
|
13 |
protected function _getNodeJson($node, $level = 0)
|
14 |
{
|
15 |
+
/** @var $item string[] */
|
16 |
$item = parent::_getNodeJson($node, $level);
|
17 |
if (in_array($node->getId(), $this->getSelectedCategories())) {
|
18 |
$item['checked'] = true;
|
app/code/community/Eurotext/TranslationManager/Block/Status.php
CHANGED
@@ -65,7 +65,7 @@ class Eurotext_TranslationManager_Block_Status extends Mage_Adminhtml_Block_Widg
|
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
* @return string
|
69 |
*/
|
70 |
private function getLanguagesInStores()
|
71 |
{
|
@@ -96,22 +96,22 @@ class Eurotext_TranslationManager_Block_Status extends Mage_Adminhtml_Block_Widg
|
|
96 |
'module_version' => [
|
97 |
'name' => $this->__('Plugin version'),
|
98 |
'value_now' => $this->configHelper->getModuleVersion(),
|
99 |
-
'value_required' =>
|
100 |
],
|
101 |
'php_version' => [
|
102 |
'name' => $this->__('PHP version'),
|
103 |
'value_now' => PHP_VERSION,
|
104 |
-
'value_required' =>
|
105 |
],
|
106 |
'ftp_extension' => [
|
107 |
'name' => $this->__('FTP-Extension'),
|
108 |
-
'value_now' => extension_loaded('ftp') ? $this->__
|
109 |
-
'value_required' => $this->__
|
110 |
],
|
111 |
'zip_extension' => [
|
112 |
'name' => $this->__('ZIP-Extension'),
|
113 |
-
'value_now' => extension_loaded('zip') ? $this->__
|
114 |
-
'value_required' => $this->__
|
115 |
],
|
116 |
'max_execution_time' => [
|
117 |
'name' => $this->__("Value for 'max_execution_time'"),
|
@@ -221,7 +221,7 @@ class Eurotext_TranslationManager_Block_Status extends Mage_Adminhtml_Block_Widg
|
|
221 |
);
|
222 |
} else {
|
223 |
$ftpMessage = $this->__(
|
224 |
-
|
225 |
);
|
226 |
$fieldset->addField(
|
227 |
'url_key_scope',
|
@@ -258,11 +258,12 @@ class Eurotext_TranslationManager_Block_Status extends Mage_Adminhtml_Block_Widg
|
|
258 |
|
259 |
/**
|
260 |
* @param string $dir
|
|
|
261 |
*/
|
262 |
private function checkDirectory($dir)
|
263 |
{
|
264 |
-
if
|
265 |
-
|
266 |
}
|
267 |
|
268 |
return is_dir_writeable($dir);
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
+
* @return string[][]
|
69 |
*/
|
70 |
private function getLanguagesInStores()
|
71 |
{
|
96 |
'module_version' => [
|
97 |
'name' => $this->__('Plugin version'),
|
98 |
'value_now' => $this->configHelper->getModuleVersion(),
|
99 |
+
'value_required' => '—',
|
100 |
],
|
101 |
'php_version' => [
|
102 |
'name' => $this->__('PHP version'),
|
103 |
'value_now' => PHP_VERSION,
|
104 |
+
'value_required' => '> 5.5.0',
|
105 |
],
|
106 |
'ftp_extension' => [
|
107 |
'name' => $this->__('FTP-Extension'),
|
108 |
+
'value_now' => extension_loaded('ftp') ? $this->__('Installed') : $this->__('Missing'),
|
109 |
+
'value_required' => $this->__('Installed'),
|
110 |
],
|
111 |
'zip_extension' => [
|
112 |
'name' => $this->__('ZIP-Extension'),
|
113 |
+
'value_now' => extension_loaded('zip') ? $this->__('Installed') : $this->__('Missing'),
|
114 |
+
'value_required' => $this->__('Installed'),
|
115 |
],
|
116 |
'max_execution_time' => [
|
117 |
'name' => $this->__("Value for 'max_execution_time'"),
|
221 |
);
|
222 |
} else {
|
223 |
$ftpMessage = $this->__(
|
224 |
+
'Your Magento installation allows the translation of URLs of categories and products.'
|
225 |
);
|
226 |
$fieldset->addField(
|
227 |
'url_key_scope',
|
258 |
|
259 |
/**
|
260 |
* @param string $dir
|
261 |
+
* @return bool
|
262 |
*/
|
263 |
private function checkDirectory($dir)
|
264 |
{
|
265 |
+
if (!@mkdir($dir, 0777, true) && !is_dir($dir)) {
|
266 |
+
throw new Exception(sprintf('Directory %s could not be created.', $dir));
|
267 |
}
|
268 |
|
269 |
return is_dir_writeable($dir);
|
app/code/community/Eurotext/TranslationManager/Helper/Data.php
CHANGED
@@ -5,27 +5,27 @@ class Eurotext_TranslationManager_Helper_Data extends Mage_Core_Helper_Abstract
|
|
5 |
/**
|
6 |
* @var string
|
7 |
*/
|
8 |
-
private $helpUrl =
|
9 |
|
10 |
/**
|
11 |
* @var string
|
12 |
*/
|
13 |
-
private $liveRegistrationEmail =
|
14 |
|
15 |
/**
|
16 |
* @var string
|
17 |
*/
|
18 |
-
private $liveRegistrationEmailName =
|
19 |
|
20 |
/**
|
21 |
* @var string
|
22 |
*/
|
23 |
-
private $debugRegistrationEmail =
|
24 |
|
25 |
/**
|
26 |
* @var string
|
27 |
*/
|
28 |
-
private $debugRegistrationEmailName =
|
29 |
|
30 |
/**
|
31 |
* @var Eurotext_TranslationManager_Helper_Config
|
@@ -92,14 +92,14 @@ class Eurotext_TranslationManager_Helper_Data extends Mage_Core_Helper_Abstract
|
|
92 |
{
|
93 |
$recipient = [];
|
94 |
if ($this->configHelper->isDebugMode()) {
|
95 |
-
$recipient
|
96 |
-
$recipient
|
97 |
|
98 |
return $recipient;
|
99 |
}
|
100 |
|
101 |
-
$recipient
|
102 |
-
$recipient
|
103 |
|
104 |
return $recipient;
|
105 |
}
|
5 |
/**
|
6 |
* @var string
|
7 |
*/
|
8 |
+
private $helpUrl = 'http://www.eurotext.de';
|
9 |
|
10 |
/**
|
11 |
* @var string
|
12 |
*/
|
13 |
+
private $liveRegistrationEmail = 'magento@eurotext.de';
|
14 |
|
15 |
/**
|
16 |
* @var string
|
17 |
*/
|
18 |
+
private $liveRegistrationEmailName = 'Eurotext Magento (Live)';
|
19 |
|
20 |
/**
|
21 |
* @var string
|
22 |
*/
|
23 |
+
private $debugRegistrationEmail = 'debug@eurotext.de';
|
24 |
|
25 |
/**
|
26 |
* @var string
|
27 |
*/
|
28 |
+
private $debugRegistrationEmailName = 'Eurotext Magento (Debug)';
|
29 |
|
30 |
/**
|
31 |
* @var Eurotext_TranslationManager_Helper_Config
|
92 |
{
|
93 |
$recipient = [];
|
94 |
if ($this->configHelper->isDebugMode()) {
|
95 |
+
$recipient['email'] = $this->debugRegistrationEmail;
|
96 |
+
$recipient['name'] = $this->debugRegistrationEmailName;
|
97 |
|
98 |
return $recipient;
|
99 |
}
|
100 |
|
101 |
+
$recipient['email'] = $this->liveRegistrationEmail;
|
102 |
+
$recipient['name'] = $this->liveRegistrationEmailName;
|
103 |
|
104 |
return $recipient;
|
105 |
}
|
app/code/community/Eurotext/TranslationManager/Helper/Eurotext.php
CHANGED
@@ -10,9 +10,9 @@ class Eurotext_TranslationManager_Helper_Eurotext extends Mage_Core_Helper_Abstr
|
|
10 |
$lastSep = strrpos($rpath, DIRECTORY_SEPARATOR);
|
11 |
if ($lastSep >= 0) {
|
12 |
return substr($rpath, 0, $lastSep);
|
13 |
-
} else {
|
14 |
-
return $path;
|
15 |
}
|
|
|
|
|
16 |
}
|
17 |
|
18 |
// Extract directory-part of path
|
@@ -81,11 +81,10 @@ class Eurotext_TranslationManager_Helper_Eurotext extends Mage_Core_Helper_Abstr
|
|
81 |
return false;
|
82 |
}
|
83 |
|
84 |
-
public function zipFolder($directory, $zipFile, $comment =
|
85 |
{
|
86 |
-
|
87 |
$helper = Mage::helper('eurotext_translationmanager');
|
88 |
-
if (!class_exists
|
89 |
$helper->log('ZipArchive Class does not exist!', Zend_Log::CRIT);
|
90 |
|
91 |
return false;
|
@@ -96,7 +95,7 @@ class Eurotext_TranslationManager_Helper_Eurotext extends Mage_Core_Helper_Abstr
|
|
96 |
|
97 |
$mode = file_exists($zipFile) ? ZipArchive::OVERWRITE : ZipArchive::CREATE;
|
98 |
|
99 |
-
$zip = new ZipArchive
|
100 |
$zipOpeningResult = $zip->open($zipFile, $mode);
|
101 |
|
102 |
if ($zipOpeningResult !== true) {
|
@@ -106,21 +105,20 @@ class Eurotext_TranslationManager_Helper_Eurotext extends Mage_Core_Helper_Abstr
|
|
106 |
return false;
|
107 |
}
|
108 |
|
109 |
-
if ($comment !=
|
110 |
$zip->setArchiveComment($comment);
|
111 |
}
|
112 |
|
113 |
foreach ($items as $item) {
|
114 |
if ($item['full_path'] == $zipFile) {
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
}
|
124 |
}
|
125 |
}
|
126 |
|
@@ -145,20 +143,21 @@ class Eurotext_TranslationManager_Helper_Eurotext extends Mage_Core_Helper_Abstr
|
|
145 |
while (false !== ($item = readdir($dir))) {
|
146 |
$full_path = $dirpath . DIRECTORY_SEPARATOR . $item;
|
147 |
if (($item == ".") || ($item == "..")) {
|
148 |
-
|
149 |
-
}
|
|
|
150 |
$rvItem = [];
|
151 |
$rvItem['full_path'] = $full_path;
|
152 |
$rvItem['name'] = $item;
|
153 |
-
$rvItem['type'] =
|
154 |
-
|
155 |
} elseif (is_dir($full_path)) {
|
156 |
if ($enumerateDirs) {
|
157 |
$rvItem = [];
|
158 |
$rvItem['full_path'] = $full_path;
|
159 |
$rvItem['name'] = $item;
|
160 |
-
$rvItem['type'] =
|
161 |
-
|
162 |
}
|
163 |
|
164 |
if ($recurse) {
|
@@ -178,7 +177,7 @@ class Eurotext_TranslationManager_Helper_Eurotext extends Mage_Core_Helper_Abstr
|
|
178 |
}
|
179 |
|
180 |
if ($sortResult) {
|
181 |
-
usort($result, [$this,
|
182 |
}
|
183 |
|
184 |
return $result;
|
10 |
$lastSep = strrpos($rpath, DIRECTORY_SEPARATOR);
|
11 |
if ($lastSep >= 0) {
|
12 |
return substr($rpath, 0, $lastSep);
|
|
|
|
|
13 |
}
|
14 |
+
|
15 |
+
return $path;
|
16 |
}
|
17 |
|
18 |
// Extract directory-part of path
|
81 |
return false;
|
82 |
}
|
83 |
|
84 |
+
public function zipFolder($directory, $zipFile, $comment = '')
|
85 |
{
|
|
|
86 |
$helper = Mage::helper('eurotext_translationmanager');
|
87 |
+
if (!class_exists(ZipArchive::class)) {
|
88 |
$helper->log('ZipArchive Class does not exist!', Zend_Log::CRIT);
|
89 |
|
90 |
return false;
|
95 |
|
96 |
$mode = file_exists($zipFile) ? ZipArchive::OVERWRITE : ZipArchive::CREATE;
|
97 |
|
98 |
+
$zip = new ZipArchive();
|
99 |
$zipOpeningResult = $zip->open($zipFile, $mode);
|
100 |
|
101 |
if ($zipOpeningResult !== true) {
|
105 |
return false;
|
106 |
}
|
107 |
|
108 |
+
if ($comment != '') {
|
109 |
$zip->setArchiveComment($comment);
|
110 |
}
|
111 |
|
112 |
foreach ($items as $item) {
|
113 |
if ($item['full_path'] == $zipFile) {
|
114 |
+
continue;
|
115 |
+
}
|
116 |
+
$inZipPath = substr($item['full_path'], strlen($dirpath) + 1);
|
117 |
|
118 |
+
if ($item['type'] == 'dir') {
|
119 |
+
$zip->addEmptyDir($inZipPath);
|
120 |
+
} else {
|
121 |
+
$zip->addFile($item['full_path'], $inZipPath);
|
|
|
122 |
}
|
123 |
}
|
124 |
|
143 |
while (false !== ($item = readdir($dir))) {
|
144 |
$full_path = $dirpath . DIRECTORY_SEPARATOR . $item;
|
145 |
if (($item == ".") || ($item == "..")) {
|
146 |
+
continue;
|
147 |
+
}
|
148 |
+
if ($enumerateFiles && is_file($full_path)) {
|
149 |
$rvItem = [];
|
150 |
$rvItem['full_path'] = $full_path;
|
151 |
$rvItem['name'] = $item;
|
152 |
+
$rvItem['type'] = 'file';
|
153 |
+
$result[] = $rvItem;
|
154 |
} elseif (is_dir($full_path)) {
|
155 |
if ($enumerateDirs) {
|
156 |
$rvItem = [];
|
157 |
$rvItem['full_path'] = $full_path;
|
158 |
$rvItem['name'] = $item;
|
159 |
+
$rvItem['type'] = 'dir';
|
160 |
+
$result[] = $rvItem;
|
161 |
}
|
162 |
|
163 |
if ($recurse) {
|
177 |
}
|
178 |
|
179 |
if ($sortResult) {
|
180 |
+
usort($result, [$this, 'compareFileItems']);
|
181 |
}
|
182 |
|
183 |
return $result;
|
app/code/community/Eurotext/TranslationManager/Helper/Filesystem.php
CHANGED
@@ -11,10 +11,8 @@ class Eurotext_TranslationManager_Helper_Filesystem
|
|
11 |
{
|
12 |
$xmlDir = $this->getExportXMLPath($project);
|
13 |
$xmlDir .= DS . $subdir;
|
14 |
-
if
|
15 |
-
|
16 |
-
|
17 |
-
return $xmlDir;
|
18 |
}
|
19 |
|
20 |
return $xmlDir;
|
@@ -39,7 +37,7 @@ class Eurotext_TranslationManager_Helper_Filesystem
|
|
39 |
*/
|
40 |
private function createHtaccessFile($dir)
|
41 |
{
|
42 |
-
$htaccessFilename = $dir . DS .
|
43 |
if (!is_file($htaccessFilename)) {
|
44 |
file_put_contents($htaccessFilename, "# Eurotext Export folder\nOrder Deny,Allow\nDeny From All");
|
45 |
}
|
@@ -53,10 +51,8 @@ class Eurotext_TranslationManager_Helper_Filesystem
|
|
53 |
private function createProjectExportDirectory(Eurotext_TranslationManager_Model_Project $project, $dir)
|
54 |
{
|
55 |
$dir .= DS . "projects/{$project->getId()}/export";
|
56 |
-
if
|
57 |
-
|
58 |
-
|
59 |
-
return $dir;
|
60 |
}
|
61 |
|
62 |
return $dir;
|
@@ -67,12 +63,10 @@ class Eurotext_TranslationManager_Helper_Filesystem
|
|
67 |
*/
|
68 |
private function tryCreateEurotextVarDirectory($dir)
|
69 |
{
|
70 |
-
if
|
71 |
-
|
72 |
-
Mage::
|
73 |
-
|
74 |
-
throw new Magento_Exception('Eurotext working directory could not be created.');
|
75 |
-
}
|
76 |
}
|
77 |
}
|
78 |
|
@@ -82,7 +76,7 @@ class Eurotext_TranslationManager_Helper_Filesystem
|
|
82 |
*/
|
83 |
public function getFilenameSafeString($filename)
|
84 |
{
|
85 |
-
$filename = trim
|
86 |
$filename = preg_replace('#[^a-z0-9-_.]#', '-', $filename);
|
87 |
|
88 |
do {
|
11 |
{
|
12 |
$xmlDir = $this->getExportXMLPath($project);
|
13 |
$xmlDir .= DS . $subdir;
|
14 |
+
if (!@mkdir($xmlDir, 0777, true) && !is_dir($xmlDir)) {
|
15 |
+
throw new Exception(sprintf('Directory %s could not be created.', $xmlDir));
|
|
|
|
|
16 |
}
|
17 |
|
18 |
return $xmlDir;
|
37 |
*/
|
38 |
private function createHtaccessFile($dir)
|
39 |
{
|
40 |
+
$htaccessFilename = $dir . DS . '.htaccess';
|
41 |
if (!is_file($htaccessFilename)) {
|
42 |
file_put_contents($htaccessFilename, "# Eurotext Export folder\nOrder Deny,Allow\nDeny From All");
|
43 |
}
|
51 |
private function createProjectExportDirectory(Eurotext_TranslationManager_Model_Project $project, $dir)
|
52 |
{
|
53 |
$dir .= DS . "projects/{$project->getId()}/export";
|
54 |
+
if (!@mkdir($dir, 0777, true) && !is_dir($dir)) {
|
55 |
+
throw new Exception(sprintf('Directory %s could not be created.', $dir));
|
|
|
|
|
56 |
}
|
57 |
|
58 |
return $dir;
|
63 |
*/
|
64 |
private function tryCreateEurotextVarDirectory($dir)
|
65 |
{
|
66 |
+
if (!@mkdir($dir, 0777, true) && !is_dir($dir)) {
|
67 |
+
Mage::helper('eurotext_translationmanager')
|
68 |
+
->log('Working directory could not be created in ' . Mage::getBaseDir('var'), Zend_Log::CRIT);
|
69 |
+
throw new Magento_Exception('Eurotext working directory could not be created.');
|
|
|
|
|
70 |
}
|
71 |
}
|
72 |
|
76 |
*/
|
77 |
public function getFilenameSafeString($filename)
|
78 |
{
|
79 |
+
$filename = strtolower(trim($filename));
|
80 |
$filename = preg_replace('#[^a-z0-9-_.]#', '-', $filename);
|
81 |
|
82 |
do {
|
app/code/community/Eurotext/TranslationManager/Model/EurotextLanguages.php
CHANGED
@@ -122,8 +122,8 @@ class Eurotext_TranslationManager_Model_EurotextLanguages
|
|
122 |
|
123 |
return [
|
124 |
'locale' => $locale,
|
125 |
-
'locale_eurotext' =>
|
126 |
-
'lang_name' => Mage::helper('eurotext_translationmanager')->__
|
127 |
'supported' => false,
|
128 |
];
|
129 |
}
|
@@ -138,8 +138,8 @@ class Eurotext_TranslationManager_Model_EurotextLanguages
|
|
138 |
|
139 |
return [
|
140 |
'locale' => $locale,
|
141 |
-
'locale_eurotext' =>
|
142 |
-
'lang_name' => Mage::helper('eurotext_translationmanager')->__
|
143 |
'supported' => false,
|
144 |
];
|
145 |
}
|
122 |
|
123 |
return [
|
124 |
'locale' => $locale,
|
125 |
+
'locale_eurotext' => '-',
|
126 |
+
'lang_name' => Mage::helper('eurotext_translationmanager')->__('Unsupported language'),
|
127 |
'supported' => false,
|
128 |
];
|
129 |
}
|
138 |
|
139 |
return [
|
140 |
'locale' => $locale,
|
141 |
+
'locale_eurotext' => '-',
|
142 |
+
'lang_name' => Mage::helper('eurotext_translationmanager')->__('Unsupported language'),
|
143 |
'supported' => false,
|
144 |
];
|
145 |
}
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project.php
CHANGED
@@ -63,7 +63,7 @@ class Eurotext_TranslationManager_Model_Export_Project
|
|
63 |
->validateFtpConnection();
|
64 |
$this->setDataOnStatusBlock(
|
65 |
$block,
|
66 |
-
['offset' =>
|
67 |
);
|
68 |
} elseif ($step == self::STEP_BUILD_LANGXML) {
|
69 |
$rvSub = $this->ajaxexportAction_BuildLangXML($project, $offset);
|
@@ -92,18 +92,18 @@ class Eurotext_TranslationManager_Model_Export_Project
|
|
92 |
} elseif ($step == self::STEP_GENERATE_CONTROL_FILE) {
|
93 |
$this->ajaxexportAction_GenerateControlFile($project);
|
94 |
$block->setStep(self::STEP_COMPRESS_FILES);
|
95 |
-
$block->setStatusMsg($this->helper->__
|
96 |
} elseif ($step == self::STEP_COMPRESS_FILES) {
|
97 |
$this->ajaxexportAction_CompressFiles($project);
|
98 |
$block->setStep(self::STEP_TRANSMIT_ARCHIVE);
|
99 |
-
$block->setStatusMsg($this->helper->__
|
100 |
} elseif ($step == self::STEP_TRANSMIT_ARCHIVE) {
|
101 |
$this->ajaxexportAction_TransmitArchive($project);
|
102 |
$block->setStep(self::STEP_DONE);
|
103 |
-
$block->setStatusMsg($this->helper->__
|
104 |
} else {
|
105 |
$block->setStep(self::STEP_DONE);
|
106 |
-
$block->setStatusMsg($this->helper->__
|
107 |
$block->setStatusCode('success');
|
108 |
$block->setFinished(true);
|
109 |
}
|
@@ -211,13 +211,12 @@ class Eurotext_TranslationManager_Model_Export_Project
|
|
211 |
|
212 |
/**
|
213 |
* @param Eurotext_TranslationManager_Model_Project $project
|
214 |
-
* @return mixed[]
|
215 |
*/
|
216 |
private function ajaxexportAction_CompressFiles(Eurotext_TranslationManager_Model_Project $project)
|
217 |
{
|
218 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getExportXMLPath($project);
|
219 |
$this->getEurotextHelper()
|
220 |
-
->zipFolder($xmlDir, $this->getProjectZipFilename($project),
|
221 |
}
|
222 |
|
223 |
/**
|
@@ -228,7 +227,7 @@ class Eurotext_TranslationManager_Model_Export_Project
|
|
228 |
{
|
229 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getExportXMLPath($project);
|
230 |
|
231 |
-
if ($project->getZipFilename() !=
|
232 |
return $xmlDir . DS . $project->getZipFilename();
|
233 |
}
|
234 |
|
@@ -273,12 +272,12 @@ class Eurotext_TranslationManager_Model_Export_Project
|
|
273 |
private function generateZipFilename(Eurotext_TranslationManager_Model_Project $project)
|
274 |
{
|
275 |
$filename = sprintf(
|
276 |
-
|
277 |
Mage::helper('eurotext_translationmanager/filesystem')
|
278 |
->getFilenameSafeString($this->configHelper->getShopname()),
|
279 |
Mage::helper('eurotext_translationmanager/filesystem')
|
280 |
->getFilenameSafeString($this->configHelper->getCustomerId()),
|
281 |
-
date
|
282 |
);
|
283 |
|
284 |
$project->setZipFilename($filename);
|
63 |
->validateFtpConnection();
|
64 |
$this->setDataOnStatusBlock(
|
65 |
$block,
|
66 |
+
['offset' => 0, 'step' => self::STEP_BUILD_LANGXML, 'status_msg' => '']
|
67 |
);
|
68 |
} elseif ($step == self::STEP_BUILD_LANGXML) {
|
69 |
$rvSub = $this->ajaxexportAction_BuildLangXML($project, $offset);
|
92 |
} elseif ($step == self::STEP_GENERATE_CONTROL_FILE) {
|
93 |
$this->ajaxexportAction_GenerateControlFile($project);
|
94 |
$block->setStep(self::STEP_COMPRESS_FILES);
|
95 |
+
$block->setStatusMsg($this->helper->__('Generating ZIP archive'));
|
96 |
} elseif ($step == self::STEP_COMPRESS_FILES) {
|
97 |
$this->ajaxexportAction_CompressFiles($project);
|
98 |
$block->setStep(self::STEP_TRANSMIT_ARCHIVE);
|
99 |
+
$block->setStatusMsg($this->helper->__('Sending data'));
|
100 |
} elseif ($step == self::STEP_TRANSMIT_ARCHIVE) {
|
101 |
$this->ajaxexportAction_TransmitArchive($project);
|
102 |
$block->setStep(self::STEP_DONE);
|
103 |
+
$block->setStatusMsg($this->helper->__('Data sent.'));
|
104 |
} else {
|
105 |
$block->setStep(self::STEP_DONE);
|
106 |
+
$block->setStatusMsg($this->helper->__('Export done.'));
|
107 |
$block->setStatusCode('success');
|
108 |
$block->setFinished(true);
|
109 |
}
|
211 |
|
212 |
/**
|
213 |
* @param Eurotext_TranslationManager_Model_Project $project
|
|
|
214 |
*/
|
215 |
private function ajaxexportAction_CompressFiles(Eurotext_TranslationManager_Model_Project $project)
|
216 |
{
|
217 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getExportXMLPath($project);
|
218 |
$this->getEurotextHelper()
|
219 |
+
->zipFolder($xmlDir, $this->getProjectZipFilename($project), 'Created by Eurotext Magento Module');
|
220 |
}
|
221 |
|
222 |
/**
|
227 |
{
|
228 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getExportXMLPath($project);
|
229 |
|
230 |
+
if ($project->getZipFilename() != '') {
|
231 |
return $xmlDir . DS . $project->getZipFilename();
|
232 |
}
|
233 |
|
272 |
private function generateZipFilename(Eurotext_TranslationManager_Model_Project $project)
|
273 |
{
|
274 |
$filename = sprintf(
|
275 |
+
'ET-%s-%s-%s.zip',
|
276 |
Mage::helper('eurotext_translationmanager/filesystem')
|
277 |
->getFilenameSafeString($this->configHelper->getShopname()),
|
278 |
Mage::helper('eurotext_translationmanager/filesystem')
|
279 |
->getFilenameSafeString($this->configHelper->getCustomerId()),
|
280 |
+
date('Y-m-d_H-i-s_T')
|
281 |
);
|
282 |
|
283 |
$project->setZipFilename($filename);
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/Attribute.php
CHANGED
@@ -19,7 +19,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Attribute
|
|
19 |
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
20 |
$this->doc->formatOutput = true;
|
21 |
|
22 |
-
$this->nodeAttributes = $this->doc->createElement
|
23 |
$this->doc->appendChild($this->nodeAttributes);
|
24 |
}
|
25 |
|
@@ -39,12 +39,12 @@ class Eurotext_TranslationManager_Model_Export_Project_Attribute
|
|
39 |
->addFieldToFilter('is_user_defined', 1);
|
40 |
|
41 |
foreach ($attributes as $a) {
|
42 |
-
$comment = $a->getFrontendLabel() == $a->getStoreLabel() ?
|
43 |
|
44 |
-
$nodeAttribute = $this->doc->createElement
|
45 |
$this->nodeAttributes->appendChild($nodeAttribute);
|
46 |
|
47 |
-
$optionId = $this->doc->createAttribute
|
48 |
$optionId->value = $a->getId();
|
49 |
$nodeAttribute->appendChild($optionId);
|
50 |
|
@@ -52,12 +52,12 @@ class Eurotext_TranslationManager_Model_Export_Project_Attribute
|
|
52 |
$nodeAttributeComment = $this->doc->createComment($comment);
|
53 |
$nodeAttribute->appendChild($nodeAttributeComment);
|
54 |
|
55 |
-
$nodeName = $this->doc->createElement
|
56 |
Mage::helper('eurotext_translationmanager/xml')
|
57 |
->appendTextChild($this->doc, $nodeName, $a->getStoreLabel());
|
58 |
|
59 |
-
$attrTranslate = $this->doc->createAttribute
|
60 |
-
$attrTranslate->value =
|
61 |
$nodeName->appendChild($attrTranslate);
|
62 |
|
63 |
$nodeAttribute->appendChild($nodeName);
|
@@ -71,30 +71,30 @@ class Eurotext_TranslationManager_Model_Export_Project_Attribute
|
|
71 |
$optionCollection->addOrder('sort_order ASC, main_table.option_id', 'ASC');
|
72 |
|
73 |
if ($optionCollection->count()) {
|
74 |
-
$nodeOptions = $this->doc->createElement
|
75 |
$nodeAttribute->appendChild($nodeOptions);
|
76 |
foreach ($optionCollection as $optionValue) {
|
77 |
$defaultValue = $optionValue->getValue();
|
78 |
$storeValue = $optionValue->getStoreValue();
|
79 |
|
80 |
-
$nodeOption = $this->doc->createElement
|
81 |
$nodeOptions->appendChild($nodeOption);
|
82 |
|
83 |
-
$optionId = $this->doc->createAttribute
|
84 |
$optionId->value = $optionValue->getOptionId();
|
85 |
$nodeOption->appendChild($optionId);
|
86 |
|
87 |
-
$optionComment = empty($storeValue) || $defaultValue == $storeValue ?
|
88 |
|
89 |
$nodeAttributeOptionComment = $this->doc->createComment($optionComment);
|
90 |
$nodeOption->appendChild($nodeAttributeOptionComment);
|
91 |
|
92 |
-
$nodeName = $this->doc->createElement
|
93 |
Mage::helper('eurotext_translationmanager/xml')
|
94 |
->appendTextChild($this->doc, $nodeName, $storeValue ?: $defaultValue);
|
95 |
|
96 |
-
$attrTranslate = $this->doc->createAttribute
|
97 |
-
$attrTranslate->value =
|
98 |
$nodeName->appendChild($attrTranslate);
|
99 |
|
100 |
$nodeOption->appendChild($nodeName);
|
@@ -109,13 +109,13 @@ class Eurotext_TranslationManager_Model_Export_Project_Attribute
|
|
109 |
$subdir
|
110 |
);
|
111 |
|
112 |
-
$xml_filename = $xmlDir . DS .
|
113 |
|
114 |
$this->doc->save($xml_filename);
|
115 |
}
|
116 |
|
117 |
return [
|
118 |
-
'status_msg' => Mage::helper('eurotext_translationmanager')->__
|
119 |
'step' => ProjectExporter::STEP_GENERATE_CONTROL_FILE,
|
120 |
'offset' => 1,
|
121 |
];
|
19 |
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
20 |
$this->doc->formatOutput = true;
|
21 |
|
22 |
+
$this->nodeAttributes = $this->doc->createElement('attributes');
|
23 |
$this->doc->appendChild($this->nodeAttributes);
|
24 |
}
|
25 |
|
39 |
->addFieldToFilter('is_user_defined', 1);
|
40 |
|
41 |
foreach ($attributes as $a) {
|
42 |
+
$comment = $a->getFrontendLabel() == $a->getStoreLabel() ? '(default label)' : '(src-storeview label)';
|
43 |
|
44 |
+
$nodeAttribute = $this->doc->createElement('attribute');
|
45 |
$this->nodeAttributes->appendChild($nodeAttribute);
|
46 |
|
47 |
+
$optionId = $this->doc->createAttribute('id');
|
48 |
$optionId->value = $a->getId();
|
49 |
$nodeAttribute->appendChild($optionId);
|
50 |
|
52 |
$nodeAttributeComment = $this->doc->createComment($comment);
|
53 |
$nodeAttribute->appendChild($nodeAttributeComment);
|
54 |
|
55 |
+
$nodeName = $this->doc->createElement('AttributeName');
|
56 |
Mage::helper('eurotext_translationmanager/xml')
|
57 |
->appendTextChild($this->doc, $nodeName, $a->getStoreLabel());
|
58 |
|
59 |
+
$attrTranslate = $this->doc->createAttribute('translate');
|
60 |
+
$attrTranslate->value = '1';
|
61 |
$nodeName->appendChild($attrTranslate);
|
62 |
|
63 |
$nodeAttribute->appendChild($nodeName);
|
71 |
$optionCollection->addOrder('sort_order ASC, main_table.option_id', 'ASC');
|
72 |
|
73 |
if ($optionCollection->count()) {
|
74 |
+
$nodeOptions = $this->doc->createElement('options');
|
75 |
$nodeAttribute->appendChild($nodeOptions);
|
76 |
foreach ($optionCollection as $optionValue) {
|
77 |
$defaultValue = $optionValue->getValue();
|
78 |
$storeValue = $optionValue->getStoreValue();
|
79 |
|
80 |
+
$nodeOption = $this->doc->createElement('option');
|
81 |
$nodeOptions->appendChild($nodeOption);
|
82 |
|
83 |
+
$optionId = $this->doc->createAttribute('id');
|
84 |
$optionId->value = $optionValue->getOptionId();
|
85 |
$nodeOption->appendChild($optionId);
|
86 |
|
87 |
+
$optionComment = empty($storeValue) || $defaultValue == $storeValue ? '(has default label)' : '(has src-storeview label)';
|
88 |
|
89 |
$nodeAttributeOptionComment = $this->doc->createComment($optionComment);
|
90 |
$nodeOption->appendChild($nodeAttributeOptionComment);
|
91 |
|
92 |
+
$nodeName = $this->doc->createElement('OptionName');
|
93 |
Mage::helper('eurotext_translationmanager/xml')
|
94 |
->appendTextChild($this->doc, $nodeName, $storeValue ?: $defaultValue);
|
95 |
|
96 |
+
$attrTranslate = $this->doc->createAttribute('translate');
|
97 |
+
$attrTranslate->value = '1';
|
98 |
$nodeName->appendChild($attrTranslate);
|
99 |
|
100 |
$nodeOption->appendChild($nodeName);
|
109 |
$subdir
|
110 |
);
|
111 |
|
112 |
+
$xml_filename = $xmlDir . DS . 'attributes.xml';
|
113 |
|
114 |
$this->doc->save($xml_filename);
|
115 |
}
|
116 |
|
117 |
return [
|
118 |
+
'status_msg' => Mage::helper('eurotext_translationmanager')->__('Exported attributes.'),
|
119 |
'step' => ProjectExporter::STEP_GENERATE_CONTROL_FILE,
|
120 |
'offset' => 1,
|
121 |
];
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/Category.php
CHANGED
@@ -66,23 +66,23 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
66 |
$categoryDstCollection->addIdFilter($project->getCategories());
|
67 |
}
|
68 |
|
69 |
-
if
|
70 |
-
|
71 |
) {
|
72 |
$emulator->stopEnvironmentEmulation($emulation);
|
73 |
|
74 |
return [
|
75 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_CMSPAGES,
|
76 |
'offset' => 1,
|
77 |
-
'status_msg' => $this->helper->__
|
78 |
];
|
79 |
}
|
80 |
|
81 |
-
$cats = $this->doc->createElement
|
82 |
$this->doc->appendChild($cats);
|
83 |
|
84 |
$statusMessage = sprintf(
|
85 |
-
Mage::helper('eurotext_translationmanager')->__
|
86 |
$page,
|
87 |
$categorySrcCollection->getLastPageNumber()
|
88 |
);
|
@@ -94,7 +94,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
94 |
|
95 |
$statusMessage .= "\n<br />- " . $catSrc->getName();
|
96 |
|
97 |
-
$catNode = $this->doc->createElement
|
98 |
|
99 |
$this->createDefaultAttributeNodes($catNode, $catDst, $catSrc, $manualSelected);
|
100 |
$this->createCustomCategoryAttributeNodes($catNode, $catDst, $catSrc, $manualSelected);
|
@@ -114,7 +114,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
114 |
}
|
115 |
}
|
116 |
|
117 |
-
if($cats->hasChildNodes
|
118 |
|
119 |
$subdir = 'categories';
|
120 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getXmlSubdirectoryAndMakeSureItExists(
|
@@ -122,7 +122,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
122 |
$subdir
|
123 |
);
|
124 |
|
125 |
-
$xmlFilename = $xmlDir . DS .
|
126 |
$this->doc->save($xmlFilename);
|
127 |
}
|
128 |
$emulator->stopEnvironmentEmulation($emulation);
|
@@ -162,9 +162,9 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
162 |
* @param DOMElement $catNode
|
163 |
* @param Mage_Catalog_Model_Category $catSrc
|
164 |
*/
|
165 |
-
private function createIdNode($catNode
|
166 |
{
|
167 |
-
$nodeId = $this->doc->createElement
|
168 |
$nodeId->appendChild($this->doc->createTextNode($catSrc->getId()));
|
169 |
|
170 |
$firstChildNode = $catNode->childNodes->item(0);
|
@@ -177,7 +177,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
177 |
*/
|
178 |
private function createUrlNode($catNode, $catSrc)
|
179 |
{
|
180 |
-
$nodeUrl = $this->doc->createElement
|
181 |
$nodeUrl->appendChild($this->doc->createTextNode($catSrc->getUrl()));
|
182 |
|
183 |
$secondChildNode = $catNode->childNodes->item(1);
|
@@ -200,7 +200,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
200 |
$valueSrc = $catSrc->getDataUsingMethod($attr);
|
201 |
$valueDst = $catDst->getDataUsingMethod($attr);
|
202 |
|
203 |
-
if ($valueSrc !=
|
204 |
$item = $this->doc->createElement($nodeName);
|
205 |
Mage::helper('eurotext_translationmanager/xml')->appendTextChild($this->doc, $item, $valueSrc);
|
206 |
$catNode->appendChild($item);
|
@@ -210,7 +210,9 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
210 |
|
211 |
/**
|
212 |
* @param DOMElement $catNode
|
|
|
213 |
* @param Mage_Catalog_Model_Category $catSrc
|
|
|
214 |
*/
|
215 |
private function createCustomCategoryAttributeNodes(
|
216 |
DOMElement $catNode,
|
@@ -227,7 +229,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
227 |
$valueSrc = $catSrc->getDataUsingMethod($customCategoryAttribute);
|
228 |
$valueDst = $catDst->getDataUsingMethod($customCategoryAttribute);
|
229 |
|
230 |
-
if ($valueSrc !=
|
231 |
Mage::helper('eurotext_translationmanager/xml')->appendTextNode(
|
232 |
$this->doc,
|
233 |
(string)$customCategoryAttribute,
|
@@ -237,7 +239,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
237 |
}
|
238 |
}
|
239 |
|
240 |
-
if($nodeCustomCategoryAttributes->hasChildNodes
|
241 |
$catNode->appendChild($nodeCustomCategoryAttributes);
|
242 |
}
|
243 |
}
|
@@ -256,8 +258,8 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
256 |
) {
|
257 |
$srcUrlKey = $catSrc->getUrlKey();
|
258 |
$dstUrlKey = $catDst->getUrlKey();
|
259 |
-
if ($srcUrlKey !=
|
260 |
-
$item = $this->doc->createElement
|
261 |
Mage::helper('eurotext_translationmanager/xml')->appendTextChild(
|
262 |
$this->doc,
|
263 |
$item,
|
@@ -283,7 +285,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Category
|
|
283 |
$valueSrc = $catSrc->getDataUsingMethod($attr);
|
284 |
$valueDst = $catDst->getDataUsingMethod($attr);
|
285 |
|
286 |
-
if ($valueSrc !=
|
287 |
$item = $this->doc->createElement($nodeName);
|
288 |
Mage::helper('eurotext_translationmanager/xml')->appendTextChild($this->doc, $item, $valueSrc);
|
289 |
$catNode->appendChild($item);
|
66 |
$categoryDstCollection->addIdFilter($project->getCategories());
|
67 |
}
|
68 |
|
69 |
+
if ($page > $categorySrcCollection->getLastPageNumber() ||
|
70 |
+
(!count($project->getCategories()) && !$project->isExportingAllCategories())
|
71 |
) {
|
72 |
$emulator->stopEnvironmentEmulation($emulation);
|
73 |
|
74 |
return [
|
75 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_CMSPAGES,
|
76 |
'offset' => 1,
|
77 |
+
'status_msg' => $this->helper->__('Exported categories.'),
|
78 |
];
|
79 |
}
|
80 |
|
81 |
+
$cats = $this->doc->createElement('categories');
|
82 |
$this->doc->appendChild($cats);
|
83 |
|
84 |
$statusMessage = sprintf(
|
85 |
+
Mage::helper('eurotext_translationmanager')->__('Batch %s / %s Categories:'),
|
86 |
$page,
|
87 |
$categorySrcCollection->getLastPageNumber()
|
88 |
);
|
94 |
|
95 |
$statusMessage .= "\n<br />- " . $catSrc->getName();
|
96 |
|
97 |
+
$catNode = $this->doc->createElement('category');
|
98 |
|
99 |
$this->createDefaultAttributeNodes($catNode, $catDst, $catSrc, $manualSelected);
|
100 |
$this->createCustomCategoryAttributeNodes($catNode, $catDst, $catSrc, $manualSelected);
|
114 |
}
|
115 |
}
|
116 |
|
117 |
+
if ($cats->hasChildNodes()) {
|
118 |
|
119 |
$subdir = 'categories';
|
120 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')->getXmlSubdirectoryAndMakeSureItExists(
|
122 |
$subdir
|
123 |
);
|
124 |
|
125 |
+
$xmlFilename = $xmlDir . DS . 'cat' . $page . '.xml';
|
126 |
$this->doc->save($xmlFilename);
|
127 |
}
|
128 |
$emulator->stopEnvironmentEmulation($emulation);
|
162 |
* @param DOMElement $catNode
|
163 |
* @param Mage_Catalog_Model_Category $catSrc
|
164 |
*/
|
165 |
+
private function createIdNode($catNode, $catSrc)
|
166 |
{
|
167 |
+
$nodeId = $this->doc->createElement('Id');
|
168 |
$nodeId->appendChild($this->doc->createTextNode($catSrc->getId()));
|
169 |
|
170 |
$firstChildNode = $catNode->childNodes->item(0);
|
177 |
*/
|
178 |
private function createUrlNode($catNode, $catSrc)
|
179 |
{
|
180 |
+
$nodeUrl = $this->doc->createElement('Url');
|
181 |
$nodeUrl->appendChild($this->doc->createTextNode($catSrc->getUrl()));
|
182 |
|
183 |
$secondChildNode = $catNode->childNodes->item(1);
|
200 |
$valueSrc = $catSrc->getDataUsingMethod($attr);
|
201 |
$valueDst = $catDst->getDataUsingMethod($attr);
|
202 |
|
203 |
+
if ($valueSrc != '' && ($valueSrc == $valueDst || $valueDst == '' || $manualSelected)) {
|
204 |
$item = $this->doc->createElement($nodeName);
|
205 |
Mage::helper('eurotext_translationmanager/xml')->appendTextChild($this->doc, $item, $valueSrc);
|
206 |
$catNode->appendChild($item);
|
210 |
|
211 |
/**
|
212 |
* @param DOMElement $catNode
|
213 |
+
* @param Mage_Catalog_Model_Category $catDst
|
214 |
* @param Mage_Catalog_Model_Category $catSrc
|
215 |
+
* @param bool $manualSelected
|
216 |
*/
|
217 |
private function createCustomCategoryAttributeNodes(
|
218 |
DOMElement $catNode,
|
229 |
$valueSrc = $catSrc->getDataUsingMethod($customCategoryAttribute);
|
230 |
$valueDst = $catDst->getDataUsingMethod($customCategoryAttribute);
|
231 |
|
232 |
+
if ($valueSrc != '' && ($valueSrc == $valueDst || $valueDst == '' || $manualSelected)) {
|
233 |
Mage::helper('eurotext_translationmanager/xml')->appendTextNode(
|
234 |
$this->doc,
|
235 |
(string)$customCategoryAttribute,
|
239 |
}
|
240 |
}
|
241 |
|
242 |
+
if ($nodeCustomCategoryAttributes->hasChildNodes()) {
|
243 |
$catNode->appendChild($nodeCustomCategoryAttributes);
|
244 |
}
|
245 |
}
|
258 |
) {
|
259 |
$srcUrlKey = $catSrc->getUrlKey();
|
260 |
$dstUrlKey = $catDst->getUrlKey();
|
261 |
+
if ($srcUrlKey != '' && (($srcUrlKey == $dstUrlKey) || ($dstUrlKey == '') || $manualSelected)) {
|
262 |
+
$item = $this->doc->createElement('UrlKey');
|
263 |
Mage::helper('eurotext_translationmanager/xml')->appendTextChild(
|
264 |
$this->doc,
|
265 |
$item,
|
285 |
$valueSrc = $catSrc->getDataUsingMethod($attr);
|
286 |
$valueDst = $catDst->getDataUsingMethod($attr);
|
287 |
|
288 |
+
if ($valueSrc != '' && ($valueSrc == $valueDst || $valueDst == '' || $manualSelected)) {
|
289 |
$item = $this->doc->createElement($nodeName);
|
290 |
Mage::helper('eurotext_translationmanager/xml')->appendTextChild($this->doc, $item, $valueSrc);
|
291 |
$catNode->appendChild($item);
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/CmsBlock.php
CHANGED
@@ -59,18 +59,18 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsBlock
|
|
59 |
$manualSelected = true;
|
60 |
}
|
61 |
|
62 |
-
if
|
63 |
-
|
64 |
) {
|
65 |
return [
|
66 |
-
'status_msg' => $helper->__
|
67 |
'step' => ProjectExporter::STEP_COLLECT_TEMPLATES_FILES,
|
68 |
'offset' => 0,
|
69 |
];
|
70 |
}
|
71 |
|
72 |
$statusMessage = sprintf(
|
73 |
-
Mage::helper('eurotext_translationmanager')->__
|
74 |
$offset + 1,
|
75 |
$blockSrcCollection->getLastPageNumber()
|
76 |
);
|
@@ -109,16 +109,15 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsBlock
|
|
109 |
}
|
110 |
|
111 |
return [
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
];
|
116 |
}
|
117 |
|
118 |
/**
|
119 |
* @param string $nodeName
|
120 |
* @param string $value
|
121 |
-
* @return DOMElement
|
122 |
*/
|
123 |
private function addNodeToBlockNode($nodeName, $value)
|
124 |
{
|
@@ -138,7 +137,7 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsBlock
|
|
138 |
{
|
139 |
$srcValue = $blockSrc->getDataUsingMethod($attr);
|
140 |
$dstValue = $blockDst->getDataUsingMethod($attr);
|
141 |
-
if ($srcValue !=
|
142 |
$item = $this->doc->createElement($nodeName);
|
143 |
Mage::helper('eurotext_translationmanager/xml')
|
144 |
->appendTextChild($this->doc, $item, $srcValue);
|
@@ -172,10 +171,10 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsBlock
|
|
172 |
*/
|
173 |
private function addBasicInformation(Eurotext_TranslationManager_Model_Project $project, $blockSrc, $blockDst)
|
174 |
{
|
175 |
-
$this->addNodeToBlockNode
|
176 |
-
$this->addNodeToBlockNode
|
177 |
-
$this->addNodeToBlockNode
|
178 |
-
$this->addNodeToBlockNode
|
179 |
}
|
180 |
|
181 |
/**
|
@@ -191,11 +190,11 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsBlock
|
|
191 |
|
192 |
private function createNewDOMDocument()
|
193 |
{
|
194 |
-
$this->doc
|
195 |
$this->doc->formatOutput = true;
|
196 |
-
$cmsSites
|
197 |
$this->doc->appendChild($cmsSites);
|
198 |
-
$this->cmsSiteNode = $this->doc->createElement
|
199 |
$cmsSites->appendChild($this->cmsSiteNode);
|
200 |
}
|
201 |
}
|
59 |
$manualSelected = true;
|
60 |
}
|
61 |
|
62 |
+
if ($offset > $blockSrcCollection->getLastPageNumber() ||
|
63 |
+
(!$project->isExportingAllCmsContent() && !count($project->getBlocks()))
|
64 |
) {
|
65 |
return [
|
66 |
+
'status_msg' => $helper->__('Exported CMS Blocks.'),
|
67 |
'step' => ProjectExporter::STEP_COLLECT_TEMPLATES_FILES,
|
68 |
'offset' => 0,
|
69 |
];
|
70 |
}
|
71 |
|
72 |
$statusMessage = sprintf(
|
73 |
+
Mage::helper('eurotext_translationmanager')->__('Batch %s / %s CMS Blocks:'),
|
74 |
$offset + 1,
|
75 |
$blockSrcCollection->getLastPageNumber()
|
76 |
);
|
109 |
}
|
110 |
|
111 |
return [
|
112 |
+
'status_msg' => $statusMessage,
|
113 |
+
'offset' => $offset + 1,
|
114 |
+
'step' => ProjectExporter::STEP_COLLECT_CMSBLOCKS,
|
115 |
];
|
116 |
}
|
117 |
|
118 |
/**
|
119 |
* @param string $nodeName
|
120 |
* @param string $value
|
|
|
121 |
*/
|
122 |
private function addNodeToBlockNode($nodeName, $value)
|
123 |
{
|
137 |
{
|
138 |
$srcValue = $blockSrc->getDataUsingMethod($attr);
|
139 |
$dstValue = $blockDst->getDataUsingMethod($attr);
|
140 |
+
if ($srcValue != '' && (($srcValue == $dstValue) || ($dstValue == '') || $manualSelected)) {
|
141 |
$item = $this->doc->createElement($nodeName);
|
142 |
Mage::helper('eurotext_translationmanager/xml')
|
143 |
->appendTextChild($this->doc, $item, $srcValue);
|
171 |
*/
|
172 |
private function addBasicInformation(Eurotext_TranslationManager_Model_Project $project, $blockSrc, $blockDst)
|
173 |
{
|
174 |
+
$this->addNodeToBlockNode('Id', $blockSrc->getId());
|
175 |
+
$this->addNodeToBlockNode('StoreviewSrc', $project->getStoreviewSrc());
|
176 |
+
$this->addNodeToBlockNode('StoreviewDst', $project->getStoreviewDst());
|
177 |
+
$this->addNodeToBlockNode('PageIdDst', $blockDst->getId() != $blockSrc->getId() ? $blockDst->getId() : -1);
|
178 |
}
|
179 |
|
180 |
/**
|
190 |
|
191 |
private function createNewDOMDocument()
|
192 |
{
|
193 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
194 |
$this->doc->formatOutput = true;
|
195 |
+
$cmsSites = $this->doc->createElement('cms-sites');
|
196 |
$this->doc->appendChild($cmsSites);
|
197 |
+
$this->cmsSiteNode = $this->doc->createElement('cms-site');
|
198 |
$cmsSites->appendChild($this->cmsSiteNode);
|
199 |
}
|
200 |
}
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/CmsPage.php
CHANGED
@@ -54,18 +54,18 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsPage
|
|
54 |
$manualSelected = true;
|
55 |
}
|
56 |
|
57 |
-
if
|
58 |
-
|
59 |
) {
|
60 |
return [
|
61 |
-
'status_msg' => $helper->__
|
62 |
'step' => ProjectExporter::STEP_COLLECT_CMSBLOCKS,
|
63 |
'offset' => 1,
|
64 |
];
|
65 |
}
|
66 |
|
67 |
$statusMessage = sprintf(
|
68 |
-
Mage::helper('eurotext_translationmanager')->__
|
69 |
$offset + 1,
|
70 |
$pageSrcCollection->getLastPageNumber()
|
71 |
);
|
@@ -78,9 +78,9 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsPage
|
|
78 |
$identifier = $pageSrc->getIdentifier();
|
79 |
/** @var Mage_Cms_Model_Page $matchingPage */
|
80 |
$matchingPage = Mage::getResourceModel('cms/page_collection')
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
|
85 |
if (!$matchingPage->isObjectNew()) {
|
86 |
$pageDst = $matchingPage;
|
@@ -131,7 +131,7 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsPage
|
|
131 |
{
|
132 |
$srcValue = $pageSrc->getDataUsingMethod($attr);
|
133 |
$dstValue = $pageDst->getDataUsingMethod($attr);
|
134 |
-
if ($srcValue !=
|
135 |
$item = $this->doc->createElement($nodeName);
|
136 |
Mage::helper('eurotext_translationmanager/xml')
|
137 |
->appendTextChild($this->doc, $item, $srcValue);
|
@@ -148,13 +148,13 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsPage
|
|
148 |
if ($this->cmsSiteNode->hasChildNodes()) {
|
149 |
$subdir = 'cms-sites';
|
150 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
151 |
-
|
152 |
|
153 |
$identifier = Mage::helper('eurotext_translationmanager/filesystem')
|
154 |
-
|
155 |
|
156 |
$xmlFilename = "$xmlDir/cms-" . Mage::helper('eurotext_translationmanager/filesystem')
|
157 |
-
|
158 |
|
159 |
$this->doc->save($xmlFilename);
|
160 |
}
|
@@ -167,10 +167,10 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsPage
|
|
167 |
*/
|
168 |
private function addBasicInformation(Eurotext_TranslationManager_Model_Project $project, $pageSrc, $pageDst)
|
169 |
{
|
170 |
-
$this->addNodeTopageNode
|
171 |
-
$this->addNodeTopageNode
|
172 |
-
$this->addNodeTopageNode
|
173 |
-
$this->addNodeTopageNode
|
174 |
}
|
175 |
|
176 |
/**
|
@@ -181,17 +181,17 @@ class Eurotext_TranslationManager_Model_Export_Project_CmsPage
|
|
181 |
private function getCmsPageCollectionFor($storeId)
|
182 |
{
|
183 |
return Mage::getResourceModel('cms/page_collection')
|
184 |
-
|
185 |
-
|
186 |
}
|
187 |
|
188 |
private function createNewDOMDocument()
|
189 |
{
|
190 |
-
$this->doc
|
191 |
$this->doc->formatOutput = true;
|
192 |
-
$cmsSites
|
193 |
$this->doc->appendChild($cmsSites);
|
194 |
-
$this->cmsSiteNode = $this->doc->createElement
|
195 |
$cmsSites->appendChild($this->cmsSiteNode);
|
196 |
}
|
197 |
}
|
54 |
$manualSelected = true;
|
55 |
}
|
56 |
|
57 |
+
if ($offset > $pageSrcCollection->getLastPageNumber() ||
|
58 |
+
(!$project->isExportingAllCmsContent() && !count($project->getPages()))
|
59 |
) {
|
60 |
return [
|
61 |
+
'status_msg' => $helper->__('Exported CMS Pages.'),
|
62 |
'step' => ProjectExporter::STEP_COLLECT_CMSBLOCKS,
|
63 |
'offset' => 1,
|
64 |
];
|
65 |
}
|
66 |
|
67 |
$statusMessage = sprintf(
|
68 |
+
Mage::helper('eurotext_translationmanager')->__('Batch %s / %s CMS Pages:'),
|
69 |
$offset + 1,
|
70 |
$pageSrcCollection->getLastPageNumber()
|
71 |
);
|
78 |
$identifier = $pageSrc->getIdentifier();
|
79 |
/** @var Mage_Cms_Model_Page $matchingPage */
|
80 |
$matchingPage = Mage::getResourceModel('cms/page_collection')
|
81 |
+
->addStoreFilter($project->getStoreviewDst())
|
82 |
+
->addFieldToFilter('identifier', $identifier)
|
83 |
+
->getFirstItem();
|
84 |
|
85 |
if (!$matchingPage->isObjectNew()) {
|
86 |
$pageDst = $matchingPage;
|
131 |
{
|
132 |
$srcValue = $pageSrc->getDataUsingMethod($attr);
|
133 |
$dstValue = $pageDst->getDataUsingMethod($attr);
|
134 |
+
if ($srcValue != '' && (($srcValue == $dstValue) || ($dstValue == '') || $manualSelected)) {
|
135 |
$item = $this->doc->createElement($nodeName);
|
136 |
Mage::helper('eurotext_translationmanager/xml')
|
137 |
->appendTextChild($this->doc, $item, $srcValue);
|
148 |
if ($this->cmsSiteNode->hasChildNodes()) {
|
149 |
$subdir = 'cms-sites';
|
150 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
151 |
+
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
152 |
|
153 |
$identifier = Mage::helper('eurotext_translationmanager/filesystem')
|
154 |
+
->getFilenameSafeString($page->getIdentifier());
|
155 |
|
156 |
$xmlFilename = "$xmlDir/cms-" . Mage::helper('eurotext_translationmanager/filesystem')
|
157 |
+
->getFilenameSafeString($identifier) . '-' . $page->getId() . '.xml';
|
158 |
|
159 |
$this->doc->save($xmlFilename);
|
160 |
}
|
167 |
*/
|
168 |
private function addBasicInformation(Eurotext_TranslationManager_Model_Project $project, $pageSrc, $pageDst)
|
169 |
{
|
170 |
+
$this->addNodeTopageNode('Id', $pageSrc->getId());
|
171 |
+
$this->addNodeTopageNode('StoreviewSrc', $project->getStoreviewSrc());
|
172 |
+
$this->addNodeTopageNode('StoreviewDst', $project->getStoreviewDst());
|
173 |
+
$this->addNodeTopageNode('PageIdDst', $pageDst->getId() != $pageSrc->getId() ? $pageDst->getId() : -1);
|
174 |
}
|
175 |
|
176 |
/**
|
181 |
private function getCmsPageCollectionFor($storeId)
|
182 |
{
|
183 |
return Mage::getResourceModel('cms/page_collection')
|
184 |
+
->addStoreFilter($storeId)
|
185 |
+
->addOrder('page_id');
|
186 |
}
|
187 |
|
188 |
private function createNewDOMDocument()
|
189 |
{
|
190 |
+
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
191 |
$this->doc->formatOutput = true;
|
192 |
+
$cmsSites = $this->doc->createElement('cms-sites');
|
193 |
$this->doc->appendChild($cmsSites);
|
194 |
+
$this->cmsSiteNode = $this->doc->createElement('cms-site');
|
195 |
$cmsSites->appendChild($this->cmsSiteNode);
|
196 |
}
|
197 |
}
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/CreateControlFile.php
CHANGED
@@ -12,10 +12,6 @@ class Eurotext_TranslationManager_Model_Export_Project_CreateControlFile
|
|
12 |
* @var DOMDocument
|
13 |
*/
|
14 |
private $doc;
|
15 |
-
/**
|
16 |
-
* @var DOMElement
|
17 |
-
*/
|
18 |
-
private $requestNode;
|
19 |
|
20 |
/**
|
21 |
* @var DOMElement
|
@@ -36,11 +32,6 @@ class Eurotext_TranslationManager_Model_Export_Project_CreateControlFile
|
|
36 |
*/
|
37 |
private $helper;
|
38 |
|
39 |
-
/**
|
40 |
-
* @var Eurotext_TranslationManager_Helper_Eurotext
|
41 |
-
*/
|
42 |
-
private $etHelper;
|
43 |
-
|
44 |
/**
|
45 |
* @var Eurotext_TranslationManager_Helper_Config
|
46 |
*/
|
@@ -50,15 +41,14 @@ class Eurotext_TranslationManager_Model_Export_Project_CreateControlFile
|
|
50 |
{
|
51 |
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
52 |
$this->doc->formatOutput = true;
|
53 |
-
$
|
54 |
-
$this->doc->appendChild($
|
55 |
-
$this->generalNode = $this->doc->createElement
|
56 |
-
$
|
57 |
-
$this->languageCombinationNode = $this->doc->createElement
|
58 |
-
$
|
59 |
|
60 |
$this->helper = Mage::helper('eurotext_translationmanager');
|
61 |
-
$this->etHelper = Mage::helper('eurotext_translationmanager/eurotext');
|
62 |
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
63 |
}
|
64 |
|
@@ -84,21 +74,21 @@ class Eurotext_TranslationManager_Model_Export_Project_CreateControlFile
|
|
84 |
|
85 |
private function addCustomerContact()
|
86 |
{
|
87 |
-
$nodeCustomerContact = $this->doc->createElement
|
88 |
$nodeCustomerContact->appendChild($this->doc->createTextNode($this->configHelper->getName()));
|
89 |
$this->generalNode->appendChild($nodeCustomerContact);
|
90 |
}
|
91 |
|
92 |
private function addCustomerEmail()
|
93 |
{
|
94 |
-
$nodeCustomerEmail = $this->doc->createElement
|
95 |
$nodeCustomerEmail->appendChild($this->doc->createTextNode($this->configHelper->getEmail()));
|
96 |
$this->generalNode->appendChild($nodeCustomerEmail);
|
97 |
}
|
98 |
|
99 |
private function addCustomerId()
|
100 |
{
|
101 |
-
$customerId = $this->doc->createElement
|
102 |
$customerId->appendChild($this->doc->createTextNode($this->configHelper->getCustomerId()));
|
103 |
$this->generalNode->appendChild($customerId);
|
104 |
}
|
@@ -108,21 +98,21 @@ class Eurotext_TranslationManager_Model_Export_Project_CreateControlFile
|
|
108 |
*/
|
109 |
private function addProjectName(Eurotext_TranslationManager_Model_Project $project)
|
110 |
{
|
111 |
-
$nodeProjectName = $this->doc->createElement
|
112 |
$nodeProjectName->appendChild($this->doc->createTextNode($project->getProjectName()));
|
113 |
$this->generalNode->appendChild($nodeProjectName);
|
114 |
}
|
115 |
|
116 |
private function addDeadline()
|
117 |
{
|
118 |
-
$nodeDeadline = $this->doc->createElement
|
119 |
$this->generalNode->appendChild($nodeDeadline);
|
120 |
}
|
121 |
|
122 |
private function addTarget()
|
123 |
{
|
124 |
-
$nodeTargetProject = $this->doc->createElement
|
125 |
-
$nodeTargetProject->appendChild($this->doc->createTextNode
|
126 |
$this->generalNode->appendChild($nodeTargetProject);
|
127 |
}
|
128 |
|
@@ -156,12 +146,12 @@ COMMENT;
|
|
156 |
);
|
157 |
$description .= "\n\nSrc-Storeview: '" . $srcName . "' (" . $project->getStoreviewSrcLocale() . ")\n";
|
158 |
$description .= "Dst-Storeview: '" . $dstName . "' (" . $project->getStoreviewDstLocale() . ")\n";
|
159 |
-
$description .=
|
160 |
-
$description .=
|
161 |
-
$description .= ($project->isExportingAttributes() ?
|
162 |
-
$description .=
|
163 |
|
164 |
-
$nodeDescription = $this->doc->createElement
|
165 |
$nodeDescription->appendChild($this->doc->createTextNode($description));
|
166 |
$this->generalNode->appendChild($nodeDescription);
|
167 |
}
|
@@ -204,7 +194,7 @@ COMMENT;
|
|
204 |
*/
|
205 |
private function writeXml($xmlDir)
|
206 |
{
|
207 |
-
$xmlFilename = $xmlDir . DS .
|
208 |
$this->doc->save($xmlFilename);
|
209 |
}
|
210 |
|
@@ -243,15 +233,15 @@ COMMENT;
|
|
243 |
*/
|
244 |
private function createLanguageCombination(Eurotext_TranslationManager_Model_Project $project)
|
245 |
{
|
246 |
-
$nodeLanguageCombination = $this->doc->createElement
|
247 |
-
$source = $this->doc->createAttribute
|
248 |
|
249 |
$etLocalesrc = $this->getEurotextLocale($project->getStoreviewSrcLocale());
|
250 |
$source->value = $etLocalesrc['locale_eurotext'];
|
251 |
$nodeLanguageCombination->appendChild($source);
|
252 |
|
253 |
$etLocaleDst = $this->getEurotextLocale($project->getStoreviewDstLocale());
|
254 |
-
$target = $this->doc->createAttribute
|
255 |
$target->value = $etLocaleDst['locale_eurotext'];
|
256 |
|
257 |
$nodeLanguageCombination->appendChild($target);
|
@@ -294,15 +284,15 @@ COMMENT;
|
|
294 |
{
|
295 |
$absoluteFile = $xmlDir . '/' . $file;
|
296 |
|
297 |
-
$nodeUploadedFile = $this->doc->createElement
|
298 |
$nodeLanguageCombination->appendChild($nodeUploadedFile);
|
299 |
|
300 |
-
$attrfileName = $this->doc->createAttribute
|
301 |
$attrfileName->value = $file;
|
302 |
$nodeUploadedFile->appendChild($attrfileName);
|
303 |
|
304 |
|
305 |
-
$attrsize = $this->doc->createAttribute
|
306 |
$attrsize->value = filesize($absoluteFile);
|
307 |
$nodeUploadedFile->appendChild($attrsize);
|
308 |
}
|
12 |
* @var DOMDocument
|
13 |
*/
|
14 |
private $doc;
|
|
|
|
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
* @var DOMElement
|
32 |
*/
|
33 |
private $helper;
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* @var Eurotext_TranslationManager_Helper_Config
|
37 |
*/
|
41 |
{
|
42 |
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
43 |
$this->doc->formatOutput = true;
|
44 |
+
$requestNode = $this->doc->createElement('Request');
|
45 |
+
$this->doc->appendChild($requestNode);
|
46 |
+
$this->generalNode = $this->doc->createElement('General');
|
47 |
+
$requestNode->appendChild($this->generalNode);
|
48 |
+
$this->languageCombinationNode = $this->doc->createElement('LanguageCombinations');
|
49 |
+
$requestNode->appendChild($this->languageCombinationNode);
|
50 |
|
51 |
$this->helper = Mage::helper('eurotext_translationmanager');
|
|
|
52 |
$this->configHelper = Mage::helper('eurotext_translationmanager/config');
|
53 |
}
|
54 |
|
74 |
|
75 |
private function addCustomerContact()
|
76 |
{
|
77 |
+
$nodeCustomerContact = $this->doc->createElement('CustomerContact');
|
78 |
$nodeCustomerContact->appendChild($this->doc->createTextNode($this->configHelper->getName()));
|
79 |
$this->generalNode->appendChild($nodeCustomerContact);
|
80 |
}
|
81 |
|
82 |
private function addCustomerEmail()
|
83 |
{
|
84 |
+
$nodeCustomerEmail = $this->doc->createElement('CustomerMail');
|
85 |
$nodeCustomerEmail->appendChild($this->doc->createTextNode($this->configHelper->getEmail()));
|
86 |
$this->generalNode->appendChild($nodeCustomerEmail);
|
87 |
}
|
88 |
|
89 |
private function addCustomerId()
|
90 |
{
|
91 |
+
$customerId = $this->doc->createElement('CustomerID_of_Supplier');
|
92 |
$customerId->appendChild($this->doc->createTextNode($this->configHelper->getCustomerId()));
|
93 |
$this->generalNode->appendChild($customerId);
|
94 |
}
|
98 |
*/
|
99 |
private function addProjectName(Eurotext_TranslationManager_Model_Project $project)
|
100 |
{
|
101 |
+
$nodeProjectName = $this->doc->createElement('ProjectName');
|
102 |
$nodeProjectName->appendChild($this->doc->createTextNode($project->getProjectName()));
|
103 |
$this->generalNode->appendChild($nodeProjectName);
|
104 |
}
|
105 |
|
106 |
private function addDeadline()
|
107 |
{
|
108 |
+
$nodeDeadline = $this->doc->createElement('Deadline');
|
109 |
$this->generalNode->appendChild($nodeDeadline);
|
110 |
}
|
111 |
|
112 |
private function addTarget()
|
113 |
{
|
114 |
+
$nodeTargetProject = $this->doc->createElement('TargetProject');
|
115 |
+
$nodeTargetProject->appendChild($this->doc->createTextNode('Quote'));
|
116 |
$this->generalNode->appendChild($nodeTargetProject);
|
117 |
}
|
118 |
|
146 |
);
|
147 |
$description .= "\n\nSrc-Storeview: '" . $srcName . "' (" . $project->getStoreviewSrcLocale() . ")\n";
|
148 |
$description .= "Dst-Storeview: '" . $dstName . "' (" . $project->getStoreviewDstLocale() . ")\n";
|
149 |
+
$description .= 'Export SEO content: ' . ($project->isExportingMetaAttributes() ? 'Yes' : 'No') . "\n";
|
150 |
+
$description .= 'Export attributes and attribute options? ';
|
151 |
+
$description .= ($project->isExportingAttributes() ? 'Yes' : 'No') . "\n";
|
152 |
+
$description .= 'Export URL keys? ' . ($project->isExportingUrlKeys() ? 'Yes' : 'No');
|
153 |
|
154 |
+
$nodeDescription = $this->doc->createElement('Description');
|
155 |
$nodeDescription->appendChild($this->doc->createTextNode($description));
|
156 |
$this->generalNode->appendChild($nodeDescription);
|
157 |
}
|
194 |
*/
|
195 |
private function writeXml($xmlDir)
|
196 |
{
|
197 |
+
$xmlFilename = $xmlDir . DS . 'control.xml';
|
198 |
$this->doc->save($xmlFilename);
|
199 |
}
|
200 |
|
233 |
*/
|
234 |
private function createLanguageCombination(Eurotext_TranslationManager_Model_Project $project)
|
235 |
{
|
236 |
+
$nodeLanguageCombination = $this->doc->createElement('LanguageCombination');
|
237 |
+
$source = $this->doc->createAttribute('source');
|
238 |
|
239 |
$etLocalesrc = $this->getEurotextLocale($project->getStoreviewSrcLocale());
|
240 |
$source->value = $etLocalesrc['locale_eurotext'];
|
241 |
$nodeLanguageCombination->appendChild($source);
|
242 |
|
243 |
$etLocaleDst = $this->getEurotextLocale($project->getStoreviewDstLocale());
|
244 |
+
$target = $this->doc->createAttribute('target');
|
245 |
$target->value = $etLocaleDst['locale_eurotext'];
|
246 |
|
247 |
$nodeLanguageCombination->appendChild($target);
|
284 |
{
|
285 |
$absoluteFile = $xmlDir . '/' . $file;
|
286 |
|
287 |
+
$nodeUploadedFile = $this->doc->createElement('uploadedFile');
|
288 |
$nodeLanguageCombination->appendChild($nodeUploadedFile);
|
289 |
|
290 |
+
$attrfileName = $this->doc->createAttribute('fileName');
|
291 |
$attrfileName->value = $file;
|
292 |
$nodeUploadedFile->appendChild($attrfileName);
|
293 |
|
294 |
|
295 |
+
$attrsize = $this->doc->createAttribute('size');
|
296 |
$attrsize->value = filesize($absoluteFile);
|
297 |
$nodeUploadedFile->appendChild($attrsize);
|
298 |
}
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/EmailDatabaseTemplates.php
CHANGED
@@ -50,7 +50,7 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailDatabaseTemplates
|
|
50 |
|
51 |
if (!$templateCollection->getSize()) {
|
52 |
return [
|
53 |
-
'status_msg' => $this->getHelper()->__
|
54 |
'offset' => 1,
|
55 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
56 |
];
|
@@ -58,7 +58,7 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailDatabaseTemplates
|
|
58 |
|
59 |
if ($templateCollection->getLastPageNumber() < $this->offset) {
|
60 |
return [
|
61 |
-
'status_msg' => $this->getHelper()->__
|
62 |
'offset' => 1,
|
63 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
64 |
];
|
@@ -70,7 +70,7 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailDatabaseTemplates
|
|
70 |
$this->writeXml($templateCollection);
|
71 |
|
72 |
return [
|
73 |
-
'status_msg' => $this->getHelper()->__
|
74 |
'offset' => $this->offset + 1,
|
75 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
76 |
];
|
@@ -107,13 +107,13 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailDatabaseTemplates
|
|
107 |
$type = $t->getType() == \Mage_Core_Model_Template::TYPE_HTML ? 'html' : 'plaintext';
|
108 |
$xmlWriter->writeElement('Type', $type);
|
109 |
$xmlWriter->startElement('Styles');
|
110 |
-
$xmlWriter->
|
111 |
$xmlWriter->endElement(); // Styles
|
112 |
$xmlWriter->startElement('Subject');
|
113 |
-
$xmlWriter->
|
114 |
$xmlWriter->endElement(); // Subject
|
115 |
$xmlWriter->startElement('Text');
|
116 |
-
$xmlWriter->
|
117 |
Mage::helper('eurotext_translationmanager/string')
|
118 |
->replaceMagentoBlockDirectives($t->getTemplateText())
|
119 |
);
|
@@ -123,7 +123,7 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailDatabaseTemplates
|
|
123 |
$xmlWriter->endElement(); // emails
|
124 |
|
125 |
file_put_contents(
|
126 |
-
sprintf($this->xmlDir . '/emailtemplates-db-%s.xml',
|
127 |
$xmlWriter->flush()
|
128 |
);
|
129 |
}
|
50 |
|
51 |
if (!$templateCollection->getSize()) {
|
52 |
return [
|
53 |
+
'status_msg' => $this->getHelper()->__('No Email Templates from the database exported'),
|
54 |
'offset' => 1,
|
55 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
56 |
];
|
58 |
|
59 |
if ($templateCollection->getLastPageNumber() < $this->offset) {
|
60 |
return [
|
61 |
+
'status_msg' => $this->getHelper()->__('All Email-Database-Templates exported'),
|
62 |
'offset' => 1,
|
63 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
64 |
];
|
70 |
$this->writeXml($templateCollection);
|
71 |
|
72 |
return [
|
73 |
+
'status_msg' => $this->getHelper()->__('%s Email-Database-Templates exported', $templateCollection->getSize()),
|
74 |
'offset' => $this->offset + 1,
|
75 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_EXPORT_ATTRIBUTES,
|
76 |
];
|
107 |
$type = $t->getType() == \Mage_Core_Model_Template::TYPE_HTML ? 'html' : 'plaintext';
|
108 |
$xmlWriter->writeElement('Type', $type);
|
109 |
$xmlWriter->startElement('Styles');
|
110 |
+
$xmlWriter->writeCData($t->getTemplateStyles());
|
111 |
$xmlWriter->endElement(); // Styles
|
112 |
$xmlWriter->startElement('Subject');
|
113 |
+
$xmlWriter->writeCData($t->getTemplateSubject());
|
114 |
$xmlWriter->endElement(); // Subject
|
115 |
$xmlWriter->startElement('Text');
|
116 |
+
$xmlWriter->writeCData(
|
117 |
Mage::helper('eurotext_translationmanager/string')
|
118 |
->replaceMagentoBlockDirectives($t->getTemplateText())
|
119 |
);
|
123 |
$xmlWriter->endElement(); // emails
|
124 |
|
125 |
file_put_contents(
|
126 |
+
sprintf($this->xmlDir . '/emailtemplates-db-%s.xml', (($this->offset - 1) * self::PAGE_SIZE) + $i++),
|
127 |
$xmlWriter->flush()
|
128 |
);
|
129 |
}
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/EmailFileTemplates.php
CHANGED
@@ -40,7 +40,7 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailFileTemplates
|
|
40 |
|
41 |
if (!$numberOfEmailTemplatesExported) {
|
42 |
return [
|
43 |
-
'status_msg' => $this->getHelper()->__
|
44 |
'offset' => 1,
|
45 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_TEMPLATES_DATABASE,
|
46 |
];
|
@@ -53,7 +53,7 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailFileTemplates
|
|
53 |
$this->writeXml($emailTemplates, $project);
|
54 |
|
55 |
return [
|
56 |
-
'status_msg' => $this->getHelper()->__
|
57 |
'offset' => 1,
|
58 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_TEMPLATES_DATABASE,
|
59 |
];
|
@@ -82,7 +82,7 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailFileTemplates
|
|
82 |
$filenameSrc = $baseLocale . "/{$project->getStoreviewSrcLocale()}/template$relativeFilePath";
|
83 |
$filenameDst = $baseLocale . "/{$project->getStoreviewDstLocale()}/template$relativeFilePath";
|
84 |
|
85 |
-
if
|
86 |
continue;
|
87 |
}
|
88 |
$this->exportedTemplateFiles++;
|
@@ -98,13 +98,13 @@ class Eurotext_TranslationManager_Model_Export_Project_EmailFileTemplates
|
|
98 |
$type = $this->emailPaths[$fileInConfigXml]['type'];
|
99 |
$xmlWriter->writeElement('Type', $type);
|
100 |
$xmlWriter->startElement('Styles');
|
101 |
-
$xmlWriter->
|
102 |
$xmlWriter->endElement(); // Styles
|
103 |
$xmlWriter->startElement('Subject');
|
104 |
-
$xmlWriter->
|
105 |
$xmlWriter->endElement(); // Subject
|
106 |
$xmlWriter->startElement('Text');
|
107 |
-
$xmlWriter->
|
108 |
$xmlWriter->endElement(); // Text
|
109 |
$xmlWriter->endElement(); // email
|
110 |
|
40 |
|
41 |
if (!$numberOfEmailTemplatesExported) {
|
42 |
return [
|
43 |
+
'status_msg' => $this->getHelper()->__('No Email-File-Templates exported'),
|
44 |
'offset' => 1,
|
45 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_TEMPLATES_DATABASE,
|
46 |
];
|
53 |
$this->writeXml($emailTemplates, $project);
|
54 |
|
55 |
return [
|
56 |
+
'status_msg' => $this->getHelper()->__('Exported %s Email Templates', $this->exportedTemplateFiles),
|
57 |
'offset' => 1,
|
58 |
'step' => Eurotext_TranslationManager_Model_Export_Project::STEP_COLLECT_TEMPLATES_DATABASE,
|
59 |
];
|
82 |
$filenameSrc = $baseLocale . "/{$project->getStoreviewSrcLocale()}/template$relativeFilePath";
|
83 |
$filenameDst = $baseLocale . "/{$project->getStoreviewDstLocale()}/template$relativeFilePath";
|
84 |
|
85 |
+
if (!isset($this->emailPaths[$fileInConfigXml]) || !$this->isTranslationNeeded($filenameDst)) {
|
86 |
continue;
|
87 |
}
|
88 |
$this->exportedTemplateFiles++;
|
98 |
$type = $this->emailPaths[$fileInConfigXml]['type'];
|
99 |
$xmlWriter->writeElement('Type', $type);
|
100 |
$xmlWriter->startElement('Styles');
|
101 |
+
$xmlWriter->writeCData($info['styles']);
|
102 |
$xmlWriter->endElement(); // Styles
|
103 |
$xmlWriter->startElement('Subject');
|
104 |
+
$xmlWriter->writeCData($info['subject']);
|
105 |
$xmlWriter->endElement(); // Subject
|
106 |
$xmlWriter->startElement('Text');
|
107 |
+
$xmlWriter->writeCData($info['text']);
|
108 |
$xmlWriter->endElement(); // Text
|
109 |
$xmlWriter->endElement(); // email
|
110 |
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/FtpUpload.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
4 |
{
|
5 |
-
const FTP_HOST =
|
6 |
const FTP_PORT = 21;
|
7 |
|
8 |
/**
|
@@ -63,7 +63,7 @@ class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
|
63 |
|
64 |
$uploadSuccess = $this->uploadZipFileToEurotext($zipFile);
|
65 |
|
66 |
-
if
|
67 |
$this->createFallbackFile($zipFile);
|
68 |
}
|
69 |
|
@@ -155,11 +155,11 @@ class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
|
155 |
|
156 |
private function validateUsername()
|
157 |
{
|
158 |
-
if (trim($this->ftpUsername) ==
|
159 |
$this->helper->log('Login data is not set.', Zend_Log::ERR);
|
160 |
throw new Eurotext_TranslationManager_Exception_FtpException(
|
161 |
$this->helper->__(
|
162 |
-
|
163 |
)
|
164 |
);
|
165 |
}
|
@@ -167,11 +167,11 @@ class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
|
167 |
|
168 |
private function validateFtpConnectExists()
|
169 |
{
|
170 |
-
if (!function_exists
|
171 |
$this->helper->log('There is no FTP Client available: ftp_connect does not exist.', Zend_Log::CRIT);
|
172 |
throw new Eurotext_TranslationManager_Exception_FtpException(
|
173 |
$this->helper->__(
|
174 |
-
|
175 |
)
|
176 |
);
|
177 |
}
|
@@ -183,7 +183,7 @@ class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
|
183 |
$this->helper->log('There is no FTP Client available: ftp_connect is disabled in PHP.', Zend_Log::CRIT);
|
184 |
throw new Eurotext_TranslationManager_Exception_FtpException(
|
185 |
$this->helper->__(
|
186 |
-
|
187 |
)
|
188 |
);
|
189 |
}
|
@@ -195,7 +195,7 @@ class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
|
195 |
$this->helper->log('Could not connect to Translation Portal Server.', Zend_Log::ERR);
|
196 |
throw new Eurotext_TranslationManager_Exception_FtpException(
|
197 |
$this->helper->__(
|
198 |
-
|
199 |
)
|
200 |
);
|
201 |
}
|
@@ -204,13 +204,13 @@ class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
|
204 |
private function cleanupFtp()
|
205 |
{
|
206 |
@ftp_delete($this->ftpConnection, $this->project->getData('zip_filename'));
|
207 |
-
@ftp_delete($this->ftpConnection, $this->project->getData('zip_filename') .
|
208 |
}
|
209 |
|
210 |
private function setupFtpSettings()
|
211 |
{
|
212 |
ftp_pasv($this->ftpConnection, true);
|
213 |
-
ftp_chdir($this->ftpConnection,
|
214 |
}
|
215 |
|
216 |
/**
|
@@ -218,7 +218,7 @@ class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
|
218 |
*/
|
219 |
private function uploadZipWithUploadingExtension($zipFile)
|
220 |
{
|
221 |
-
if (ftp_put($this->ftpConnection, $this->project->getZipFilename() .
|
222 |
$this->helper->log(
|
223 |
'File was successfully uploaded to ' . $this->project->getZipFilename() . '.uploading',
|
224 |
Zend_Log::INFO
|
@@ -232,7 +232,7 @@ class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
|
232 |
private function removeUploadingExtension()
|
233 |
{
|
234 |
$filename = $this->project->getZipFilename();
|
235 |
-
$uploadSuccess = ftp_rename($this->ftpConnection, $filename .
|
236 |
if ($uploadSuccess) {
|
237 |
$this->helper->log('File was successfully renamed to ' . $filename, Zend_Log::INFO);
|
238 |
}
|
2 |
|
3 |
class Eurotext_TranslationManager_Model_Export_Project_FtpUpload
|
4 |
{
|
5 |
+
const FTP_HOST = 'eurotext-services.de';
|
6 |
const FTP_PORT = 21;
|
7 |
|
8 |
/**
|
63 |
|
64 |
$uploadSuccess = $this->uploadZipFileToEurotext($zipFile);
|
65 |
|
66 |
+
if (false === $uploadSuccess || true === $this->configHelper->isDebugMode()) {
|
67 |
$this->createFallbackFile($zipFile);
|
68 |
}
|
69 |
|
155 |
|
156 |
private function validateUsername()
|
157 |
{
|
158 |
+
if (trim($this->ftpUsername) == '') {
|
159 |
$this->helper->log('Login data is not set.', Zend_Log::ERR);
|
160 |
throw new Eurotext_TranslationManager_Exception_FtpException(
|
161 |
$this->helper->__(
|
162 |
+
'There seems to be a problem with your login data. Please check username and password!'
|
163 |
)
|
164 |
);
|
165 |
}
|
167 |
|
168 |
private function validateFtpConnectExists()
|
169 |
{
|
170 |
+
if (!function_exists('ftp_connect')) {
|
171 |
$this->helper->log('There is no FTP Client available: ftp_connect does not exist.', Zend_Log::CRIT);
|
172 |
throw new Eurotext_TranslationManager_Exception_FtpException(
|
173 |
$this->helper->__(
|
174 |
+
'There is no FTP Client available: ftp_connect does not exist.'
|
175 |
)
|
176 |
);
|
177 |
}
|
183 |
$this->helper->log('There is no FTP Client available: ftp_connect is disabled in PHP.', Zend_Log::CRIT);
|
184 |
throw new Eurotext_TranslationManager_Exception_FtpException(
|
185 |
$this->helper->__(
|
186 |
+
'There is no FTP Client available: ftp_connect is disabled in PHP.'
|
187 |
)
|
188 |
);
|
189 |
}
|
195 |
$this->helper->log('Could not connect to Translation Portal Server.', Zend_Log::ERR);
|
196 |
throw new Eurotext_TranslationManager_Exception_FtpException(
|
197 |
$this->helper->__(
|
198 |
+
'Could not connect to server. Could be a temporary error or firewall problem. You could also check for a new module version. It might be a problem with your login data, too. Please check username and password!'
|
199 |
)
|
200 |
);
|
201 |
}
|
204 |
private function cleanupFtp()
|
205 |
{
|
206 |
@ftp_delete($this->ftpConnection, $this->project->getData('zip_filename'));
|
207 |
+
@ftp_delete($this->ftpConnection, $this->project->getData('zip_filename') . '.uploading');
|
208 |
}
|
209 |
|
210 |
private function setupFtpSettings()
|
211 |
{
|
212 |
ftp_pasv($this->ftpConnection, true);
|
213 |
+
ftp_chdir($this->ftpConnection, '/');
|
214 |
}
|
215 |
|
216 |
/**
|
218 |
*/
|
219 |
private function uploadZipWithUploadingExtension($zipFile)
|
220 |
{
|
221 |
+
if (ftp_put($this->ftpConnection, $this->project->getZipFilename() . '.uploading', $zipFile, FTP_BINARY)) {
|
222 |
$this->helper->log(
|
223 |
'File was successfully uploaded to ' . $this->project->getZipFilename() . '.uploading',
|
224 |
Zend_Log::INFO
|
232 |
private function removeUploadingExtension()
|
233 |
{
|
234 |
$filename = $this->project->getZipFilename();
|
235 |
+
$uploadSuccess = ftp_rename($this->ftpConnection, $filename . '.uploading', $filename);
|
236 |
if ($uploadSuccess) {
|
237 |
$this->helper->log('File was successfully renamed to ' . $filename, Zend_Log::INFO);
|
238 |
}
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/LocaleCsvFiles.php
CHANGED
@@ -34,7 +34,7 @@ class Eurotext_TranslationManager_Model_Export_Project_LocaleCsvFiles
|
|
34 |
$count = $csvCollection->count();
|
35 |
if (!$csv) {
|
36 |
return [
|
37 |
-
|
38 |
'step' => ExportProject::STEP_COLLECT_PRODUCTS,
|
39 |
'offset' => 1,
|
40 |
];
|
@@ -46,7 +46,7 @@ class Eurotext_TranslationManager_Model_Export_Project_LocaleCsvFiles
|
|
46 |
$filenameEn = preg_replace('#/[a-z]{2}_[A-Z]{2}/#', '/en_US/', $filenameSrc);
|
47 |
$filenameDst = preg_replace('#/[a-z]{2}_[A-Z]{2}/#', "/{$project->getStoreviewDstLocale()}/", $filenameSrc);
|
48 |
|
49 |
-
$statusMessage = $this->getHelper()->__
|
50 |
|
51 |
$srcCsvFilename = basename($filenameEn);
|
52 |
$xmlFilename = $this->createFilenameFromCsvFilename($srcCsvFilename, $xmlDir);
|
@@ -110,7 +110,7 @@ class Eurotext_TranslationManager_Model_Export_Project_LocaleCsvFiles
|
|
110 |
{
|
111 |
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
112 |
$this->doc->formatOutput = true;
|
113 |
-
$translation = $this->doc->createElement
|
114 |
|
115 |
$this->writeAttribute($translation, 'src_filename', $filenameSrc);
|
116 |
$this->writeAttribute($translation, 'dst_filename', $filenameDst);
|
@@ -123,11 +123,12 @@ class Eurotext_TranslationManager_Model_Export_Project_LocaleCsvFiles
|
|
123 |
/**
|
124 |
* @param int $itemCount
|
125 |
* @param string $txtEn
|
|
|
126 |
* @param DOMNOde $lineExport
|
127 |
*/
|
128 |
private function createLineContextNode($itemCount, $txtEn, $locale, DOMNode $lineExport)
|
129 |
{
|
130 |
-
$lineContext = $this->doc->createElement
|
131 |
$this->writeAttribute($lineContext, 'num', $itemCount);
|
132 |
$this->writeAttribute($lineContext, 'context', 'yes');
|
133 |
$this->writeAttribute($lineContext, 'locale', $locale);
|
@@ -160,7 +161,7 @@ class Eurotext_TranslationManager_Model_Export_Project_LocaleCsvFiles
|
|
160 |
$txtSrc,
|
161 |
$lineExport
|
162 |
) {
|
163 |
-
$lineContext = $this->doc->createElement
|
164 |
$this->writeAttribute($lineContext, 'num', $itemCount);
|
165 |
$this->writeAttribute($lineContext, 'locale-src', $project->getStoreviewSrcLocale());
|
166 |
$this->writeAttribute($lineContext, 'locale-dst', $project->getStoreviewDstLocale());
|
@@ -184,10 +185,10 @@ class Eurotext_TranslationManager_Model_Export_Project_LocaleCsvFiles
|
|
184 |
$txtDst,
|
185 |
$txtSrc
|
186 |
) {
|
187 |
-
$comment = $this->doc->createComment
|
188 |
$translation->appendChild($comment);
|
189 |
|
190 |
-
$lineExport = $this->doc->createElement
|
191 |
$translation->appendChild($lineExport);
|
192 |
|
193 |
$this->createLineContextNode($itemCount, $txtEn, 'en_US', $lineExport);
|
@@ -223,7 +224,7 @@ class Eurotext_TranslationManager_Model_Export_Project_LocaleCsvFiles
|
|
223 |
*/
|
224 |
private function createSubdirectory(Eurotext_TranslationManager_Model_Project $project)
|
225 |
{
|
226 |
-
$subdir =
|
227 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
228 |
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
229 |
|
34 |
$count = $csvCollection->count();
|
35 |
if (!$csv) {
|
36 |
return [
|
37 |
+
'status_msg' => $this->getHelper()->__('Exported language files.'),
|
38 |
'step' => ExportProject::STEP_COLLECT_PRODUCTS,
|
39 |
'offset' => 1,
|
40 |
];
|
46 |
$filenameEn = preg_replace('#/[a-z]{2}_[A-Z]{2}/#', '/en_US/', $filenameSrc);
|
47 |
$filenameDst = preg_replace('#/[a-z]{2}_[A-Z]{2}/#', "/{$project->getStoreviewDstLocale()}/", $filenameSrc);
|
48 |
|
49 |
+
$statusMessage = $this->getHelper()->__('Batch %s / %s CSV File: %s', $offset + 1, $count, $filenameSrc);
|
50 |
|
51 |
$srcCsvFilename = basename($filenameEn);
|
52 |
$xmlFilename = $this->createFilenameFromCsvFilename($srcCsvFilename, $xmlDir);
|
110 |
{
|
111 |
$this->doc = new DOMDocument('1.0', 'UTF-8');
|
112 |
$this->doc->formatOutput = true;
|
113 |
+
$translation = $this->doc->createElement('translation');
|
114 |
|
115 |
$this->writeAttribute($translation, 'src_filename', $filenameSrc);
|
116 |
$this->writeAttribute($translation, 'dst_filename', $filenameDst);
|
123 |
/**
|
124 |
* @param int $itemCount
|
125 |
* @param string $txtEn
|
126 |
+
* @param string $locale
|
127 |
* @param DOMNOde $lineExport
|
128 |
*/
|
129 |
private function createLineContextNode($itemCount, $txtEn, $locale, DOMNode $lineExport)
|
130 |
{
|
131 |
+
$lineContext = $this->doc->createElement('line-context');
|
132 |
$this->writeAttribute($lineContext, 'num', $itemCount);
|
133 |
$this->writeAttribute($lineContext, 'context', 'yes');
|
134 |
$this->writeAttribute($lineContext, 'locale', $locale);
|
161 |
$txtSrc,
|
162 |
$lineExport
|
163 |
) {
|
164 |
+
$lineContext = $this->doc->createElement('line');
|
165 |
$this->writeAttribute($lineContext, 'num', $itemCount);
|
166 |
$this->writeAttribute($lineContext, 'locale-src', $project->getStoreviewSrcLocale());
|
167 |
$this->writeAttribute($lineContext, 'locale-dst', $project->getStoreviewDstLocale());
|
185 |
$txtDst,
|
186 |
$txtSrc
|
187 |
) {
|
188 |
+
$comment = $this->doc->createComment('Line ' . $itemCount);
|
189 |
$translation->appendChild($comment);
|
190 |
|
191 |
+
$lineExport = $this->doc->createElement('line' . $itemCount);
|
192 |
$translation->appendChild($lineExport);
|
193 |
|
194 |
$this->createLineContextNode($itemCount, $txtEn, 'en_US', $lineExport);
|
224 |
*/
|
225 |
private function createSubdirectory(Eurotext_TranslationManager_Model_Project $project)
|
226 |
{
|
227 |
+
$subdir = 'framework';
|
228 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
229 |
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
230 |
|
app/code/community/Eurotext/TranslationManager/Model/Export/Project/Product.php
CHANGED
@@ -86,8 +86,8 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
86 |
$productCollectionDst->addIdFilter($project->getProducts());
|
87 |
}
|
88 |
|
89 |
-
if
|
90 |
-
|
91 |
) {
|
92 |
$emulator->stopEnvironmentEmulation($emulation);
|
93 |
|
@@ -107,12 +107,14 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
107 |
'eurotext_translationmanager/catalog_product_attribute_backend_media_onlyStoreValues'
|
108 |
);
|
109 |
|
110 |
-
$statusMessage = Mage::helper('eurotext_translationmanager')->__
|
111 |
-
|
112 |
-
|
|
|
|
|
113 |
|
114 |
foreach ($productCollectionSrc as $productSrc) {
|
115 |
-
$this->nodeArticle = $this->doc->createElement
|
116 |
$statusMessage .= "\n<br />- " . $productSrc->getSku();
|
117 |
/** @var Mage_Catalog_Model_Product $productDst */
|
118 |
$productDst = $productCollectionDst->getItemById($productSrc->getId());
|
@@ -132,7 +134,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
132 |
if ($this->nodeArticle->hasChildNodes()) {
|
133 |
$firstChildNode = $this->nodeArticle->childNodes->item(0);
|
134 |
|
135 |
-
$nodeArticleId = $this->doc->createElement
|
136 |
$nodeArticleId->appendChild($this->doc->createTextNode($productSrc->getId()));
|
137 |
$this->nodeArticle->insertBefore($nodeArticleId, $firstChildNode);
|
138 |
|
@@ -144,19 +146,19 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
144 |
}
|
145 |
}
|
146 |
|
147 |
-
if($this->articlesNode->hasChildNodes
|
148 |
-
$subdir =
|
149 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
150 |
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
151 |
|
152 |
-
$this->doc->save($xmlDir . DS .
|
153 |
}
|
154 |
$emulator->stopEnvironmentEmulation($emulation);
|
155 |
|
156 |
return [
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
];
|
161 |
}
|
162 |
|
@@ -222,46 +224,46 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
222 |
}
|
223 |
|
224 |
$hasImages = false;
|
225 |
-
$imagesNode = $this->doc->createElement
|
226 |
|
227 |
foreach ($imagesOrig as $imgValueId => $imgLabel) {
|
228 |
if (!array_key_exists($imgValueId, $imagesDstLabel)) {
|
229 |
-
$imagesDstLabel[$imgValueId] =
|
230 |
}
|
231 |
|
232 |
$needsUpdate = $manualSelected;
|
233 |
-
if (
|
234 |
$needsUpdate = true;
|
235 |
}
|
236 |
|
237 |
-
if ($needsUpdate &&
|
238 |
$hasImages = true;
|
239 |
-
$imageNode = $this->doc->createElement
|
240 |
$imagesNode->appendChild($imageNode);
|
241 |
|
242 |
-
$imageNodeId = $this->doc->createAttribute
|
243 |
$imageNodeId->value = $imgValueId;
|
244 |
$imageNode->appendChild($imageNodeId);
|
245 |
|
246 |
-
$imageNodePosition = $this->doc->createAttribute
|
247 |
$imageNodePosition->value = $imagesDstPosition[$imgValueId];
|
248 |
$imageNode->appendChild($imageNodePosition);
|
249 |
|
250 |
-
$imageNodeDisabled = $this->doc->createAttribute
|
251 |
$imageNodeDisabled->value = $imagesDstDisabled[$imgValueId];
|
252 |
$imageNode->appendChild($imageNodeDisabled);
|
253 |
|
254 |
// URL:
|
255 |
$imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .
|
256 |
-
|
257 |
|
258 |
-
$imageNodeUrl = $this->doc->createElement
|
259 |
Mage::helper('eurotext_translationmanager/xml')
|
260 |
->appendTextChild($this->doc, $imageNodeUrl, $imgUrl);
|
261 |
$imageNode->appendChild($imageNodeUrl);
|
262 |
|
263 |
// Label:
|
264 |
-
$labelNode = $this->doc->createElement
|
265 |
Mage::helper('eurotext_translationmanager/xml')
|
266 |
->appendTextChild($this->doc, $labelNode, $imgLabel);
|
267 |
$imageNode->appendChild($labelNode);
|
@@ -288,7 +290,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
288 |
foreach ($this->configHelper->getCustomProductAttributesForExport() as $customProductAttribute) {
|
289 |
$srcValue = $productSrc->getDataUsingMethod($customProductAttribute);
|
290 |
$dstValue = $productDst->getDataUsingMethod($customProductAttribute);
|
291 |
-
if ($srcValue && ($srcValue == $dstValue || $dstValue ==
|
292 |
Mage::helper('eurotext_translationmanager/xml')->appendTextNode(
|
293 |
$this->doc,
|
294 |
(string)$customProductAttribute,
|
@@ -298,9 +300,9 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
298 |
}
|
299 |
}
|
300 |
|
301 |
-
if($nodeCustomProductAttributes->hasChildNodes()) {
|
302 |
$this->nodeArticle->appendChild($nodeCustomProductAttributes);
|
303 |
-
|
304 |
|
305 |
}
|
306 |
|
@@ -315,7 +317,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
315 |
foreach ($this->attributesToExportAlways as $attribute => $xmlNode) {
|
316 |
$srcValue = $productSrc->getDataUsingMethod($attribute);
|
317 |
$dstValue = $productDst->getDataUsingMethod($attribute);
|
318 |
-
if ($srcValue && ($srcValue == $dstValue || $dstValue ==
|
319 |
$xmlHelper->appendTextNode($this->doc, $xmlNode, $srcValue, $this->nodeArticle);
|
320 |
}
|
321 |
}
|
@@ -326,7 +328,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
326 |
*/
|
327 |
private function exportOptions($product)
|
328 |
{
|
329 |
-
$optionsNode = $this->doc->createElement
|
330 |
|
331 |
$options = $product->getOptions();
|
332 |
usort(
|
@@ -342,9 +344,9 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
342 |
|
343 |
foreach ($options as $_option) {
|
344 |
/** @var Mage_Catalog_Model_Product_Option $_option */
|
345 |
-
$optionNode = $this->doc->createElement
|
346 |
|
347 |
-
$optionNodeIdAttribute = $this->doc->createAttribute
|
348 |
$optionNodeIdAttribute->value = $_option->getId();
|
349 |
$optionNode->appendChild($optionNodeIdAttribute);
|
350 |
|
@@ -354,7 +356,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
354 |
}
|
355 |
$optionsNode->appendChild($optionNode);
|
356 |
|
357 |
-
$optionsNodeTitle = $this->doc->createElement
|
358 |
Mage::helper('eurotext_translationmanager/xml')
|
359 |
->appendTextChild($this->doc, $optionsNodeTitle, $_optionTitle);
|
360 |
$optionNode->appendChild($optionsNodeTitle);
|
@@ -364,7 +366,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
364 |
if (!$_values) {
|
365 |
continue;
|
366 |
}
|
367 |
-
$valuesNode = $this->doc->createElement
|
368 |
|
369 |
foreach ($_values as $_value) {
|
370 |
$_valueTitle = $_value->getTitle();
|
@@ -373,13 +375,13 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
373 |
}
|
374 |
$_valueId = $_value->getId();
|
375 |
|
376 |
-
$valueNode = $this->doc->createElement
|
377 |
|
378 |
-
$valueNodeIdAttribute = $this->doc->createAttribute
|
379 |
$valueNodeIdAttribute->value = $_valueId;
|
380 |
$valueNode->appendChild($valueNodeIdAttribute);
|
381 |
|
382 |
-
$valueNodeTitle = $this->doc->createElement
|
383 |
Mage::helper('eurotext_translationmanager/xml')
|
384 |
->appendTextChild($this->doc, $valueNodeTitle, $_valueTitle);
|
385 |
$valueNode->appendChild($valueNodeTitle);
|
@@ -413,8 +415,8 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
413 |
}
|
414 |
$valueSrc = $productSrc->getUrlKey();
|
415 |
$valueDst = $productDst->getUrlKey();
|
416 |
-
if ($valueSrc !=
|
417 |
-
$item = $this->doc->createElement
|
418 |
Mage::helper('eurotext_translationmanager/xml')
|
419 |
->appendTextChild($this->doc, $item, $productSrc->getUrlKey());
|
420 |
$this->nodeArticle->appendChild($item);
|
@@ -441,7 +443,7 @@ class Eurotext_TranslationManager_Model_Export_Project_Product
|
|
441 |
foreach ($this->seoAttributes as $attribute => $xmlNode) {
|
442 |
$srcValue = $productSrc->getDataUsingMethod($attribute);
|
443 |
$dstValue = $productDst->getDataUsingMethod($attribute);
|
444 |
-
if ($srcValue && ($srcValue == $dstValue || $dstValue ==
|
445 |
$item = $this->doc->createElement($xmlNode);
|
446 |
Mage::helper('eurotext_translationmanager/xml')
|
447 |
->appendTextChild($this->doc, $item, $srcValue);
|
86 |
$productCollectionDst->addIdFilter($project->getProducts());
|
87 |
}
|
88 |
|
89 |
+
if ($page > $productCollectionSrc->getLastPageNumber() ||
|
90 |
+
(!count($project->getProducts()) && !$project->isExportingAllProducts())
|
91 |
) {
|
92 |
$emulator->stopEnvironmentEmulation($emulation);
|
93 |
|
107 |
'eurotext_translationmanager/catalog_product_attribute_backend_media_onlyStoreValues'
|
108 |
);
|
109 |
|
110 |
+
$statusMessage = Mage::helper('eurotext_translationmanager')->__(
|
111 |
+
'Batch %s / %s Products:',
|
112 |
+
$page,
|
113 |
+
$productCollectionSrc->getLastPageNumber()
|
114 |
+
);
|
115 |
|
116 |
foreach ($productCollectionSrc as $productSrc) {
|
117 |
+
$this->nodeArticle = $this->doc->createElement('article');
|
118 |
$statusMessage .= "\n<br />- " . $productSrc->getSku();
|
119 |
/** @var Mage_Catalog_Model_Product $productDst */
|
120 |
$productDst = $productCollectionDst->getItemById($productSrc->getId());
|
134 |
if ($this->nodeArticle->hasChildNodes()) {
|
135 |
$firstChildNode = $this->nodeArticle->childNodes->item(0);
|
136 |
|
137 |
+
$nodeArticleId = $this->doc->createElement('Id');
|
138 |
$nodeArticleId->appendChild($this->doc->createTextNode($productSrc->getId()));
|
139 |
$this->nodeArticle->insertBefore($nodeArticleId, $firstChildNode);
|
140 |
|
146 |
}
|
147 |
}
|
148 |
|
149 |
+
if ($this->articlesNode->hasChildNodes()) {
|
150 |
+
$subdir = 'articles';
|
151 |
$xmlDir = Mage::helper('eurotext_translationmanager/filesystem')
|
152 |
->getXmlSubdirectoryAndMakeSureItExists($project, $subdir);
|
153 |
|
154 |
+
$this->doc->save($xmlDir . DS . 'a' . ((int)$page) . '.xml');
|
155 |
}
|
156 |
$emulator->stopEnvironmentEmulation($emulation);
|
157 |
|
158 |
return [
|
159 |
+
'offset' => $page + 1,
|
160 |
+
'step' => ProjectExporter::STEP_COLLECT_PRODUCTS,
|
161 |
+
'status_msg' => $statusMessage,
|
162 |
];
|
163 |
}
|
164 |
|
224 |
}
|
225 |
|
226 |
$hasImages = false;
|
227 |
+
$imagesNode = $this->doc->createElement('Images');
|
228 |
|
229 |
foreach ($imagesOrig as $imgValueId => $imgLabel) {
|
230 |
if (!array_key_exists($imgValueId, $imagesDstLabel)) {
|
231 |
+
$imagesDstLabel[$imgValueId] = '';
|
232 |
}
|
233 |
|
234 |
$needsUpdate = $manualSelected;
|
235 |
+
if (trim($imagesDstLabel[$imgValueId]) === '') {
|
236 |
$needsUpdate = true;
|
237 |
}
|
238 |
|
239 |
+
if ($needsUpdate && trim($imgLabel)) {
|
240 |
$hasImages = true;
|
241 |
+
$imageNode = $this->doc->createElement('Image');
|
242 |
$imagesNode->appendChild($imageNode);
|
243 |
|
244 |
+
$imageNodeId = $this->doc->createAttribute('value_id');
|
245 |
$imageNodeId->value = $imgValueId;
|
246 |
$imageNode->appendChild($imageNodeId);
|
247 |
|
248 |
+
$imageNodePosition = $this->doc->createAttribute('position');
|
249 |
$imageNodePosition->value = $imagesDstPosition[$imgValueId];
|
250 |
$imageNode->appendChild($imageNodePosition);
|
251 |
|
252 |
+
$imageNodeDisabled = $this->doc->createAttribute('disabled');
|
253 |
$imageNodeDisabled->value = $imagesDstDisabled[$imgValueId];
|
254 |
$imageNode->appendChild($imageNodeDisabled);
|
255 |
|
256 |
// URL:
|
257 |
$imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .
|
258 |
+
'catalog/product' . $imagesOrigUrl[$imgValueId];
|
259 |
|
260 |
+
$imageNodeUrl = $this->doc->createElement('Url');
|
261 |
Mage::helper('eurotext_translationmanager/xml')
|
262 |
->appendTextChild($this->doc, $imageNodeUrl, $imgUrl);
|
263 |
$imageNode->appendChild($imageNodeUrl);
|
264 |
|
265 |
// Label:
|
266 |
+
$labelNode = $this->doc->createElement('Label');
|
267 |
Mage::helper('eurotext_translationmanager/xml')
|
268 |
->appendTextChild($this->doc, $labelNode, $imgLabel);
|
269 |
$imageNode->appendChild($labelNode);
|
290 |
foreach ($this->configHelper->getCustomProductAttributesForExport() as $customProductAttribute) {
|
291 |
$srcValue = $productSrc->getDataUsingMethod($customProductAttribute);
|
292 |
$dstValue = $productDst->getDataUsingMethod($customProductAttribute);
|
293 |
+
if ($srcValue && ($srcValue == $dstValue || $dstValue == '' || $manualSelected)) {
|
294 |
Mage::helper('eurotext_translationmanager/xml')->appendTextNode(
|
295 |
$this->doc,
|
296 |
(string)$customProductAttribute,
|
300 |
}
|
301 |
}
|
302 |
|
303 |
+
if ($nodeCustomProductAttributes->hasChildNodes()) {
|
304 |
$this->nodeArticle->appendChild($nodeCustomProductAttributes);
|
305 |
+
}
|
306 |
|
307 |
}
|
308 |
|
317 |
foreach ($this->attributesToExportAlways as $attribute => $xmlNode) {
|
318 |
$srcValue = $productSrc->getDataUsingMethod($attribute);
|
319 |
$dstValue = $productDst->getDataUsingMethod($attribute);
|
320 |
+
if ($srcValue && ($srcValue == $dstValue || $dstValue == '' || $manualSelected)) {
|
321 |
$xmlHelper->appendTextNode($this->doc, $xmlNode, $srcValue, $this->nodeArticle);
|
322 |
}
|
323 |
}
|
328 |
*/
|
329 |
private function exportOptions($product)
|
330 |
{
|
331 |
+
$optionsNode = $this->doc->createElement('Options');
|
332 |
|
333 |
$options = $product->getOptions();
|
334 |
usort(
|
344 |
|
345 |
foreach ($options as $_option) {
|
346 |
/** @var Mage_Catalog_Model_Product_Option $_option */
|
347 |
+
$optionNode = $this->doc->createElement('Option');
|
348 |
|
349 |
+
$optionNodeIdAttribute = $this->doc->createAttribute('Id');
|
350 |
$optionNodeIdAttribute->value = $_option->getId();
|
351 |
$optionNode->appendChild($optionNodeIdAttribute);
|
352 |
|
356 |
}
|
357 |
$optionsNode->appendChild($optionNode);
|
358 |
|
359 |
+
$optionsNodeTitle = $this->doc->createElement('Title');
|
360 |
Mage::helper('eurotext_translationmanager/xml')
|
361 |
->appendTextChild($this->doc, $optionsNodeTitle, $_optionTitle);
|
362 |
$optionNode->appendChild($optionsNodeTitle);
|
366 |
if (!$_values) {
|
367 |
continue;
|
368 |
}
|
369 |
+
$valuesNode = $this->doc->createElement('Values');
|
370 |
|
371 |
foreach ($_values as $_value) {
|
372 |
$_valueTitle = $_value->getTitle();
|
375 |
}
|
376 |
$_valueId = $_value->getId();
|
377 |
|
378 |
+
$valueNode = $this->doc->createElement('Value');
|
379 |
|
380 |
+
$valueNodeIdAttribute = $this->doc->createAttribute('Id');
|
381 |
$valueNodeIdAttribute->value = $_valueId;
|
382 |
$valueNode->appendChild($valueNodeIdAttribute);
|
383 |
|
384 |
+
$valueNodeTitle = $this->doc->createElement('Title');
|
385 |
Mage::helper('eurotext_translationmanager/xml')
|
386 |
->appendTextChild($this->doc, $valueNodeTitle, $_valueTitle);
|
387 |
$valueNode->appendChild($valueNodeTitle);
|
415 |
}
|
416 |
$valueSrc = $productSrc->getUrlKey();
|
417 |
$valueDst = $productDst->getUrlKey();
|
418 |
+
if ($valueSrc != '' && ($valueSrc == $valueDst || $valueDst == '' || $manualSelected)) {
|
419 |
+
$item = $this->doc->createElement('UrlKey');
|
420 |
Mage::helper('eurotext_translationmanager/xml')
|
421 |
->appendTextChild($this->doc, $item, $productSrc->getUrlKey());
|
422 |
$this->nodeArticle->appendChild($item);
|
443 |
foreach ($this->seoAttributes as $attribute => $xmlNode) {
|
444 |
$srcValue = $productSrc->getDataUsingMethod($attribute);
|
445 |
$dstValue = $productDst->getDataUsingMethod($attribute);
|
446 |
+
if ($srcValue && ($srcValue == $dstValue || $dstValue == '' || $manualSelected)) {
|
447 |
$item = $this->doc->createElement($xmlNode);
|
448 |
Mage::helper('eurotext_translationmanager/xml')
|
449 |
->appendTextChild($this->doc, $item, $srcValue);
|
app/code/community/Eurotext/TranslationManager/Model/Extractor.php
CHANGED
@@ -53,7 +53,7 @@ class Eurotext_TranslationManager_Model_Extractor
|
|
53 |
return 'Unknown error.';
|
54 |
}
|
55 |
|
56 |
-
function __destruct()
|
57 |
{
|
58 |
$this->zip->close();
|
59 |
}
|
53 |
return 'Unknown error.';
|
54 |
}
|
55 |
|
56 |
+
public function __destruct()
|
57 |
{
|
58 |
$this->zip->close();
|
59 |
}
|
app/code/community/Eurotext/TranslationManager/Model/Import/Project.php
CHANGED
@@ -2,21 +2,11 @@
|
|
2 |
|
3 |
class Eurotext_TranslationManager_Model_Import_Project
|
4 |
{
|
5 |
-
/**
|
6 |
-
* @var Varien_Db_Adapter_Interface
|
7 |
-
*/
|
8 |
-
private $writeConnection;
|
9 |
-
|
10 |
/**
|
11 |
* @var mixed[]
|
12 |
*/
|
13 |
private $skippedEntities = [];
|
14 |
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
$this->writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
18 |
-
}
|
19 |
-
|
20 |
public function import(
|
21 |
Eurotext_TranslationManager_Model_Project $project
|
22 |
) {
|
@@ -43,19 +33,19 @@ class Eurotext_TranslationManager_Model_Import_Project
|
|
43 |
$filename = $importFile->getFilename();
|
44 |
$fullFilename = $tmpdir . DIRECTORY_SEPARATOR . $filename;
|
45 |
|
46 |
-
if (stripos($filename,
|
47 |
$this->importstepActionImportCMS($fullFilename, $project);
|
48 |
-
} elseif (stripos($filename,
|
49 |
$this->importstepActionImportBlocks($fullFilename, $project);
|
50 |
-
} elseif (stripos($filename,
|
51 |
$this->importstepActionImportArticle($fullFilename, $project);
|
52 |
-
} elseif (stripos($filename,
|
53 |
$this->importstepActionImportCategory($fullFilename, $project);
|
54 |
-
} elseif (stripos($filename,
|
55 |
$this->importstepActionImportTranslation($fullFilename);
|
56 |
-
} elseif (stripos($filename,
|
57 |
$this->importstepActionImportAttributes($fullFilename, $project);
|
58 |
-
} elseif (stripos($filename,
|
59 |
$this->importstepActionImportTemplates($fullFilename, $project);
|
60 |
}
|
61 |
|
@@ -69,17 +59,15 @@ class Eurotext_TranslationManager_Model_Import_Project
|
|
69 |
private function getTempDir()
|
70 |
{
|
71 |
$dir = Mage::getBaseDir('tmp');
|
72 |
-
$dir .= DS .
|
73 |
-
if
|
74 |
-
|
75 |
-
Mage::
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
throw new Magento_Exception('Eurotext temporary directory could not be created.');
|
80 |
-
}
|
81 |
}
|
82 |
-
$htaccessFilename = $dir . DS .
|
83 |
if (!is_file($htaccessFilename)) {
|
84 |
file_put_contents($htaccessFilename, "# Eurotext Temp folder\r\nOrder Deny,Allow\r\nDeny From All");
|
85 |
}
|
2 |
|
3 |
class Eurotext_TranslationManager_Model_Import_Project
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
5 |
/**
|
6 |
* @var mixed[]
|
7 |
*/
|
8 |
private $skippedEntities = [];
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
public function import(
|
11 |
Eurotext_TranslationManager_Model_Project $project
|
12 |
) {
|
33 |
$filename = $importFile->getFilename();
|
34 |
$fullFilename = $tmpdir . DIRECTORY_SEPARATOR . $filename;
|
35 |
|
36 |
+
if (stripos($filename, 'cms-sites' . DS . 'cms-') === 0) {
|
37 |
$this->importstepActionImportCMS($fullFilename, $project);
|
38 |
+
} elseif (stripos($filename, 'cms-sites' . DS . 'cmsblock-') === 0) {
|
39 |
$this->importstepActionImportBlocks($fullFilename, $project);
|
40 |
+
} elseif (stripos($filename, 'articles' . DS) === 0) {
|
41 |
$this->importstepActionImportArticle($fullFilename, $project);
|
42 |
+
} elseif (stripos($filename, 'categories' . DS) === 0) {
|
43 |
$this->importstepActionImportCategory($fullFilename, $project);
|
44 |
+
} elseif (stripos($filename, 'framework' . DS) === 0) {
|
45 |
$this->importstepActionImportTranslation($fullFilename);
|
46 |
+
} elseif (stripos($filename, 'attributes' . DS) === 0) {
|
47 |
$this->importstepActionImportAttributes($fullFilename, $project);
|
48 |
+
} elseif (stripos($filename, 'emailtemplates' . DS) === 0) {
|
49 |
$this->importstepActionImportTemplates($fullFilename, $project);
|
50 |
}
|
51 |
|
59 |
private function getTempDir()
|
60 |
{
|
61 |
$dir = Mage::getBaseDir('tmp');
|
62 |
+
$dir .= DS . 'eurotext';
|
63 |
+
if (!@mkdir($dir) && !is_dir($dir)) {
|
64 |
+
Mage::helper('eurotext_translationmanager')->log(
|
65 |
+
'Temporary directory could not be created in ' . Mage::getBaseDir('var'),
|
66 |
+
Zend_Log::CRIT
|
67 |
+
);
|
68 |
+
throw new Magento_Exception('Eurotext temporary directory could not be created.');
|
|
|
|
|
69 |
}
|
70 |
+
$htaccessFilename = $dir . DS . '.htaccess';
|
71 |
if (!is_file($htaccessFilename)) {
|
72 |
file_put_contents($htaccessFilename, "# Eurotext Temp folder\r\nOrder Deny,Allow\r\nDeny From All");
|
73 |
}
|
app/code/community/Eurotext/TranslationManager/Model/Import/Project/Attributes.php
CHANGED
@@ -14,7 +14,7 @@ class Eurotext_TranslationManager_Model_Import_Project_Attributes
|
|
14 |
$doc = new DOMDocument();
|
15 |
$doc->load($filename);
|
16 |
|
17 |
-
foreach ($doc->getElementsByTagName
|
18 |
$this->importAttribute($project, $attribute);
|
19 |
}
|
20 |
}
|
@@ -27,15 +27,15 @@ class Eurotext_TranslationManager_Model_Import_Project_Attributes
|
|
27 |
{
|
28 |
/** @var Eurotext_TranslationManager_Model_Eav_Attribute_Label $eavLabel */
|
29 |
$eavLabel = Mage::getResourceModel('eurotext_translationmanager/eav_attribute_label_collection')
|
30 |
-
->addFieldToFilter('attribute_id', $attribute->getAttribute
|
31 |
->addFieldToFilter('store_id', $project->getStoreviewDst())
|
32 |
->getFirstItem();
|
33 |
|
34 |
$eavLabel->addData(
|
35 |
[
|
36 |
-
'attribute_id' =>
|
37 |
'store_id' => $project->getStoreviewDst(),
|
38 |
-
'value' => $attribute->getElementsByTagName
|
39 |
]
|
40 |
);
|
41 |
$eavLabel->save();
|
@@ -49,7 +49,7 @@ class Eurotext_TranslationManager_Model_Import_Project_Attributes
|
|
49 |
*/
|
50 |
private function importOptions(Eurotext_TranslationManager_Model_Project $project, DOMElement $attribute)
|
51 |
{
|
52 |
-
foreach ($attribute->getElementsByTagName
|
53 |
$this->importOption($project, $option);
|
54 |
}
|
55 |
}
|
@@ -61,15 +61,15 @@ class Eurotext_TranslationManager_Model_Import_Project_Attributes
|
|
61 |
private function importOption(Eurotext_TranslationManager_Model_Project $project, DOMElement $option)
|
62 |
{
|
63 |
$value = Mage::getResourceModel('eurotext_translationmanager/eav_attribute_option_value_collection')
|
64 |
-
->addFieldToFilter('option_id', $option->getAttribute
|
65 |
->addFieldToFilter('store_id', $project->getStoreviewDst())
|
66 |
->getFirstItem();
|
67 |
|
68 |
$value->addData(
|
69 |
[
|
70 |
-
'option_id' =>
|
71 |
'store_id' => $project->getStoreviewDst(),
|
72 |
-
'value' => $option->getElementsByTagName
|
73 |
]
|
74 |
);
|
75 |
|
14 |
$doc = new DOMDocument();
|
15 |
$doc->load($filename);
|
16 |
|
17 |
+
foreach ($doc->getElementsByTagName('attribute') as $attribute) {
|
18 |
$this->importAttribute($project, $attribute);
|
19 |
}
|
20 |
}
|
27 |
{
|
28 |
/** @var Eurotext_TranslationManager_Model_Eav_Attribute_Label $eavLabel */
|
29 |
$eavLabel = Mage::getResourceModel('eurotext_translationmanager/eav_attribute_label_collection')
|
30 |
+
->addFieldToFilter('attribute_id', $attribute->getAttribute('id'))
|
31 |
->addFieldToFilter('store_id', $project->getStoreviewDst())
|
32 |
->getFirstItem();
|
33 |
|
34 |
$eavLabel->addData(
|
35 |
[
|
36 |
+
'attribute_id' => (int)$attribute->getAttribute('id'),
|
37 |
'store_id' => $project->getStoreviewDst(),
|
38 |
+
'value' => $attribute->getElementsByTagName('AttributeName')[0]->textContent,
|
39 |
]
|
40 |
);
|
41 |
$eavLabel->save();
|
49 |
*/
|
50 |
private function importOptions(Eurotext_TranslationManager_Model_Project $project, DOMElement $attribute)
|
51 |
{
|
52 |
+
foreach ($attribute->getElementsByTagName('option') as $option) {
|
53 |
$this->importOption($project, $option);
|
54 |
}
|
55 |
}
|
61 |
private function importOption(Eurotext_TranslationManager_Model_Project $project, DOMElement $option)
|
62 |
{
|
63 |
$value = Mage::getResourceModel('eurotext_translationmanager/eav_attribute_option_value_collection')
|
64 |
+
->addFieldToFilter('option_id', $option->getAttribute('id'))
|
65 |
->addFieldToFilter('store_id', $project->getStoreviewDst())
|
66 |
->getFirstItem();
|
67 |
|
68 |
$value->addData(
|
69 |
[
|
70 |
+
'option_id' => (int)$option->getAttribute('id'),
|
71 |
'store_id' => $project->getStoreviewDst(),
|
72 |
+
'value' => $option->getElementsByTagName('OptionName')[0]->textContent,
|
73 |
]
|
74 |
);
|
75 |
|
app/code/community/Eurotext/TranslationManager/Model/Import/Project/Categories.php
CHANGED
@@ -35,7 +35,7 @@ class Eurotext_TranslationManager_Model_Import_Project_Categories
|
|
35 |
{
|
36 |
$doc = new DOMDocument();
|
37 |
$doc->load($filename);
|
38 |
-
$categories = $doc->getElementsByTagName
|
39 |
foreach ($categories as $categoryNode) {
|
40 |
$fieldNodes = $categoryNode->childNodes;
|
41 |
$id = 0;
|
@@ -45,9 +45,9 @@ class Eurotext_TranslationManager_Model_Import_Project_Categories
|
|
45 |
$nodeName = trim($fieldNode->nodeName);
|
46 |
$nodeContent = trim($fieldNode->textContent);
|
47 |
|
48 |
-
if ($nodeName !=
|
49 |
-
if ($nodeName ==
|
50 |
-
$id =
|
51 |
}
|
52 |
if ('custom_attributes' == $nodeName) {
|
53 |
$fields[$nodeName] = $fieldNode;
|
@@ -81,7 +81,7 @@ class Eurotext_TranslationManager_Model_Import_Project_Categories
|
|
81 |
if (!$hasUrlKey) {
|
82 |
// Check if urlkey is already set:
|
83 |
$urlKey = Mage::getResourceModel('catalog/category')
|
84 |
-
->getAttributeRawValue($id,
|
85 |
|
86 |
if (!$urlKey) {
|
87 |
// setting null will force magento to generate the urlkey using the product-name
|
35 |
{
|
36 |
$doc = new DOMDocument();
|
37 |
$doc->load($filename);
|
38 |
+
$categories = $doc->getElementsByTagName('category');
|
39 |
foreach ($categories as $categoryNode) {
|
40 |
$fieldNodes = $categoryNode->childNodes;
|
41 |
$id = 0;
|
45 |
$nodeName = trim($fieldNode->nodeName);
|
46 |
$nodeContent = trim($fieldNode->textContent);
|
47 |
|
48 |
+
if ($nodeName != '') {
|
49 |
+
if ($nodeName == 'Id') {
|
50 |
+
$id = (int)$nodeContent;
|
51 |
}
|
52 |
if ('custom_attributes' == $nodeName) {
|
53 |
$fields[$nodeName] = $fieldNode;
|
81 |
if (!$hasUrlKey) {
|
82 |
// Check if urlkey is already set:
|
83 |
$urlKey = Mage::getResourceModel('catalog/category')
|
84 |
+
->getAttributeRawValue($id, 'url_key', $project->getStoreviewDst());
|
85 |
|
86 |
if (!$urlKey) {
|
87 |
// setting null will force magento to generate the urlkey using the product-name
|
app/code/community/Eurotext/TranslationManager/Model/Import/Project/CmsBlocks.php
CHANGED
@@ -21,7 +21,7 @@ class Eurotext_TranslationManager_Model_Import_Project_CmsBlocks
|
|
21 |