Antidot_Antidot - Version 1.1.3

Version Notes

Fix facet with ampersand configuration for search engine > facets
Replace "-" with "&afs:feed" to separate feeds in url (compatibility with AFS 7.7)
Fix empty facet id sent when performing an empty query to afs to get facets list
Add description node for variants
Add cdata for variant name
Prevent to export empty categories node
Add cdata for variant name
Add variant details for grouped products

Download this release

Release Info

Developer Antidot
Extension Antidot_Antidot
Version 1.1.3
Comparing to
See all releases


Code changes from version 1.1.2 to 1.1.3

Files changed (58) hide show
  1. app/code/community/MDN/Antidot/Block/Catalogsearch/Result.php +0 -2
  2. app/code/community/MDN/Antidot/Block/System/Config/Fieldset/Notice.php +56 -0
  3. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Additional.php +1 -1
  4. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/AdditionalFeed.php +1 -1
  5. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/DefaultSort.php +2 -2
  6. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Facet.php +7 -6
  7. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Identifier.php +1 -1
  8. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ProductAdditionalFacet.php +1 -1
  9. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Sort.php +1 -1
  10. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/CategoryAttribute.php +1 -1
  11. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/ProductAttribute.php +1 -1
  12. app/code/community/MDN/Antidot/Block/System/Config/Html/Export.php +1 -1
  13. app/code/community/MDN/Antidot/Helper/Compress.php +1 -1
  14. app/code/community/MDN/Antidot/Helper/Data.php +41 -3
  15. app/code/community/MDN/Antidot/Helper/XmlWriter.php +1 -1
  16. app/code/community/MDN/Antidot/Model/Catalog/Layer/Filter/Category.php +1 -1
  17. app/code/community/MDN/Antidot/Model/Catalog/Layer/Filter/Item.php +1 -1
  18. app/code/community/MDN/Antidot/Model/Export/Abstract.php +127 -2
  19. app/code/community/MDN/Antidot/Model/Export/Article.php +1 -1
  20. app/code/community/MDN/Antidot/Model/Export/Product.php +117 -35
  21. app/code/community/MDN/Antidot/Model/Observer.php +22 -50
  22. app/code/community/MDN/Antidot/Model/Resource/Engine/Abstract.php +6 -6
  23. app/code/community/MDN/Antidot/Model/Resource/Engine/Antidot.php +2 -3
  24. app/code/community/MDN/Antidot/Model/Search/Search.php +17 -6
  25. app/code/community/MDN/Antidot/Model/System/Config/Facet.php +3 -2
  26. app/code/community/MDN/Antidot/Model/Transport.php +1 -1
  27. app/code/community/MDN/Antidot/Test/Helper/Data.php +36 -0
  28. app/code/community/MDN/Antidot/Test/Model/Export/Abstract.php +34 -0
  29. app/code/community/MDN/Antidot/Test/Model/Export/Abstract/fixtures/testGarbageCollection.yaml +3 -0
  30. app/code/community/MDN/Antidot/Test/Model/Export/Category.php +13 -4
  31. app/code/community/MDN/Antidot/Test/Model/Export/Category/fixtures/testEmptyFile.yaml +19 -0
  32. app/code/community/MDN/Antidot/Test/Model/Export/Product.php +33 -0
  33. app/code/community/MDN/Antidot/Test/Model/Export/Product/fixtures/testGetProductCategories.yaml +101 -0
  34. app/code/community/MDN/Antidot/Test/Model/System/Config/Facet.php +45 -2
  35. app/code/community/MDN/Antidot/controllers/Admin/PushController.php +2 -2
  36. app/code/community/MDN/Antidot/etc/config.xml +24 -1
  37. app/code/community/MDN/Antidot/etc/system.xml +9 -2
  38. app/design/frontend/{default → base}/default/layout/antidot.xml +1 -0
  39. app/design/frontend/{default → base}/default/template/antidot/catalogsearch/result/category.phtml +0 -0
  40. app/locale/de_AT/MDN_Antidot.csv +6 -1
  41. app/locale/de_CH/MDN_Antidot.csv +6 -1
  42. app/locale/de_DE/MDN_Antidot.csv +6 -1
  43. app/locale/es_AR/MDN_Antidot.csv +7 -2
  44. app/locale/es_CL/MDN_Antidot.csv +7 -2
  45. app/locale/es_CO/MDN_Antidot.csv +7 -2
  46. app/locale/es_CR/MDN_Antidot.csv +7 -2
  47. app/locale/es_ES/MDN_Antidot.csv +7 -2
  48. app/locale/es_MX/MDN_Antidot.csv +7 -2
  49. app/locale/es_PA/MDN_Antidot.csv +7 -2
  50. app/locale/es_PE/MDN_Antidot.csv +7 -2
  51. app/locale/es_VE/MDN_Antidot.csv +7 -2
  52. app/locale/fr_CA/MDN_Antidot.csv +6 -1
  53. app/locale/fr_FR/MDN_Antidot.csv +6 -1
  54. package.xml +4 -4
  55. shell/antidotExport.php +3 -1
  56. shell/antidotExportCategory.php +3 -1
  57. shell/antidotExportInc.php +3 -1
  58. shell/antidotExportProduct.php +5 -3
app/code/community/MDN/Antidot/Block/Catalogsearch/Result.php CHANGED
@@ -85,8 +85,6 @@ class MDN_Antidot_Block_CatalogSearch_Result extends Mage_CatalogSearch_Block_Re
85
*/
86
public function _toHtml()
87
{
88
- $this->setTemplate('antidot/catalogsearch/result.phtml');
89
-
90
return parent::_toHtml();
91
}
92
}
85
*/
86
public function _toHtml()
87
{
88
return parent::_toHtml();
89
}
90
}
app/code/community/MDN/Antidot/Block/System/Config/Fieldset/Notice.php ADDED
@@ -0,0 +1,56 @@
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @copyright Copyright (c) 2015 Antidot (http://www.antidot.net)
13
+ * @author : Antidot devmagento@antidot.net
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Fieldset_Notice
17
+ extends Mage_Adminhtml_Block_Abstract
18
+ implements Varien_Data_Form_Element_Renderer_Interface
19
+ {
20
+
21
+ /**
22
+ * Render fieldset html
23
+ *
24
+ * @param Varien_Data_Form_Element_Abstract $element
25
+ * @return string
26
+ */
27
+ public function render(Varien_Data_Form_Element_Abstract $element)
28
+ {
29
+ $helper = Mage::helper('Antidot');
30
+ $html = '<div class="be2bill-api-notice">';
31
+ $html .= '<ul style="margin:10px;color:red">';
32
+ if (!class_exists('DOMDocument')) {
33
+ $html .= "<li><strong>" . $helper->__("DOMDocument class doesn't exist, you must install php libxml extension, otherwise the xsd validation during export will not run and autocomplete neither") . "</strong></li>";
34
+ }
35
+ if (!class_exists('XSLTProcessor')) {
36
+ $html .= "<li><strong>" . $helper->__("XSLTProcessor class doesn't exist, you must install php xsl extension, otherwise the autocomplete will not run correctly") . "</strong></li>";
37
+ }
38
+ if (!class_exists('ZipArchive')) {
39
+ $html .= "<li><strong>" . $helper->__("ZipArchive class doesn't exist, you must install php zip extension, otherwise the zip operation during export may not run correctly") . "</strong></li>";
40
+ }
41
+ $extensions = get_loaded_extensions();
42
+ if (!in_array('curl', $extensions)) {
43
+ $html .= "<li><strong>" . $helper->__("The curl php extension is not installed, it's required to upload export files") . "</strong></li>";
44
+ } else {
45
+ $curl_version = curl_version();
46
+ if (!isset($curl_version['protocols']) || !in_array("sftp", $curl_version['protocols'])) {
47
+ $html .= "<li><strong>" . $helper->__("The curl php extension doesn't support sftp protocol, libcurl must be upgraded on your system, otherwise the export files won't be uploaded") . "</strong></li>";
48
+ }
49
+ }
50
+
51
+ $html .= '</ul>';
52
+ $html .= '</div>';
53
+ return $html;
54
+ }
55
+
56
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Additional.php CHANGED
@@ -46,7 +46,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_Additional extends Mage_A
46
{
47
if (!$this->_valueRenderer) {
48
$this->_valueRenderer = $this->getLayout()
49
- ->createBlock('Antidot/Html_Select')
50
->setIsRenderToJsTemplate(true);
51
}
52
return $this->_valueRenderer;
46
{
47
if (!$this->_valueRenderer) {
48
$this->_valueRenderer = $this->getLayout()
49
+ ->createBlock('Antidot/html_select')
50
->setIsRenderToJsTemplate(true);
51
}
52
return $this->_valueRenderer;
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/AdditionalFeed.php CHANGED
@@ -46,7 +46,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_AdditionalFeed extends Ma
46
{
47
if (!$this->_valueRenderer) {
48
$this->_valueRenderer = $this->getLayout()
49
- ->createBlock('Antidot/Html_Select')
50
->setIsRenderToJsTemplate(true);
51
}
52
return $this->_valueRenderer;
46
{
47
if (!$this->_valueRenderer) {
48
$this->_valueRenderer = $this->getLayout()
49
+ ->createBlock('Antidot/html_select')
50
->setIsRenderToJsTemplate(true);
51
}
52
return $this->_valueRenderer;
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/DefaultSort.php CHANGED
@@ -64,7 +64,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_DefaultSort extends Mage_
64
{
65
if (!$this->_fieldRenderer) {
66
$this->_fieldRenderer = $this->getLayout()
67
- ->createBlock('Antidot/Html_Select')
68
->setIsRenderToJsTemplate(true);
69
}
70
return $this->_fieldRenderer;
@@ -77,7 +77,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_DefaultSort extends Mage_
77
{
78
if (!$this->_dirRenderer) {
79
$this->_dirRenderer = $this->getLayout()
80
- ->createBlock('Antidot/Html_Select')
81
->setIsRenderToJsTemplate(true);
82
}
83
return $this->_dirRenderer;
64
{
65
if (!$this->_fieldRenderer) {
66
$this->_fieldRenderer = $this->getLayout()
67
+ ->createBlock('Antidot/html_select')
68
->setIsRenderToJsTemplate(true);
69
}
70
return $this->_fieldRenderer;
77
{
78
if (!$this->_dirRenderer) {
79
$this->_dirRenderer = $this->getLayout()
80
+ ->createBlock('Antidot/html_select')
81
->setIsRenderToJsTemplate(true);
82
}
83
return $this->_dirRenderer;
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Facet.php CHANGED
@@ -76,7 +76,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_Facet extends Mage_Adminh
76
{
77
if (!$this->_facetRenderer) {
78
$this->_facetRenderer = $this->getLayout()
79
- ->createBlock('Antidot/Html_Select')
80
->setIsRenderToJsTemplate(true);
81
}
82
return $this->_facetRenderer;
@@ -89,7 +89,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_Facet extends Mage_Adminh
89
{
90
if (!$this->_orderRenderer) {
91
$this->_orderRenderer = $this->getLayout()
92
- ->createBlock('Antidot/Html_Select')
93
->setIsRenderToJsTemplate(true);
94
}
95
return $this->_orderRenderer;
@@ -102,7 +102,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_Facet extends Mage_Adminh
102
{
103
if (!$this->_multipleRenderer) {
104
$this->_multipleRenderer = $this->getLayout()
105
- ->createBlock('Antidot/Html_Select')
106
->setIsRenderToJsTemplate(true);
107
}
108
return $this->_multipleRenderer;
@@ -147,9 +147,10 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_Facet extends Mage_Adminh
147
$element = $this->getElement();
148
if ($element->getValue() && is_array($element->getValue())) {
149
foreach ($element->getValue() as $rowId => $row) {
150
- //foreach ($row as $key => $value) {
151
- // $row[$key] = $this->escapeHtml($value);
152
- //}
153
$row['_id'] = $rowId;
154
$result[$rowId] = new Varien_Object($row);
155
$this->_prepareArrayRow($result[$rowId]);
76
{
77
if (!$this->_facetRenderer) {
78
$this->_facetRenderer = $this->getLayout()
79
+ ->createBlock('Antidot/html_select')
80
->setIsRenderToJsTemplate(true);
81
}
82
return $this->_facetRenderer;
89
{
90
if (!$this->_orderRenderer) {
91
$this->_orderRenderer = $this->getLayout()
92
+ ->createBlock('Antidot/html_select')
93
->setIsRenderToJsTemplate(true);
94
}
95
return $this->_orderRenderer;
102
{
103
if (!$this->_multipleRenderer) {
104
$this->_multipleRenderer = $this->getLayout()
105
+ ->createBlock('Antidot/html_select')
106
->setIsRenderToJsTemplate(true);
107
}
108
return $this->_multipleRenderer;
147
$element = $this->getElement();
148
if ($element->getValue() && is_array($element->getValue())) {
149
foreach ($element->getValue() as $rowId => $row) {
150
+ //MCNX-232 : escape single quote for javascript, it cause error in javascript facet editor in BO
151
+ foreach ($row as $key => $value) {
152
+ $row[$key] = $this->jsQuoteEscape($value);
153
+ }
154
$row['_id'] = $rowId;
155
$result[$rowId] = new Varien_Object($row);
156
$this->_prepareArrayRow($result[$rowId]);
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Identifier.php CHANGED
@@ -48,7 +48,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_Identifier extends Mage_A
48
{
49
if (!$this->_valueRenderer) {
50
$this->_valueRenderer = $this->getLayout()
51
- ->createBlock('Antidot/Html_Select')
52
->setIsRenderToJsTemplate(true);
53
}
54
return $this->_valueRenderer;
48
{
49
if (!$this->_valueRenderer) {
50
$this->_valueRenderer = $this->getLayout()
51
+ ->createBlock('Antidot/html_select')
52
->setIsRenderToJsTemplate(true);
53
}
54
return $this->_valueRenderer;
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ProductAdditionalFacet.php CHANGED
@@ -58,7 +58,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_ProductAdditionalFacet ex
58
{
59
if (!$this->_autocompleteRenderer) {
60
$this->_autocompleteRenderer = $this->getLayout()
61
- ->createBlock('Antidot/Html_Select')
62
->setIsRenderToJsTemplate(true);
63
}
64
return $this->_autocompleteRenderer;
58
{
59
if (!$this->_autocompleteRenderer) {
60
$this->_autocompleteRenderer = $this->getLayout()
61
+ ->createBlock('Antidot/html_select')
62
->setIsRenderToJsTemplate(true);
63
}
64
return $this->_autocompleteRenderer;
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Sort.php CHANGED
@@ -57,7 +57,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_Array_Sort extends Mage_Adminht
57
{
58
if (!$this->_sortRenderer) {
59
$this->_sortRenderer = $this->getLayout()
60
- ->createBlock('Antidot/Html_Select')
61
->setIsRenderToJsTemplate(true);
62
}
63
return $this->_sortRenderer;
57
{
58
if (!$this->_sortRenderer) {
59
$this->_sortRenderer = $this->getLayout()
60
+ ->createBlock('Antidot/html_select')
61
->setIsRenderToJsTemplate(true);
62
}
63
return $this->_sortRenderer;
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/CategoryAttribute.php CHANGED
@@ -31,7 +31,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_CategoryAttribute extends Mage_
31
protected function _getRenderer()
32
{
33
return $this->getLayout()
34
- ->createBlock('Antidot/Html_Select')
35
->setIsRenderToJsTemplate(true);
36
}
37
}
31
protected function _getRenderer()
32
{
33
return $this->getLayout()
34
+ ->createBlock('Antidot/html_select')
35
->setIsRenderToJsTemplate(true);
36
}
37
}
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/ProductAttribute.php CHANGED
@@ -31,7 +31,7 @@ class MDN_Antidot_Block_System_Config_Form_Field_ProductAttribute extends Mage_A
31
protected function _getRenderer()
32
{
33
return $this->getLayout()
34
- ->createBlock('Antidot/Html_Select')
35
->setIsRenderToJsTemplate(true);
36
}
37
}
31
protected function _getRenderer()
32
{
33
return $this->getLayout()
34
+ ->createBlock('Antidot/html_select')
35
->setIsRenderToJsTemplate(true);
36
}
37
}
app/code/community/MDN/Antidot/Block/System/Config/Html/Export.php CHANGED
@@ -43,7 +43,7 @@ class MDN_Antidot_Block_System_Config_Html_Export extends Mage_Adminhtml_Block_S
43
44
$rows = '';
45
$rowExport = '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>';
46
- foreach(Mage::helper('Antidot/LogExport')->getAllLastGeneration() as $export) {
47
$rows.= sprintf(
48
$rowExport,
49
$export['begin_at'],
43
44
$rows = '';
45
$rowExport = '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>';
46
+ foreach(Mage::helper('Antidot/logExport')->getAllLastGeneration() as $export) {
47
$rows.= sprintf(
48
$rowExport,
49
$export['begin_at'],
app/code/community/MDN/Antidot/Helper/Compress.php CHANGED
@@ -39,7 +39,7 @@ class MDN_Antidot_Helper_Compress extends Mage_Core_Helper_Abstract {
39
Mage::log('Add '.$file.' to archive', null, 'antidot.log');
40
$zip->addFile($file, basename($file));
41
}
42
- $zip->close($zip);
43
}
44
else
45
{
39
Mage::log('Add '.$file.' to archive', null, 'antidot.log');
40
$zip->addFile($file, basename($file));
41
}
42
+ $zip->close();
43
}
44
else
45
{
app/code/community/MDN/Antidot/Helper/Data.php CHANGED
@@ -212,11 +212,12 @@ class MDN_Antidot_Helper_Data extends Mage_Core_Helper_Abstract
212
*/
213
public function translateFacetName($facetcode, $defaultValue)
214
{
215
- $model = Mage::getModel('Antidot/Search_Search');
216
217
$label = $defaultValue;
218
- if (isset($model::$lastSearchTranslations[$facetcode]))
219
- $label = $model::$lastSearchTranslations[$facetcode];
220
return $label;
221
}
222
@@ -247,4 +248,41 @@ class MDN_Antidot_Helper_Data extends Mage_Core_Helper_Abstract
247
return $number;
248
}
249
250
}
212
*/
213
public function translateFacetName($facetcode, $defaultValue)
214
{
215
+ $model = Mage::getModel('Antidot/search_search');
216
217
$label = $defaultValue;
218
+ $translations = $model->getLastSearchTranslations();
219
+ if (isset($translations[$facetcode]))
220
+ $label = $translations[$facetcode];
221
return $label;
222
}
223
248
return $number;
249
}
250
251
+ /**
252
+ * Gives the value in bytes
253
+ * used for ini_get('memory_limit')
254
+ */
255
+ public function returnBytes ($val)
256
+ {
257
+ if(empty($val))return 0;
258
+
259
+ $val = trim($val);
260
+
261
+ preg_match('#([0-9]+)[\s]*([a-z]+)#i', $val, $matches);
262
+
263
+ $last = '';
264
+ if(isset($matches[2])){
265
+ $last = $matches[2];
266
+ }
267
+
268
+ if(isset($matches[1])){
269
+ $val = (int) $matches[1];
270
+ }
271
+
272
+ switch (strtolower($last))
273
+ {
274
+ case 'g':
275
+ case 'gb':
276
+ $val *= 1024;
277
+ case 'm':
278
+ case 'mb':
279
+ $val *= 1024;
280
+ case 'k':
281
+ case 'kb':
282
+ $val *= 1024;
283
+ }
284
+
285
+ return (int) $val;
286
+ }
287
+
288
}
app/code/community/MDN/Antidot/Helper/XmlWriter.php CHANGED
@@ -82,7 +82,7 @@ class MDN_Antidot_Helper_XmlWriter extends Mage_Core_Helper_Abstract
82
}
83
}
84
85
- $content = Mage::helper('Antidot/Url')->isUtf8($content) === false ? mb_convert_encoding($content, "UTF-8") : $content;
86
$this->xml.= '>' . ($content) . '</' . $element . '>' . $this->cr;
87
}
88
82
}
83
}
84
85
+ $content = Mage::helper('Antidot/url')->isUtf8($content) === false ? mb_convert_encoding($content, "UTF-8") : $content;
86
$this->xml.= '>' . ($content) . '</' . $element . '>' . $this->cr;
87
}
88
app/code/community/MDN/Antidot/Model/Catalog/Layer/Filter/Category.php CHANGED
@@ -75,7 +75,7 @@ class MDN_Antidot_Model_Catalog_Layer_Filter_Category extends Mage_Catalog_Model
75
}
76
77
if (!$filter) {
78
- $this->addCategoryFilter($category, null);
79
return $this;
80
}
81
75
}
76
77
if (!$filter) {
78
+ $this->addCategoryFilter($category);
79
return $this;
80
}
81
app/code/community/MDN/Antidot/Model/Catalog/Layer/Filter/Item.php CHANGED
@@ -159,7 +159,7 @@ class MDN_Antidot_Model_Catalog_Layer_Filter_Item extends Mage_Catalog_Model_Lay
159
$selected = Mage::getSingleton('core/app')->getRequest()->getParam($filter);
160
161
if ($selected) {
162
- $antidotEngine = Mage::getResourceSingleton('Antidot/engine_Antidot');
163
return $antidotEngine->extractMultiSelectValues($selected);
164
} else {
165
return array();
159
$selected = Mage::getSingleton('core/app')->getRequest()->getParam($filter);
160
161
if ($selected) {
162
+ $antidotEngine = Mage::getResourceSingleton('Antidot/engine_antidot');
163
return $antidotEngine->extractMultiSelectValues($selected);
164
} else {
165
return array();
app/code/community/MDN/Antidot/Model/Export/Abstract.php CHANGED
@@ -44,14 +44,14 @@ class MDN_Antidot_Model_Export_Abstract extends Mage_Core_Model_Abstract
44
'identifier',
45
'description'
46
);
47
-
48
/**
49
* Init the xml writer
50
*/
51
protected function initXml()
52
{
53
if($this->xml === null) {
54
- $this->xml = Mage::helper('Antidot/XmlWriter');
55
$this->xml->init();
56
}
57
}
@@ -160,4 +160,129 @@ class MDN_Antidot_Model_Export_Abstract extends Mage_Core_Model_Abstract
160
return strtolower($this::TYPE) . ' ' . $context['run'] . ' v' . Mage::getConfig()->getNode()->modules->MDN_Antidot->version;
161
}
162
163
}
44
'identifier',
45
'description'
46
);
47
+
48
/**
49
* Init the xml writer
50
*/
51
protected function initXml()
52
{
53
if($this->xml === null) {
54
+ $this->xml = Mage::helper('Antidot/xmlWriter');
55
$this->xml->init();
56
}
57
}
160
return strtolower($this::TYPE) . ' ' . $context['run'] . ' v' . Mage::getConfig()->getNode()->modules->MDN_Antidot->version;
161
}
162
163
+ /**
164
+ * Free some memory if the memory used is higher than 80% of the
165
+ * memory limit, and if garbage collection if configured .
166
+ *
167
+ * @return boolean (true if garbage collection has been done, for tests)
168
+ */
169
+ protected function garbageCollection() {
170
+
171
+ $gc_enabled = Mage::getStoreConfig('antidot/export/gc_enabled');
172
+ $gc_percentage_limit = Mage::getStoreConfig('antidot/export/gc_percentage_limit');
173
+ if ($gc_enabled) {
174
+ $memoryUsed = memory_get_usage(true);
175
+
176
+ $memoryLimit = Mage::helper('Antidot')->returnBytes(ini_get('memory_limit'));
177
+ if ($memoryUsed > ($gc_percentage_limit * $memoryLimit / 100)) {
178
+ gc_collect_cycles();
179
+ Mage::log("Garbage Collection : memory used : $memoryUsed, memory limit : $memoryLimit, memory after gc_collect_cylces : ".memory_get_usage(true), null, 'antidot.log');
180
+ return true;
181
+ }
182
+ }
183
+ return false;
184
+ }
185
+
186
+ /**
187
+ * Log profiler informations :
188
+ *
189
+ * SQL : number of queries, time consumed, average, top slower queries
190
+ *
191
+ * Varien_Profiler most time consuming items
192
+ *
193
+ */
194
+ protected function profile() {
195
+
196
+ $profiler = Mage::getStoreConfig('antidot/export/profiler_enable');
197
+ if ($profiler) {
198
+
199
+ Mage::log('################### ', null, 'antidot.log');
200
+ Mage::log('#### STATS DB ##### ', null, 'antidot.log');
201
+ Mage::log('################### ', null, 'antidot.log');
202
+ $_profiler = Mage::getSingleton('core/resource')->getConnection('core_read')->getProfiler();
203
+ $_queries = $_profiler->getQueryProfiles();
204
+ uasort($_queries, array('self', 'compareElapsedSecs'));
205
+
206
+
207
+ Mage::log(
208
+ sprintf(
209
+ 'Executed: %s queries in %s seconds',
210
+ $_profiler->getTotalNumQueries(),
211
+ $_profiler->getTotalElapsedSecs()
212
+ ),
213
+ null,
214
+ 'antidot.log'
215
+ );
216
+ Mage::log(
217
+ sprintf(
218
+ 'Average query length: %s seconds',
219
+ $_profiler->getTotalNumQueries() && $_profiler->getTotalElapsedSecs(
220
+ ) ? $_profiler->getTotalElapsedSecs() / $_profiler->getTotalNumQueries() : 0
221
+ ),
222
+ null,
223
+ 'antidot.log'
224
+ );
225
+ Mage::log(
226
+ sprintf(
227
+ 'Queries per second: %s ',
228
+ ($_profiler->getTotalNumQueries() && $_profiler->getTotalElapsedSecs(
229
+ ) ? $_profiler->getTotalNumQueries() / $_profiler->getTotalElapsedSecs() : 0)
230
+ ),
231
+ null,
232
+ 'antidot.log'
233
+ );
234
+
235
+ $profiler_nb_queries = Mage::getStoreConfig('antidot/export/profiler_nb_lowest_queries');
236
+ Mage::log("TOP $profiler_nb_queries lowest queries : ", null, 'antidot.log');
237
+ $i=0;
238
+ foreach ($_queries as $_query) {
239
+ if ($i<$profiler_nb_queries) {
240
+ Mage::log($_query->getElapsedSecs().' '.$_query->getQuery(), null, 'antidot.log');
241
+ $i++;
242
+ }
243
+ }
244
+
245
+ Mage::log('################### ', null, 'antidot.log');
246
+ Mage::log('#### PROFILER ##### ', null, 'antidot.log');
247
+ Mage::log('###########################################', null, 'antidot.log');
248
+ Mage::log("# durée # nbs # emalloc #", null, 'antidot.log');
249
+ Mage::log('###########################################', null, 'antidot.log');
250
+
251
+ $timers = Varien_Profiler::getTimers();
252
+ $totalTime = 0;
253
+ foreach ($timers as $key => $value) {
254
+ $timers[$key]['sum'] = Varien_Profiler::fetch($key,'sum');
255
+ $totalTime += $timers[$key]['sum'];
256
+ }
257
+ uasort($timers, array('self', 'compareTimers'));
258
+
259
+ $profiler_varien_quota = Mage::getStoreConfig('antidot/export/profiler_varien_quota');
260
+ foreach ($timers as $timerName => $timerData) {
261
+ if ($timerData['sum'] > $totalTime * $profiler_varien_quota) {
262
+ Mage::log("# "
263
+ . str_pad(number_format($timerData['sum'], 6), 12, ' ', STR_PAD_LEFT ) . 's # '
264
+ . str_pad($timerData['count'], 6, ' ', STR_PAD_LEFT ) . ' # '
265
+ . str_pad(number_format($timerData['emalloc']), 14, ' ', STR_PAD_LEFT ) . ' # '
266
+ . $timerName,
267
+ null,
268
+ 'antidot.log'
269
+ );
270
+ }
271
+ }
272
+
273
+
274
+ }
275
+
276
+ }
277
+
278
+ static public function compareTimers(array $timerA, array $timerB)
279
+ {
280
+ return $timerA['sum'] < $timerB['sum'];
281
+ }
282
+
283
+ static public function compareElapsedSecs(array $queryA, array $queryB)
284
+ {
285
+ return $queryA->getElapsedSecs() < $queryB->getElapsedSecs();
286
+ }
287
+
288
}
app/code/community/MDN/Antidot/Model/Export/Article.php CHANGED
@@ -92,7 +92,7 @@ class MDN_Antidot_Model_Export_Article extends MDN_Antidot_Model_Export_Product
92
{
93
if ($manufacturer = $this->getField($article, 'manufacturer')) {
94
$this->xml->push('brands');
95
- $brandUrl = Mage::getModel('Antidot/Export_Brand')->getUrl($article->getAttributeText('manufacturer'));
96
$this->xml->element('brand', $this->xml->encloseCData($article->getAttributeText('manufacturer')), array('id' => $manufacturer, 'url' => $brandUrl));
97
$this->xml->pop();
98
}
92
{
93
if ($manufacturer = $this->getField($article, 'manufacturer')) {
94
$this->xml->push('brands');
95
+ $brandUrl = Mage::getModel('Antidot/export_brand')->getUrl($article->getAttributeText('manufacturer'));
96
$this->xml->element('brand', $this->xml->encloseCData($article->getAttributeText('manufacturer')), array('id' => $manufacturer, 'url' => $brandUrl));
97
$this->xml->pop();
98
}
app/code/community/MDN/Antidot/Model/Export/Product.php CHANGED
@@ -73,7 +73,14 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
73
Mage::log('Starting product XML export, filename = '.$filename, null, 'antidot.log');
74
75
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
76
- $db->getProfiler()->setEnabled(false);
77
78
$this->onlyProductsWithStock = !(boolean)Mage::getStoreConfig('antidot/fields_product/in_stock_only');
79
$this->autoCompleteProducts = Mage::getStoreConfig('antidot/suggest/enable') === 'Antidot/engine_antidot' ? 'on' : 'off';
@@ -94,16 +101,26 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
94
95
if ($type === MDN_Antidot_Model_Observer::GENERATE_INC) {
96
if($this->lastGeneration === null) {
97
- $this->lastGeneration = Mage::helper('Antidot/LogExport')->getLastGeneration(self::TYPE);
98
}
99
$collection->addAttributeToFilter('updated_at', array('gteq' => $this->lastGeneration));
100
}
101
- $collection->setPageSize(500);
102
103
$productsCount = $collection->getSize();
104
Mage::log('Products to export : '.$productsCount, null, 'antidot.log');
105
$chunkCount = $collection->getLastPageNumber();
106
107
if ($productsCount > 0) {
108
109
$this->initXml();
@@ -142,7 +159,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
142
$product->clearInstance(); //memory flush
143
$product = null;
144
unset($product);
145
- gc_collect_cycles();
146
}
147
148
}
@@ -151,7 +168,9 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
151
$collection->clear();
152
153
Mage::log('Process chunk # '.$chunkId .' / '.$chunkCount. ' - memory usage = '.memory_get_usage().' - took '.(time() - $lastExecutionTime).' sec', null, 'antidot.log');
154
- $lastExecutionTime = time();
155
156
}
157
$this->xml->pop();
@@ -161,6 +180,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
161
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); //in order to stay on the admin and not be redirected to the last indexed frontend store
162
Mage::log('Products parsing complete', null, 'antidot.log');
163
164
return $productsCount;
165
}
166
@@ -186,7 +207,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
186
foreach($attributes as $att) {
187
$k = $att->getAttributeCode();
188
$this->propertyLabel[$k] = array();
189
- $this->propertyLabel[$k]['default'] = $att->getfrontend_label();
190
$this->propertyLabel[$k]['per_store'] = $att->getStoreLabels();
191
192
$this->propertyLabel[$k]['options'] = array();
@@ -197,14 +218,19 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
197
}
198
199
$this->propertyLabel[$k]['options'][$option['value']] = array();
200
$this->propertyLabel[$k]['options'][$option['value']]['per_store'] = array();
201
- $query = 'SELECT store_id, value FROM '
202
- . Mage::getConfig()->getTablePrefix().'eav_attribute_option_value '
203
- . 'WHERE option_id = "'.$option['value'].'"';
204
-
205
- $valuesCollection = mage::getResourceModel('sales/order_item_collection')->getConnection()->fetchAll($query);
206
- foreach($valuesCollection as $item) {
207
- $this->propertyLabel[$k]['options'][$option['value']]['per_store'][$item['store_id']] = $item['value'];
208
}
209
}
210
}
@@ -218,6 +244,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
218
*/
219
protected function writeProduct($product, $stores)
220
{
221
222
//skip product if no websites
223
if (count($stores) == 0)
@@ -268,8 +295,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
268
}
269
$this->xml->pop();
270
271
- //$this->xml->element('created_at', $product->getCreated_at()); AFM-83
272
- //$this->xml->element('last_updated_at', $product->getUpdated_at()); AFM-92
273
274
$this->xml->element('name', $this->xml->encloseCData($this->utf8CharacterValidation($this->getField($product, 'name'))));
275
if($shortName = $this->getField($product, 'short_name')) {
@@ -291,6 +318,9 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
291
$this->writeVariants($product, $variantProducts, $stores);
292
293
$this->xml->pop();
294
}
295
296
/**
@@ -301,6 +331,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
301
*/
302
protected function writeStore($product, $stores, $variantProduct)
303
{
304
$this->xml->push('stores');
305
306
/* Qty is the same for all stores, better compute it outside the loop: */
@@ -345,28 +377,17 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
345
$reloadedVariantProduct->clearInstance(); //memory flush
346
$reloadedVariantProduct = null;
347
unset($reloadedVariantProduct);
348
- gc_collect_cycles();
349
}
350
351
352
}
353
$this->xml->pop();
354
- }
355
-
356
- /**
357
- * Get catalog/product model
358
- *
359
- * @return Model
360
- */
361
- protected function getCatalogProduct()
362
- {
363
- if(!$this->catalogProduct) {
364
- $this->catalogProduct = Mage::getModel('catalog/product');
365
- }
366
367
- return $this->catalogProduct;
368
- }
369
370
/**
371
* Get product stores
372
*
@@ -393,6 +414,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
393
*/
394
protected function writeDescriptions($product)
395
{
396
if(!empty($this->fields['description'])) {
397
$this->xml->push('descriptions');
398
foreach($this->fields['description'] as $description) {
@@ -403,6 +426,9 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
403
}
404
$this->xml->pop();
405
}
406
}
407
408
/**
@@ -435,6 +461,9 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
435
*/
436
protected function writeIdentifiers($product)
437
{
438
if($gtin = $this->getField($product, 'gtin')) {
439
if(!preg_match('/^[0-9]{12,14}#x2F;', $gtin)) {
440
$gtin = false;
@@ -464,6 +493,9 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
464
465
$this->xml->pop();
466
}
467
}
468
469
/**
@@ -473,6 +505,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
473
*/
474
protected function writeBrand($product)
475
{
476
if ($manufacturer = $this->getField($product, 'manufacturer')) {
477
if(!empty($manufacturer)) {
478
$field = empty($this->fields['manufacturer']) ? 'manufacturer' : $this->fields['manufacturer'];
@@ -485,6 +519,9 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
485
}
486
}
487
}
488
}
489
490
/**
@@ -495,7 +532,10 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
495
*/
496
protected function writeProductUrl($product)
497
{
498
$this->xml->element('url', $this->xml->encloseCData($product->getProductUrl(false)));
499
}
500
501
@@ -507,8 +547,10 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
507
*/
508
protected function writeImageUrl($product, $urlImg = true)
509
{
510
-
511
- //Set the current store to generate correct URls (even in unit tests)
512
Mage::app()->setCurrentStore($product->getStoreId());
513
514
try {
@@ -516,7 +558,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
516
$this->xml->element('url_thumbnail', $this->xml->encloseCData(Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getThumbnail())));
517
}
518
} catch(Exception $e) {
519
- Mage::log($e, Zend_Log::ERR, 'antidot.log');
520
}
521
522
try {
@@ -524,8 +566,11 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
524
$this->xml->element('url_image', $this->xml->encloseCData(Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage())));
525
}
526
} catch(Exception $e) {
527
- Mage::log($e, Zend_Log::ERR, 'antidot.log');
528
}
529
}
530
531
/**
@@ -535,6 +580,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
535
*/
536
protected function writeClassification($product, $rootCategoriesIds)
537
{
538
$categories = $this->getProductCategories($product, $rootCategoriesIds);
539
if(count($categories) > 0) {
540
$this->xml->push('classification');
@@ -543,6 +589,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
543
}
544
$this->xml->pop();
545
}
546
}
547
548
/**
@@ -628,6 +676,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
628
$rootCategoryCondition[] = array('like' => '1/'.$rootCategoryId.'/%');
629
}
630
$categories->addAttributeToFilter('path', $rootCategoryCondition);
631
632
//Mage::log($categories->getSelect()->__toString(), null, 'antidot.log');
633
@@ -663,11 +712,13 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
663
*/
664
protected function writeMaterials($product)
665
{
666
if(!empty($this->fields['materials']) && $materials = $product->getAttributeText($this->fields['materials'])) {
667
$this->xml->push('materials');
668
$this->xml->element('material', $this->xml->encloseCData($materials));
669
$this->xml->pop();
670
}
671
}
672
673
/**
@@ -677,11 +728,13 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
677
*/
678
protected function writeColors($product)
679
{
680
if(!empty($this->fields['colors']) && $color = $product->getAttributeText($this->fields['colors'])) {
681
$this->xml->push('colors');
682
$this->xml->element('color', $this->xml->encloseCData($color));
683
$this->xml->pop();
684
}
685
}
686
687
/**
@@ -691,11 +744,13 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
691
*/
692
protected function writeModels($product)
693
{
694
if(!empty($this->fields['models']) && $models = $this->getField($product, $this->fields['models'])) {
695
$this->xml->push('models', array('autocomplete' => 'off'));
696
$this->xml->element('model', $this->xml->encloseCData(substr($models, 0, 40)));
697
$this->xml->pop();
698
}
699
}
700
701
/**
@@ -705,11 +760,13 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
705
*/
706
protected function writeSizes($product)
707
{
708
if(!empty($this->fields['sizes']) && $size = $product->getAttributeText($this->fields['sizes'])) {
709
$this->xml->push('sizes');
710
$this->xml->element('size', $this->xml->encloseCData($size));
711
$this->xml->pop();
712
}
713
}
714
715
/**
@@ -719,6 +776,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
719
*/
720
protected function writeGenders($product)
721
{
722
if(!empty($this->fields['gender']) && $gender = $product->getAttributeText($this->fields['gender'])) {
723
$this->xml->push('audience');
724
$this->xml->push('genders');
@@ -726,6 +784,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
726
$this->xml->pop();
727
$this->xml->pop();
728
}
729
}
730
731
/**
@@ -735,6 +794,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
735
*/
736
protected function writeProperties($product)
737
{
738
$properties = array();
739
if(!empty($this->fields['properties'])) {
740
foreach($this->fields['properties'] as $property) {
@@ -803,6 +863,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
803
}
804
$this->xml->pop();
805
}
806
}
807
808
/**
@@ -812,6 +874,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
812
*/
813
protected function writePrices($product, $parentProduct, $context, $store)
814
{
815
816
/**
817
* MCNX-222 : Add Fixed Taxs to prices
@@ -863,6 +926,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
863
}
864
865
$this->xml->pop();
866
}
867
868
/**
@@ -938,7 +1003,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
938
$product->clearInstance(); //memory flush
939
$product = null;
940
unset($product);
941
- gc_collect_cycles();
942
}
943
944
return $result;
@@ -952,6 +1017,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
952
*/
953
protected function writeMarketing($product, $operations)
954
{
955
$this->xml->push('marketing');
956
$this->xml->element('is_new', ($this->getField($product, 'is_new') ? 1 : 0));
957
$this->xml->element('is_best_sale', ($this->getField($product, 'is_best_sale') ? 1 : 0));
@@ -968,6 +1035,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
968
$this->xml->element('is_promotional', (int)$isPromotional);
969
970
$this->xml->pop();
971
}
972
973
/**
@@ -1018,6 +1086,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
1018
*/
1019
protected function writeMisc($product)
1020
{
1021
$this->xml->push('misc');
1022
$this->xml->element('product_type', $this->xml->encloseCData($product->getTypeID()));
1023
if(!empty($this->fields['misc'])) {
@@ -1026,6 +1095,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
1026
}
1027
}
1028
$this->xml->pop();
1029
}
1030
1031
/**
@@ -1037,6 +1107,7 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
1037
*/
1038
protected function writeVariants($product, $variantProducts, $stores)
1039
{
1040
$this->xml->push('variants');
1041
1042
$this->xml->push('variant', array('id' => 'fake'));
@@ -1051,6 +1122,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
1051
}
1052
1053
$this->xml->pop();
1054
}
1055
1056
/**
@@ -1062,6 +1135,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
1062
*/
1063
protected function writeVariant($variantProduct, $product, $stores)
1064
{
1065
$this->xml->element('name', $this->xml->encloseCData($this->utf8CharacterValidation($variantProduct->getName())));
1066
$this->writeDescriptions($variantProduct);
1067
$this->writeStore($product, $stores, $variantProduct);
@@ -1073,6 +1148,9 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
1073
$this->writeSizes($variantProduct);
1074
$this->writeGenders($product);
1075
$this->writeMisc($variantProduct);
1076
}
1077
1078
/**
@@ -1083,6 +1161,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
1083
*/
1084
protected function writePart($xml, $close = false)
1085
{
1086
$filename = $this->getFilename();
1087
if ($this->file === null) {
1088
$this->file = fopen($filename, 'a+');
@@ -1098,6 +1178,8 @@ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
1098
fclose($this->file);
1099
$this->file = null;
1100
}
1101
}
1102
1103
/**
73
Mage::log('Starting product XML export, filename = '.$filename, null, 'antidot.log');
74
75
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
76
+ if (Mage::getStoreConfig('antidot/export/profiler_enable')) {
77
+ $db->getProfiler()->setEnabled(true);
78
+ Varien_Profiler::enable();
79
+ } else {
80
+ $db->getProfiler()->setEnabled(false);
81
+ }
82
+
83
+ Varien_Profiler::start("export_product_writeXml");
84
85
$this->onlyProductsWithStock = !(boolean)Mage::getStoreConfig('antidot/fields_product/in_stock_only');
86
$this->autoCompleteProducts = Mage::getStoreConfig('antidot/suggest/enable') === 'Antidot/engine_antidot' ? 'on' : 'off';
101
102
if ($type === MDN_Antidot_Model_Observer::GENERATE_INC) {
103
if($this->lastGeneration === null) {
104
+ $this->lastGeneration = Mage::helper('Antidot/logExport')->getLastGeneration(self::TYPE);
105
}
106
$collection->addAttributeToFilter('updated_at', array('gteq' => $this->lastGeneration));
107
}
108
+
109
+ $chunkSize = Mage::getStoreConfig('antidot/export/chunk_size');
110
+ if (!$chunkSize) {
111
+ $chunkSize = 500;
112
+ }
113
+ $collection->setPageSize($chunkSize);
114
115
$productsCount = $collection->getSize();
116
Mage::log('Products to export : '.$productsCount, null, 'antidot.log');
117
$chunkCount = $collection->getLastPageNumber();
118
119
+ /** if profiling is enabled process only one chunk */
120
+ if (Mage::getStoreConfig('antidot/export/profiler_enable')) {
121
+ $chunkCount = 1;
122
+ }
123
+
124
if ($productsCount > 0) {
125
126
$this->initXml();
159
$product->clearInstance(); //memory flush
160
$product = null;
161
unset($product);
162
+ $this->garbageCollection();
163
}
164
165
}
168
$collection->clear();
169
170
Mage::log('Process chunk # '.$chunkId .' / '.$chunkCount. ' - memory usage = '.memory_get_usage().' - took '.(time() - $lastExecutionTime).' sec', null, 'antidot.log');
171
+ $lastExecutionTime = time();
172
+
173
+ $this->profile();
174
175
}
176
$this->xml->pop();
180
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); //in order to stay on the admin and not be redirected to the last indexed frontend store
181
Mage::log('Products parsing complete', null, 'antidot.log');
182
183
+ Varien_Profiler::stop("export_product_writeXml");
184
+
185
return $productsCount;
186
}
187
207
foreach($attributes as $att) {
208
$k = $att->getAttributeCode();
209
$this->propertyLabel[$k] = array();
210
+ $this->propertyLabel[$k]['default'] = $att->getFrontendLabel();
211
$this->propertyLabel[$k]['per_store'] = $att->getStoreLabels();
212
213
$this->propertyLabel[$k]['options'] = array();
218
}
219
220
$this->propertyLabel[$k]['options'][$option['value']] = array();
221
+ $this->propertyLabel[$k]['options'][$option['value']]['default'] = $option['label'];
222
$this->propertyLabel[$k]['options'][$option['value']]['per_store'] = array();
223
+ if ($att->getSourceModel()=='eav/entity_attribute_source_table') {
224
+ $query = 'SELECT store_id, value FROM '
225
+ .Mage::getConfig()->getTablePrefix().'eav_attribute_option_value '
226
+ .'WHERE option_id = "'.$option['value'].'"';
227
+
228
+ $valuesCollection = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll(
229
+ $query
230
+ );
231
+ foreach ($valuesCollection as $item) {
232
+ $this->propertyLabel[$k]['options'][$option['value']]['per_store'][$item['store_id']] = $item['value'];
233
+ }
234
}
235
}
236
}
244
*/
245
protected function writeProduct($product, $stores)
246
{
247
+ Varien_Profiler::start("export_product_writeProduct");
248
249
//skip product if no websites
250
if (count($stores) == 0)
295
}
296
$this->xml->pop();
297
298
+ //$this->xml->writeElement('created_at', $product->getCreated_at()); AFM-83
299
+ //$this->xml->writeElement('last_updated_at', $product->getUpdated_at()); AFM-92
300
301
$this->xml->element('name', $this->xml->encloseCData($this->utf8CharacterValidation($this->getField($product, 'name'))));
302
if($shortName = $this->getField($product, 'short_name')) {
318
$this->writeVariants($product, $variantProducts, $stores);
319
320
$this->xml->pop();
321
+
322
+ Varien_Profiler::stop("export_product_writeProduct");
323
+
324
}
325
326
/**
331
*/
332
protected function writeStore($product, $stores, $variantProduct)
333
{
334
+ Varien_Profiler::start("export_product_writeStore");
335
+
336
$this->xml->push('stores');
337
338
/* Qty is the same for all stores, better compute it outside the loop: */
377
$reloadedVariantProduct->clearInstance(); //memory flush
378
$reloadedVariantProduct = null;
379
unset($reloadedVariantProduct);
380
+ $this->garbageCollection();
381
}
382
383
384
}
385
$this->xml->pop();
386
387
+ Varien_Profiler::stop("export_product_writeStore");
388
389
+ }
390
+
391
/**
392
* Get product stores
393
*
414
*/
415
protected function writeDescriptions($product)
416
{
417
+ Varien_Profiler::start("export_product_writeDescriptions");
418
+
419
if(!empty($this->fields['description'])) {
420
$this->xml->push('descriptions');
421
foreach($this->fields['description'] as $description) {
426
}
427
$this->xml->pop();
428
}
429
+
430
+ Varien_Profiler::stop("export_product_writeDescriptions");
431
+
432
}
433
434
/**
461
*/
462
protected function writeIdentifiers($product)
463
{
464
+
465
+ Varien_Profiler::start("export_product_writeIdentifiers");
466
+
467
if($gtin = $this->getField($product, 'gtin')) {
468
if(!preg_match('/^[0-9]{12,14}#x2F;', $gtin)) {
469
$gtin = false;
493
494
$this->xml->pop();
495
}
496
+
497
+ Varien_Profiler::stop("export_product_writeIdentifiers");
498
+
499
}
500
501
/**
505
*/
506
protected function writeBrand($product)
507
{
508
+ Varien_Profiler::start("export_product_writeBrand");
509
+
510
if ($manufacturer = $this->getField($product, 'manufacturer')) {
511
if(!empty($manufacturer)) {
512
$field = empty($this->fields['manufacturer']) ? 'manufacturer' : $this->fields['manufacturer'];
519
}
520
}
521
}
522
+
523
+ Varien_Profiler::stop("export_product_writeBrand");
524
+
525
}
526
527
/**
532
*/
533
protected function writeProductUrl($product)
534
{
535
+ Varien_Profiler::start("export_product_writeProductUrl");
536
$this->xml->element('url', $this->xml->encloseCData($product->getProductUrl(false)));
537
+ Varien_Profiler::stop("export_product_writeProductUrl");
538
+
539
}
540
541
547
*/
548
protected function writeImageUrl($product, $urlImg = true)
549
{
550
+
551
+ Varien_Profiler::start("export_product_writeImageUrl");
552
+
553
+ //Set the current store to generate correct URls (even in unit tests)
554
Mage::app()->setCurrentStore($product->getStoreId());
555
556
try {
558
$this->xml->element('url_thumbnail', $this->xml->encloseCData(Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getThumbnail())));
559
}
560
} catch(Exception $e) {
561
+ Mage::log("writeImageUrl Exception : " . $e->getMessage(), Zend_Log::ERR, 'antidot.log');
562
}
563
564
try {
566
$this->xml->element('url_image', $this->xml->encloseCData(Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage())));
567
}
568
} catch(Exception $e) {
569
+ Mage::log("writeImageUrl Exception : " .$e->getMessage(), Zend_Log::ERR, 'antidot.log');
570
}
571
+
572
+ Varien_Profiler::stop("export_product_writeImageUrl");
573
+
574
}
575
576
/**
580
*/
581
protected function writeClassification($product, $rootCategoriesIds)
582
{
583
+ Varien_Profiler::start("export_product_writeClassification");
584
$categories = $this->getProductCategories($product, $rootCategoriesIds);
585
if(count($categories) > 0) {
586
$this->xml->push('classification');
589
}
590
$this->xml->pop();
591
}
592
+ Varien_Profiler::stop("export_product_writeClassification");
593
+
594
}
595
596
/**
676
$rootCategoryCondition[] = array('like' => '1/'.$rootCategoryId.'/%');
677
}
678
$categories->addAttributeToFilter('path', $rootCategoryCondition);
679
+ $categories->addAttributeToFilter('is_active', 1); //MCNX-236
680
681
//Mage::log($categories->getSelect()->__toString(), null, 'antidot.log');
682
712
*/
713
protected function writeMaterials($product)
714
{
715
+ Varien_Profiler::start("export_product_writeMaterials");
716
if(!empty($this->fields['materials']) && $materials = $product->getAttributeText($this->fields['materials'])) {
717
$this->xml->push('materials');
718
$this->xml->element('material', $this->xml->encloseCData($materials));
719
$this->xml->pop();
720
}
721
+ Varien_Profiler::stop("export_product_writeMaterials");
722
}
723
724
/**
728
*/
729
protected function writeColors($product)
730
{
731
+ Varien_Profiler::start("export_product_writeColors");
732
if(!empty($this->fields['colors']) && $color = $product->getAttributeText($this->fields['colors'])) {
733
$this->xml->push('colors');
734
$this->xml->element('color', $this->xml->encloseCData($color));
735
$this->xml->pop();
736
}
737
+ Varien_Profiler::stop("export_product_writeColors");
738
}
739
740
/**
744
*/
745
protected function writeModels($product)
746
{
747
+ Varien_Profiler::start("export_product_writeModels");
748
if(!empty($this->fields['models']) && $models = $this->getField($product, $this->fields['models'])) {
749
$this->xml->push('models', array('autocomplete' => 'off'));
750
$this->xml->element('model', $this->xml->encloseCData(substr($models, 0, 40)));
751
$this->xml->pop();
752
}
753
+ Varien_Profiler::stop("export_product_writeModels");
754
}
755
756
/**
760
*/
761
protected function writeSizes($product)
762
{
763
+ Varien_Profiler::start("export_product_writeSizes");
764
if(!empty($this->fields['sizes']) && $size = $product->getAttributeText($this->fields['sizes'])) {
765
$this->xml->push('sizes');
766
$this->xml->element('size', $this->xml->encloseCData($size));
767
$this->xml->pop();
768
}
769
+ Varien_Profiler::stop("export_product_writeSizes");
770
}
771
772
/**
776
*/
777
protected function writeGenders($product)
778
{
779
+ Varien_Profiler::start("export_product_writeGenders");
780
if(!empty($this->fields['gender']) && $gender = $product->getAttributeText($this->fields['gender'])) {
781
$this->xml->push('audience');
782
$this->xml->push('genders');
784
$this->xml->pop();
785
$this->xml->pop();
786
}
787
+ Varien_Profiler::stop("export_product_writeGenders");
788
}
789
790
/**
794
*/
795
protected function writeProperties($product)
796
{
797
+ Varien_Profiler::start("export_product_writeProperties");
798
$properties = array();
799
if(!empty($this->fields['properties'])) {
800
foreach($this->fields['properties'] as $property) {
863
}
864
$this->xml->pop();
865
}
866
+ Varien_Profiler::stop("export_product_writeProperties");
867
+
868
}
869
870
/**
874
*/
875
protected function writePrices($product, $parentProduct, $context, $store)
876
{
877
+ Varien_Profiler::start("export_product_writePrices");
878
879
/**
880
* MCNX-222 : Add Fixed Taxs to prices
926
}
927
928
$this->xml->pop();
929
+ Varien_Profiler::stop("export_product_writePrices");
930
+
931
}
932
933
/**
1003
$product->clearInstance(); //memory flush
1004
$product = null;
1005
unset($product);
1006
+ $this->garbageCollection();
1007
}
1008
1009
return $result;
1017
*/
1018
protected function writeMarketing($product, $operations)
1019
{
1020
+ Varien_Profiler::start("export_product_writeMarketing");
1021
+
1022
$this->xml->push('marketing');
1023
$this->xml->element('is_new', ($this->getField($product, 'is_new') ? 1 : 0));
1024
$this->xml->element('is_best_sale', ($this->getField($product, 'is_best_sale') ? 1 : 0));
1035
$this->xml->element('is_promotional', (int)$isPromotional);
1036
1037
$this->xml->pop();
1038
+ Varien_Profiler::stop("export_product_writeMarketing");
1039
}
1040
1041
/**
1086
*/
1087
protected function writeMisc($product)
1088
{
1089
+ Varien_Profiler::start("export_product_writeMisc");
1090
$this->xml->push('misc');
1091
$this->xml->element('product_type', $this->xml->encloseCData($product->getTypeID()));
1092
if(!empty($this->fields['misc'])) {
1095
}
1096
}
1097
$this->xml->pop();
1098
+ Varien_Profiler::stop("export_product_writeMisc");
1099
}
1100
1101
/**
1107
*/
1108
protected function writeVariants($product, $variantProducts, $stores)
1109
{
1110
+ Varien_Profiler::start("export_product_writeVariants");
1111
$this->xml->push('variants');
1112
1113
$this->xml->push('variant', array('id' => 'fake'));
1122
}
1123
1124
$this->xml->pop();
1125
+ Varien_Profiler::stop("export_product_writeVariants");
1126
+
1127
}
1128
1129
/**
1135
*/
1136
protected function writeVariant($variantProduct, $product, $stores)
1137
{
1138
+ Varien_Profiler::start("export_product_writeVariant");
1139
+
1140
$this->xml->element('name', $this->xml->encloseCData($this->utf8CharacterValidation($variantProduct->getName())));
1141
$this->writeDescriptions($variantProduct);
1142
$this->writeStore($product, $stores, $variantProduct);
1148
$this->writeSizes($variantProduct);
1149
$this->writeGenders($product);
1150
$this->writeMisc($variantProduct);
1151
+
1152
+ Varien_Profiler::stop("export_product_writeVariant");
1153
+
1154
}
1155
1156
/**
1161
*/
1162
protected function writePart($xml, $close = false)
1163
{
1164
+ Varien_Profiler::start("export_product_writePart");
1165
+
1166
$filename = $this->getFilename();
1167
if ($this->file === null) {
1168
$this->file = fopen($filename, 'a+');
1178
fclose($this->file);
1179
$this->file = null;
1180
}
1181
+ Varien_Profiler::stop("export_product_writePart");
1182
+
1183
}
1184
1185
/**
app/code/community/MDN/Antidot/Model/Observer.php CHANGED
@@ -49,52 +49,23 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
49
$this->begin = microtime(true);
50
$this->initTmpDirectory();
51
52
- /*
53
* If the default memory limit is below 2048M set it to 2048M
54
* else if it is above 2048M let it as it is
55
*/
56
- if ($this->return_bytes(ini_get('memory_limit')) < $this->return_bytes(self::MINIMUM_MEMORY_LIMIT)) {
57
- ini_set('memory_limit', self::MINIMUM_MEMORY_LIMIT);
58
}
59
60
}
61
62
- /**
63
- * Gives the value in bytes
64
- */
65
- protected function return_bytes ($val)
66
- {
67
- if(empty($val))return 0;
68
-
69
- $val = trim($val);
70
-
71
- preg_match('#([0-9]+)[\s]*([a-z]+)#i', $val, $matches);
72
-
73
- $last = '';
74
- if(isset($matches[2])){
75
- $last = $matches[2];
76
- }
77
-
78
- if(isset($matches[1])){
79
- $val = (int) $matches[1];
80
- }
81
-
82
- switch (strtolower($last))
83
- {
84
- case 'g':
85
- case 'gb':
86
- $val *= 1024;
87
- case 'm':
88
- case 'mb':
89
- $val *= 1024;
90
- case 'k':
91
- case 'kb':
92
- $val *= 1024;
93
- }
94
-
95
- return (int) $val;
96
- }
97
-
98
/**
99
* Init the tmp directory
100
*/
@@ -124,7 +95,7 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
124
public function catalogFullExport($runContext = 'cron')
125
{
126
$this->log('FULL EXPORT');
127
- return $this->generate(Mage::getModel('Antidot/Export_Product'), self::GENERATE_FULL, $runContext);
128
}
129
130
/**
@@ -132,7 +103,7 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
132
*/
133
public function catalogIncExport($runContext = 'cron')
134
{
135
- return $this->generate(Mage::getModel('Antidot/Export_Product'), self::GENERATE_INC, $runContext);
136
}
137
138
/**
@@ -140,7 +111,7 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
140
*/
141
public function categoriesFullExport($runContext = 'cron')
142
{
143
- return $this->generate(Mage::getModel('Antidot/Export_Category'), self::GENERATE_FULL, $runContext);
144
}
145
146
/**
@@ -208,7 +179,7 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
208
$log['status'] = 'SUCCESS';
209
} else {
210
$log['status'] = 'FAILED';
211
- $lastError = current(Mage::helper('Antidot/XmlWriter')->getErrors());
212
if ($lastError) {
213
$log['error'][] = $lastError;
214
} else {
@@ -232,7 +203,7 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
232
$this->log('generate '.$exportModel::TYPE.' '.$context['owner']);
233
$this->log('end');
234
235
- Mage::helper('Antidot/LogExport')->add($log['reference'], $type, $exportModel::TYPE, $log['begin'], $log['end'], $log['items'], $log['status'], implode(',', $log['error']));
236
237
if ( count($log['error']) ) {
238
//send error alert mail
@@ -282,7 +253,7 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
282
$this->log('compress the file');
283
284
$compressFile = dirname(current($files)).'/'.$compressFile;
285
- Mage::helper('Antidot/Compress')->zip($files, $compressFile);
286
287
return $compressFile;
288
}
@@ -297,7 +268,7 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
297
{
298
$this->log('send the file');
299
300
- $transport = Mage::getModel('Antidot/Transport');
301
302
return $transport->send($filename, $transport::TRANS_FTP);
303
}
@@ -315,9 +286,10 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
315
$errors = array();
316
317
//disable schema validation
318
- if (Mage::getStoreConfig('antidot/xsd_verification/disable') == 1)
319
- {
320
- $this->log('schema validation is DISABLED');
321
} else {
322
323
libxml_use_internal_errors(true);
@@ -332,7 +304,7 @@ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
332
$this->log('Schema validated');
333
} else {
334
335
- $errors = Mage::helper('Antidot/XmlWriter')->getErrors();
336
337
$match = array();
338
if (preg_match('#Warning 1549: failed to load external entity "(.*)\.xsd"#', $errors[0], $match)) {
49
$this->begin = microtime(true);
50
$this->initTmpDirectory();
51
52
+ /**
53
* If the default memory limit is below 2048M set it to 2048M
54
* else if it is above 2048M let it as it is
55
+ *
56
+ * @var $antidotHelper MDN_Antidot_Helper_Data
57
*/
58
+ $antidotHelper = Mage::helper('Antidot');
59
+ $memoryLimit = Mage::getStoreConfig('antidot/export/memory_limit');
60
+ if (!$memoryLimit) {
61
+ $memoryLimit = self::MINIMUM_MEMORY_LIMIT;
62
+ }
63
+ if ($antidotHelper->returnBytes(ini_get('memory_limit')) < $antidotHelper->returnBytes($memoryLimit)) {
64
+ ini_set('memory_limit', $memoryLimit);
65
}
66
67
}
68
69
/**
70
* Init the tmp directory
71
*/
95
public function catalogFullExport($runContext = 'cron')
96
{
97
$this->log('FULL EXPORT');
98
+ return $this->generate(Mage::getModel('Antidot/export_product'), self::GENERATE_FULL, $runContext);
99
}
100
101
/**
103
*/
104
public function catalogIncExport($runContext = 'cron')
105
{
106
+ return $this->generate(Mage::getModel('Antidot/export_product'), self::GENERATE_INC, $runContext);
107
}
108
109
/**
111
*/
112
public function categoriesFullExport($runContext = 'cron')
113
{
114
+ return $this->generate(Mage::getModel('Antidot/export_category'), self::GENERATE_FULL, $runContext);
115
}
116
117
/**
179
$log['status'] = 'SUCCESS';
180
} else {
181
$log['status'] = 'FAILED';
182
+ $lastError = current(Mage::helper('Antidot/xmlWriter')->getErrors());
183
if ($lastError) {
184
$log['error'][] = $lastError;
185
} else {
203
$this->log('generate '.$exportModel::TYPE.' '.$context['owner']);
204
$this->log('end');
205
206
+ Mage::helper('Antidot/logExport')->add($log['reference'], $type, $exportModel::TYPE, $log['begin'], $log['end'], $log['items'], $log['status'], implode(',', $log['error']));
207
208
if ( count($log['error']) ) {
209
//send error alert mail
253
$this->log('compress the file');
254
255
$compressFile = dirname(current($files)).'/'.$compressFile;
256
+ Mage::helper('Antidot/compress')->zip($files, $compressFile);
257
258
return $compressFile;
259
}
268
{
269
$this->log('send the file');
270
271
+ $transport = Mage::getModel('Antidot/transport');
272
273
return $transport->send($filename, $transport::TRANS_FTP);
274
}
286
$errors = array();
287
288
//disable schema validation
289
+ if (Mage::getStoreConfig('antidot/export/xsd_validation_disable') == 1) {
290
+ $this->log('schema validation is DISABLED due to configuration');
291
+ } elseif (!class_exists('DOMDocument')) {
292
+ $this->log('schema validation is DISABLED due to lack of libxml DOMDocument Class');
293
} else {
294
295
libxml_use_internal_errors(true);
304
$this->log('Schema validated');
305
} else {
306
307
+ $errors = Mage::helper('Antidot/xmlWriter')->getErrors();
308
309
$match = array();
310
if (preg_match('#Warning 1549: failed to load external entity "(.*)\.xsd"#', $errors[0], $match)) {
app/code/community/MDN/Antidot/Model/Resource/Engine/Abstract.php CHANGED
@@ -86,12 +86,12 @@ abstract class MDN_Antidot_Model_Resource_Engine_Abstract
86
* @param string $type
87
* @return array
88
*/
89
- public function getIdsByQuery($query, $params = array(), $type = 'product')
90
{
91
$paramsHash = md5(json_encode($params));
92
if (!isset($this->_idsByQuery[$paramsHash])) {
93
$ids = array();
94
- $resultTmp = $this->search($query, $params, $type);
95
if (!empty($resultTmp['ids'])) {
96
foreach ($resultTmp['ids'] as $id) {
97
$ids[] = $id['id'];
@@ -149,7 +149,7 @@ abstract class MDN_Antidot_Model_Resource_Engine_Abstract
149
*/
150
public function getStats($query, $params = array(), $type = 'product')
151
{
152
- return $this->_search($query, $params, $type);
153
}
154
155
/**
@@ -180,16 +180,16 @@ abstract class MDN_Antidot_Model_Resource_Engine_Abstract
180
* @param string $type
181
* @return array
182
*/
183
- public function search($query, $params = array(), $type = 'product')
184
{
185
$result = array();
186
try {
187
Varien_Profiler::start('Antidot');
188
- $result = $this->_search($query, $params, $type);
189
Varien_Profiler::stop('Antidot');
190
191
} catch (Exception $e) {
192
- Mage::logException($e, null, 'antidot.log');
193
}
194
195
return $result;
86
* @param string $type
87
* @return array
88
*/
89
+ public function getIdsByQuery($query, $params = array())
90
{
91
$paramsHash = md5(json_encode($params));
92
if (!isset($this->_idsByQuery[$paramsHash])) {
93
$ids = array();
94
+ $resultTmp = $this->search($query, $params);
95
if (!empty($resultTmp['ids'])) {
96
foreach ($resultTmp['ids'] as $id) {
97
$ids[] = $id['id'];
149
*/
150
public function getStats($query, $params = array(), $type = 'product')
151
{
152
+ return $this->_search($query, $params);
153
}
154
155
/**
180
* @param string $type
181
* @return array
182
*/
183
+ public function search($query, $params = array())
184
{
185
$result = array();
186
try {
187
Varien_Profiler::start('Antidot');
188
+ $result = $this->_search($query, $params);
189
Varien_Profiler::stop('Antidot');
190
191
} catch (Exception $e) {
192
+ Mage::log($e->getMessage(), null, 'antidot.log');
193
}
194
195
return $result;
app/code/community/MDN/Antidot/Model/Resource/Engine/Antidot.php CHANGED
@@ -27,7 +27,7 @@ class MDN_Antidot_Model_Resource_Engine_Antidot extends MDN_Antidot_Model_Resour
27
*/
28
public function __construct()
29
{
30
- $this->client = Mage::getModel('Antidot/Search_Search');
31
}
32
33
/**
@@ -37,7 +37,7 @@ class MDN_Antidot_Model_Resource_Engine_Antidot extends MDN_Antidot_Model_Resour
37
*/
38
protected function _getHelper()
39
{
40
- return Mage::helper('Antidot/Antidot');
41
}
42
43
/**
@@ -291,7 +291,6 @@ class MDN_Antidot_Model_Resource_Engine_Antidot extends MDN_Antidot_Model_Resour
291
*
292
* @param string $query
293
* @param array $params
294
- * @param string $type
295
* @return array
296
*/
297
protected function _search($query, $params = array())
27
*/
28
public function __construct()
29
{
30
+ $this->client = Mage::getModel('Antidot/search_search');
31
}
32
33
/**
37
*/
38
protected function _getHelper()
39
{
40
+ return Mage::helper('Antidot/antidot');
41
}
42
43
/**
291
*
292
* @param string $query
293
* @param array $params
294
* @return array
295
*/
296
protected function _search($query, $params = array())
app/code/community/MDN/Antidot/Model/Search/Search.php CHANGED
@@ -32,6 +32,11 @@ class MDN_Antidot_Model_Search_Search extends MDN_Antidot_Model_Search_Abstract
32
*/
33
protected $afsSearch;
34
35
/**
36
* {@inherit}
37
*/
@@ -54,6 +59,10 @@ class MDN_Antidot_Model_Search_Search extends MDN_Antidot_Model_Search_Abstract
54
}
55
}
56
57
/**
58
* Get the suggest list
59
*
@@ -167,16 +176,18 @@ class MDN_Antidot_Model_Search_Search extends MDN_Antidot_Model_Search_Abstract
167
*/
168
public function getFacets()
169
{
170
- $facets = array();
171
172
- $resultAntidot = $this->search(null, array('limit' => 1), true);
173
- if (isset($resultAntidot->replyset) && $resultAntidot->replyset) {
174
- foreach ($resultAntidot->replyset->facets as $facet) {
175
- $facets[$facet->id] = $facet;
176
}
177
}
178
179
- return $facets;
180
}
181
182
/**
32
*/
33
protected $afsSearch;
34
35
+ /**
36
+ * @var array facets
37
+ */
38
+ protected $facets;
39
+
40
/**
41
* {@inherit}
42
*/
59
}
60
}
61
62
+ public function getLastSearchTranslations() {
63
+ return self::$lastSearchTranslations;
64
+ }
65
+
66
/**
67
* Get the suggest list
68
*
176
*/
177
public function getFacets()
178
{
179
+ if (!$this->facets) {
180
+ $this->facets = array();
181
182
+ $resultAntidot = $this->search(null, array('limit' => 1), true);
183
+ if (isset($resultAntidot->replyset) && $resultAntidot->replyset) {
184
+ foreach ($resultAntidot->replyset->facets as $facet) {
185
+ $this->facets[$facet->id] = $facet;
186
+ }
187
}
188
}
189
190
+ return $this->facets;
191
}
192
193
/**
app/code/community/MDN/Antidot/Model/System/Config/Facet.php CHANGED
@@ -25,7 +25,7 @@ class MDN_Antidot_Model_System_Config_Facet
25
{
26
if (!$this->options) {
27
try {
28
- $search = Mage::getModel('Antidot/Search_Search');
29
30
$this->options = array();
31
if (count($search->getFacets()) > 0) {
@@ -46,8 +46,9 @@ class MDN_Antidot_Model_System_Config_Facet
46
47
foreach ($search->getFacets() as $facetId => $facet) {
48
if ($typeExclude === null || $facet->get_type() !== $typeExclude) {
49
$this->options[] = array(
50
- 'value' => $facetId.'|'.$facet->get_label(),
51
'label' => $facetId.' ('.$facet->get_type().')'
52
);
53
25
{
26
if (!$this->options) {
27
try {
28
+ $search = Mage::getSingleton('Antidot/search_search');
29
30
$this->options = array();
31
if (count($search->getFacets()) > 0) {
46
47
foreach ($search->getFacets() as $facetId => $facet) {
48
if ($typeExclude === null || $facet->get_type() !== $typeExclude) {
49
+ //MCNX-235 : escape single quote for javascript, it cause error in javascript facet editor in BO
50
$this->options[] = array(
51
+ 'value' => $facetId.'|'.Mage::helper('core')->jsQuoteEscape($facet->get_label()),
52
'label' => $facetId.' ('.$facet->get_type().')'
53
);
54
app/code/community/MDN/Antidot/Model/Transport.php CHANGED
@@ -28,7 +28,7 @@ class MDN_Antidot_Model_Transport extends Mage_Core_Model_Abstract
28
*/
29
public function send($file, $type = self::TRANS_FILE)
30
{
31
- if($transport = Mage::getModel('Antidot/Transport_'.ucfirst($type))) {
32
return $transport->send($file);
33
}
34
28
*/
29
public function send($file, $type = self::TRANS_FILE)
30
{
31
+ if($transport = Mage::getModel('Antidot/transport_'.ucfirst($type))) {
32
return $transport->send($file);
33
}
34
app/code/community/MDN/Antidot/Test/Helper/Data.php ADDED
@@ -0,0 +1,36 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @copyright Copyright (c) 2015 Antidot (http://www.antidot.net)
12
+ * @author : Antidot devmagento@antidot.net
13
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
14
+ */
15
+ class MDN_Antidot_Test_Helper_Data extends EcomDev_PHPUnit_Test_Case
16
+ {
17
+
18
+ /**
19
+ * Test method MDN_Antidot_Model_Observer returnBytes
20
+ */
21
+ function testReturnBytes()
22
+ {
23
+ /** @var $observer MDN_Antidot_Model_Observer */
24
+ $helper = Mage::helper('Antidot');
25
+
26
+ foreach (array("2048M" => "2147483648", "512M" => "536870912", "4G" => "4294967296") as $value => $expected) {
27
+ $result = $helper->returnBytes($value);
28
+ $this->assertEquals(
29
+ $result,
30
+ $expected
31
+ );
32
+ }
33
+
34
+ }
35
+
36
+ }
app/code/community/MDN/Antidot/Test/Model/Export/Abstract.php ADDED
@@ -0,0 +1,34 @@
1
+ <?php
2
+
3
+
4
+ class MDN_Antidot_Test_Model_Export_Abstract extends EcomDev_PHPUnit_Test_Case
5
+ {
6
+
7
+ /**
8
+ * test Garbage Collection
9
+ *
10
+ * gc is enabled in fixture
11
+ * percentage is set to 10% in fixture
12
+ *
13
+ * @loadFixture
14
+ */
15
+ public function testGarbageCollection() {
16
+
17
+ $export = Mage::getModel('Antidot/export_product');
18
+ /* store the default limit */
19
+ $initialLimit = ini_get('memory_limit');
20
+
21
+ //set memory limit to 5x the used memory : then the used memory will be more than 10% of the limit
22
+ ini_set('memory_limit', memory_get_usage(true) * 5);
23
+ $done = MDN_Antidot_Test_PHPUnitUtil::callPrivateMethod($export, 'garbageCollection', array());
24
+ $this->assertTrue($done);
25
+
26
+ //set memory limit to 10x the used memory : then the used memory will be less than 10% of the limit
27
+ ini_set('memory_limit', memory_get_usage(true) * 10);
28
+ $done = MDN_Antidot_Test_PHPUnitUtil::callPrivateMethod($export, 'garbageCollection', array());
29
+ $this->assertFalse($done);
30
+
31
+ ini_set('memory_limit', $initialLimit);
32
+ }
33
+
34
+ }
app/code/community/MDN/Antidot/Test/Model/Export/Abstract/fixtures/testGarbageCollection.yaml ADDED
@@ -0,0 +1,3 @@
1
+ config:
2
+ default/antidot/export/gc_enabled: 1
3
+ default/antidot/export/gc_percentage_limit: 10
app/code/community/MDN/Antidot/Test/Model/Export/Category.php CHANGED
@@ -4,6 +4,11 @@
4
class MDN_Antidot_Test_Model_Export_Category extends EcomDev_PHPUnit_Test_Case
5
{
6
7
/*
8
* MCNX-56 add version number and run context in the feed tag
9
*/
@@ -23,15 +28,19 @@ class MDN_Antidot_Test_Model_Export_Category extends EcomDev_PHPUnit_Test_Case
23
/*
24
* MCNX-170 don't generate file if there's no categories to export
25
* test the XmlWriter has not been initialised if there's no categories to export
26
*/
27
public function testEmptyFile() {
28
29
$export = Mage::getModel('Antidot/export_category');
30
31
$context = array();
32
- $context['store_id'] = array(1);
33
- $context['website_ids'] = array(1);
34
- $context['stores'] = array(Mage::getModel('core/store')->load(1));
35
$nbItem = $export->writeXml($context, 'categories-magento_jetpulp_FULL-en.xml', MDN_Antidot_Model_Observer::GENERATE_FULL);
36
37
$this->assertEquals($nbItem, 0);
@@ -43,4 +52,4 @@ class MDN_Antidot_Test_Model_Export_Category extends EcomDev_PHPUnit_Test_Case
43
44
}
45
46
- }
4
class MDN_Antidot_Test_Model_Export_Category extends EcomDev_PHPUnit_Test_Case
5
{
6
7
+ public static function setUpBeforeClass()
8
+ {
9
+ //avoid errors when session_start is called during the test
10
+ @session_start();
11
+ }
12
/*
13
* MCNX-56 add version number and run context in the feed tag
14
*/
28
/*
29
* MCNX-170 don't generate file if there's no categories to export
30
* test the XmlWriter has not been initialised if there's no categories to export
31
+ * @loadFixture
32
*/
33
public function testEmptyFile() {
34
35
$export = Mage::getModel('Antidot/export_category');
36
37
$context = array();
38
+ $context['store_id'] = array(2);
39
+ $context['website_ids'] = array(2);
40
+ $context['stores'] = array(Mage::getModel('core/store')->load(2));
41
+ $context['owner'] = 'JETPULP';
42
+ $context['run'] = 'phpunit';
43
+ $context['lang'] = 'en';
44
$nbItem = $export->writeXml($context, 'categories-magento_jetpulp_FULL-en.xml', MDN_Antidot_Model_Observer::GENERATE_FULL);
45
46
$this->assertEquals($nbItem, 0);
52
53
}
54
55
+ }
app/code/community/MDN/Antidot/Test/Model/Export/Category/fixtures/testEmptyFile.yaml ADDED
@@ -0,0 +1,19 @@
1
+ scope:
2
+ website: # Initialize websites
3
+ - website_id: 2
4
+ code: usa_website
5
+ name: USA Website
6
+ default_group_id: 2
7
+ group: # Initializes store groups
8
+ - group_id: 2
9
+ website_id: 2
10
+ name: USA Store Group
11
+ default_store_id: 2
12
+ root_category_id: 99 # Default Category
13
+ store: # Initializes store views
14
+ - store_id: 2
15
+ website_id: 2
16
+ group_id: 2
17
+ code: usa
18
+ name: USA Store
19
+ is_active: 1
app/code/community/MDN/Antidot/Test/Model/Export/Product.php CHANGED
@@ -453,8 +453,41 @@ class MDN_Antidot_Test_Model_Export_Product extends EcomDev_PHPUnit_Test_Case
453
$expected='<prices><price currency="EUR" type="PRICE_FINAL" vat_included="true" country="FR">15.99</price></prices>';
454
$this->assertEquals($expected, $xmlWriter->getXml());
455
456
457
}
458
/**
459
*
460
* @param $productId
453
$expected='<prices><price currency="EUR" type="PRICE_FINAL" vat_included="true" country="FR">15.99</price></prices>';
454
$this->assertEquals($expected, $xmlWriter->getXml());
455
456
+ }
457
+
458
+ /**
459
+ * MCNX-236 : test getProductCategories
460
+ * @loadFixture
461
+ */
462
+ public function testGetProductCategories()
463
+ {
464
+
465
+ /* @var $export \MDN_Antidot_Model_Export_Product */
466
+ $export = Mage::getModel('Antidot/export_product');
467
+
468
+ /**
469
+ * create mock product to simulate getCategoryCollection returning list of the to category of the product
470
+ * beacause fixture doesn't simulate it...
471
+ */
472
+ $mockModel = $this->getModelMock('catalog/product', array('getCategoryCollection', 'getStoreId'));
473
+ $mockModel->expects($this->any())
474
+ ->method('getCategoryCollection')
475
+ ->will($this->returnValue(Mage::getResourceModel('catalog/category_collection')->addAttributeToFilter('entity_id', array(10,11))));
476
+ $mockModel->expects($this->any())
477
+ ->method('getStoreId')
478
+ ->will($this->returnValue(3));
479
+
480
+ /**
481
+ * Categories 10 and 11 are affected to the product in fixtures
482
+ * Category 11 is not active.
483
+ * We expect one category associated to the product
484
+ */
485
+ $categories = MDN_Antidot_Test_PHPUnitUtil::callPrivateMethod($export,'getProductCategories', array($mockModel, array(2)));
486
+
487
+ $this->assertEquals(1, count($categories));
488
489
}
490
+
491
/**
492
*
493
* @param $productId
app/code/community/MDN/Antidot/Test/Model/Export/Product/fixtures/testGetProductCategories.yaml ADDED
@@ -0,0 +1,101 @@
1
+ scope:
2
+ website: # Initialize websites
3
+ - website_id: 2
4
+ code: usa_website
5
+ name: USA Website
6
+ default_group_id: 2
7
+ - website_id: 3
8
+ code: french_website
9
+ name: French Website
10
+ default_group_id: 3
11
+ - website_id: 4
12
+ code: german_website
13
+ name: German Website
14
+ default_group_id: 4
15
+ group: # Initializes store groups
16
+ - group_id: 2
17
+ website_id: 2
18
+ name: USA Store Group
19
+ default_store_id: 2
20
+ root_category_id: 2 # Default Category
21
+ - group_id: 3
22
+ website_id: 3
23
+ name: French Store Group
24
+ default_store_id: 3
25
+ root_category_id: 2 # Default Category
26
+ - group_id: 4
27
+ website_id: 4
28
+ name: German Store Group
29
+ default_store_id: 4
30
+ root_category_id: 2 # Default Category
31
+ store: # Initializes store views
32
+ - store_id: 2
33
+ website_id: 2
34
+ group_id: 2
35
+ code: usa
36
+ name: USA Store
37
+ is_active: 1
38
+ - store_id: 3
39
+ website_id: 3
40
+ group_id: 3
41
+ code: france
42
+ name: France Store
43
+ is_active: 1
44
+ - store_id: 4
45
+ website_id: 4
46
+ group_id: 4
47
+ code: germany
48
+ name: Germany Store
49
+ is_active: 1
50
+ config:
51
+ default/web/secure/base_url: http://www.mywebsite.com/
52
+ default/web/unsecure/base_url: http://www.mywebsite.com/
53
+ stores/usa/web/secure/base_url: http://www.mywebsite.com/
54
+ stores/france/web/secure/base_url: http://www.monsiteweb.fr/
55
+ stores/germany/web/secure/base_url: http://www.meinwebseite.de/
56
+ stores/usa/web/unsecure/base_url: http://www.mywebsite.com/
57
+ stores/france/web/unsecure/base_url: http://www.monsiteweb.fr/
58
+ stores/germany/web/unsecure/base_url: http://www.meinwebseite.de/
59
+ eav:
60
+ catalog_product:
61
+ - entity_id: 1
62
+ type_id: simple
63
+ attribute_set_id: 4 # Default
64
+ sku: book
65
+ name: Book
66
+ short_description: Book
67
+ description: Book
68
+ url_key: book
69
+ image: b/o/book.jpg
70
+ thumbnail: b/o/book_small.jpg
71
+ stock:
72
+ qty: 100.00
73
+ is_in_stock: 1
74
+ website_ids:
75
+ - usa_website
76
+ - french_website
77
+ - german_website
78
+ category_ids:
79
+ - 10,11
80
+ price: 12.99
81
+ tax_class_id: 2 # Taxable Goods
82
+ status: 1 # Enabled
83
+ visibility: 4 # Visible in Catalog & Search
84
+ /websites: # Set different prices per website
85
+ usa_website:
86
+ special_price: 9.99
87
+ german_website:
88
+ price: 9.99
89
+ special_price: 5.99
90
+ eav:
91
+ catalog_category:
92
+ - entity_id: 10
93
+ path: 1/2/10
94
+ name: Categorie active
95
+ is_active: 1
96
+ parent_id: 2
97
+ - entity_id: 11
98
+ path: 1/2/11
99
+ name: Categorie inactive
100
+ is_active: 0
101
+ parent_id: 2
app/code/community/MDN/Antidot/Test/Model/System/Config/Facet.php CHANGED
@@ -28,11 +28,11 @@ class MDN_Antidot_Test_Model_System_Config_Facet extends EcomDev_PHPUnit_Test_Ca
28
->method('get_labels')
29
->will($this->returnValue(array('de'=>'Verfügbarkeit', 'fr' => 'Disponibilité', 'en' => 'Availability')));
30
31
- $mockSearch = $this->getModelMock('Antidot/Search_Search', array('getFacets'));
32
$mockSearch->expects($this->any())
33
->method('getFacets')
34
->will($this->returnValue(array('is_available'=> $mockAFSHelper )));
35
- $this->replaceByMock('model', 'Antidot/Search_Search', $mockSearch);
36
37
38
Mage::app()->setCurrentStore(0);
@@ -76,6 +76,49 @@ class MDN_Antidot_Test_Model_System_Config_Facet extends EcomDev_PHPUnit_Test_Ca
76
77
}
78
79
}
80
class MDN_Antidot_Test_Model_System_Config_Facet_MockAFSHelper
81
{
28
->method('get_labels')
29
->will($this->returnValue(array('de'=>'Verfügbarkeit', 'fr' => 'Disponibilité', 'en' => 'Availability')));
30
31
+ $mockSearch = $this->getModelMock('Antidot/search_search', array('getFacets'));
32
$mockSearch->expects($this->any())
33
->method('getFacets')
34
->will($this->returnValue(array('is_available'=> $mockAFSHelper )));
35
+ $this->replaceByMock('model', 'Antidot/search_search', $mockSearch);
36
37
38
Mage::app()->setCurrentStore(0);
76
77
}
78
79
+ /**
80
+ * Test toOptionArray method
81
+ *
82
+ * MCNX-235 : escape single quote in label
83
+ */
84
+ public function testToOptionArrayEscapeQuote()
85
+ {
86
+
87
+ /*
88
+ *
89
+ */
90
+ $mockAFSHelper = $this->getMock('MDN_Antidot_Test_Model_System_Config_Facet_MockAFSHelper');
91
+ $mockAFSHelper->expects($this->any())
92
+ ->method('get_type')
93
+ ->will($this->returnValue('boolean'));
94
+ $mockAFSHelper->expects($this->any())
95
+ ->method('get_label')
96
+ ->will($this->returnValue("Type d'accessoire"));
97
+ $mockAFSHelper->expects($this->any())
98
+ ->method('get_labels')
99
+ ->will($this->returnValue(array("fr"=>"Type d'accessoire")));
100
+
101
+ $mockSearch = $this->getModelMock('Antidot/search_search', array('getFacets'));
102
+ $mockSearch->expects($this->any())
103
+ ->method('getFacets')
104
+ ->will($this->returnValue(array('type_accessoire'=> $mockAFSHelper )));
105
+ $this->replaceByMock('model', 'Antidot/search_search', $mockSearch);
106
+
107
+
108
+ Mage::app()->setCurrentStore(0);
109
+ /** @var $configSort MDN_Antidot_Model_System_Config_Facet */
110
+ $configFacet = Mage::getModel('Antidot/system_config_facet');
111
+
112
+ $values = $configFacet->toOptionArray('STRING');
113
+
114
+ $this->assertEquals(
115
+ array(array("value"=>"type_accessoire|Type d\'accessoire", 'label' => 'type_accessoire (boolean)')),
116
+ $values
117
+ );
118
+
119
+
120
+ }
121
+
122
}
123
class MDN_Antidot_Test_Model_System_Config_Facet_MockAFSHelper
124
{
app/code/community/MDN/Antidot/controllers/Admin/PushController.php CHANGED
@@ -23,7 +23,7 @@ class MDN_Antidot_Admin_PushController extends Mage_Adminhtml_Controller_Action
23
{
24
try
25
{
26
- if (Mage::getModel('Antidot/Observer')->categoriesFullExport('UI')) {
27
Mage::getSingleton('adminhtml/session')->addSuccess(
28
Mage::helper('Antidot')->__('Categories exported')
29
);
@@ -47,7 +47,7 @@ class MDN_Antidot_Admin_PushController extends Mage_Adminhtml_Controller_Action
47
public function ProductAction()
48
{
49
try {
50
- if (Mage::getModel('Antidot/Observer')->catalogFullExport('UI')) {
51
Mage::getSingleton('adminhtml/session')->addSuccess(
52
Mage::helper('Antidot')->__('Catalog exported')
53
);
23
{
24
try
25
{
26
+ if (Mage::getModel('Antidot/observer')->categoriesFullExport('UI')) {
27
Mage::getSingleton('adminhtml/session')->addSuccess(
28
Mage::helper('Antidot')->__('Categories exported')
29
);
47
public function ProductAction()
48
{
49
try {
50
+ if (Mage::getModel('Antidot/observer')->catalogFullExport('UI')) {
51
Mage::getSingleton('adminhtml/session')->addSuccess(
52
Mage::helper('Antidot')->__('Catalog exported')
53
);
app/code/community/MDN/Antidot/etc/config.xml CHANGED
@@ -18,7 +18,7 @@
18
</crontab>
19
<modules>
20
<MDN_Antidot>
21
- <version>1.1.2</version>
22
</MDN_Antidot>
23
</modules>
24
<global>
@@ -605,6 +605,29 @@
605
<promote>
606
<redirect>no_result</redirect>
607
</promote>
608
</antidot>
609
</default>
610
<phpunit>
18
</crontab>
19
<modules>
20
<MDN_Antidot>
21
+ <version>1.1.3</version>
22
</MDN_Antidot>
23
</modules>
24
<global>
605
<promote>
606
<redirect>no_result</redirect>
607
</promote>
608
+ <!-- Export Parameters :-->
609
+ <!-- For developpers : these parameters are set with default values which fit most of systems, but they can be tweak here : -->
610
+ <!-- (Flush magento config cache after modifiying them) -->
611
+ <export>
612
+ <!-- Memory Limit : this value is set as memory_limit if default one is below, you can increase it if you run into out of memory error -->
613
+ <memory_limit>2048M</memory_limit>
614
+ <!-- If you run into out of memory error, but can't increase memory limit, you can set gc_enabled to 1, -->
615
+ <!-- it will trigger some gc_collect_cycles to free some memory, however it will slow down process -->
616
+ <gc_enabled>0</gc_enabled>
617
+ <!-- if garbage collection is enabled, the gc_collect_cycles will be trigger when memory used exceeds gc_percentage_limit of memory_limit -->
618
+ <gc_percentage_limit>80</gc_percentage_limit>
619
+ <!-- number of product processed before flush xml in file -->
620
+ <chunk_size>500</chunk_size>
621
+ <!-- disable xsd validation -->
622
+ <xsd_validation_disable>0</xsd_validation_disable>
623
+ <!-- enable profiler and debug mode -->
624
+ <!-- it collect mysql queries, methods timers and limit to 1 chunk the process -->
625
+ <profiler_enable>0</profiler_enable>
626
+ <!-- number of slowest mysql queries logged -->
627
+ <profiler_nb_lowest_queries>10</profiler_nb_lowest_queries>
628
+ <!-- varien_profiler items time consuming quota of total time logged -->
629
+ <profiler_varien_quota>0.001</profiler_varien_quota>
630
+ </export>
631
</antidot>
632
</default>
633
<phpunit>
app/code/community/MDN/Antidot/etc/system.xml CHANGED
@@ -18,10 +18,17 @@
18
<show_in_website>1</show_in_website>
19
<show_in_store>1</show_in_store>
20
<fields>
21
<afsstore translate="label">
22
<label>AFS@Store Back-Office</label>
23
<frontend_model>Antidot/System_Config_Button_AfsStore</frontend_model>
24
- <sort_order>1</sort_order>
25
<show_in_default>1</show_in_default>
26
<show_in_website>0</show_in_website>
27
<show_in_store>0</show_in_store>
@@ -29,7 +36,7 @@
29
<version translate="label">
30
<label>AFS@Store Extension Version</label>
31
<frontend_model>Antidot/System_Config_Html_Version</frontend_model>
32
- <sort_order>2</sort_order>
33
<show_in_default>1</show_in_default>
34
<show_in_website>0</show_in_website>
35
<show_in_store>0</show_in_store>
18
<show_in_website>1</show_in_website>
19
<show_in_store>1</show_in_store>
20
<fields>
21
+ <notice>
22
+ <frontend_model>Antidot/System_Config_Fieldset_Notice</frontend_model>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>0</show_in_website>
26
+ <show_in_store>0</show_in_store>
27
+ </notice>
28
<afsstore translate="label">
29
<label>AFS@Store Back-Office</label>
30
<frontend_model>Antidot/System_Config_Button_AfsStore</frontend_model>
31
+ <sort_order>2</sort_order>
32
<show_in_default>1</show_in_default>
33
<show_in_website>0</show_in_website>
34
<show_in_store>0</show_in_store>
36
<version translate="label">
37
<label>AFS@Store Extension Version</label>
38
<frontend_model>Antidot/System_Config_Html_Version</frontend_model>
39
+ <sort_order>3</sort_order>
40
<show_in_default>1</show_in_default>
41
<show_in_website>0</show_in_website>
42
<show_in_store>0</show_in_store>
app/design/frontend/{default → base}/default/layout/antidot.xml RENAMED
@@ -4,6 +4,7 @@
4
5
<catalogsearch_result_index>
6
<reference name="search.result">
7
<block type="Antidot/Catalogsearch_Category" name="search_result_category" as="search_result_category" template="antidot/catalogsearch/result/category.phtml" />
8
</reference>
9
</catalogsearch_result_index>
4
5
<catalogsearch_result_index>
6
<reference name="search.result">
7
+ <action method="setTemplate"><template>antidot/catalogsearch/result.phtml</template></action>
8
<block type="Antidot/Catalogsearch_Category" name="search_result_category" as="search_result_category" template="antidot/catalogsearch/result/category.phtml" />
9
</reference>
10
</catalogsearch_result_index>
app/design/frontend/{default → base}/default/template/antidot/catalogsearch/result/category.phtml RENAMED
File without changes
app/locale/de_AT/MDN_Antidot.csv CHANGED
@@ -139,4 +139,9 @@ Price,Preis
139
"Feed ID","Futter ID"
140
"Add a feed","fügen Sie ein Futter"
141
"Additionnal feed","Additionnal Futter"
142
- "Add an additional feed to the ACP response, typicaly an hit-parade or any other feed configured in AFSStore Back-office.","Fügen Sie eine zusätzliche Einspeisung in den AKP- Reaktion , typicaly einer Hitparade oder andere Futtermittel in AFSStore Back-Office konfiguriert ist."
139
"Feed ID","Futter ID"
140
"Add a feed","fügen Sie ein Futter"
141
"Additionnal feed","Additionnal Futter"
142
+ "Add an additional feed to the ACP response, typicaly an hit-parade or any other feed configured in AFSStore Back-office.","Fügen Sie eine zusätzliche Einspeisung in den AKP- Reaktion , typicaly einer Hitparade oder andere Futtermittel in AFSStore Back-Office konfiguriert ist."
143
+ "XSLTProcessor class doesn't exist, you must install php xsl extension, otherwise the autocomplete will not run correctly","XSLTProcessor Klasse nicht vorhanden ist, müssen Sie php xsl extension zu installieren, da sonst die Autovervollständigung werden nicht ordnungsgemäß ausgeführt"
144
+ "ZipArchive class doesn't exist, you must install php zip extension, otherwise the zip operation during export may not run correctly","ZipArchive Klasse nicht vorhanden ist, müssen Sie php zip extension zu installieren, sonst wird die Zip-Betrieb während der Export möglicherweise nicht korrekt ausgeführt"
145
+ "DOMDocument class doesn't exist, you must install php libxml extension, otherwise the xsd validation during export will not run and autocomplete neither","DOMDocument Klasse nicht vorhanden ist, müssen Sie php libxml extension zu installieren, da sonst die XSD-Validierung während des Exports wird nicht ausgeführt und weder Autovervollständigung"
146
+ "The curl php extension is not installed, it's required to upload export files","Die php curl extension nicht installiert ist, es ist erforderlich , um den Export Dateien hochladen"
147
+ "The curl php extension doesn't support sftp protocol, libcurl must be upgraded on your system, otherwise the export files won't be uploaded","Die php curl extension nicht SFTP-Protokoll unterstützen, müssen libcurl auf Ihrem System aktualisiert werden , sonst werden die Exportdateien werden nicht hochgeladen werden"
app/locale/de_CH/MDN_Antidot.csv CHANGED
@@ -139,4 +139,9 @@ Price,Preis
139
"Feed ID","Futter ID"
140
"Add a feed","fügen Sie ein Futter"
141
"Additionnal feed","Additionnal Futter"
142
- "Add an additional feed to the ACP response, typicaly an hit-parade or any other feed configured in AFSStore Back-office.","Fügen Sie eine zusätzliche Einspeisung in den AKP- Reaktion , typicaly einer Hitparade oder andere Futtermittel in AFSStore Back-Office konfiguriert ist."
139
"Feed ID","Futter ID"
140
"Add a feed","fügen Sie ein Futter"
141
"Additionnal feed","Additionnal Futter"
142
+ "Add an additional feed to the ACP response, typicaly an hit-parade or any other feed configured in AFSStore Back-office.","Fügen Sie eine zusätzliche Einspeisung in den AKP- Reaktion , typicaly einer Hitparade oder andere Futtermittel in AFSStore Back-Office konfiguriert ist."
143
+ "XSLTProcessor class doesn't exist, you must install php xsl extension, otherwise the autocomplete will not run correctly","XSLTProcessor Klasse nicht vorhanden ist, müssen Sie php xsl extension zu installieren, da sonst die Autovervollständigung werden nicht ordnungsgemäß ausgeführt"
144
+ "ZipArchive class doesn't exist, you must install php zip extension, otherwise the zip operation during export may not run correctly","ZipArchive Klasse nicht vorhanden ist, müssen Sie