afs-store - Version 1.0.6

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 afs-store
Version 1.0.6
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.6

Files changed (68) hide show
  1. app/code/community/MDN/Antidot/Block/Catalogsearch/Category.php +66 -66
  2. app/code/community/MDN/Antidot/Block/Html/Select.php +25 -25
  3. app/code/community/MDN/Antidot/Block/System/Config/Button/PushArticles.php +36 -36
  4. app/code/community/MDN/Antidot/Block/System/Config/Button/PushBrands.php +36 -36
  5. app/code/community/MDN/Antidot/Block/System/Config/Button/PushCategories.php +36 -36
  6. app/code/community/MDN/Antidot/Block/System/Config/Button/PushProducts.php +35 -35
  7. app/code/community/MDN/Antidot/Block/System/Config/Button/RestoreTemplate.php +44 -44
  8. app/code/community/MDN/Antidot/Block/System/Config/Button/ShowXml.php +46 -46
  9. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Additional.php +67 -67
  10. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ArticleAdditional.php +36 -36
  11. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ArticleIdentifier.php +37 -37
  12. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/DefaultSort.php +103 -103
  13. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Facet.php +162 -132
  14. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Identifier.php +69 -69
  15. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ProductAdditionalFacet.php +81 -81
  16. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ProductAdditionalField.php +35 -35
  17. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ProductIdentifier.php +36 -36
  18. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Sort.php +78 -78
  19. app/code/community/MDN/Antidot/Block/System/Config/Form/Field/ProductAttribute.php +37 -37
  20. app/code/community/MDN/Antidot/Block/System/Config/Html/Export.php +60 -58
  21. app/code/community/MDN/Antidot/Helper/Antidot.php +34 -34
  22. app/code/community/MDN/Antidot/Helper/CatalogSearch/Data.php +28 -28
  23. app/code/community/MDN/Antidot/Helper/Compress.php +59 -48
  24. app/code/community/MDN/Antidot/Helper/Data.php +219 -201
  25. app/code/community/MDN/Antidot/Helper/LogExport.php +74 -70
  26. app/code/community/MDN/Antidot/Helper/Url.php +73 -73
  27. app/code/community/MDN/Antidot/Model/Catalogsearch/Layer.php +3 -2
  28. app/code/community/MDN/Antidot/Model/Catalogsearch/Layer/Filter/Attribute.php +13 -0
  29. app/code/community/MDN/Antidot/Model/Catalogsearch/Resource/Attribute.php +64 -64
  30. app/code/community/MDN/Antidot/Model/Export/Abstract.php +139 -139
  31. app/code/community/MDN/Antidot/Model/Export/Article.php +132 -132
  32. app/code/community/MDN/Antidot/Model/Export/Brand.php +129 -129
  33. app/code/community/MDN/Antidot/Model/Export/Category.php +105 -105
  34. app/code/community/MDN/Antidot/Model/Export/Log.php +33 -0
  35. app/code/community/MDN/Antidot/Model/Export/Product.php +881 -818
  36. app/code/community/MDN/Antidot/Model/Mysql4/Export/Log.php +11 -0
  37. app/code/community/MDN/Antidot/Model/Mysql4/Export/Log/Collection.php +12 -0
  38. app/code/community/MDN/Antidot/Model/Observer.php +289 -274
  39. app/code/community/MDN/Antidot/Model/Resource/Engine/Antidot.php +23 -2
  40. app/code/community/MDN/Antidot/Model/Search/Abstract.php +55 -55
  41. app/code/community/MDN/Antidot/Model/Search/Search.php +271 -262
  42. app/code/community/MDN/Antidot/Model/Search/Suggest.php +321 -321
  43. app/code/community/MDN/Antidot/Model/System/Config/ArticleAttribute.php +48 -48
  44. app/code/community/MDN/Antidot/Model/System/Config/CategoryAttribute.php +77 -77
  45. app/code/community/MDN/Antidot/Model/System/Config/Facet.php +14 -1
  46. app/code/community/MDN/Antidot/Model/System/Config/ProductAttribute.php +103 -102
  47. app/code/community/MDN/Antidot/Model/System/Config/Sort.php +1 -1
  48. app/code/community/MDN/Antidot/Model/System/Config/Suggest/Type.php +55 -55
  49. app/code/community/MDN/Antidot/Model/Transport.php +36 -36
  50. app/code/community/MDN/Antidot/Model/Transport/Abstract.php +18 -18
  51. app/code/community/MDN/Antidot/Model/Transport/File.php +28 -28
  52. app/code/community/MDN/Antidot/Model/Transport/Ftp.php +57 -51
  53. app/code/community/MDN/Antidot/Model/Transport/Http.php +26 -26
  54. app/code/community/MDN/Antidot/Model/Transport/Interface.php +23 -23
  55. app/code/community/MDN/Antidot/controllers/Admin/PushController.php +43 -36
  56. app/code/community/MDN/Antidot/controllers/Front/SearchController.php +35 -35
  57. app/code/community/MDN/Antidot/etc/config.xml +467 -392
  58. app/code/community/MDN/Antidot/etc/system.xml +635 -635
  59. app/code/community/MDN/Antidot/sql/Antidot_setup/mysql4-install-0.9.php +24 -24
  60. app/design/frontend/default/default/layout/antidot.xml +11 -11
  61. app/design/frontend/default/default/template/antidot/catalogsearch/result/category.phtml +10 -10
  62. app/etc/modules/MDN_Antidot.xml +8 -8
  63. package.xml +14 -7
  64. shell/abstract.php +225 -0
  65. shell/antidotExport.php +43 -0
  66. shell/compiler.php +132 -0
  67. shell/indexer.php +212 -0
  68. shell/log.php +191 -0
app/code/community/MDN/Antidot/Block/Catalogsearch/Category.php CHANGED
@@ -1,67 +1,67 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_Catalogsearch_Category extends Mage_Core_Block_Template
17
- {
18
- protected $_categories = null;
19
-
20
- /**
21
- * Return categories
22
- * @return type
23
- */
24
- public function getCategories()
25
- {
26
- if ($this->_categories == null)
27
- {
28
- $this->loadCategories();
29
- }
30
- return $this->_categories;
31
- }
32
-
33
- /**
34
- *
35
- * @param type $cat
36
- */
37
- public function getCategoryUrl($cat)
38
- {
39
- return $cat->getUrl();
40
- }
41
-
42
- /**
43
- * Load category based on antidot results
44
- */
45
- protected function loadCategories()
46
- {
47
- $categoryIds = $this->getLayer()->getProductCollection()->getCategoryIds();
48
-
49
- $this->_categories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*')->addFieldToFilter('entity_id', array('in' => $categoryIds));
50
- }
51
-
52
- /**
53
- * Returns current catalog layer.
54
- *
55
- * @return MDN_Antidot_Model_Catalogsearch_Layer|Mage_Catalog_Model_Layer
56
- */
57
- public function getLayer()
58
- {
59
- $helper = Mage::helper('Antidot');
60
- if ($helper->isActiveEngine()) {
61
- return Mage::getSingleton('Antidot/catalogsearch_layer');
62
- }
63
-
64
- return parent::getLayer();
65
- }
66
-
67
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_Catalogsearch_Category extends Mage_Core_Block_Template
17
+ {
18
+ protected $_categories = null;
19
+
20
+ /**
21
+ * Return categories
22
+ * @return type
23
+ */
24
+ public function getCategories()
25
+ {
26
+ if ($this->_categories == null)
27
+ {
28
+ $this->loadCategories();
29
+ }
30
+ return $this->_categories;
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @param type $cat
36
+ */
37
+ public function getCategoryUrl($cat)
38
+ {
39
+ return $cat->getUrl();
40
+ }
41
+
42
+ /**
43
+ * Load category based on antidot results
44
+ */
45
+ protected function loadCategories()
46
+ {
47
+ $categoryIds = $this->getLayer()->getProductCollection()->getCategoryIds();
48
+
49
+ $this->_categories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*')->addFieldToFilter('entity_id', array('in' => $categoryIds));
50
+ }
51
+
52
+ /**
53
+ * Returns current catalog layer.
54
+ *
55
+ * @return MDN_Antidot_Model_Catalogsearch_Layer|Mage_Catalog_Model_Layer
56
+ */
57
+ public function getLayer()
58
+ {
59
+ $helper = Mage::helper('Antidot');
60
+ if ($helper->isActiveEngine()) {
61
+ return Mage::getSingleton('Antidot/catalogsearch_layer');
62
+ }
63
+
64
+ return parent::getLayer();
65
+ }
66
+
67
  }
app/code/community/MDN/Antidot/Block/Html/Select.php CHANGED
@@ -1,25 +1,25 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_Html_Select extends Mage_Core_Block_Html_Select
17
- {
18
- /**
19
- * {@inherit}
20
- */
21
- protected function _toHtml()
22
- {
23
- return parent::_toHtml();
24
- }
25
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_Html_Select extends Mage_Core_Block_Html_Select
17
+ {
18
+ /**
19
+ * {@inherit}
20
+ */
21
+ protected function _toHtml()
22
+ {
23
+ return parent::_toHtml();
24
+ }
25
+ }
app/code/community/MDN/Antidot/Block/System/Config/Button/PushArticles.php CHANGED
@@ -1,36 +1,36 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Button_PushArticles extends Mage_Adminhtml_Block_System_Config_Form_Field
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
- {
24
- $this->setElement($element);
25
- $url = $this->getUrl('Antidot/Admin_Push/Article');
26
-
27
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
28
- ->setType('button')
29
- ->setClass('scalable')
30
- ->setLabel(Mage::helper('Antidot')->__('Push'))
31
- ->setOnClick("setLocation('$url')")
32
- ->toHtml();
33
-
34
- return $html;
35
- }
36
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Button_PushArticles extends Mage_Adminhtml_Block_System_Config_Form_Field
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $this->setElement($element);
25
+ $url = $this->getUrl('Antidot/Admin_Push/Article');
26
+
27
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
28
+ ->setType('button')
29
+ ->setClass('scalable')
30
+ ->setLabel(Mage::helper('Antidot')->__('Push'))
31
+ ->setOnClick("setLocation('$url')")
32
+ ->toHtml();
33
+
34
+ return $html;
35
+ }
36
+ }
app/code/community/MDN/Antidot/Block/System/Config/Button/PushBrands.php CHANGED
@@ -1,36 +1,36 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Button_PushBrands extends Mage_Adminhtml_Block_System_Config_Form_Field
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
- {
24
- $this->setElement($element);
25
- $url = $this->getUrl('Antidot/Admin_Push/Brand');
26
-
27
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
28
- ->setType('button')
29
- ->setClass('scalable')
30
- ->setLabel(Mage::helper('Antidot')->__('Push'))
31
- ->setOnClick("setLocation('$url')")
32
- ->toHtml();
33
-
34
- return $html;
35
- }
36
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Button_PushBrands extends Mage_Adminhtml_Block_System_Config_Form_Field
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $this->setElement($element);
25
+ $url = $this->getUrl('Antidot/Admin_Push/Brand');
26
+
27
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
28
+ ->setType('button')
29
+ ->setClass('scalable')
30
+ ->setLabel(Mage::helper('Antidot')->__('Push'))
31
+ ->setOnClick("setLocation('$url')")
32
+ ->toHtml();
33
+
34
+ return $html;
35
+ }
36
+ }
app/code/community/MDN/Antidot/Block/System/Config/Button/PushCategories.php CHANGED
@@ -1,36 +1,36 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Button_PushCategories extends Mage_Adminhtml_Block_System_Config_Form_Field
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
- {
24
- $this->setElement($element);
25
- $url = $this->getUrl('Antidot/Admin_Push/Category');
26
-
27
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
28
- ->setType('button')
29
- ->setClass('scalable')
30
- ->setLabel(Mage::helper('Antidot')->__('Push'))
31
- ->setOnClick("setLocation('$url')")
32
- ->toHtml();
33
-
34
- return $html;
35
- }
36
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Button_PushCategories extends Mage_Adminhtml_Block_System_Config_Form_Field
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $this->setElement($element);
25
+ $url = $this->getUrl('Antidot/Admin_Push/Category');
26
+
27
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
28
+ ->setType('button')
29
+ ->setClass('scalable')
30
+ ->setLabel(Mage::helper('Antidot')->__('Push'))
31
+ ->setOnClick("setLocation('$url')")
32
+ ->toHtml();
33
+
34
+ return $html;
35
+ }
36
+ }
app/code/community/MDN/Antidot/Block/System/Config/Button/PushProducts.php CHANGED
@@ -1,36 +1,36 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Button_PushProducts extends Mage_Adminhtml_Block_System_Config_Form_Field
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
- {
24
- $this->setElement($element);
25
- $url = $this->getUrl('Antidot/Admin_Push/Product');
26
-
27
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
28
- ->setType('button')
29
- ->setClass('scalable')
30
- ->setLabel(Mage::helper('Antidot')->__('Push'))
31
- ->setOnClick("setLocation('$url')")
32
- ->toHtml();
33
-
34
- return $html;
35
- }
36
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Button_PushProducts extends Mage_Adminhtml_Block_System_Config_Form_Field
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $this->setElement($element);
25
+ $url = $this->getUrl('Antidot/Admin_Push/Product');
26
+
27
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
28
+ ->setType('button')
29
+ ->setClass('scalable')
30
+ ->setLabel(Mage::helper('Antidot')->__('Push'))
31
+ ->setOnClick("setLocation('$url')")
32
+ ->toHtml();
33
+
34
+ return $html;
35
+ }
36
  }
app/code/community/MDN/Antidot/Block/System/Config/Button/RestoreTemplate.php CHANGED
@@ -1,45 +1,45 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Button_RestoreTemplate extends Mage_Adminhtml_Block_System_Config_Form_Field
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
- {
24
- $this->setElement($element);
25
-
26
- $xslt = '';
27
- $configFile = dirname(__FILE__).'/../../../../etc/config.xml';
28
- if($sxe = @simplexml_load_file($configFile)) {
29
- if($template = $sxe->xpath('//template')) {
30
- $search = array('"', "'", "\n");
31
- $replace = array('\"', "\'", '\n');
32
- $xslt = str_replace($search, $replace, trim(htmlentities((string)$template[0])));
33
- }
34
- }
35
-
36
- $html = $this->getLayout()->createBlock('adminhtml/widget_button')
37
- ->setType('button')
38
- ->setClass('scalable')
39
- ->setLabel(Mage::helper('Antidot')->__('Restore the default template'))
40
- ->setOnClick("$('antidot_suggest_template').setValue('".$xslt."'); return false;")
41
- ->toHtml();
42
-
43
- return $html;
44
- }
45
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Button_RestoreTemplate extends Mage_Adminhtml_Block_System_Config_Form_Field
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $this->setElement($element);
25
+
26
+ $xslt = '';
27
+ $configFile = dirname(__FILE__).'/../../../../etc/config.xml';
28
+ if($sxe = @simplexml_load_file($configFile)) {
29
+ if($template = $sxe->xpath('//template')) {
30
+ $search = array('"', "'", "\n");
31
+ $replace = array('\"', "\'", '\n');
32
+ $xslt = str_replace($search, $replace, trim(htmlentities((string)$template[0])));
33
+ }
34
+ }
35
+
36
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
37
+ ->setType('button')
38
+ ->setClass('scalable')
39
+ ->setLabel(Mage::helper('Antidot')->__('Restore the default template'))
40
+ ->setOnClick("$('antidot_suggest_template').setValue('".$xslt."'); return false;")
41
+ ->toHtml();
42
+
43
+ return $html;
44
+ }
45
  }
app/code/community/MDN/Antidot/Block/System/Config/Button/ShowXml.php CHANGED
@@ -1,47 +1,47 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Button_ShowXml extends Mage_Adminhtml_Block_System_Config_Form_Field
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
- {
24
- $this->setElement($element);
25
-
26
- $suggestXml = '';
27
- $configFile = dirname(__FILE__).'/../../../../etc/config.xml';
28
- if($sxe = @simplexml_load_file($configFile)) {
29
- if($suggestXml = $sxe->xpath('//suggest_xml')) {
30
- $suggestXml = str_replace('"', '\"', trim(htmlentities((string)$suggestXml[0])));
31
- $suggestXml = str_replace("\n", '\n', $suggestXml);
32
- $suggestXml = str_replace(" ", '&nbsp;&nbsp;&nbsp;&nbsp;', $suggestXml);
33
- }
34
- }
35
-
36
- return $this->getLayout()->createBlock('adminhtml/widget_button')
37
- ->setType('button')
38
- ->setClass('scalable')
39
- ->setLabel(Mage::helper('Antidot')->__('Display XML'))
40
- ->setOnClick(
41
- "var w = window.open('', '', 'width=400,height=400,resizeable,scrollbars');"
42
- ."w.document.write('".$suggestXml."');"
43
- ."return false;"
44
- )
45
- ->toHtml();
46
- }
47
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Button_ShowXml extends Mage_Adminhtml_Block_System_Config_Form_Field
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $this->setElement($element);
25
+
26
+ $suggestXml = '';
27
+ $configFile = dirname(__FILE__).'/../../../../etc/config.xml';
28
+ if($sxe = @simplexml_load_file($configFile)) {
29
+ if($suggestXml = $sxe->xpath('//suggest_xml')) {
30
+ $suggestXml = str_replace('"', '\"', trim(htmlentities((string)$suggestXml[0])));
31
+ $suggestXml = str_replace("\n", '\n', $suggestXml);
32
+ $suggestXml = str_replace(" ", '&nbsp;&nbsp;&nbsp;&nbsp;', $suggestXml);
33
+ }
34
+ }
35
+
36
+ return $this->getLayout()->createBlock('adminhtml/widget_button')
37
+ ->setType('button')
38
+ ->setClass('scalable')
39
+ ->setLabel(Mage::helper('Antidot')->__('Display XML'))
40
+ ->setOnClick(
41
+ "var w = window.open('', '', 'width=400,height=400,resizeable,scrollbars');"
42
+ ."w.document.write('".$suggestXml."');"
43
+ ."return false;"
44
+ )
45
+ ->toHtml();
46
+ }
47
  }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Additional.php CHANGED
@@ -1,67 +1,67 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_Additional extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
- {
18
- protected $_valueRenderer;
19
-
20
- /**
21
- * {@inherit}
22
- */
23
- protected function _prepareToRender()
24
- {
25
- $this->_valueRenderer = null;
26
-
27
- $this->addColumn('value', array('label' => Mage::helper('Antidot')->__('Attribute')));
28
-
29
- // Disables "Add after" button
30
- $this->_addAfter = false;
31
- $this->_addButtonLabel = Mage::helper('Antidot')->__('Add a field');
32
- }
33
-
34
- /**
35
- * {@inherit}
36
- */
37
- protected function _renderCellTemplate($columnName)
38
- {
39
- return parent::_renderCellTemplate($columnName);
40
- }
41
-
42
- /**
43
- * {@inherit}
44
- */
45
- protected function _getValueRenderer()
46
- {
47
- if (!$this->_valueRenderer) {
48
- $this->_valueRenderer = $this->getLayout()
49
- ->createBlock('Antidot/Html_Select')
50
- ->setIsRenderToJsTemplate(true);
51
- }
52
- return $this->_valueRenderer;
53
- }
54
-
55
- /**
56
- * Assign extra parameters to row
57
- *
58
- * @param Varien_Object $row
59
- */
60
- protected function _prepareArrayRow(Varien_Object $row)
61
- {
62
- $row->setData(
63
- 'option_extra_attr_'.$this->_getValueRenderer()->calcOptionHash($row->getData('value')),
64
- 'selected="selected"'
65
- );
66
- }
67
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_Additional extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
+ {
18
+ protected $_valueRenderer;
19
+
20
+ /**
21
+ * {@inherit}
22
+ */
23
+ protected function _prepareToRender()
24
+ {
25
+ $this->_valueRenderer = null;
26
+
27
+ $this->addColumn('value', array('label' => Mage::helper('Antidot')->__('Attribute')));
28
+
29
+ // Disables "Add after" button
30
+ $this->_addAfter = false;
31
+ $this->_addButtonLabel = Mage::helper('Antidot')->__('Add a field');
32
+ }
33
+
34
+ /**
35
+ * {@inherit}
36
+ */
37
+ protected function _renderCellTemplate($columnName)
38
+ {
39
+ return parent::_renderCellTemplate($columnName);
40
+ }
41
+
42
+ /**
43
+ * {@inherit}
44
+ */
45
+ protected function _getValueRenderer()
46
+ {
47
+ if (!$this->_valueRenderer) {
48
+ $this->_valueRenderer = $this->getLayout()
49
+ ->createBlock('Antidot/Html_Select')
50
+ ->setIsRenderToJsTemplate(true);
51
+ }
52
+ return $this->_valueRenderer;
53
+ }
54
+
55
+ /**
56
+ * Assign extra parameters to row
57
+ *
58
+ * @param Varien_Object $row
59
+ */
60
+ protected function _prepareArrayRow(Varien_Object $row)
61
+ {
62
+ $row->setData(
63
+ 'option_extra_attr_'.$this->_getValueRenderer()->calcOptionHash($row->getData('value')),
64
+ 'selected="selected"'
65
+ );
66
+ }
67
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ArticleAdditional.php CHANGED
@@ -1,36 +1,36 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_ArticleAdditional extends MDN_Antidot_Block_System_Config_Form_Field_Array_Additional
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _renderCellTemplate($columnName)
23
- {
24
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
25
- switch($columnName) {
26
- case 'value':
27
- return $this->_getValueRenderer()
28
- ->setName($inputName)
29
- ->setTitle($columnName)
30
- ->setOptions(Mage::getModel("Antidot/System_Config_ArticleAttribute")->toOptionArray(null))
31
- ->toHtml();
32
- }
33
-
34
- return parent::_renderCellTemplate($columnName);
35
- }
36
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_ArticleAdditional extends MDN_Antidot_Block_System_Config_Form_Field_Array_Additional
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _renderCellTemplate($columnName)
23
+ {
24
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
25
+ switch($columnName) {
26
+ case 'value':
27
+ return $this->_getValueRenderer()
28
+ ->setName($inputName)
29
+ ->setTitle($columnName)
30
+ ->setOptions(Mage::getModel("Antidot/System_Config_ArticleAttribute")->toOptionArray(null))
31
+ ->toHtml();
32
+ }
33
+
34
+ return parent::_renderCellTemplate($columnName);
35
+ }
36
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ArticleIdentifier.php CHANGED
@@ -1,37 +1,37 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_ArticleIdentifier extends MDN_Antidot_Block_System_Config_Form_Field_Array_Identifier
17
- {
18
-
19
-
20
- /**
21
- * {@inherit}
22
- */
23
- protected function _renderCellTemplate($columnName)
24
- {
25
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
26
- switch($columnName) {
27
- case 'value':
28
- return $this->_getValueRenderer()
29
- ->setName($inputName)
30
- ->setTitle($columnName)
31
- ->setOptions(Mage::getModel("Antidot/System_Config_ArticleAttribute")->toOptionArray(null))
32
- ->toHtml();
33
- }
34
-
35
- return parent::_renderCellTemplate($columnName);
36
- }
37
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_ArticleIdentifier extends MDN_Antidot_Block_System_Config_Form_Field_Array_Identifier
17
+ {
18
+
19
+
20
+ /**
21
+ * {@inherit}
22
+ */
23
+ protected function _renderCellTemplate($columnName)
24
+ {
25
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
26
+ switch($columnName) {
27
+ case 'value':
28
+ return $this->_getValueRenderer()
29
+ ->setName($inputName)
30
+ ->setTitle($columnName)
31
+ ->setOptions(Mage::getModel("Antidot/System_Config_ArticleAttribute")->toOptionArray(null))
32
+ ->toHtml();
33
+ }
34
+
35
+ return parent::_renderCellTemplate($columnName);
36
+ }
37
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/DefaultSort.php CHANGED
@@ -1,103 +1,103 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_DefaultSort extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
- {
18
- protected $_fieldRenderer;
19
- protected $_dirRenderer;
20
-
21
- /**
22
- * {@inherit}
23
- */
24
- protected function _prepareToRender()
25
- {
26
- $this->_fieldRenderer = null;
27
- $this->_dirRenderer = null;
28
-
29
- $this->addColumn('field', array('label' => Mage::helper('Antidot')->__('Sortable')));
30
- $this->addColumn('dir', array('label' => Mage::helper('Antidot')->__('Direction')));
31
-
32
- $this->_addAfter = false;
33
- $this->_add = false;
34
- }
35
-
36
- /**
37
- * {@inherit}
38
- */
39
- protected function _renderCellTemplate($columnName)
40
- {
41
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
42
- switch($columnName) {
43
- case 'field':
44
- return $this->_getFieldRenderer()
45
- ->setName($inputName)
46
- ->setTitle($columnName)
47
- ->setOptions(Mage::getModel("Antidot/System_Config_Sort")->toOptionArray())
48
- ->toHtml();
49
- case 'dir':
50
- return $this->_getDirRenderer()
51
- ->setName($inputName)
52
- ->setTitle($columnName)
53
- ->setOptions(Mage::getModel("Antidot/System_Config_Dir")->toOptionArray())
54
- ->toHtml();
55
- }
56
-
57
- return parent::_renderCellTemplate($columnName);
58
- }
59
-
60
- /**
61
- * {@inherit}
62
- */
63
- protected function _getFieldRenderer()
64
- {
65
- if (!$this->_fieldRenderer) {
66
- $this->_fieldRenderer = $this->getLayout()
67
- ->createBlock('Antidot/Html_Select')
68
- ->setIsRenderToJsTemplate(true);
69
- }
70
- return $this->_fieldRenderer;
71
- }
72
-
73
- /**
74
- * {@inherit}
75
- */
76
- protected function _getDirRenderer()
77
- {
78
- if (!$this->_dirRenderer) {
79
- $this->_dirRenderer = $this->getLayout()
80
- ->createBlock('Antidot/Html_Select')
81
- ->setIsRenderToJsTemplate(true);
82
- }
83
- return $this->_dirRenderer;
84
- }
85
-
86
- /**
87
- * Assign extra parameters to row
88
- *
89
- * @param Varien_Object $row
90
- */
91
- protected function _prepareArrayRow(Varien_Object $row)
92
- {
93
- $row->setData(
94
- 'option_extra_attr_'.$this->_getFieldRenderer()->calcOptionHash($row->getData('field')),
95
- 'selected="selected"'
96
- );
97
-
98
- $row->setData(
99
- 'option_extra_attr_'.$this->_getDirRenderer()->calcOptionHash($row->getData('dir')),
100
- 'selected="selected"'
101
- );
102
- }
103
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_DefaultSort extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
+ {
18
+ protected $_fieldRenderer;
19
+ protected $_dirRenderer;
20
+
21
+ /**
22
+ * {@inherit}
23
+ */
24
+ protected function _prepareToRender()
25
+ {
26
+ $this->_fieldRenderer = null;
27
+ $this->_dirRenderer = null;
28
+
29
+ $this->addColumn('field', array('label' => Mage::helper('Antidot')->__('Sortable')));
30
+ $this->addColumn('dir', array('label' => Mage::helper('Antidot')->__('Direction')));
31
+
32
+ $this->_addAfter = false;
33
+ $this->_add = false;
34
+ }
35
+
36
+ /**
37
+ * {@inherit}
38
+ */
39
+ protected function _renderCellTemplate($columnName)
40
+ {
41
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
42
+ switch($columnName) {
43
+ case 'field':
44
+ return $this->_getFieldRenderer()
45
+ ->setName($inputName)
46
+ ->setTitle($columnName)
47
+ ->setOptions(Mage::getModel("Antidot/System_Config_Sort")->toOptionArray())
48
+ ->toHtml();
49
+ case 'dir':
50
+ return $this->_getDirRenderer()
51
+ ->setName($inputName)
52
+ ->setTitle($columnName)
53
+ ->setOptions(Mage::getModel("Antidot/System_Config_Dir")->toOptionArray())
54
+ ->toHtml();
55
+ }
56
+
57
+ return parent::_renderCellTemplate($columnName);
58
+ }
59
+
60
+ /**
61
+ * {@inherit}
62
+ */
63
+ protected function _getFieldRenderer()
64
+ {
65
+ if (!$this->_fieldRenderer) {
66
+ $this->_fieldRenderer = $this->getLayout()
67
+ ->createBlock('Antidot/Html_Select')
68
+ ->setIsRenderToJsTemplate(true);
69
+ }
70
+ return $this->_fieldRenderer;
71
+ }
72
+
73
+ /**
74
+ * {@inherit}
75
+ */
76
+ protected function _getDirRenderer()
77
+ {
78
+ if (!$this->_dirRenderer) {
79
+ $this->_dirRenderer = $this->getLayout()
80
+ ->createBlock('Antidot/Html_Select')
81
+ ->setIsRenderToJsTemplate(true);
82
+ }
83
+ return $this->_dirRenderer;
84
+ }
85
+
86
+ /**
87
+ * Assign extra parameters to row
88
+ *
89
+ * @param Varien_Object $row
90
+ */
91
+ protected function _prepareArrayRow(Varien_Object $row)
92
+ {
93
+ $row->setData(
94
+ 'option_extra_attr_'.$this->_getFieldRenderer()->calcOptionHash($row->getData('field')),
95
+ 'selected="selected"'
96
+ );
97
+
98
+ $row->setData(
99
+ 'option_extra_attr_'.$this->_getDirRenderer()->calcOptionHash($row->getData('dir')),
100
+ 'selected="selected"'
101
+ );
102
+ }
103
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Facet.php CHANGED
@@ -1,132 +1,162 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_Facet extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
- {
18
- protected $_facetRenderer;
19
- protected $_orderRenderer;
20
- protected $_multipleRenderer;
21
-
22
- /**
23
- * {@inherit}
24
- */
25
- protected function _prepareToRender()
26
- {
27
- $this->_facetRenderer = null;
28
- $this->_orderRenderer = null;
29
- $this->_multipleRenderer = null;
30
-
31
- $this->addColumn('facet', array('label' => Mage::helper('Antidot')->__('Facet')));
32
- $this->addColumn('order', array('label' => Mage::helper('Antidot')->__('Sort')));
33
- $this->addColumn('multiple', array('label' => Mage::helper('Antidot')->__('Multiple selections')));
34
-
35
- // Disables "Add after" button
36
- $this->_addAfter = false;
37
- $this->_addButtonLabel = Mage::helper('Antidot')->__('Add a field');
38
- }
39
-
40
- /**
41
- * {@inherit}
42
- */
43
- protected function _renderCellTemplate($columnName)
44
- {
45
- $inputName = $this->getElement()->getName() . '[#{_id}]['.$columnName.']';
46
- switch($columnName) {
47
- case 'facet':
48
- return $this->_getFacetRenderer()
49
- ->setName($inputName)
50
- ->setTitle($columnName)
51
- ->setOptions(Mage::getModel("Antidot/System_Config_Facet")->toOptionArray())
52
- ->toHtml();
53
- case 'order':
54
- return $this->_getOrderRenderer()
55
- ->setName($inputName)
56
- ->setTitle($columnName)
57
- ->setWidth(50)
58
- ->setOptions(Mage::getModel("Antidot/System_Config_Number")->toOptionArray(10))
59
- ->toHtml();
60
- case 'multiple':
61
- return $this->_getMultipleRenderer()
62
- ->setName($inputName)
63
- ->setTitle($columnName)
64
- ->setOptions(Mage::getModel("Antidot/System_Config_DisableEnable")->toOptionArray())
65
- ->toHtml();
66
- }
67
-
68
- return parent::_renderCellTemplate($columnName);
69
- }
70
-
71
- /**
72
- * {@inherit}
73
- */
74
- protected function _getFacetRenderer()
75
- {
76
- if (!$this->_facetRenderer) {
77
- $this->_facetRenderer = $this->getLayout()
78
- ->createBlock('Antidot/Html_Select')
79
- ->setIsRenderToJsTemplate(true);
80
- }
81
- return $this->_facetRenderer;
82
- }
83
-
84
- /**
85
- * {@inherit}
86
- */
87
- protected function _getOrderRenderer()
88
- {
89
- if (!$this->_orderRenderer) {
90
- $this->_orderRenderer = $this->getLayout()
91
- ->createBlock('Antidot/Html_Select')
92
- ->setIsRenderToJsTemplate(true);
93
- }
94
- return $this->_orderRenderer;
95
- }
96
-
97
- /**
98
- * {@inherit}
99
- */
100
- protected function _getMultipleRenderer()
101
- {
102
- if (!$this->_multipleRenderer) {
103
- $this->_multipleRenderer = $this->getLayout()
104
- ->createBlock('Antidot/Html_Select')
105
- ->setIsRenderToJsTemplate(true);
106
- }
107
- return $this->_multipleRenderer;
108
- }
109
-
110
- /**
111
- * Assign extra parameters to row
112
- *
113
- * @param Varien_Object $row
114
- */
115
- protected function _prepareArrayRow(Varien_Object $row)
116
- {
117
- $row->setData(
118
- 'option_extra_attr_'.$this->_getFacetRenderer()->calcOptionHash($row->getData('facet')),
119
- 'selected="selected"'
120
- );
121
-
122
- $row->setData(
123
- 'option_extra_attr_'.$this->_getOrderRenderer()->calcOptionHash($row->getData('order')),
124
- 'selected="selected"'
125
- );
126
-
127
- $row->setData(
128
- 'option_extra_attr_'.$this->_getMultipleRenderer()->calcOptionHash($row->getData('multiple')),
129
- 'selected="selected"'
130
- );
131
- }
132
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_Facet extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
+ {
18
+ protected $_facetRenderer;
19
+ protected $_orderRenderer;
20
+ protected $_multipleRenderer;
21
+
22
+ /**
23
+ * {@inherit}
24
+ */
25
+ protected function _prepareToRender()
26
+ {
27
+ $this->_facetRenderer = null;
28
+ $this->_orderRenderer = null;
29
+ $this->_multipleRenderer = null;
30
+
31
+ $this->addColumn('facet', array('label' => Mage::helper('Antidot')->__('Facet')));
32
+ $this->addColumn('order', array('label' => Mage::helper('Antidot')->__('Sort')));
33
+ $this->addColumn('multiple', array('label' => Mage::helper('Antidot')->__('Multiple selections')));
34
+
35
+ // Disables "Add after" button
36
+ $this->_addAfter = false;
37
+ $this->_addButtonLabel = Mage::helper('Antidot')->__('Add a field');
38
+ }
39
+
40
+ /**
41
+ * {@inherit}
42
+ */
43
+ protected function _renderCellTemplate($columnName)
44
+ {
45
+
46
+ $inputName = $this->getElement()->getName() . '[#{_id}]['.$columnName.']';
47
+ switch($columnName) {
48
+ case 'facet':
49
+ return $this->_getFacetRenderer()
50
+ ->setName($inputName)
51
+ ->setTitle($columnName)
52
+ ->setOptions(Mage::getModel("Antidot/System_Config_Facet")->toOptionArray())
53
+ ->toHtml();
54
+ case 'order':
55
+ return $this->_getOrderRenderer()
56
+ ->setName($inputName)
57
+ ->setTitle($columnName)
58
+ ->setWidth(50)
59
+ ->setOptions(Mage::getModel("Antidot/System_Config_Number")->toOptionArray(10))
60
+ ->toHtml();
61
+ case 'multiple':
62
+ return $this->_getMultipleRenderer()
63
+ ->setName($inputName)
64
+ ->setTitle($columnName)
65
+ ->setOptions(Mage::getModel("Antidot/System_Config_DisableEnable")->toOptionArray())
66
+ ->toHtml();
67
+ }
68
+
69
+ return parent::_renderCellTemplate($columnName);
70
+ }
71
+
72
+ /**
73
+ * {@inherit}
74
+ */
75
+ protected function _getFacetRenderer()
76
+ {
77
+ if (!$this->_facetRenderer) {
78
+ $this->_facetRenderer = $this->getLayout()
79
+ ->createBlock('Antidot/Html_Select')
80
+ ->setIsRenderToJsTemplate(true);
81
+ }
82
+ return $this->_facetRenderer;
83
+ }
84
+
85
+ /**
86
+ * {@inherit}
87
+ */
88
+ protected function _getOrderRenderer()
89
+ {
90
+ if (!$this->_orderRenderer) {
91
+ $this->_orderRenderer = $this->getLayout()
92
+ ->createBlock('Antidot/Html_Select')
93
+ ->setIsRenderToJsTemplate(true);
94
+ }
95
+ return $this->_orderRenderer;
96
+ }
97
+
98
+ /**
99
+ * {@inherit}
100
+ */
101
+ protected function _getMultipleRenderer()
102
+ {
103
+ if (!$this->_multipleRenderer) {
104
+ $this->_multipleRenderer = $this->getLayout()
105
+ ->createBlock('Antidot/Html_Select')
106
+ ->setIsRenderToJsTemplate(true);
107
+ }
108
+ return $this->_multipleRenderer;
109
+ }
110
+
111
+ /**
112
+ * Assign extra parameters to row
113
+ *
114
+ * @param Varien_Object $row
115
+ */
116
+ protected function _prepareArrayRow(Varien_Object $row)
117
+ {
118
+ $row->setData(
119
+ 'option_extra_attr_'.$this->_getFacetRenderer()->calcOptionHash($row->getData('facet')),
120
+ 'selected="selected"'
121
+ );
122
+
123
+ $row->setData(
124
+ 'option_extra_attr_'.$this->_getOrderRenderer()->calcOptionHash($row->getData('order')),
125
+ 'selected="selected"'
126
+ );
127
+
128
+ $row->setData(
129
+ 'option_extra_attr_'.$this->_getMultipleRenderer()->calcOptionHash($row->getData('multiple')),
130
+ 'selected="selected"'
131
+ );
132
+ }
133
+
134
+ /**
135
+ * Override this parent method to avoid conversion from & => &amp;
136
+ *
137
+ *
138
+ * @return array
139
+ */
140
+ public function getArrayRows()
141
+ {
142
+ if (null !== $this->_arrayRowsCache) {
143
+ return $this->_arrayRowsCache;
144
+ }
145
+ $result = array();
146
+ /** @var Varien_Data_Form_Element_Abstract */
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]);
156
+ }
157
+ }
158
+ $this->_arrayRowsCache = $result;
159
+ return $this->_arrayRowsCache;
160
+ }
161
+
162
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Identifier.php CHANGED
@@ -1,69 +1,69 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_Identifier extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
- {
18
- protected $_valueRenderer;
19
-
20
- /**
21
- * {@inherit}
22
- */
23
- protected function _prepareToRender()
24
- {
25
- $this->_fieldRenderer = null;
26
- $this->_valueRenderer = null;
27
- $this->_indexRenderer = null;
28
-
29
- $this->addColumn('value', array('label' => Mage::helper('Antidot')->__('Attribute')));
30
-
31
- // Disables "Add after" button
32
- $this->_addAfter = false;
33
- $this->_addButtonLabel = Mage::helper('Antidot')->__('Add a field');
34
- }
35
-
36
- /**
37
- * {@inherit}
38
- */
39
- protected function _renderCellTemplate($columnName)
40
- {
41
- return parent::_renderCellTemplate($columnName);
42
- }
43
-
44
- /**
45
- * {@inherit}
46
- */
47
- protected function _getValueRenderer()
48
- {
49
- if (!$this->_valueRenderer) {
50
- $this->_valueRenderer = $this->getLayout()
51
- ->createBlock('Antidot/Html_Select')
52
- ->setIsRenderToJsTemplate(true);
53
- }
54
- return $this->_valueRenderer;
55
- }
56
-
57
- /**
58
- * Assign extra parameters to row
59
- *
60
- * @param Varien_Object $row
61
- */
62
- protected function _prepareArrayRow(Varien_Object $row)
63
- {
64
- $row->setData(
65
- 'option_extra_attr_'.$this->_getValueRenderer()->calcOptionHash($row->getData('value')),
66
- 'selected="selected"'
67
- );
68
- }
69
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_Identifier extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
+ {
18
+ protected $_valueRenderer;
19
+
20
+ /**
21
+ * {@inherit}
22
+ */
23
+ protected function _prepareToRender()
24
+ {
25
+ $this->_fieldRenderer = null;
26
+ $this->_valueRenderer = null;
27
+ $this->_indexRenderer = null;
28
+
29
+ $this->addColumn('value', array('label' => Mage::helper('Antidot')->__('Attribute')));
30
+
31
+ // Disables "Add after" button
32
+ $this->_addAfter = false;
33
+ $this->_addButtonLabel = Mage::helper('Antidot')->__('Add a field');
34
+ }
35
+
36
+ /**
37
+ * {@inherit}
38
+ */
39
+ protected function _renderCellTemplate($columnName)
40
+ {
41
+ return parent::_renderCellTemplate($columnName);
42
+ }
43
+
44
+ /**
45
+ * {@inherit}
46
+ */
47
+ protected function _getValueRenderer()
48
+ {
49
+ if (!$this->_valueRenderer) {
50
+ $this->_valueRenderer = $this->getLayout()
51
+ ->createBlock('Antidot/Html_Select')
52
+ ->setIsRenderToJsTemplate(true);
53
+ }
54
+ return $this->_valueRenderer;
55
+ }
56
+
57
+ /**
58
+ * Assign extra parameters to row
59
+ *
60
+ * @param Varien_Object $row
61
+ */
62
+ protected function _prepareArrayRow(Varien_Object $row)
63
+ {
64
+ $row->setData(
65
+ 'option_extra_attr_'.$this->_getValueRenderer()->calcOptionHash($row->getData('value')),
66
+ 'selected="selected"'
67
+ );
68
+ }
69
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ProductAdditionalFacet.php CHANGED
@@ -1,81 +1,81 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_ProductAdditionalFacet extends MDN_Antidot_Block_System_Config_Form_Field_Array_Additional
17
- {
18
- protected $_autocompleteRenderer;
19
-
20
- /**
21
- * {@inherit}
22
- */
23
- protected function _prepareToRender()
24
- {
25
- parent::_prepareToRender();
26
- $this->addColumn('autocomplete', array('label' => Mage::helper('Antidot')->__('Auto Complete')));
27
- }
28
-
29
- /**
30
- * {@inherit}
31
- */
32
- protected function _renderCellTemplate($columnName)
33
- {
34
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
35
- switch($columnName) {
36
- case 'value':
37
- return $this->_getValueRenderer()
38
- ->setName($inputName)
39
- ->setTitle($columnName)
40
- ->setOptions(Mage::getModel("Antidot/System_Config_ProductAttribute")->toOptionArray(null))
41
- ->toHtml();
42
- case 'autocomplete':
43
- return $this->_getAutocompleteRenderer()
44
- ->setName($inputName)
45
- ->setTitle($columnName)
46
- ->setExtraParams('style="width:100px"')
47
- ->setOptions(Mage::getModel("Antidot/System_Config_DisableEnable")->toOptionArray(null))
48
- ->toHtml();
49
- }
50
-
51
- return parent::_renderCellTemplate($columnName);
52
- }
53
-
54
- /**
55
- * {@inherit}
56
- */
57
- protected function _getAutocompleteRenderer()
58
- {
59
- if (!$this->_autocompleteRenderer) {
60
- $this->_autocompleteRenderer = $this->getLayout()
61
- ->createBlock('Antidot/Html_Select')
62
- ->setIsRenderToJsTemplate(true);
63
- }
64
- return $this->_autocompleteRenderer;
65
- }
66
-
67
- /**
68
- * Assign extra parameters to row
69
- *
70
- * @param Varien_Object $row
71
- */
72
- protected function _prepareArrayRow(Varien_Object $row)
73
- {
74
- $row->setData(
75
- 'option_extra_attr_'.$this->_getAutocompleteRenderer()->calcOptionHash($row->getData('autocomplete')),
76
- 'selected="selected"'
77
- );
78
-
79
- parent::_prepareArrayRow($row);
80
- }
81
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_ProductAdditionalFacet extends MDN_Antidot_Block_System_Config_Form_Field_Array_Additional
17
+ {
18
+ protected $_autocompleteRenderer;
19
+
20
+ /**
21
+ * {@inherit}
22
+ */
23
+ protected function _prepareToRender()
24
+ {
25
+ parent::_prepareToRender();
26
+ $this->addColumn('autocomplete', array('label' => Mage::helper('Antidot')->__('Auto Complete')));
27
+ }
28
+
29
+ /**
30
+ * {@inherit}
31
+ */
32
+ protected function _renderCellTemplate($columnName)
33
+ {
34
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
35
+ switch($columnName) {
36
+ case 'value':
37
+ return $this->_getValueRenderer()
38
+ ->setName($inputName)
39
+ ->setTitle($columnName)
40
+ ->setOptions(Mage::getModel("Antidot/System_Config_ProductAttribute")->toOptionArray(null))
41
+ ->toHtml();
42
+ case 'autocomplete':
43
+ return $this->_getAutocompleteRenderer()
44
+ ->setName($inputName)
45
+ ->setTitle($columnName)
46
+ ->setExtraParams('style="width:100px"')
47
+ ->setOptions(Mage::getModel("Antidot/System_Config_DisableEnable")->toOptionArray(null))
48
+ ->toHtml();
49
+ }
50
+
51
+ return parent::_renderCellTemplate($columnName);
52
+ }
53
+
54
+ /**
55
+ * {@inherit}
56
+ */
57
+ protected function _getAutocompleteRenderer()
58
+ {
59
+ if (!$this->_autocompleteRenderer) {
60
+ $this->_autocompleteRenderer = $this->getLayout()
61
+ ->createBlock('Antidot/Html_Select')
62
+ ->setIsRenderToJsTemplate(true);
63
+ }
64
+ return $this->_autocompleteRenderer;
65
+ }
66
+
67
+ /**
68
+ * Assign extra parameters to row
69
+ *
70
+ * @param Varien_Object $row
71
+ */
72
+ protected function _prepareArrayRow(Varien_Object $row)
73
+ {
74
+ $row->setData(
75
+ 'option_extra_attr_'.$this->_getAutocompleteRenderer()->calcOptionHash($row->getData('autocomplete')),
76
+ 'selected="selected"'
77
+ );
78
+
79
+ parent::_prepareArrayRow($row);
80
+ }
81
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ProductAdditionalField.php CHANGED
@@ -1,35 +1,35 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_ProductAdditionalField extends MDN_Antidot_Block_System_Config_Form_Field_Array_Additional
17
- {
18
- /**
19
- * {@inherit}
20
- */
21
- protected function _renderCellTemplate($columnName)
22
- {
23
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
24
- switch($columnName) {
25
- case 'value':
26
- return $this->_getValueRenderer()
27
- ->setName($inputName)
28
- ->setTitle($columnName)
29
- ->setOptions(Mage::getModel("Antidot/System_Config_ProductAttribute")->toOptionArray(null))
30
- ->toHtml();
31
- }
32
-
33
- return parent::_renderCellTemplate($columnName);
34
- }
35
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_ProductAdditionalField extends MDN_Antidot_Block_System_Config_Form_Field_Array_Additional
17
+ {
18
+ /**
19
+ * {@inherit}
20
+ */
21
+ protected function _renderCellTemplate($columnName)
22
+ {
23
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
24
+ switch($columnName) {
25
+ case 'value':
26
+ return $this->_getValueRenderer()
27
+ ->setName($inputName)
28
+ ->setTitle($columnName)
29
+ ->setOptions(Mage::getModel("Antidot/System_Config_ProductAttribute")->toOptionArray(null))
30
+ ->toHtml();
31
+ }
32
+
33
+ return parent::_renderCellTemplate($columnName);
34
+ }
35
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/ProductIdentifier.php CHANGED
@@ -1,36 +1,36 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_ProductIdentifier extends MDN_Antidot_Block_System_Config_Form_Field_Array_Identifier
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _renderCellTemplate($columnName)
23
- {
24
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
25
- switch($columnName) {
26
- case 'value':
27
- return $this->_getValueRenderer()
28
- ->setName($inputName)
29
- ->setTitle($columnName)
30
- ->setOptions(Mage::getModel("Antidot/System_Config_ProductAttribute")->toOptionArray($this->getElement()->getName()))
31
- ->toHtml();
32
- }
33
-
34
- return parent::_renderCellTemplate($columnName);
35
- }
36
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_ProductIdentifier extends MDN_Antidot_Block_System_Config_Form_Field_Array_Identifier
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _renderCellTemplate($columnName)
23
+ {
24
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
25
+ switch($columnName) {
26
+ case 'value':
27
+ return $this->_getValueRenderer()
28
+ ->setName($inputName)
29
+ ->setTitle($columnName)
30
+ ->setOptions(Mage::getModel("Antidot/System_Config_ProductAttribute")->toOptionArray($this->getElement()->getName()))
31
+ ->toHtml();
32
+ }
33
+
34
+ return parent::_renderCellTemplate($columnName);
35
+ }
36
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/Array/Sort.php CHANGED
@@ -1,78 +1,78 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_Array_Sort extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
- {
18
- protected $_sortRenderer;
19
-
20
- /**
21
- * {@inherit}
22
- */
23
- protected function _prepareToRender()
24
- {
25
- $this->_sortRenderer = null;
26
- $this->_labelRenderer = null;
27
-
28
- $this->addColumn('sort', array('label' => Mage::helper('Antidot')->__('Sortable')));
29
-
30
- // Disables "Add after" button
31
- $this->_addAfter = false;
32
- $this->_addButtonLabel = Mage::helper('Antidot')->__('Add a field');
33
- }
34
-
35
- /**
36
- * {@inherit}
37
- */
38
- protected function _renderCellTemplate($columnName)
39
- {
40
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
41
- switch($columnName) {
42
- case 'sort':
43
- return $this->_getSortRenderer()
44
- ->setName($inputName)
45
- ->setTitle($columnName)
46
- ->setOptions(Mage::getModel("Antidot/System_Config_Sort")->toOptionArray())
47
- ->toHtml();
48
- }
49
-
50
- return parent::_renderCellTemplate($columnName);
51
- }
52
-
53
- /**
54
- * {@inherit}
55
- */
56
- protected function _getSortRenderer()
57
- {
58
- if (!$this->_sortRenderer) {
59
- $this->_sortRenderer = $this->getLayout()
60
- ->createBlock('Antidot/Html_Select')
61
- ->setIsRenderToJsTemplate(true);
62
- }
63
- return $this->_sortRenderer;
64
- }
65
-
66
- /**
67
- * Assign extra parameters to row
68
- *
69
- * @param Varien_Object $row
70
- */
71
- protected function _prepareArrayRow(Varien_Object $row)
72
- {
73
- $row->setData(
74
- 'option_extra_attr_'.$this->_getSortRenderer()->calcOptionHash($row->getData('sort')),
75
- 'selected="selected"'
76
- );
77
- }
78
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_Array_Sort extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
17
+ {
18
+ protected $_sortRenderer;
19
+
20
+ /**
21
+ * {@inherit}
22
+ */
23
+ protected function _prepareToRender()
24
+ {
25
+ $this->_sortRenderer = null;
26
+ $this->_labelRenderer = null;
27
+
28
+ $this->addColumn('sort', array('label' => Mage::helper('Antidot')->__('Sortable')));
29
+
30
+ // Disables "Add after" button
31
+ $this->_addAfter = false;
32
+ $this->_addButtonLabel = Mage::helper('Antidot')->__('Add a field');
33
+ }
34
+
35
+ /**
36
+ * {@inherit}
37
+ */
38
+ protected function _renderCellTemplate($columnName)
39
+ {
40
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
41
+ switch($columnName) {
42
+ case 'sort':
43
+ return $this->_getSortRenderer()
44
+ ->setName($inputName)
45
+ ->setTitle($columnName)
46
+ ->setOptions(Mage::getModel("Antidot/System_Config_Sort")->toOptionArray())
47
+ ->toHtml();
48
+ }
49
+
50
+ return parent::_renderCellTemplate($columnName);
51
+ }
52
+
53
+ /**
54
+ * {@inherit}
55
+ */
56
+ protected function _getSortRenderer()
57
+ {
58
+ if (!$this->_sortRenderer) {
59
+ $this->_sortRenderer = $this->getLayout()
60
+ ->createBlock('Antidot/Html_Select')
61
+ ->setIsRenderToJsTemplate(true);
62
+ }
63
+ return $this->_sortRenderer;
64
+ }
65
+
66
+ /**
67
+ * Assign extra parameters to row
68
+ *
69
+ * @param Varien_Object $row
70
+ */
71
+ protected function _prepareArrayRow(Varien_Object $row)
72
+ {
73
+ $row->setData(
74
+ 'option_extra_attr_'.$this->_getSortRenderer()->calcOptionHash($row->getData('sort')),
75
+ 'selected="selected"'
76
+ );
77
+ }
78
+ }
app/code/community/MDN/Antidot/Block/System/Config/Form/Field/ProductAttribute.php CHANGED
@@ -1,37 +1,37 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Form_Field_ProductAttribute extends Mage_Adminhtml_Block_System_Config_Form_Field
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
- {
24
- return $this->_getRenderer()
25
- ->setOptions(Mage::getModel("Antidot/System_Config_ProductAttribute")->toOptionArray($element->getName()))
26
- ->setValue($element->getValue())
27
- ->setName($element->getName())
28
- ->toHtml();
29
- }
30
-
31
- protected function _getRenderer()
32
- {
33
- return $this->getLayout()
34
- ->createBlock('Antidot/Html_Select')
35
- ->setIsRenderToJsTemplate(true);
36
- }
37
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Form_Field_ProductAttribute extends Mage_Adminhtml_Block_System_Config_Form_Field
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ return $this->_getRenderer()
25
+ ->setOptions(Mage::getModel("Antidot/System_Config_ProductAttribute")->toOptionArray($element->getName()))
26
+ ->setValue($element->getValue())
27
+ ->setName($element->getName())
28
+ ->toHtml();
29
+ }
30
+
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
@@ -1,59 +1,61 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Block_System_Config_Html_Export extends Mage_Adminhtml_Block_System_Config_Form_Field
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
- {
24
- $table = '<div class="grid">'
25
- .'<table class="border" cellspacing="0" cellpadding="0">'
26
- .'<thead>'
27
- .'<tr class="headings">'
28
- .'<th width="120px">'.Mage::helper('Antidot')->__('Date').'</th>'
29
- .'<th>'.Mage::helper('Antidot')->__('Reference').'</th>'
30
- .'<th>'.Mage::helper('Antidot')->__('Type').'</th>'
31
- .'<th>'.Mage::helper('Antidot')->__('Element').'</th>'
32
- .'<th>'.Mage::helper('Antidot')->__('Products').'</th>'
33
- .'<th>'.Mage::helper('Antidot')->__('Status').'</th>'
34
- .'</tr>'
35
- .'</thead>'
36
- .'<tbody>'
37
- .'%s'
38
- .'</tbody>'
39
- .'</table>'
40
- .'</div>'
41
- ;
42
-
43
- $rows = '';
44
- $rowExport = '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>';
45
- foreach(Mage::helper('Antidot/LogExport')->getAllLastGeneration() as $export) {
46
- $rows.= sprintf(
47
- $rowExport,
48
- $export['begin_at'],
49
- $export['reference'],
50
- $export['type'],
51
- $export['element'],
52
- $export['items_processed'],
53
- $export['status']
54
- );
55
- }
56
-
57
- return sprintf($table, $rows);
58
- }
 
 
59
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Block_System_Config_Html_Export extends Mage_Adminhtml_Block_System_Config_Form_Field
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $table = '<div class="grid">'
25
+ .'<table class="border" cellspacing="0" cellpadding="0">'
26
+ .'<thead>'
27
+ .'<tr class="headings">'
28
+ .'<th width="120px">'.Mage::helper('Antidot')->__('Date').'</th>'
29
+ .'<th>'.Mage::helper('Antidot')->__('Reference').'</th>'
30
+ .'<th>'.Mage::helper('Antidot')->__('Type').'</th>'
31
+ .'<th>'.Mage::helper('Antidot')->__('Element').'</th>'
32
+ .'<th>'.Mage::helper('Antidot')->__('Products').'</th>'
33
+ .'<th>'.Mage::helper('Antidot')->__('Status').'</th>'
34
+ .'<th>'.Mage::helper('Antidot')->__('Msg').'</th>'
35
+ .'</tr>'
36
+ .'</thead>'
37
+ .'<tbody>'
38
+ .'%s'
39
+ .'</tbody>'
40
+ .'</table>'
41
+ .'</div>'
42
+ ;
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'],
50
+ $export['reference'],
51
+ $export['type'],
52
+ $export['element'],
53
+ $export['items_processed'],
54
+ $export['status'],
55
+ $export['error']
56
+ );
57
+ }
58
+
59
+ return sprintf($table, $rows);
60
+ }
61
  }
app/code/community/MDN/Antidot/Helper/Antidot.php CHANGED
@@ -1,35 +1,35 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Helper_Antidot extends MDN_Antidot_Helper_Data
17
- {
18
- /**
19
- * {@inherit}
20
- */
21
- public function getEngineConfigData($prefix = '', $store = null)
22
- {
23
- return parent::getEngineConfigData('antidot_', $store);
24
- }
25
-
26
- /**
27
- * Should Antidot also search on options?
28
- *
29
- * @return bool
30
- */
31
- public function shouldSearchOnOptions()
32
- {
33
- return Mage::getStoreConfigFlag('catalog/search/andidot_enable_options_search');
34
- }
35
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Helper_Antidot extends MDN_Antidot_Helper_Data
17
+ {
18
+ /**
19
+ * {@inherit}
20
+ */
21
+ public function getEngineConfigData($prefix = '', $store = null)
22
+ {
23
+ return parent::getEngineConfigData('antidot_', $store);
24
+ }
25
+
26
+ /**
27
+ * Should Antidot also search on options?
28
+ *
29
+ * @return bool
30
+ */
31
+ public function shouldSearchOnOptions()
32
+ {
33
+ return Mage::getStoreConfigFlag('catalog/search/andidot_enable_options_search');
34
+ }
35
  }
app/code/community/MDN/Antidot/Helper/CatalogSearch/Data.php CHANGED
@@ -1,28 +1,28 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Helper_CatalogSearch_Data extends Mage_CatalogSearch_Helper_Data {
17
-
18
- /**
19
- * {@inherit}
20
- */
21
- public function getSuggestUrl()
22
- {
23
- $url = Mage::getStoreConfig('antidot/suggest/enable') === 'Antidot/engine_antidot' ? 'Antidot/Front_Search/Suggest' : 'catalogsearch/ajax/suggest';
24
- return $this->_getUrl($url, array(
25
- '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure()
26
- ));
27
- }
28
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Helper_CatalogSearch_Data extends Mage_CatalogSearch_Helper_Data {
17
+
18
+ /**
19
+ * {@inherit}
20
+ */
21
+ public function getSuggestUrl()
22
+ {
23
+ $url = Mage::getStoreConfig('antidot/suggest/enable') === 'Antidot/engine_antidot' ? 'Antidot/Front_Search/Suggest' : 'catalogsearch/ajax/suggest';
24
+ return $this->_getUrl($url, array(
25
+ '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure()
26
+ ));
27
+ }
28
+ }
app/code/community/MDN/Antidot/Helper/Compress.php CHANGED
@@ -1,49 +1,60 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Helper_Compress extends Mage_Core_Helper_Abstract {
17
-
18
- /**
19
- * Compress files
20
- *
21
- * @param array|string $files
22
- * @param string $zipFile
23
- * @return boolean
24
- */
25
- public function zip($files, $zipFile)
26
- {
27
- $files = (array)$files;
28
- try {
29
- if(class_exists('ZipArchive')) {
30
- $zip = new ZipArchive();
31
- if(!$zip->open($zipFile, ZipArchive::CREATE)) {
32
- throw new Exception("cannot open ".$zipFile." for writing");
33
- }
34
-
35
- foreach($files as $file) {
36
- $zip->addFile($file, basename($file));
37
- }
38
- $zip->close($zip);
39
- }
40
- } catch (Exception $e) {
41
- $files = array_map('basename', $files);
42
- exec('cd /tmp && zip '.$zipFile.' '.implode(' ', $files));
43
- }
44
-
45
- if(!file_exists($zipFile)) {
46
- throw new Exception('Could not zip the file');
47
- }
48
- }
 
 
 
 
 
 
 
 
 
 
 
49
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Helper_Compress extends Mage_Core_Helper_Abstract {
17
+
18
+ /**
19
+ * Compress files
20
+ *
21
+ * @param array|string $files
22
+ * @param string $zipFile
23
+ * @return boolean
24
+ */
25
+ public function zip($files, $zipFile)
26
+ {
27
+ Mage::log('Start zip of '.count($files).' files to '.$zipFile, null, 'antidot.log');
28
+
29
+ $files = (array)$files;
30
+ try {
31
+ if(class_exists('ZipArchive')) {
32
+ Mage::log('ZipArchive exists', null, 'antidot.log');
33
+ $zip = new ZipArchive();
34
+ if(!$zip->open($zipFile, ZipArchive::CREATE)) {
35
+ throw new Exception("cannot open ".$zipFile." for writing");
36
+ }
37
+
38
+ foreach($files as $file) {
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
+ {
46
+ throw new Exception('Zip archive is not installed on your server');
47
+ Mage::log('ZipArchive DOES NOT exist', null, 'antidot.log');
48
+ }
49
+ } catch (Exception $e) {
50
+ Mage::log('Zip exception : '.$e->getMessage(), null, 'antidot.log');
51
+ $files = array_map('basename', $files);
52
+ exec('cd /tmp && zip '.$zipFile.' '.implode(' ', $files));
53
+ }
54
+
55
+ if(!file_exists($zipFile)) {
56
+ Mage::log('zip file '.$zipFile.' doest no exist', null, 'antidot.log');
57
+ throw new Exception('Could not zip the file at '.$zipFile);
58
+ }
59
+ }
60
  }
app/code/community/MDN/Antidot/Helper/Data.php CHANGED
@@ -1,202 +1,220 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Helper_Data extends Mage_Core_Helper_Abstract
17
- {
18
-
19
- /**
20
- * @var array Searchable attributes
21
- */
22
- protected $_searchableAttributes;
23
-
24
- /**
25
- * @var array Facets configuration
26
- */
27
- protected $facetConfiguration;
28
-
29
- /**
30
- * Returns attribute field name (localized if needed).
31
- *
32
- * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
33
- * @param string $localeCode
34
- * @return string
35
- */
36
- public function getAttributeFieldName($attribute, $localeCode = null)
37
- {
38
- if (is_string($attribute)) {
39
- $this->getSearchableAttributes();
40
- if (!isset($this->_searchableAttributes[$attribute])) {
41
- return $attribute;
42
- }
43
- $attribute = $this->_searchableAttributes[$attribute];
44
- }
45
- $attributeCode = $attribute->getAttributeCode();
46
-
47
- return $attributeCode;
48
- }
49
-
50
- /**
51
- * Returns search engine config data.
52
- *
53
- * @param string $prefix
54
- * @param mixed $store
55
- * @return array
56
- */
57
- public function getEngineConfigData($prefix = '', $store = null)
58
- {
59
- $config = Mage::getStoreConfig('catalog/search', $store);
60
- $data = array();
61
- if ($prefix) {
62
- foreach ($config as $key => $value) {
63
- $matches = array();
64
- if (preg_match("#^{$prefix}(.*)#", $key, $matches)) {
65
- $data[$matches[1]] = $value;
66
- }
67
- }
68
- } else {
69
- $data = $config;
70
- }
71
-
72
- return $data;
73
- }
74
-
75
- /**
76
- * Returns EAV config singleton.
77
- *
78
- * @return Mage_Eav_Model_Config
79
- */
80
- public function getEavConfig()
81
- {
82
- return Mage::getSingleton('eav/config');
83
- }
84
-
85
- /**
86
- * Returns seach config data.
87
- *
88
- * @param string $field
89
- * @param mixed $store
90
- * @return array
91
- */
92
- public function getSearchConfigData($field, $store = null)
93
- {
94
- $path = 'catalog/search/' . $field;
95
-
96
- return Mage::getStoreConfig($path, $store);
97
- }
98
-
99
- /**
100
- * Check if the facet accepts multiple options
101
- *
102
- * @param string $facetId
103
- * @return boolean
104
- */
105
- public function hasFacetMultiple($facetId)
106
- {
107
- $facets = $this->getFacetsFilter();
108
-
109
- return array_key_exists($facetId, $facets) && $facets[$facetId]['multiple'] === '1';
110
- }
111
-
112
- /**
113
- * Retrieve the facets configuration
114
- *
115
- * @return array
116
- */
117
- public function getFacetsFilter()
118
- {
119
- if($this->facetConfiguration === null) {
120
- $this->facetConfiguration = array();
121
- if($serializeFacets = Mage::getStoreConfig('antidot/engine/facets')) {
122
- $facets = unserialize($serializeFacets);
123
- foreach($facets as $facet) {
124
- list($facetId) = explode('|', $facet['facet']);
125
- $this->facetConfiguration[$facetId] = $facet;
126
- }
127
- }
128
- }
129
-
130
- return $this->facetConfiguration;
131
- }
132
-
133
- /**
134
- * Returns searched parameter as array.
135
- *
136
- * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
137
- * @param mixed $value
138
- * @return array
139
- */
140
- public function getSearchParam($attribute, $value)
141
- {
142
- if (empty($value) ||
143
- (isset($value['from']) && empty($value['from']) &&
144
- isset($value['to']) && empty($value['to']))) {
145
- return false;
146
- }
147
-
148
- $field = $this->getAttributeFieldName($attribute);
149
- if ($attribute->usesSource()) {
150
- $attribute->setStoreId(Mage::app()->getStore()->getId());
151
- }
152
-
153
- return array($field => $value);
154
- }
155
-
156
- /**
157
- * Checks if configured engine is active.
158
- *
159
- * @return bool
160
- */
161
- public function isActiveEngine()
162
- {
163
- $engine = $this->getSearchConfigData('engine');
164
- if ($engine && Mage::getConfig()->getResourceModelClassName($engine)) {
165
- $model = Mage::getResourceSingleton($engine);
166
- return $model
167
- && $model instanceof MDN_Antidot_Model_Resource_Engine_Abstract
168
- && $model->test();
169
- }
170
-
171
- return false;
172
- }
173
-
174
- /**
175
- * Send an email to admin
176
- *
177
- * @param string $subject
178
- * @param string $message
179
- */
180
- public function sendMail($subject, $message)
181
- {
182
- if(!$email = Mage::getStoreConfig('antidot/general/email')) {
183
- return;
184
- }
185
-
186
- $mail = Mage::getModel('core/email');
187
- $mail->setToEmail($email);
188
- $mail->setBody($message);
189
- $mail->setSubject(Mage::getStoreConfig('system/website/name').': '. $subject);
190
- $mail->setFromEmail('no-reply@boostmyshop.com');
191
- $mail->setFromName("BoostMyShop");
192
- $mail->setType('text');
193
-
194
- try {
195
- $mail->send();
196
- Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
197
- }
198
- catch (Exception $e) {
199
- Mage::getSingleton('core/session')->addError('Unable to send.');
200
- }
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Helper_Data extends Mage_Core_Helper_Abstract
17
+ {
18
+
19
+ /**
20
+ * @var array Searchable attributes
21
+ */
22
+ protected $_searchableAttributes;
23
+
24
+ /**
25
+ * @var array Facets configuration
26
+ */
27
+ protected $facetConfiguration;
28
+
29
+ /**
30
+ * Returns attribute field name (localized if needed).
31
+ *
32
+ * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
33
+ * @param string $localeCode
34
+ * @return string
35
+ */
36
+ public function getAttributeFieldName($attribute, $localeCode = null)
37
+ {
38
+ if (is_string($attribute)) {
39
+ $this->getSearchableAttributes();
40
+ if (!isset($this->_searchableAttributes[$attribute])) {
41
+ return $attribute;
42
+ }
43
+ $attribute = $this->_searchableAttributes[$attribute];
44
+ }
45
+ $attributeCode = $attribute->getAttributeCode();
46
+
47
+ return $attributeCode;
48
+ }
49
+
50
+ /**
51
+ * Returns search engine config data.
52
+ *
53
+ * @param string $prefix
54
+ * @param mixed $store
55
+ * @return array
56
+ */
57
+ public function getEngineConfigData($prefix = '', $store = null)
58
+ {
59
+ $config = Mage::getStoreConfig('catalog/search', $store);
60
+ $data = array();
61
+ if ($prefix) {
62
+ foreach ($config as $key => $value) {
63
+ $matches = array();
64
+ if (preg_match("#^{$prefix}(.*)#", $key, $matches)) {
65
+ $data[$matches[1]] = $value;
66
+ }
67
+ }
68
+ } else {
69
+ $data = $config;
70
+ }
71
+
72
+ return $data;
73
+ }
74
+
75
+ /**
76
+ * Returns EAV config singleton.
77
+ *
78
+ * @return Mage_Eav_Model_Config
79
+ */
80
+ public function getEavConfig()
81
+ {
82
+ return Mage::getSingleton('eav/config');
83
+ }
84
+
85
+ /**
86
+ * Returns seach config data.
87
+ *
88
+ * @param string $field
89
+ * @param mixed $store
90
+ * @return array
91
+ */
92
+ public function getSearchConfigData($field, $store = null)
93
+ {
94
+ $path = 'catalog/search/' . $field;
95
+
96
+ return Mage::getStoreConfig($path, $store);
97
+ }
98
+
99
+ /**
100
+ * Check if the facet accepts multiple options
101
+ *
102
+ * @param string $facetId
103
+ * @return boolean
104
+ */
105
+ public function hasFacetMultiple($facetId)
106
+ {
107
+ $facets = $this->getFacetsFilter();
108
+
109
+ return array_key_exists($facetId, $facets) && $facets[$facetId]['multiple'] === '1';
110
+ }
111
+
112
+ /**
113
+ * Retrieve the facets configuration
114
+ *
115
+ * @return array
116
+ */
117
+ public function getFacetsFilter()
118
+ {
119
+ if($this->facetConfiguration === null) {
120
+ $this->facetConfiguration = array();
121
+ if($serializeFacets = Mage::getStoreConfig('antidot/engine/facets')) {
122
+ $facets = unserialize($serializeFacets);
123
+ foreach($facets as $facet) {
124
+ list($facetId) = explode('|', $facet['facet']);
125
+ $this->facetConfiguration[$facetId] = $facet;
126
+ }
127
+ }
128
+ }
129
+
130
+ return $this->facetConfiguration;
131
+ }
132
+
133
+ /**
134
+ * Returns searched parameter as array.
135
+ *
136
+ * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
137
+ * @param mixed $value
138
+ * @return array
139
+ */
140
+ public function getSearchParam($attribute, $value)
141
+ {
142
+ if (empty($value) ||
143
+ (isset($value['from']) && empty($value['from']) &&
144
+ isset($value['to']) && empty($value['to']))) {
145
+ return false;
146
+ }
147
+
148
+ $field = $this->getAttributeFieldName($attribute);
149
+ if ($attribute->usesSource()) {
150
+ $attribute->setStoreId(Mage::app()->getStore()->getId());
151
+ }
152
+
153
+ return array($field => $value);
154
+ }
155
+
156
+ /**
157
+ * Checks if configured engine is active.
158
+ *
159
+ * @return bool
160
+ */
161
+ public function isActiveEngine()
162
+ {
163
+ $engine = $this->getSearchConfigData('engine');
164
+ if ($engine && Mage::getConfig()->getResourceModelClassName($engine)) {
165
+ $model = Mage::getResourceSingleton($engine);
166
+ return $model
167
+ && $model instanceof MDN_Antidot_Model_Resource_Engine_Abstract
168
+ && $model->test();
169
+ }
170
+
171
+ return false;
172
+ }
173
+
174
+ /**
175
+ * Send an email to admin
176
+ *
177
+ * @param string $subject
178
+ * @param string $message
179
+ */
180
+ public function sendMail($subject, $message)
181
+ {
182
+ if(!$email = Mage::getStoreConfig('antidot/general/email')) {
183
+ return;
184
+ }
185
+
186
+ $mail = Mage::getModel('core/email');
187
+ $mail->setToEmail($email);
188
+ $mail->setBody($message);
189
+ $mail->setSubject(Mage::getStoreConfig('system/website/name').': '. $subject);
190
+ $mail->setFromEmail('no-reply@antidot.net');
191
+ $mail->setFromName("AFSStore for Magento");
192
+ $mail->setType('text');
193
+
194
+ try {
195
+ $mail->send();
196
+ Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
197
+ }
198
+ catch (Exception $e) {
199
+ Mage::getSingleton('core/session')->addError('Unable to send.');
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Translate facet name
205
+ *
206
+ * @param $facetcode
207
+ * @param $defaultValue
208
+ * @return mixed
209
+ */
210
+ public function translateFacetName($facetcode, $defaultValue)
211
+ {
212
+ $model = Mage::getModel('Antidot/Search_Search');
213
+
214
+ $label = $defaultValue;
215
+ if (isset($model::$lastSearchTranslations[$facetcode]))
216
+ $label = $model::$lastSearchTranslations[$facetcode];
217
+ return $label;
218
+ }
219
+
220
  }
app/code/community/MDN/Antidot/Helper/LogExport.php CHANGED
@@ -1,70 +1,74 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Helper_LogExport extends Mage_Core_Helper_Abstract
17
- {
18
-
19
- /**
20
- * Add a row to antidot_export
21
- *
22
- * @param string $uid Reference to
23
- * @param string $type FULL|INC
24
- * @param string $element CATALOG|CATEGORY
25
- * @param string $begin
26
- * @param string $end
27
- * @param int $items
28
- */
29
- public function add($reference, $type, $element, $begin, $end, $items, $status, $error = '')
30
- {
31
- $query = "INSERT INTO antidot_export(reference, type, element, begin_at, end_at, items_processed, status, error) "
32
- . "VALUES('".$reference."', '".$type."', '".$element."', '".date('Y-m-d H:i:s', $begin)."', '".date('Y-m-d H:i:s', $end)."', ".(int)$items.", '".$status."', '".$error."')";
33
-
34
- Mage::getSingleton('core/resource')->getConnection('core_write')->query($query);
35
- }
36
-
37
- /**
38
- * Return the last export
39
- *
40
- * @param string $element
41
- * @return array
42
- */
43
- public function getLastGeneration($element)
44
- {
45
- $query = "SELECT begin_at "
46
- . "FROM antidot_export "
47
- . "WHERE element = '".$element."' "
48
- . "ORDER BY begin_at DESC "
49
- . "LIMIT 1";
50
-
51
- return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchOne($query);
52
- }
53
-
54
- /**
55
- * Return the last export
56
- *
57
- * @param int Since x hours
58
- * @return array
59
- */
60
- public function getAllLastGeneration($sinceHour = 24)
61
- {
62
- $since = date('Y-m-d H:i:s', time()-(int)$sinceHour*60*60);
63
- $query = "SELECT reference, type, element, begin_at, items_processed, status "
64
- . "FROM antidot_export "
65
- . "WHERE begin_at > '".$since."' "
66
- . "ORDER BY begin_at DESC";
67
-
68
- return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
69
- }
70
- }
 
 
 
 
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Helper_LogExport extends Mage_Core_Helper_Abstract
17
+ {
18
+
19
+ /**
20
+ * Add a row to antidot_export
21
+ *
22
+ * @param string $uid Reference to
23
+ * @param string $type FULL|INC
24
+ * @param string $element CATALOG|CATEGORY
25
+ * @param string $begin
26
+ * @param string $end
27
+ * @param int $items
28
+ */
29
+ public function add($reference, $type, $element, $begin, $end, $items, $status, $error = '')
30
+ {
31
+ $error = str_replace("'", "", $error);
32
+ if (strlen($error) > 254)
33
+ $error = substr ($error, 0, 254);
34
+
35
+ $query = "INSERT INTO antidot_export(reference, type, element, begin_at, end_at, items_processed, status, error) "
36
+ . "VALUES('".$reference."', '".$type."', '".$element."', '".date('Y-m-d H:i:s', $begin)."', '".date('Y-m-d H:i:s', $end)."', ".(int)$items.", '".$status."', '".$error."')";
37
+
38
+ Mage::getSingleton('core/resource')->getConnection('core_write')->query($query);
39
+ }
40
+
41
+ /**
42
+ * Return the last export
43
+ *
44
+ * @param string $element
45
+ * @return array
46
+ */
47
+ public function getLastGeneration($element)
48
+ {
49
+ $query = "SELECT begin_at "
50
+ . "FROM antidot_export "
51
+ . "WHERE element = '".$element."' "
52
+ . "ORDER BY begin_at DESC "
53
+ . "LIMIT 1";
54
+
55
+ return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchOne($query);
56
+ }
57
+
58
+ /**
59
+ * Return the last export
60
+ *
61
+ * @param int Since x hours
62
+ * @return array
63
+ */
64
+ public function getAllLastGeneration($sinceHour = 24)
65
+ {
66
+ $since = date('Y-m-d H:i:s', time()-(int)$sinceHour*60*60);
67
+ $query = "SELECT reference, type, element, begin_at, items_processed, status, error "
68
+ . "FROM antidot_export "
69
+ . "WHERE begin_at > '".$since."' "
70
+ . "ORDER BY begin_at DESC";
71
+
72
+ return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
73
+ }
74
+ }
app/code/community/MDN/Antidot/Helper/Url.php CHANGED
@@ -1,74 +1,74 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Helper_Url extends Mage_Core_Helper_Abstract
17
- {
18
-
19
- /**
20
- * Urlize
21
- *
22
- * @param string $string
23
- * @return string
24
- */
25
- public function url($string, $separator = '-')
26
- {
27
- $string = self::removeAccent($string);
28
- $string = preg_replace('#([^a-zA-Z0-9])#', $separator, $string);
29
- $string = preg_replace('#\\'.preg_quote($separator).'{2,}#', $separator, $string);
30
- $string = preg_replace('#(^'.preg_quote($separator).')|('.preg_quote($separator).'$)#', '', $string);
31
-
32
- return strtolower($string);
33
- }
34
-
35
- /**
36
- * Check if the string is utf8
37
- *
38
- * @see http://fr2.php.net/manual/fr/function.mb-detect-encoding.php#68607
39
- * @param string $string
40
- * @return bool
41
- */
42
- public function isUtf8($string)
43
- {
44
- return preg_match(
45
- '%(?:
46
- [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
47
- |\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
48
- |[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
49
- |\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
50
- |\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
51
- |[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
52
- |\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
53
- )+%xs',
54
- $string
55
- ) === 1;
56
- }
57
-
58
- /**
59
- * Remove accents from the string
60
- *
61
- * @param string $string
62
- * @return string
63
- */
64
- protected function removeAccent($string)
65
- {
66
- if (!self::isUtf8($string)) {
67
- $string = utf8_encode($string);
68
- }
69
-
70
- $string = htmlentities($string, ENT_NOQUOTES, 'UTF-8');
71
-
72
- return preg_replace('#&([a-zA-Z])[a-zA-Z]+;#', '$1', $string);
73
- }
74
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Helper_Url extends Mage_Core_Helper_Abstract
17
+ {
18
+
19
+ /**
20
+ * Urlize
21
+ *
22
+ * @param string $string
23
+ * @return string
24
+ */
25
+ public function url($string, $separator = '-')
26
+ {
27
+ $string = self::removeAccent($string);
28
+ $string = preg_replace('#([^a-zA-Z0-9])#', $separator, $string);
29
+ $string = preg_replace('#\\'.preg_quote($separator).'{2,}#', $separator, $string);
30
+ $string = preg_replace('#(^'.preg_quote($separator).')|('.preg_quote($separator).'$)#', '', $string);
31
+
32
+ return strtolower($string);
33
+ }
34
+
35
+ /**
36
+ * Check if the string is utf8
37
+ *
38
+ * @see http://fr2.php.net/manual/fr/function.mb-detect-encoding.php#68607
39
+ * @param string $string
40
+ * @return bool
41
+ */
42
+ public function isUtf8($string)
43
+ {
44
+ return preg_match(
45
+ '%(?:
46
+ [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
47
+ |\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
48
+ |[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
49
+ |\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
50
+ |\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
51
+ |[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
52
+ |\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
53
+ )+%xs',
54
+ $string
55
+ ) === 1;
56
+ }
57
+
58
+ /**
59
+ * Remove accents from the string
60
+ *
61
+ * @param string $string
62
+ * @return string
63
+ */
64
+ protected function removeAccent($string)
65
+ {
66
+ if (!self::isUtf8($string)) {
67
+ $string = utf8_encode($string);
68
+ }
69
+
70
+ $string = htmlentities($string, ENT_NOQUOTES, 'UTF-8');
71
+
72
+ return preg_replace('#&([a-zA-Z])[a-zA-Z]+;#', '$1', $string);
73
+ }
74
  }
app/code/community/MDN/Antidot/Model/Catalogsearch/Layer.php CHANGED
@@ -48,14 +48,15 @@ class MDN_Antidot_Model_Catalogsearch_Layer extends Mage_CatalogSearch_Model_Lay
48
  $facets = array();
49
  if($config = Mage::getStoreConfig('antidot/engine/facets')) {
50
  $config = unserialize($config);
 
51
  foreach($config as $facet) {
52
  list($id, $label) = explode('|', $facet['facet']);
53
- $key = $facet['order'].'_'.$id;
54
  $facets[$key] = array('id' => $id, 'label' => $label);
55
  }
56
  }
57
  ksort($facets);
58
-
59
  $attributes = array();
60
  foreach($facets as $facet) {
61
  $attributes[] = new MDN_Antidot_Model_Catalogsearch_Resource_Attribute($facet);
48
  $facets = array();
49
  if($config = Mage::getStoreConfig('antidot/engine/facets')) {
50
  $config = unserialize($config);
51
+
52
  foreach($config as $facet) {
53
  list($id, $label) = explode('|', $facet['facet']);
54
+ $key = sprintf('%02d', $facet['order']).'_'.$id; //sptrinf to ensure order : 10 is after 09
55
  $facets[$key] = array('id' => $id, 'label' => $label);
56
  }
57
  }
58
  ksort($facets);
59
+
60
  $attributes = array();
61
  foreach($facets as $facet) {
62
  $attributes[] = new MDN_Antidot_Model_Catalogsearch_Resource_Attribute($facet);
app/code/community/MDN/Antidot/Model/Catalogsearch/Layer/Filter/Attribute.php CHANGED
@@ -19,4 +19,17 @@ class MDN_Antidot_Model_Catalogsearch_Layer_Filter_Attribute extends MDN_Antidot
19
  {
20
  return $attribute->getIsFilterableInSearch();
21
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
19
  {
20
  return $attribute->getIsFilterableInSearch();
21
  }
22
+
23
+ /**
24
+ * Override getName method to return facet name in the last AFS response
25
+ *
26
+ * @return mixed
27
+ */
28
+ public function getName()
29
+ {
30
+ $name = Mage::helper('Antidot')->translateFacetName($this->getCode(), parent::getName());
31
+
32
+
33
+ return $name;
34
+ }
35
  }
app/code/community/MDN/Antidot/Model/Catalogsearch/Resource/Attribute.php CHANGED
@@ -1,64 +1,64 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Catalogsearch_Resource_Attribute
17
- {
18
-
19
- public function __construct($facet)
20
- {
21
- $this->name = $facet['label'];
22
- $this->id = $facet['id'];
23
- }
24
-
25
- public function getId()
26
- {
27
- return $this->id;
28
- }
29
-
30
- public function getAttributeCode()
31
- {
32
- return $this->id;
33
- }
34
-
35
- public function getName()
36
- {
37
- return $this->name;
38
- }
39
-
40
- public function getStoreLabel()
41
- {
42
- return $this->name;
43
- }
44
-
45
- public function getSourceModel()
46
- {
47
- return 'text';
48
- }
49
-
50
- public function getBackendType()
51
- {
52
- return '';
53
- }
54
-
55
- public function getFrontendInput()
56
- {
57
- return 'text';
58
- }
59
-
60
- public function usesSource()
61
- {
62
- return false;
63
- }
64
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Catalogsearch_Resource_Attribute
17
+ {
18
+
19
+ public function __construct($facet)
20
+ {
21
+ $this->name = $facet['label'];
22
+ $this->id = $facet['id'];
23
+ }
24
+
25
+ public function getId()
26
+ {
27
+ return $this->id;
28
+ }
29
+
30
+ public function getAttributeCode()
31
+ {
32
+ return $this->id;
33
+ }
34
+
35
+ public function getName()
36
+ {
37
+ return $this->name;
38
+ }
39
+
40
+ public function getStoreLabel()
41
+ {
42
+ return $this->name;
43
+ }
44
+
45
+ public function getSourceModel()
46
+ {
47
+ return 'text';
48
+ }
49
+
50
+ public function getBackendType()
51
+ {
52
+ return '';
53
+ }
54
+
55
+ public function getFrontendInput()
56
+ {
57
+ return 'text';
58
+ }
59
+
60
+ public function usesSource()
61
+ {
62
+ return false;
63
+ }
64
+ }
app/code/community/MDN/Antidot/Model/Export/Abstract.php CHANGED
@@ -1,140 +1,140 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Export_Abstract extends Mage_Core_Model_Abstract
17
- {
18
- /**
19
- * Instance of XmlWriter
20
- *
21
- * @var XmlWriter
22
- */
23
- protected $xml;
24
-
25
- /**
26
- * List website loaded
27
- *
28
- * @var array
29
- */
30
- protected $website = array();
31
-
32
- protected $storeLang = array();
33
-
34
- /**
35
- * The fields to load
36
- *
37
- * @var array
38
- */
39
- protected $fields = array();
40
-
41
- protected $fieldsSerialized = array(
42
- 'properties',
43
- 'misc',
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
- }
58
-
59
- /**
60
- * Extract the uri from an url
61
- *
62
- * @param string $url
63
- * @return string
64
- */
65
- protected function getUri($url)
66
- {
67
- $urls = parse_url($url);
68
-
69
-
70
- return $urls['path'];
71
- }
72
-
73
- /**
74
- * Init the fields
75
- *
76
- * @param string $section The section to load
77
- */
78
- protected function initFields($section)
79
- {
80
- $this->fields = array();
81
- $values = Mage::getStoreConfig('antidot/fields_'.$section);
82
- foreach($values as $key => $value) {
83
- if(in_array($key, $this->fieldsSerialized) && $value = @unserialize($value)) {
84
- $values = array_values($value);
85
- foreach($values as $value) {
86
- if($key !== 'properties') {
87
- $this->fields[$key][] = $value['value'];
88
- } else {
89
- $this->fields[$key][] = $value;
90
- }
91
- }
92
- continue;
93
- }
94
- $this->fields[$key] = $value;
95
- }
96
- }
97
-
98
- /**
99
- * Rertrieve a data from an entity
100
- *
101
- * @param Entity $entity
102
- * @param string $field
103
- * @return string
104
- */
105
- protected function getField($entity, $field)
106
- {
107
- $field = isset($this->fields[$field]) && !is_array($this->fields[$field]) ? $this->fields[$field] : $field;
108
- if(empty($field)) {
109
- return false;
110
- }
111
-
112
- $method = 'get'.ucfirst(strtolower($field));
113
-
114
- return $entity->$method();
115
- }
116
-
117
- /**
118
- * Get website by store
119
- *
120
- * @param Store $store
121
- * @return WebSite
122
- */
123
- protected function getWebSiteByStore($store)
124
- {
125
- if(!isset($this->website[$store->getId()])) {
126
- $this->website[$store->getId()] = Mage::getModel('core/website')->load($store->getWebSiteId());
127
- }
128
-
129
- return $this->website[$store->getId()];
130
- }
131
-
132
- protected function getStoreLang($storeId)
133
- {
134
- if(!isset($this->storeLang[$storeId])) {
135
- list($this->storeLang[$storeId]) = explode('_', Mage::getStoreConfig('general/locale/code', $storeId));
136
- }
137
-
138
- return $this->storeLang[$storeId];
139
- }
140
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Export_Abstract extends Mage_Core_Model_Abstract
17
+ {
18
+ /**
19
+ * Instance of XmlWriter
20
+ *
21
+ * @var XmlWriter
22
+ */
23
+ protected $xml;
24
+
25
+ /**
26
+ * List website loaded
27
+ *
28
+ * @var array
29
+ */
30
+ protected $website = array();
31
+
32
+ protected $storeLang = array();
33
+
34
+ /**
35
+ * The fields to load
36
+ *
37
+ * @var array
38
+ */
39
+ protected $fields = array();
40
+
41
+ protected $fieldsSerialized = array(
42
+ 'properties',
43
+ 'misc',
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
+ }
58
+
59
+ /**
60
+ * Extract the uri from an url
61
+ *
62
+ * @param string $url
63
+ * @return string
64
+ */
65
+ protected function getUri($url)
66
+ {
67
+ $urls = parse_url($url);
68
+
69
+
70
+ return $urls['path'];
71
+ }
72
+
73
+ /**
74
+ * Init the fields
75
+ *
76
+ * @param string $section The section to load
77
+ */
78
+ protected function initFields($section)
79
+ {
80
+ $this->fields = array();
81
+ $values = Mage::getStoreConfig('antidot/fields_'.$section);
82
+ foreach($values as $key => $value) {
83
+ if(in_array($key, $this->fieldsSerialized) && $value = @unserialize($value)) {
84
+ $values = array_values($value);
85
+ foreach($values as $value) {
86
+ if($key !== 'properties') {
87
+ $this->fields[$key][] = $value['value'];
88
+ } else {
89
+ $this->fields[$key][] = $value;
90
+ }
91
+ }
92
+ continue;
93
+ }
94
+ $this->fields[$key] = $value;
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Rertrieve a data from an entity
100
+ *
101
+ * @param Entity $entity
102
+ * @param string $field
103
+ * @return string
104
+ */
105
+ protected function getField($entity, $field)
106
+ {
107
+ $field = isset($this->fields[$field]) && !is_array($this->fields[$field]) ? $this->fields[$field] : $field;
108
+ if(empty($field)) {
109
+ return false;
110
+ }
111
+
112
+ $method = 'get'.ucfirst(strtolower($field));
113
+
114
+ return $entity->$method();
115
+ }
116
+
117
+ /**
118
+ * Get website by store
119
+ *
120
+ * @param Store $store
121
+ * @return WebSite
122
+ */
123
+ protected function getWebSiteByStore($store)
124
+ {
125
+ if(!isset($this->website[$store->getId()])) {
126
+ $this->website[$store->getId()] = Mage::getModel('core/website')->load($store->getWebSiteId());
127
+ }
128
+
129
+ return $this->website[$store->getId()];
130
+ }
131
+
132
+ protected function getStoreLang($storeId)
133
+ {
134
+ if(!isset($this->storeLang[$storeId])) {
135
+ list($this->storeLang[$storeId]) = explode('_', Mage::getStoreConfig('general/locale/code', $storeId));
136
+ }
137
+
138
+ return $this->storeLang[$storeId];
139
+ }
140
  }
app/code/community/MDN/Antidot/Model/Export/Article.php CHANGED
@@ -1,132 +1,132 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Export_Article extends MDN_Antidot_Model_Export_Product
17
- {
18
-
19
- const TYPE = 'ARTICLE';
20
- const FILENAME_XML = 'articles-mdn-fr.xml';
21
- const FILENAME_ZIP = '%s_full_mdn_articles.zip';
22
- const XSD = 'http://ref.antidot.net/store/latest/articles.xsd';
23
-
24
- const imagePrefix = 'media/catalog/article';
25
-
26
- const ARTICLE_LIMIT = 1000;
27
-
28
- /**
29
- * Write the xml file
30
- *
31
- * @param array $context
32
- * @param string $filename
33
- */
34
- public function writeXml($context, $filename)
35
- {
36
- $this->initXml();
37
- $this->initFields('article');
38
- $this->setFilename($filename);
39
-
40
-
41
-
42
- $this->xml->push('articles', array('xmlns' => "http://ref.antidot.net/store/afs#"));
43
- $this->writeHeader($context);
44
- $this->writePart($this->xml->flush());
45
-
46
- foreach($context['store_id'] as $storeId) {
47
- $store = Mage::getModel('core/store')->load($storeId);
48
- $page = 1;
49
- while($articles = $this->getProducts($store, $page, self::ARTICLE_LIMIT)) {
50
- foreach($articles as $article) {
51
- $this->xml->push('article', array('id' => $article->getId(), 'xml:lang' => $context['lang']));
52
-
53
- $this->xml->push('websites');
54
- $this->xml->element('website', $store->getWebsite()->getName(), array('id' => $store->getWebsite()->getId()));
55
- $this->xml->pop();
56
-
57
- $this->xml->element('created_at', $article->getCreated_at());
58
- $this->xml->element('last_updated_at', $article->getUpdated_at());
59
- //$this->xml->element('published_at', $article->getPublished_at());
60
-
61
- $this->xml->element('title', $this->xml->encloseCData($this->getField($article, 'title')));
62
- $this->xml->element('subtitle', $this->xml->encloseCData($this->getField($article, 'subtitle')));
63
- $this->xml->element('type', $this->xml->encloseCData($this->getField($article, 'type')));
64
- $this->xml->element('text', $this->xml->encloseCData($this->getField($article, 'text')));
65
-
66
- $this->writeDescriptions($article);
67
- $this->writeIdentifiers($article);
68
- $this->writeClassification($article);
69
- //$this->writeBrands($article);
70
-
71
- $this->writeUrl($article, false);
72
- $this->writeMisc($article);
73
-
74
- $this->xml->pop();
75
- }
76
- $page++;
77
-
78
- $this->writePart($this->xml->flush());
79
- }
80
- }
81
- $this->xml->pop();
82
-
83
- $this->writePart($this->xml->flush(), true);
84
- }
85
-
86
- /**
87
- * Write the xml header
88
- *
89
- * @param array $context
90
- */
91
- protected function writeHeader($context)
92
- {
93
- $this->xml->push('header');
94
- $this->xml->element('owner', $context['owner']);
95
- $this->xml->element('feed', 'article');
96
- $this->xml->element('generated_at', date('c', Mage::getModel('core/date')->timestamp(time())));
97
- $this->xml->pop();
98
- }
99
-
100
- /**
101
- * Write the article identifiers
102
- *
103
- * @param Product $article
104
- */
105
- protected function writeBrands($article)
106
- {
107
- if ($manufacturer = $this->getField($article, 'manufacturer')) {
108
- $this->xml->push('brands');
109
- $brandUrl = Mage::getModel('Antidot/Export_Brand')->getUrl($article->getAttributeText('manufacturer'));
110
- $this->xml->element('brand', $this->xml->encloseCData($article->getAttributeText('manufacturer')), array('id' => $manufacturer, 'url' => $brandUrl));
111
- $this->xml->pop();
112
- }
113
- }
114
-
115
- /**
116
- * Get articles to generate
117
- *
118
- * @param int $store
119
- * @param int $page
120
- * @param int $limit
121
- * @return array
122
- */
123
- protected function getArticles($store, $page, $limit)
124
- {
125
- return Mage::getModel('cms/page')
126
- ->getCollection()
127
- ->addStoreFilter($store->getId())
128
- ->addAttributeToSelect('*')
129
- ->setPage($page, $limit)
130
- ;
131
- }
132
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Export_Article extends MDN_Antidot_Model_Export_Product
17
+ {
18
+
19
+ const TYPE = 'ARTICLE';
20
+ const FILENAME_XML = 'articles-mdn-fr.xml';
21
+ const FILENAME_ZIP = '%s_full_mdn_articles.zip';
22
+ const XSD = 'http://ref.antidot.net/store/latest/articles.xsd';
23
+
24
+ const imagePrefix = 'media/catalog/article';
25
+
26
+ const ARTICLE_LIMIT = 1000;
27
+
28
+ /**
29
+ * Write the xml file
30
+ *
31
+ * @param array $context
32
+ * @param string $filename
33
+ */
34
+ public function writeXml($context, $filename)
35
+ {
36
+ $this->initXml();
37
+ $this->initFields('article');
38
+ $this->setFilename($filename);
39
+
40
+
41
+
42
+ $this->xml->push('articles', array('xmlns' => "http://ref.antidot.net/store/afs#"));
43
+ $this->writeHeader($context);
44
+ $this->writePart($this->xml->flush());
45
+
46
+ foreach($context['store_id'] as $storeId) {
47
+ $store = Mage::getModel('core/store')->load($storeId);
48
+ $page = 1;
49
+ while($articles = $this->getProducts($store, $page, self::ARTICLE_LIMIT)) {
50
+ foreach($articles as $article) {
51
+ $this->xml->push('article', array('id' => $article->getId(), 'xml:lang' => $context['lang']));
52
+
53
+ $this->xml->push('websites');
54
+ $this->xml->element('website', $store->getWebsite()->getName(), array('id' => $store->getWebsite()->getId()));
55
+ $this->xml->pop();
56
+
57
+ $this->xml->element('created_at', $article->getCreated_at());
58
+ $this->xml->element('last_updated_at', $article->getUpdated_at());
59
+ //$this->xml->element('published_at', $article->getPublished_at());
60
+
61
+ $this->xml->element('title', $this->xml->encloseCData($this->getField($article, 'title')));
62
+ $this->xml->element('subtitle', $this->xml->encloseCData($this->getField($article, 'subtitle')));
63
+ $this->xml->element('type', $this->xml->encloseCData($this->getField($article, 'type')));
64
+ $this->xml->element('text', $this->xml->encloseCData($this->getField($article, 'text')));
65
+
66
+ $this->writeDescriptions($article);
67
+ $this->writeIdentifiers($article);
68
+ $this->writeClassification($article);
69
+ //$this->writeBrands($article);
70
+
71
+ $this->writeUrl($article, false);
72
+ $this->writeMisc($article);
73
+
74
+ $this->xml->pop();
75
+ }
76
+ $page++;
77
+
78
+ $this->writePart($this->xml->flush());
79
+ }
80
+ }
81
+ $this->xml->pop();
82
+
83
+ $this->writePart($this->xml->flush(), true);
84
+ }
85
+
86
+ /**
87
+ * Write the xml header
88
+ *
89
+ * @param array $context
90
+ */
91
+ protected function writeHeader($context)
92
+ {
93
+ $this->xml->push('header');
94
+ $this->xml->element('owner', $context['owner']);
95
+ $this->xml->element('feed', 'article');
96
+ $this->xml->element('generated_at', date('c', Mage::getModel('core/date')->timestamp(time())));
97
+ $this->xml->pop();
98
+ }
99
+
100
+ /**
101
+ * Write the article identifiers
102
+ *
103
+ * @param Product $article
104
+ */
105
+ protected function writeBrands($article)
106
+ {
107
+ if ($manufacturer = $this->getField($article, 'manufacturer')) {
108
+ $this->xml->push('brands');
109
+ $brandUrl = Mage::getModel('Antidot/Export_Brand')->getUrl($article->getAttributeText('manufacturer'));
110
+ $this->xml->element('brand', $this->xml->encloseCData($article->getAttributeText('manufacturer')), array('id' => $manufacturer, 'url' => $brandUrl));
111
+ $this->xml->pop();
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Get articles to generate
117
+ *
118
+ * @param int $store
119
+ * @param int $page
120
+ * @param int $limit
121
+ * @return array
122
+ */
123
+ protected function getArticles($store, $page, $limit)
124
+ {
125
+ return Mage::getModel('cms/page')
126
+ ->getCollection()
127
+ ->addStoreFilter($store->getId())
128
+ ->addAttributeToSelect('*')
129
+ ->setPage($page, $limit)
130
+ ;
131
+ }
132
+ }
app/code/community/MDN/Antidot/Model/Export/Brand.php CHANGED
@@ -1,130 +1,130 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Export_Brand extends MDN_Antidot_Model_Export_Abstract
17
- {
18
- const TYPE = 'BRAND';
19
- const FILENAME_XML = 'brands-mdn-fr.xml';
20
- const FILENAME_ZIP = '%s_full_mdn_brands.zip';
21
- const XSD = 'http://ref.antidot.net/store/latest/brands.xsd';
22
-
23
- const PATTERN_URL = '/brands/{brand}';
24
-
25
- protected $urlHelper;
26
-
27
- /**
28
- * Get xml
29
- *
30
- * @param type $context
31
- */
32
- public function getXml($context)
33
- {
34
- $this->initXml();
35
- $this->initFields('brand');
36
-
37
- $brandPattern = $this->getBrandPattern();
38
-
39
- $this->xml->push('brands', array('xmlns' => "http://ref.antidot.net/store/afs#"));
40
-
41
- $this->xml->push('header');
42
- $this->xml->element('owner', $context['owner']);
43
- $this->xml->element('feed', 'brand');
44
- $this->xml->element('generated_at', date('c', Mage::getModel('core/date')->timestamp(time())));
45
- $this->xml->pop();
46
-
47
- foreach($context['store_id']as $storeId) {
48
- $store = Mage::getModel('core/store')->load($storeId);
49
- foreach($this->getBrands() as $brandId => $brand) {
50
- $this->xml->push('brand', array('id' => $brandId, 'xml:lang' => $context['lang']));
51
-
52
- $this->xml->element('name', $this->xml->encloseCData($brand));
53
- $this->xml->element('url', $this->getUrl($brand, $brandPattern));
54
-
55
- $this->xml->push('websites');
56
- $this->xml->element('website', '', array('id' => $storeId, 'name' => $store->getName()));
57
- $this->xml->pop();
58
-
59
- $this->xml->pop();
60
- }
61
- }
62
-
63
- $this->xml->pop();
64
-
65
- return $this->xml->getXml();
66
- }
67
-
68
- /**
69
- * Return categories
70
- *
71
- * @param int $rootCategoryId
72
- * @param array
73
- */
74
- protected function getBrands()
75
- {
76
- $attribute = Mage::getModel('eav/config')
77
- ->getAttribute('catalog_product', 'manufacturer');
78
-
79
- $brands = array();
80
- foreach($attribute->getSource()->getAllOptions(true, true) as $option) {
81
- if(!empty($option['value'])) {
82
- $brands[$option['value']] = $option['label'];
83
- }
84
- }
85
-
86
- return $brands;
87
- }
88
-
89
- /**
90
- * Return brand url
91
- *
92
- * @param string $brand
93
- * @return string
94
- */
95
- public function getUrl($brand, $brandPattern = null)
96
- {
97
- $brandPattern = $brandPattern === null ? $this->getBrandPattern() : $brandPattern;
98
-
99
- return preg_replace('/\{brand\}/', $this->getUrlHelper()->url($brand), $brandPattern);
100
- }
101
-
102
- /**
103
- * Get the brand pattern
104
- *
105
- * @return string
106
- */
107
- protected function getBrandPattern()
108
- {
109
- $brandPattern = Mage::getStoreConfig('antidot/general/brand');
110
- if(strpos($brandPattern, '{brand}') === false) {
111
- $brandPattern = self::PATTERN_URL;
112
- }
113
-
114
- return $brandPattern;
115
- }
116
-
117
- /**
118
- * Return url Helper
119
- *
120
- * @return Antidot/Url
121
- */
122
- protected function getUrlHelper()
123
- {
124
- if($this->urlHelper === null) {
125
- $this->urlHelper = Mage::helper('Antidot/Url');
126
- }
127
-
128
- return $this->urlHelper;
129
- }
130
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Export_Brand extends MDN_Antidot_Model_Export_Abstract
17
+ {
18
+ const TYPE = 'BRAND';
19
+ const FILENAME_XML = 'brands-mdn-fr.xml';
20
+ const FILENAME_ZIP = '%s_full_mdn_brands.zip';
21
+ const XSD = 'http://ref.antidot.net/store/latest/brands.xsd';
22
+
23
+ const PATTERN_URL = '/brands/{brand}';
24
+
25
+ protected $urlHelper;
26
+
27
+ /**
28
+ * Get xml
29
+ *
30
+ * @param type $context
31
+ */
32
+ public function getXml($context)
33
+ {
34
+ $this->initXml();
35
+ $this->initFields('brand');
36
+
37
+ $brandPattern = $this->getBrandPattern();
38
+
39
+ $this->xml->push('brands', array('xmlns' => "http://ref.antidot.net/store/afs#"));
40
+
41
+ $this->xml->push('header');
42
+ $this->xml->element('owner', $context['owner']);
43
+ $this->xml->element('feed', 'brand');
44
+ $this->xml->element('generated_at', date('c', Mage::getModel('core/date')->timestamp(time())));
45
+ $this->xml->pop();
46
+
47
+ foreach($context['store_id']as $storeId) {
48
+ $store = Mage::getModel('core/store')->load($storeId);
49
+ foreach($this->getBrands() as $brandId => $brand) {
50
+ $this->xml->push('brand', array('id' => $brandId, 'xml:lang' => $context['lang']));
51
+
52
+ $this->xml->element('name', $this->xml->encloseCData($brand));
53
+ $this->xml->element('url', $this->getUrl($brand, $brandPattern));
54
+
55
+ $this->xml->push('websites');
56
+ $this->xml->element('website', '', array('id' => $storeId, 'name' => $store->getName()));
57
+ $this->xml->pop();
58
+
59
+ $this->xml->pop();
60
+ }
61
+ }
62
+
63
+ $this->xml->pop();
64
+
65
+ return $this->xml->getXml();
66
+ }
67
+
68
+ /**
69
+ * Return categories
70
+ *
71
+ * @param int $rootCategoryId
72
+ * @param array
73
+ */
74
+ protected function getBrands()
75
+ {
76
+ $attribute = Mage::getModel('eav/config')
77
+ ->getAttribute('catalog_product', 'manufacturer');
78
+
79
+ $brands = array();
80
+ foreach($attribute->getSource()->getAllOptions(true, true) as $option) {
81
+ if(!empty($option['value'])) {
82
+ $brands[$option['value']] = $option['label'];
83
+ }
84
+ }
85
+
86
+ return $brands;
87
+ }
88
+
89
+ /**
90
+ * Return brand url
91
+ *
92
+ * @param string $brand
93
+ * @return string
94
+ */
95
+ public function getUrl($brand, $brandPattern = null)
96
+ {
97
+ $brandPattern = $brandPattern === null ? $this->getBrandPattern() : $brandPattern;
98
+
99
+ return preg_replace('/\{brand\}/', $this->getUrlHelper()->url($brand), $brandPattern);
100
+ }
101
+
102
+ /**
103
+ * Get the brand pattern
104
+ *
105
+ * @return string
106
+ */
107
+ protected function getBrandPattern()
108
+ {
109
+ $brandPattern = Mage::getStoreConfig('antidot/general/brand');
110
+ if(strpos($brandPattern, '{brand}') === false) {
111
+ $brandPattern = self::PATTERN_URL;
112
+ }
113
+
114
+ return $brandPattern;
115
+ }
116
+
117
+ /**
118
+ * Return url Helper
119
+ *
120
+ * @return Antidot/Url
121
+ */
122
+ protected function getUrlHelper()
123
+ {
124
+ if($this->urlHelper === null) {
125
+ $this->urlHelper = Mage::helper('Antidot/Url');
126
+ }
127
+
128
+ return $this->urlHelper;
129
+ }
130
  }
app/code/community/MDN/Antidot/Model/Export/Category.php CHANGED
@@ -1,106 +1,106 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Export_Category extends MDN_Antidot_Model_Export_Abstract
17
- {
18
- const TYPE = 'CATEGORY';
19
- const FILENAME_XML = 'categories-mdn-%s.xml';
20
- const FILENAME_ZIP = '%s_full_mdn_categories.zip';
21
- const XSD = 'http://ref.antidot.net/store/latest/categories.xsd';
22
-
23
- /**
24
- * Get xml
25
- *
26
- * @param type $context
27
- */
28
- public function writeXml($context, $filename)
29
- {
30
- $this->initXml();
31
- $this->initFields('category');
32
-
33
- $this->xml->push('categories', array('xmlns' => "http://ref.antidot.net/store/afs#"));
34
-
35
- $this->xml->push('header');
36
- $this->xml->element('owner', $context['owner']);
37
- $this->xml->element('feed', 'category');
38
- $this->xml->element('generated_at', date('c', Mage::getModel('core/date')->timestamp(time())));
39
- $this->xml->pop();
40
-
41
- $nbItems = 0;
42
- foreach($context['stores'] as $store) {
43
- foreach($this->getCategories($store) as $cat) {
44
- $this->xml->push('category', array('id' => $cat->getId(), 'xml:lang' => $context['lang']));
45
-
46
- $this->xml->element('name', $this->xml->encloseCData($this->getField($cat, 'name')));
47
- $this->xml->element('url', $this->getUri($cat->getUrl()));
48
-
49
- if ($cat->getImageUrl()) {
50
- $this->xml->element('image', $cat->getImageUrl());
51
- }
52
-
53
- if ($keywords = $this->getField($cat, 'keywords')) {
54
- $this->xml->element('keywords', $this->xml->encloseCData($keywords));
55
- }
56
-
57
- if ($description = $this->getField($cat, 'description')) {
58
- $this->xml->element('description', $this->xml->encloseCData($description));
59
- }
60
-
61
- if ($cat->getProductCount() > 0) {
62
- $this->xml->element('productsCount', $cat->getProductCount());
63
- }
64
-
65
- if ($cat->getParentId() && ($cat->getParentId() != $store->getRootCategoryId())) {
66
- $this->xml->emptyelement('broader', array('idref' => $cat->getParentId()));
67
- }
68
-
69
- $storeIds = array_intersect($context['store_id'], $cat->getStoreIds());
70
- $this->xml->push('websites');
71
- foreach($storeIds as $storeId) {
72
- $website = $this->getWebSiteByStore($context['stores'][$storeId]);
73
- $this->xml->element('website', '', array('id' => $website->getId(), 'name' => $website->getName()));
74
- }
75
- $this->xml->pop();
76
-
77
- $this->xml->pop();
78
-
79
- $nbItems++;
80
- }
81
- }
82
- $this->xml->pop();
83
-
84
- file_put_contents($filename, $this->xml->flush());
85
-
86
- return $nbItems;
87
- }
88
-
89
- /**
90
- * Return categories
91
- *
92
- * @param Store $store
93
- * @return array
94
- */
95
- protected function getCategories($store)
96
- {
97
- return Mage::getModel('catalog/category')
98
- ->getCollection()
99
- ->setStoreId($store->getId())
100
- ->addAttributeToSelect('url_key')
101
- ->addAttributeToSelect('name')
102
- ->addAttributeToFilter('is_active', 1)
103
- ->addFieldToFilter('path', array('like' => Mage::getModel('catalog/category')->load($store->getRootCategoryId())->getPath().'/%'))
104
- ;
105
- }
106
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Export_Category extends MDN_Antidot_Model_Export_Abstract
17
+ {
18
+ const TYPE = 'CATEGORY';
19
+ const FILENAME_XML = 'categories-mdn-%s.xml';
20
+ const FILENAME_ZIP = '%s_full_mdn_categories.zip';
21
+ const XSD = 'http://ref.antidot.net/store/latest/categories.xsd';
22
+
23
+ /**
24
+ * Get xml
25
+ *
26
+ * @param type $context
27
+ */
28
+ public function writeXml($context, $filename)
29
+ {
30
+ $this->initXml();
31
+ $this->initFields('category');
32
+
33
+ $this->xml->push('categories', array('xmlns' => "http://ref.antidot.net/store/afs#"));
34
+
35
+ $this->xml->push('header');
36
+ $this->xml->element('owner', $context['owner']);
37
+ $this->xml->element('feed', 'category');
38
+ $this->xml->element('generated_at', date('c', Mage::getModel('core/date')->timestamp(time())));
39
+ $this->xml->pop();
40
+
41
+ $nbItems = 0;
42
+ foreach($context['stores'] as $store) {
43
+ foreach($this->getCategories($store) as $cat) {
44
+ $this->xml->push('category', array('id' => $cat->getId(), 'xml:lang' => $context['lang']));
45
+
46
+ $this->xml->element('name', $this->xml->encloseCData($this->getField($cat, 'name')));
47
+ $this->xml->element('url', $this->getUri($cat->getUrl()));
48
+
49
+ if ($cat->getImageUrl()) {
50
+ $this->xml->element('image', $cat->getImageUrl());
51
+ }
52
+
53
+ if ($keywords = $this->getField($cat, 'keywords')) {
54
+ $this->xml->element('keywords', $this->xml->encloseCData($keywords));
55
+ }
56
+
57
+ if ($description = $this->getField($cat, 'description')) {
58
+ $this->xml->element('description', $this->xml->encloseCData($description));
59
+ }
60
+
61
+ if ($cat->getProductCount() > 0) {
62
+ $this->xml->element('productsCount', $cat->getProductCount());
63
+ }
64
+
65
+ if ($cat->getParentId() && ($cat->getParentId() != $store->getRootCategoryId())) {
66
+ $this->xml->emptyelement('broader', array('idref' => $cat->getParentId()));
67
+ }
68
+
69
+ $storeIds = array_intersect($context['store_id'], $cat->getStoreIds());
70
+ $this->xml->push('websites');
71
+ foreach($storeIds as $storeId) {
72
+ $website = $this->getWebSiteByStore($context['stores'][$storeId]);
73
+ $this->xml->element('website', '', array('id' => $website->getId(), 'name' => $website->getName()));
74
+ }
75
+ $this->xml->pop();
76
+
77
+ $this->xml->pop();
78
+
79
+ $nbItems++;
80
+ }
81
+ }
82
+ $this->xml->pop();
83
+
84
+ file_put_contents($filename, $this->xml->flush());
85
+
86
+ return $nbItems;
87
+ }
88
+
89
+ /**
90
+ * Return categories
91
+ *
92
+ * @param Store $store
93
+ * @return array
94
+ */
95
+ protected function getCategories($store)
96
+ {
97
+ return Mage::getModel('catalog/category')
98
+ ->getCollection()
99
+ ->setStoreId($store->getId())
100
+ ->addAttributeToSelect('url_key')
101
+ ->addAttributeToSelect('name')
102
+ ->addAttributeToFilter('is_active', 1)
103
+ ->addFieldToFilter('path', array('like' => Mage::getModel('catalog/category')->load($store->getRootCategoryId())->getPath().'/%'))
104
+ ;
105
+ }
106
  }
app/code/community/MDN/Antidot/Model/Export/Log.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MDN_Antidot_Model_Export_Log extends Mage_Core_Model_Abstract {
4
+
5
+ public function _construct(){
6
+ $this->_init('Antidot/ExportLog');
7
+ }
8
+
9
+
10
+ /**
11
+ * Return alst generation date for element
12
+ * @param type $element
13
+ * @return type
14
+ */
15
+ public function getLastGenerationDate($element)
16
+ {
17
+ $item = $this->getCollection()->addFieldToFilter('element', $element)->setOrder('begin_at', 'desc')->getFirstItem();
18
+ return $item->getbegin_at();
19
+ }
20
+
21
+ /**
22
+ * return last logs for the last X hours
23
+ * @param type $sinceHour
24
+ * @return type
25
+ */
26
+ public function getAllLastGeneration($sinceHour = 24)
27
+ {
28
+ $since = date('Y-m-d H:i:s', + $sinceHour * 3600);
29
+ $collection = $this->getCollection()->addFieldToFilter('begin_at', array('gt' => $since));
30
+ return $collection;
31
+ }
32
+
33
+ }
app/code/community/MDN/Antidot/Model/Export/Product.php CHANGED
@@ -1,818 +1,881 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
17
- {
18
-
19
- const TYPE = 'CATALOG';
20
- const FILENAME_XML = 'catalog-mdn-%s.xml';
21
- const FILENAME_ZIP = '%s_full_mdn_catalog.zip';
22
- const FILENAME_ZIP_INC = '%s_inc_mdn_catalog.zip';
23
- const XSD = 'http://ref.antidot.net/store/latest/catalog.xsd';
24
-
25
- const PRODUCT_LIMIT = 1000;
26
-
27
- protected $file;
28
-
29
- protected $productGenerated = array();
30
-
31
- protected $categories = array();
32
-
33
- protected $onlyProductsWithStock;
34
-
35
- protected $autoCompleteProducts;
36
-
37
- protected $propertyLabel = array();
38
-
39
- protected $productVisible = array(
40
- Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH,
41
- Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
42
- );
43
-
44
- protected $productMultiple = array(
45
- Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
46
- Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
47
- );
48
-
49
- /**
50
- * Write the xml file
51
- *
52
- * @param array $context
53
- * @param string $filename
54
- * @param string $type Incremantal or full
55
- * @return int nb items generated
56
- */
57
- public function writeXml($context, $filename, $type)
58
- {
59
- $db = Mage::getSingleton('core/resource')->getConnection('core_read');
60
- $db->getProfiler()->setEnabled(false);
61
-
62
- $this->onlyProductsWithStock = !(boolean)Mage::getStoreConfig('antidot/fields_product/in_stock_only');
63
- $this->autoCompleteProducts = Mage::getStoreConfig('antidot/suggest/enable') === 'Antidot/engine_antidot' ? 'on' : 'off';
64
-
65
- $this->initXml();
66
- $this->initPropertyLabel();
67
- $this->initFields('product');
68
- $this->setFilename($filename);
69
-
70
- $this->xml->push('catalog', array('xmlns' => "http://ref.antidot.net/store/afs#"));
71
- $this->writeHeader($context);
72
- $this->writePart($this->xml->flush());
73
-
74
- $this->lang = $context['lang'];
75
- $productIds = $this->getProductIds($context['store_id'], $type);
76
- foreach(array_chunk($productIds, 500) as $productId) {
77
- $collection = Mage::getModel('catalog/product')
78
- ->getCollection()
79
- ->addAttributeToSelect('*')
80
- ->addAttributeToFilter('entity_id', array('in', $productId))
81
- ->joinField('qty',
82
- 'cataloginventory/stock_item',
83
- 'qty',
84
- 'product_id = entity_id')
85
- ;
86
-
87
- foreach($collection as $product) {
88
- if($context['langs'] > 1) {
89
- $store = current($this->getProductStores($product, $context));
90
- $product = Mage::getModel('catalog/product')->setStoreId($store->getId())->load($product->getId());
91
- }
92
- $this->writeProduct($product, $context);
93
- }
94
- $this->writePart($this->xml->flush());
95
- }
96
- $this->xml->pop();
97
-
98
- $this->writePart($this->xml->flush(), true);
99
-
100
- return count($productIds);
101
- }
102
-
103
- /**
104
- * Init properties label
105
- */
106
- protected function initPropertyLabel()
107
- {
108
- $attributes = Mage::getResourceModel('catalog/product_attribute_collection');
109
- foreach($attributes as $att) {
110
- $k = $att->getAttributeCode();
111
- $this->propertyLabel[$k] = array();
112
- $this->propertyLabel[$k]['default'] = $att->getfrontend_label();
113
- $this->propertyLabel[$k]['per_store'] = $att->getStoreLabels();
114
-
115
- $this->propertyLabel[$k]['options'] = array();
116
- $options = $att->getSource()->getAllOptions(true);
117
- foreach($options as $option) {
118
- if (empty($option['value']) || is_array($option['value'])) {
119
- continue;
120
- }
121
-
122
- $this->propertyLabel[$k]['options'][$option['value']] = array();
123
- $this->propertyLabel[$k]['options'][$option['value']]['per_store'] = array();
124
- $query = 'SELECT store_id, value FROM '
125
- . Mage::getConfig()->getTablePrefix().'eav_attribute_option_value '
126
- . 'WHERE option_id = "'.$option['value'].'"';
127
-
128
- $valuesCollection = mage::getResourceModel('sales/order_item_collection')->getConnection()->fetchAll($query);
129
- foreach($valuesCollection as $item) {
130
- $this->propertyLabel[$k]['options'][$option['value']]['per_store'][$item['store_id']] = $item['value'];
131
- }
132
- }
133
- }
134
- }
135
-
136
- /**
137
- * Write the xml header
138
- *
139
- * @param array $context
140
- */
141
- protected function writeHeader($context)
142
- {
143
- $this->xml->push('header');
144
- $this->xml->element('owner', $context['owner']);
145
- $this->xml->element('feed', 'product');
146
- $this->xml->element('generated_at', date('c', Mage::getModel('core/date')->timestamp(time())));
147
- $this->xml->pop();
148
- }
149
-
150
- /**
151
- * Write the product
152
- *
153
- * @param Product $product
154
- * @param Array $context
155
- */
156
- protected function writeProduct($product, $context)
157
- {
158
- $stores = $this->getProductStores($product, $context);
159
-
160
- $this->xml->push('product', array('id' => $product->getId(), 'xml:lang' => $this->lang, 'autocomplete' => $this->autoCompleteProducts));
161
-
162
- $this->xml->push('websites');
163
- foreach($stores as $store) {
164
- $website = $this->getWebSiteByStore($store);
165
- $this->xml->element('website', $website->getName(), array('id' => $website->getId()));
166
- }
167
- $this->xml->pop();
168
-
169
- $this->xml->element('created_at', $product->getCreated_at());
170
- $this->xml->element('last_updated_at', $product->getUpdated_at());
171
-
172
- $this->xml->element('name', $this->xml->encloseCData($this->getField($product, 'name')));
173
- if($shortName = $this->getField($product, 'short_name')) {
174
- $this->xml->element('short_name', $this->xml->encloseCData(mb_substr($shortName, 0, 45, 'UTF-8')), array('autocomplete' => 'off'));
175
- }
176
-
177
- if ($keywords = $this->getField($product, 'keywords')) {
178
- $this->xml->element('keywords', $this->xml->encloseCData($keywords));
179
- }
180
- $this->writeDescriptions($product);
181
- $this->xml->element('url', $this->xml->encloseCData($product->getProductUrl()));
182
- $this->writeImageUrl($product);
183
- $this->writeClassification($product);
184
- $this->writeProperties($product, $stores);
185
- $this->writeBrand($product);
186
- $this->writeMaterials($product);
187
- $this->writeColors($product);
188
- $this->writeModels($product);
189
- $this->writeSizes($product);
190
- $this->writeGenders($product);
191
- $this->writeMisc($product);
192
-
193
- $this->writeVariants($product, $stores);
194
-
195
- $this->xml->pop();
196
- }
197
-
198
- /**
199
- * Write the store's informations
200
- *
201
- * @param Product $product
202
- * @param array $stores
203
- */
204
- protected function writeStore($product, $stores, $variantProduct)
205
- {
206
- $this->xml->push('stores');
207
- foreach($stores as $store) {
208
- Mage::app()->setCurrentStore($store->getId());
209
-
210
- $this->xml->push('store', array('id' => $store->getId(), 'name' => $store->getName()));
211
- $storeContext['currency'] = $store->getCurrentCurrencyCode();
212
- $storeContext['country'] = $this->getStoreLang($store->getId());
213
-
214
- $operations = $this->getOperations($product, $store);
215
- $this->writePrices($variantProduct, $storeContext, $store, $operations);
216
- $this->writeMarketing($variantProduct, $operations);
217
-
218
- $isAvailable = $variantProduct->isSalable() || (in_array($variantProduct->getTypeId(), $this->productMultiple) && $product->isInStock());
219
- $this->xml->element('is_available', (int)$isAvailable);
220
-
221
- $qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($variantProduct)->getQty();
222
- $this->xml->element('stock', (int)$qty);
223
-
224
- $this->xml->element('url', $this->xml->encloseCData($variantProduct->getProductUrl()));
225
- $this->xml->pop();
226
- }
227
- $this->xml->pop();
228
- }
229
-
230
- /**
231
- * Get catalog/product model
232
- *
233
- * @return Model
234
- */
235
- protected function getCatalogProduct()
236
- {
237
- if(!$this->catalogProduct) {
238
- $this->catalogProduct = Mage::getModel('catalog/product');
239
- }
240
-
241
- return $this->catalogProduct;
242
- }
243
-
244
- /**
245
- * Get product stores
246
- *
247
- * @param Product $product
248
- * @param array $context
249
- */
250
- protected function getProductStores($product, $context)
251
- {
252
- $stores = array();
253
-
254
- $storeIds = array_intersect($product->getStoreIds(), $context['store_id']);
255
- foreach($storeIds as $storeId) {
256
- $stores[] = $context['stores'][$storeId];
257
- }
258
-
259
- return $stores;
260
- }
261
-
262
- /**
263
- * Write the product descriptions
264
- *
265
- * @param Product $product
266
- */
267
- protected function writeDescriptions($product)
268
- {
269
- if(!empty($this->fields['description'])) {
270
- $this->xml->push('descriptions');
271
- foreach($this->fields['description'] as $description) {
272
- if ($value = $this->getField($product, $description)) {
273
- $this->xml->element('description', $this->xml->encloseCData(substr($value, 0, 20000)), array('type' => $description));
274
- }
275
- }
276
- $this->xml->pop();
277
- }
278
- }
279
-
280
- /**
281
- * Write the product identifiers
282
- *
283
- * @param Product $product
284
- */
285
- protected function writeIdentifiers($product)
286
- {
287
- if($gtin = $this->getField($product, 'gtin')) {
288
- if(!preg_match('/^[0-9]{12,14}$/', $gtin)) {
289
- $gtin = false;
290
- }
291
- }
292
-
293
- $identifiers = array();
294
- if(!empty($this->fields['identifier'])) {
295
- foreach($this->fields['identifier'] as $identifier) {
296
- if ($value = $this->getField($product, $identifier)) {
297
- $identifiers[$identifier] = mb_substr($value, 0, 40, 'UTF-8');
298
- }
299
- }
300
- }
301
-
302
- if($gtin ||!empty($identifiers)) {
303
- $this->xml->push('identifiers');
304
- if($gtin) {
305
- $this->xml->element('gtin', $gtin);
306
- }
307
-
308
- if(!empty($identifiers)) {
309
- foreach($identifiers as $identifier => $value) {
310
- $this->xml->element('identifier', $value, array('type' => $identifier));
311
- }
312
- }
313
-
314
- $this->xml->pop();
315
- }
316
- }
317
-
318
- /**
319
- * Write the product identifiers
320
- *
321
- * @param Product $product
322
- */
323
- protected function writeBrand($product)
324
- {
325
- if ($manufacturer = $this->getField($product, 'manufacturer')) {
326
- if(!empty($manufacturer)) {
327
- $field = empty($this->fields['manufacturer']) ? 'manufacturer' : $this->fields['manufacturer'];
328
- $brand = mb_substr($product->getAttributeText($field), 0, 40, 'UTF-8');
329
- $brandUrl = Mage::helper('catalogsearch')->getResultUrl($brand);
330
- $brandUrl = parse_url($brandUrl, PHP_URL_PATH).'?'.parse_url($brandUrl, PHP_URL_QUERY);
331
- if(!empty($brand)) {
332
- $this->xml->element('brand', $this->xml->encloseCData($brand), array('id' => $manufacturer, 'url' => $brandUrl));
333
- }
334
- }
335
- }
336
- }
337
-
338
- /**
339
- * Write the product urls
340
- *
341
- * @param Product $product
342
- * @param string $urlImg
343
- */
344
- protected function writeImageUrl($product, $urlImg = true)
345
- {
346
- try {
347
- if ($product->getThumbnail()) {
348
- $this->xml->element('url_thumbnail', $this->xml->encloseCData(Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getThumbnail())));
349
- }
350
- } catch(Exception $e) {}
351
-
352
- try {
353
- if ($urlImg && $product->getImage()) {
354
- $this->xml->element('url_image', $this->xml->encloseCData(Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage())));
355
- }
356
- } catch(Exception $e) {}
357
- }
358
-
359
- /**
360
- * Write the product classification
361
- *
362
- * @param Product $product
363
- */
364
- protected function writeClassification($product)
365
- {
366
- $categories = $this->getProductCategories($product);
367
- if(count($categories) > 0) {
368
- $this->xml->push('classification');
369
- foreach($categories as $category) {
370
- $this->writeCategory($category);
371
- }
372
- $this->xml->pop();
373
- }
374
- }
375
-
376
- /**
377
- * Write category node with their parents
378
- *
379
- * @param $category
380
- * @param bool $first
381
- * @param int $level
382
- */
383
- protected function writeCategory($category, $first = true, &$level = 0)
384
- {
385
- if($category->getParentId() !== 1 && $category->getParentId() !== 0) {
386
- $level++;
387
- if(!$this->writeCategory($this->getCategoryById($category->getParentId()), false, $level)) {
388
- $level--;
389
- }
390
- }
391
-
392
- $attributes = array('id' => $category->getId(), 'label' => $category->getName(), 'url' => $this->getUri($category->getUrl()));
393
- if ($category->getImage()) {
394
- $attributes['img'] = $category->getImage();
395
- }
396
- $this->xml->push('category', $attributes);
397
-
398
- if($first) {
399
- // close xml elements
400
- for($i = 0; $i <= $level; $i++) {
401
- $this->xml->pop();
402
- }
403
- }
404
-
405
- return true;
406
- }
407
-
408
- /**
409
- * Get category by id
410
- *
411
- * @param int $categoryId
412
- * @return Category
413
- */
414
- protected function getCategoryById($categoryId)
415
- {
416
- if(!isset($this->categories[$categoryId])) {
417
- $this->categories[$categoryId] = Mage::getModel('catalog/category')->load($categoryId);
418
- }
419
-
420
- return $this->categories[$categoryId];
421
- }
422
-
423
- /**
424
- * Return the top level category
425
- *
426
- * @param Product $product
427
- * @return array
428
- */
429
- protected function getProductCategories($product)
430
- {
431
- $categories = $product->getCategoryCollection()->setStoreId($product->getStoreId())->addAttributeToSelect('name')->addAttributeToSelect('image')->addAttributeToSelect('url_key');
432
- $productCategories = array();
433
- foreach($categories as $category) {
434
- $productCategories[$category->getId()] = $category;
435
- $parentCategory[] = $category->getParentId();
436
- }
437
-
438
- foreach($productCategories as $category) {
439
- if(in_array($category->getParentId(), $parentCategory)) {
440
- unset($productCategories[$category->getParentId()]);
441
- }
442
- }
443
-
444
- return $productCategories;
445
- }
446
-
447
- /**
448
- * Write the product materials
449
- *
450
- * @param Product $product
451
- */
452
- protected function writeMaterials($product)
453
- {
454
- if(!empty($this->fields['materials']) && $materials = $this->getField($product, $this->fields['materials'])) {
455
- $this->xml->push('materials');
456
- $this->xml->element('material', $this->xml->encloseCData($materials));
457
- $this->xml->pop();
458
- }
459
- }
460
-
461
- /**
462
- * Write the product colors
463
- *
464
- * @param Product $product
465
- */
466
- protected function writeColors($product)
467
- {
468
- if(!empty($this->fields['colors']) && $color = $product->getAttributeText($this->fields['colors'])) {
469
- $this->xml->push('colors');
470
- $this->xml->element('color', $this->xml->encloseCData($color));
471
- $this->xml->pop();
472
- }
473
- }
474
-
475
- /**
476
- * Write the product models
477
- *
478
- * @param Product $product
479
- */
480
- protected function writeModels($product)
481
- {
482
- if(!empty($this->fields['models']) && $models = $this->getField($product, $this->fields['models'])) {
483
- $this->xml->push('models', array('autocomplete' => 'off'));
484
- $this->xml->element('model', $this->xml->encloseCData(substr($models, 0, 40)));
485
- $this->xml->pop();
486
- }
487
- }
488
-
489
- /**
490
- * Write the product sizes
491
- *
492
- * @param Product $product
493
- */
494
- protected function writeSizes($product)
495
- {
496
- if(!empty($this->fields['sizes']) && $size = $product->getAttributeText($this->fields['sizes'])) {
497
- $this->xml->push('sizes');
498
- $this->xml->element('size', $this->xml->encloseCData($size));
499
- $this->xml->pop();
500
- }
501
- }
502
-
503
- /**
504
- * Write the product genders
505
- *
506
- * @param Product $product
507
- */
508
- protected function writeGenders($product)
509
- {
510
- if(!empty($this->fields['gender']) && $gender = $product->getAttributeText($this->fields['gender'])) {
511
- $this->xml->push('audience');
512
- $this->xml->push('genders');
513
- $this->xml->element('gender', $this->xml->encloseCData($gender));
514
- $this->xml->pop();
515
- $this->xml->pop();
516
- }
517
- }
518
-
519
- /**
520
- * Write the product properties
521
- *
522
- * @param Product $product
523
- * @param array $stores List product store
524
- */
525
- protected function writeProperties($product, $stores)
526
- {
527
- $properties = array();
528
- if(!empty($this->fields['properties'])) {
529
- foreach($this->fields['properties'] as $property) {
530
- $id = $this->getField($product, $property['value']);
531
- if($id !== null) {
532
- $value = $product->getResource()->getAttribute($property['value'])->getFrontend()->getValue($product);
533
- $label = $product->getResource()->getAttribute($property['value'])->getStoreLabel();
534
- $optionName = $value;
535
- if(!empty($this->propertyLabel[$property['value']]['options'][$id]['per_store'][current($stores)->getId()])) {
536
- $optionName = $this->propertyLabel[$property['value']]['options'][$id]['per_store'][current($stores)->getId()];
537
- }
538
-
539
- $value = is_bool($value) ? (int)$value : $value;
540
- $properties[] = array(
541
- 'name' => $property['value'],
542
- 'display_name' => substr($label, 0, 79),
543
- 'label' => substr($optionName, 0, 79),
544
- 'autocomplete' => ($property['autocomplete'] == 1 ? 'on' : 'off')
545
- );
546
- }
547
- }
548
- }
549
-
550
- if(!empty($properties)) {
551
- $this->xml->push('properties');
552
- foreach($properties as $property) {
553
- $this->xml->emptyelement('property', $property);
554
- }
555
- $this->xml->pop();
556
- }
557
- }
558
-
559
- /**
560
- * Write the product prices
561
- *
562
- * @param Product $product
563
- */
564
- protected function writePrices($product, $context, $store, $operations)
565
- {
566
- $prices = current($this->getPrices($product->getId(), $store->getWebsiteId()));
567
-
568
- if($product->getTypeID() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
569
- $prices['price'] = $prices['min_price'];
570
- }
571
-
572
- $price = Mage::helper('tax')->getPrice($product, $prices['price'], true);
573
- if($operations) {
574
- $operation = current($operations);
575
- if($operation['action_operator'] === 'by_percent') {
576
- $amount = $prices['price'] * $operation['action_amount'] / 100;
577
- } else {
578
- $amount = $operation['action_amount'];
579
- }
580
-
581
- $priceCut = $price;
582
- $price = Mage::helper('tax')->getPrice($product, $prices['price'] - $amount, true);
583
- $finalPrice = Mage::helper('tax')->getPrice($product, $prices['final_price'], true);
584
- if($finalPrice < $price) {
585
- $price = $finalPrice;
586
- }
587
-
588
- $priceCut = Mage::helper('directory')->currencyConvert($priceCut, Mage::app()->getStore()->getCurrentCurrencyCode(), $store->getCurrentCurrencyCode());
589
- }
590
- $price = Mage::helper('directory')->currencyConvert($price, Mage::app()->getStore()->getCurrentCurrencyCode(), $store->getCurrentCurrencyCode());
591
-
592
- $this->xml->push('prices');
593
- $this->xml->element(
594
- 'price',
595
- round($price, 2),
596
- array('currency' => $context['currency'], 'type' => 'PRICE_FINAL', 'vat_included' => 'true', 'country' => strtoupper($context['country']))
597
- );
598
-
599
-
600
- if(isset($priceCut)) {
601
- $this->xml->element(
602
- 'price',
603
- round($priceCut, 2),
604
- array('currency' => $context['currency'], 'type' => 'PRICE_CUT', 'vat_included' => 'true', 'country' => strtoupper($context['country']))
605
- );
606
-
607
- }
608
-
609
- $this->xml->pop();
610
- }
611
-
612
- /**
613
- * Get product's prices
614
- *
615
- * @param int $productId
616
- * @param int $websiteId
617
- * @return array
618
- */
619
- protected function getPrices($productId, $websiteId)
620
- {
621
- $query = "SELECT price, final_price, min_price "
622
- . "FROM catalog_product_index_price "
623
- . "WHERE entity_id = ".(int)$productId." "
624
- . "AND website_id = ".(int)$websiteId." "
625
- . "AND customer_group_id = 0 "
626
- ;
627
-
628
- return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
629
- }
630
-
631
- /**
632
- * Write the marketing elements
633
- *
634
- * @param Product $product
635
- * @param array $operations
636
- */
637
- protected function writeMarketing($product, $operations)
638
- {
639
- $this->xml->push('marketing');
640
- $this->xml->element('is_new', ($this->getField($product, 'is_new') ? 1 : 0));
641
- $this->xml->element('is_best_sale', ($this->getField($product, 'is_best_sale') ? 1 : 0));
642
- $this->xml->element('is_featured', ($this->getField($product, 'is_featured') ? 1 : 0));
643
-
644
- $isPromotional = false;
645
- foreach($operations as $operation) {
646
- $isPromotional = true;
647
- $this->xml->element('operation', 1, array('display_name' => $operation['name'], 'name' => 'OPERATION_'.$operation['rule_id']));
648
- }
649
- $this->xml->element('is_promotional', (int)$isPromotional);
650
-
651
- $this->xml->pop();
652
- }
653
-
654
- /**
655
- * Get operations from $product
656
- *
657
- * @param Product $product
658
- * @param Store $store
659
- * @return array
660
- */
661
- protected function getOperations($product, $store)
662
- {
663
- $date = date('Y-m-d');
664
- $query = "SELECT catalogrule.name, catalogrule.rule_id, action_operator, action_amount "
665
- . "FROM catalogrule_product "
666
- . "JOIN catalogrule ON catalogrule_product.rule_id = catalogrule.rule_id "
667
- . "WHERE product_id = ".(int)$product->getId()." "
668
- . "AND website_id = ".$store->getWebSiteId()." "
669
- . "AND from_date < '".$date."' "
670
- . "AND to_date > '".$date."' "
671
- . "AND customer_group_id = 0 "
672
- ;
673
-
674
- return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
675
- }
676
-
677
- /**
678
- * Write the dynamic elements
679
- *
680
- * @param Product $product
681
- */
682
- protected function writeMisc($product)
683
- {
684
- $this->xml->push('misc');
685
- $this->xml->element('product_type', $this->xml->encloseCData($product->getTypeID()));
686
- if(!empty($this->fields['misc'])) {
687
- foreach($this->fields['misc'] as $misc) {
688
- $this->xml->element($misc, $this->xml->encloseCData($this->getField($product, $misc)));
689
- }
690
- }
691
- $this->xml->pop();
692
- }
693
-
694
- /**
695
- * Write variants produt
696
- *
697
- * @param Product $product
698
- * @param array $stores
699
- */
700
- protected function writeVariants($product, $stores)
701
- {
702
- $this->xml->push('variants');
703
-
704
- $this->xml->push('variant', array('id' => 'fake'));
705
- $this->writeVariant($product, $product, $stores);
706
- $this->xml->pop();
707
-
708
- if($product->getTypeID() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
709
- $variantProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
710
- if(count($variantProducts) > 0) {
711
- foreach($variantProducts as $variantProduct) {
712
- $this->xml->push('variant', array('id' => $variantProduct->getId()));
713
- $this->writeVariant($variantProduct, $product, $stores);
714
- $this->xml->pop();
715
- }
716
- }
717
- }
718
- $this->xml->pop();
719
- }
720
-
721
- /**
722
- * Write variant
723
- *
724
- * @param Product $variantProduct
725
- * @param Product $product
726
- * @param array $stores
727
- */
728
- protected function writeVariant($variantProduct, $product, $stores)
729
- {
730
- $this->writeStore($product, $stores, $variantProduct);
731
- $this->writeIdentifiers($variantProduct);
732
- $this->writeProperties($variantProduct, $stores);
733
- $this->writeMaterials($variantProduct);
734
- $this->writeColors($variantProduct);
735
- $this->writeModels($variantProduct);
736
- $this->writeSizes($variantProduct);
737
- $this->writeGenders($product);
738
- $this->writeImageUrl($variantProduct);
739
- $this->writeMisc($variantProduct);
740
- }
741
-
742
- /**
743
- * Write a part xml to file
744
- *
745
- * @param string $xml
746
- * @param boolean $close
747
- */
748
- protected function writePart($xml, $close = false)
749
- {
750
- $filename = $this->getFilename();
751
- if ($this->file === null) {
752
- $this->file = fopen($filename, 'a+');
753
- }
754
-
755
- fwrite($this->file, $xml);
756
- if ($close) {
757
- fclose($this->file);
758
- $this->file = null;
759
- }
760
- }
761
-
762
- /**
763
- * Set the filename
764
- *
765
- * @param string $filename
766
- */
767
- protected function setFilename($filename)
768
- {
769
- if(file_exists($filename)) {
770
- unlink($filename);
771
- }
772
- $this->filename = $filename;
773
- }
774
-
775
- /**
776
- * Return the filename
777
- *
778
- * @return string Return the filename
779
- */
780
- protected function getFilename()
781
- {
782
- return $this->filename;
783
- }
784
-
785
- /**
786
- * Get products to generate
787
- *
788
- * @param array $storeIds
789
- * @param int $page
790
- * @param int $limit
791
- * @param string $type
792
- * @return array
793
- */
794
- protected function getProductIds($storeIds, $type)
795
- {
796
- $productsInStock = $this->onlyProductsWithStock ? ' AND is_in_stock = 1' : '';
797
- $collection = Mage::getModel('catalog/product')
798
- ->getCollection()
799
- ->setStoreId($storeIds)
800
- ->addAttributeToFilter('visibility', $this->productVisible)
801
- ->addAttributeToFilter('status', 1)
802
- ->joinField('qty',
803
- 'cataloginventory/stock_item',
804
- 'qty',
805
- 'product_id = entity_id',
806
- '{{table}}.stock_id = 1'.$productsInStock)
807
- ;
808
-
809
- if ($type === MDN_Antidot_Model_Observer::GENERATE_INC) {
810
- if($this->lastGeneration === null) {
811
- $this->lastGeneration = Mage::helper('Antidot/LogExport')->getLastGeneration(self::TYPE);
812
- }
813
- $collection->addAttributeToFilter('updated_at', array('gteq' => $this->lastGeneration));
814
- }
815
-
816
- return $collection->getAllIds();
817
- }
818
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Export_Product extends MDN_Antidot_Model_Export_Abstract
17
+ {
18
+
19
+ const TYPE = 'CATALOG';
20
+ const FILENAME_XML = 'catalog-mdn-%s.xml';
21
+ const FILENAME_ZIP = '%s_full_mdn_catalog.zip';
22
+ const FILENAME_ZIP_INC = '%s_inc_mdn_catalog.zip';
23
+ const XSD = 'http://ref.antidot.net/store/latest/catalog.xsd';
24
+
25
+ const PRODUCT_LIMIT = 1000;
26
+
27
+ protected $file;
28
+
29
+ protected $productGenerated = array();
30
+
31
+ protected $categories = array();
32
+
33
+ protected $onlyProductsWithStock;
34
+
35
+ protected $autoCompleteProducts;
36
+
37
+ protected $propertyLabel = array();
38
+
39
+ protected $productVisible = array(
40
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH,
41
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
42
+ );
43
+
44
+ protected $productMultiple = array(
45
+ Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
46
+ Mage_Catalog_Model_Product_Type::TYPE_GROUPED,
47
+ Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE
48
+ );
49
+
50
+ /**
51
+ * Write the xml file
52
+ *
53
+ * @param array $context
54
+ * @param string $filename
55
+ * @param string $type Incremantal or full
56
+ * @return int nb items generated
57
+ */
58
+ public function writeXml($context, $filename, $type)
59
+ {
60
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
61
+ $db->getProfiler()->setEnabled(false);
62
+
63
+ $this->onlyProductsWithStock = !(boolean)Mage::getStoreConfig('antidot/fields_product/in_stock_only');
64
+ $this->autoCompleteProducts = Mage::getStoreConfig('antidot/suggest/enable') === 'Antidot/engine_antidot' ? 'on' : 'off';
65
+
66
+ $this->initXml();
67
+ $this->initPropertyLabel();
68
+ $this->initFields('product');
69
+ $this->setFilename($filename);
70
+
71
+ $this->xml->push('catalog', array('xmlns' => "http://ref.antidot.net/store/afs#"));
72
+ $this->writeHeader($context);
73
+ $this->writePart($this->xml->flush());
74
+
75
+ $this->lang = $context['lang'];
76
+ $productIds = $this->getProductIds($context['store_id'], $type);
77
+ foreach(array_chunk($productIds, 500) as $productId) {
78
+ $collection = Mage::getModel('catalog/product')
79
+ ->getCollection()
80
+ ->addAttributeToSelect('*')
81
+ ->addAttributeToFilter('entity_id', array('in', $productId))
82
+ ->joinField('qty',
83
+ 'cataloginventory/stock_item',
84
+ 'qty',
85
+ 'product_id = entity_id',
86
+ '{{table}}.stock_id = 1')
87
+ ;
88
+
89
+ foreach($collection as $product) {
90
+ if($context['langs'] > 1) {
91
+ $store = current($this->getProductStores($product, $context));
92
+ if ($store)
93
+ $product = Mage::getModel('catalog/product')->setStoreId($store->getId())->load($product->getId());
94
+ }
95
+ $this->writeProduct($product, $context);
96
+ }
97
+ $this->writePart($this->xml->flush());
98
+ }
99
+ $this->xml->pop();
100
+
101
+ $this->writePart($this->xml->flush(), true);
102
+
103
+ return count($productIds);
104
+ }
105
+
106
+ /**
107
+ * Init properties label
108
+ */
109
+ protected function initPropertyLabel()
110
+ {
111
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection');
112
+ foreach($attributes as $att) {
113
+ $k = $att->getAttributeCode();
114
+ $this->propertyLabel[$k] = array();
115
+ $this->propertyLabel[$k]['default'] = $att->getfrontend_label();
116
+ $this->propertyLabel[$k]['per_store'] = $att->getStoreLabels();
117
+
118
+ $this->propertyLabel[$k]['options'] = array();
119
+ $options = $att->getSource()->getAllOptions(true);
120
+ foreach($options as $option) {
121
+ if (empty($option['value']) || is_array($option['value'])) {
122
+ continue;
123
+ }
124
+
125
+ $this->propertyLabel[$k]['options'][$option['value']] = array();
126
+ $this->propertyLabel[$k]['options'][$option['value']]['per_store'] = array();
127
+ $query = 'SELECT store_id, value FROM '
128
+ . Mage::getConfig()->getTablePrefix().'eav_attribute_option_value '
129
+ . 'WHERE option_id = "'.$option['value'].'"';
130
+
131
+ $valuesCollection = mage::getResourceModel('sales/order_item_collection')->getConnection()->fetchAll($query);
132
+ foreach($valuesCollection as $item) {
133
+ $this->propertyLabel[$k]['options'][$option['value']]['per_store'][$item['store_id']] = $item['value'];
134
+ }
135
+ }
136
+ }
137
+ }
138
+
139
+ /**
140
+ * Write the xml header
141
+ *
142
+ */
143
+ protected function writeHeader($context)
144
+ {
145
+ $this->xml->push('header');
146
+ $this->xml->element('owner', $context['owner']);
147
+ $this->xml->element('feed', 'product');
148
+ $this->xml->element('generated_at', date('c', Mage::getModel('core/date')->timestamp(time())));
149
+ $this->xml->pop();
150
+ }
151
+
152
+ /**
153
+ * Write the product
154
+ *
155
+ * @param Product $product
156
+ * @param Array $context
157
+ */
158
+ protected function writeProduct($product, $context)
159
+ {
160
+ $stores = $this->getProductStores($product, $context);
161
+
162
+ //skip product if no websites
163
+ if (count($stores) == 0)
164
+ return;
165
+
166
+ $this->xml->push('product', array('id' => $product->getId(), 'xml:lang' => $this->lang, 'autocomplete' => $this->autoCompleteProducts));
167
+
168
+ $this->xml->push('websites');
169
+ foreach($stores as $store) {
170
+ $website = $this->getWebSiteByStore($store);
171
+ $this->xml->element('website', $website->getName(), array('id' => $website->getId()));
172
+ }
173
+ $this->xml->pop();
174
+
175
+ $this->xml->element('created_at', $product->getCreated_at());
176
+ $this->xml->element('last_updated_at', $product->getUpdated_at());
177
+
178
+ $this->xml->element('name', $this->xml->encloseCData($this->getField($product, 'name')));
179
+ if($shortName = $this->getField($product, 'short_name')) {
180
+ $this->xml->element('short_name', $this->xml->encloseCData(mb_substr($shortName, 0, 45, 'UTF-8')), array('autocomplete' => 'off'));
181
+ }
182
+
183
+ if ($keywords = $this->getField($product, 'keywords')) {
184
+ $this->xml->element('keywords', $this->xml->encloseCData($keywords));
185
+ }
186
+ $this->writeDescriptions($product);
187
+ $this->xml->element('url', $this->xml->encloseCData($product->getProductUrl()));
188
+ $this->writeImageUrl($product);
189
+ $this->writeClassification($product);
190
+ $this->writeProperties($product, $stores);
191
+ $this->writeBrand($product);
192
+ $this->writeMaterials($product);
193
+ $this->writeColors($product);
194
+ $this->writeModels($product);
195
+ $this->writeSizes($product);
196
+ $this->writeGenders($product);
197
+ $this->writeMisc($product);
198
+
199
+ $this->writeVariants($product, $stores);
200
+
201
+ $this->xml->pop();
202
+ }
203
+
204
+ /**
205
+ * Write the store's informations
206
+ *
207
+ * @param Product $product
208
+ * @param array $stores
209
+ */
210
+ protected function writeStore($product, $stores, $variantProduct)
211
+ {
212
+ $this->xml->push('stores');
213
+ foreach($stores as $store) {
214
+ Mage::app()->setCurrentStore($store->getId());
215
+
216
+ $this->xml->push('store', array('id' => $store->getId(), 'name' => $store->getName()));
217
+ $storeContext['currency'] = $store->getCurrentCurrencyCode();
218
+ $storeContext['country'] = $this->getStoreLang($store->getId());
219
+
220
+ $operations = $this->getOperations($product, $store);
221
+ $this->writePrices($variantProduct, $product, $storeContext, $store, $operations);
222
+ $this->writeMarketing($variantProduct, $operations);
223
+
224
+ $isAvailable = $variantProduct->isSalable() || (in_array($variantProduct->getTypeId(), $this->productMultiple) && $product->isInStock());
225
+ $this->xml->element('is_available', (int)$isAvailable);
226
+
227
+ $qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($variantProduct)->getQty();
228
+ $qty = ($qty > 0 ? $qty : 0);
229
+ $this->xml->element('stock', (int)$qty);
230
+
231
+ $this->xml->element('url', $this->xml->encloseCData($variantProduct->getProductUrl()));
232
+ $this->xml->pop();
233
+ }
234
+ $this->xml->pop();
235
+ }
236
+
237
+ /**
238
+ * Get catalog/product model
239
+ *
240
+ * @return Model
241
+ */
242
+ protected function getCatalogProduct()
243
+ {
244
+ if(!$this->catalogProduct) {
245
+ $this->catalogProduct = Mage::getModel('catalog/product');
246
+ }
247
+
248
+ return $this->catalogProduct;
249
+ }
250
+
251
+ /**
252
+ * Get product stores
253
+ *
254
+ * @param Product $product
255
+ * @param array $context
256
+ */
257
+ protected function getProductStores($product, $context)
258
+ {
259
+ $stores = array();
260
+
261
+ $storeIds = array_intersect($product->getStoreIds(), $context['store_id']);
262
+ foreach($storeIds as $storeId) {
263
+ $stores[] = $context['stores'][$storeId];
264
+ }
265
+
266
+ return $stores;
267
+ }
268
+
269
+ /**
270
+ * Write the product descriptions
271
+ *
272
+ * @param Product $product
273
+ */
274
+ protected function writeDescriptions($product)
275
+ {
276
+ if(!empty($this->fields['description'])) {
277
+ $this->xml->push('descriptions');
278
+ foreach($this->fields['description'] as $description) {
279
+ if ($value = $this->getField($product, $description)) {
280
+ $this->xml->element('description', $this->xml->encloseCData(substr($value, 0, 20000)), array('type' => $description));
281
+ }
282
+ }
283
+ $this->xml->pop();
284
+ }
285
+ }
286
+
287
+ /**
288
+ * Write the product identifiers
289
+ *
290
+ * @param Product $product
291
+ */
292
+ protected function writeIdentifiers($product)
293
+ {
294
+ if($gtin = $this->getField($product, 'gtin')) {
295
+ if(!preg_match('/^[0-9]{12,14}$/', $gtin)) {
296
+ $gtin = false;
297
+ }
298
+ }
299
+
300
+ $identifiers = array();
301
+ if(!empty($this->fields['identifier'])) {
302
+ foreach($this->fields['identifier'] as $identifier) {
303
+ if ($value = $this->getField($product, $identifier)) {
304
+ $identifiers[$identifier] = mb_substr($value, 0, 40, 'UTF-8');
305
+ }
306
+ }
307
+ }
308
+
309
+ if($gtin ||!empty($identifiers)) {
310
+ $this->xml->push('identifiers');
311
+ if($gtin) {
312
+ $this->xml->element('gtin', $gtin);
313
+ }
314
+
315
+ if(!empty($identifiers)) {
316
+ foreach($identifiers as $identifier => $value) {
317
+ $this->xml->element('identifier', $value, array('type' => $identifier));
318
+ }
319
+ }
320
+
321
+ $this->xml->pop();
322
+ }
323
+ }
324
+
325
+ /**
326
+ * Write the product identifiers
327
+ *
328
+ * @param Product $product
329
+ */
330
+ protected function writeBrand($product)
331
+ {
332
+ if ($manufacturer = $this->getField($product, 'manufacturer')) {
333
+ if(!empty($manufacturer)) {
334
+ $field = empty($this->fields['manufacturer']) ? 'manufacturer' : $this->fields['manufacturer'];
335
+ $brand = mb_substr($product->getAttributeText($field), 0, 40, 'UTF-8');
336
+ $brandUrl = Mage::helper('catalogsearch')->getResultUrl($brand);
337
+ $brandUrl = parse_url($brandUrl, PHP_URL_PATH).'?'.parse_url($brandUrl, PHP_URL_QUERY);
338
+ if(!empty($brand)) {
339
+ $this->xml->element('brand', $this->xml->encloseCData($brand), array('id' => $manufacturer, 'url' => $brandUrl));
340
+ }
341
+ }
342
+ }
343
+ }
344
+
345
+ /**
346
+ * Write the product urls
347
+ *
348
+ * @param Product $product
349
+ * @param string $urlImg
350
+ */
351
+ protected function writeImageUrl($product, $urlImg = true)
352
+ {
353
+ try {
354
+ if ($product->getThumbnail()) {
355
+ $this->xml->element('url_thumbnail', $this->xml->encloseCData(Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getThumbnail())));
356
+ }
357
+ } catch(Exception $e) {}
358
+
359
+ try {
360
+ if ($urlImg && $product->getImage()) {
361
+ $this->xml->element('url_image', $this->xml->encloseCData(Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage())));
362
+ }
363
+ } catch(Exception $e) {}
364
+ }
365
+
366
+ /**
367
+ * Write the product classification
368
+ *
369
+ * @param Product $product
370
+ */
371
+ protected function writeClassification($product)
372
+ {
373
+ $categories = $this->getProductCategories($product);
374
+ if(count($categories) > 0) {
375
+ $this->xml->push('classification');
376
+ foreach($categories as $category) {
377
+ $this->writeCategory($category);
378
+ }
379
+ $this->xml->pop();
380
+ }
381
+ }
382
+
383
+ /**
384
+ * Write category node with their parents
385
+ *
386
+ * @param $category
387
+ * @param bool $first
388
+ * @param int $level
389
+ */
390
+ protected function writeCategory($category, $first = true, &$level = 0)
391
+ {
392
+ if($category->getParentId() == 1 || $category->getParentId() == 0)
393
+ return false;
394
+
395
+ if($category->getParentId() !== 1 && $category->getParentId() !== 0) {
396
+ $level++;
397
+ if(!$this->writeCategory($this->getCategoryById($category->getParentId()), false, $level)) {
398
+ $level--;
399
+ }
400
+ }
401
+
402
+
403
+ $attributes = array('id' => $category->getId(), 'label' => $category->getName(), 'url' => $this->getUri($category->getUrl()));
404
+ if ($category->getImage()) {
405
+ $attributes['img'] = $category->getImage();
406
+ }
407
+ $this->xml->push('category', $attributes);
408
+
409
+ if($first) {
410
+ // close xml elements
411
+ for($i = 0; $i <= $level; $i++) {
412
+ $this->xml->pop();
413
+ }
414
+ }
415
+
416
+ return true;
417
+ }
418
+
419
+ /**
420
+ * Get category by id
421
+ *
422
+ * @param int $categoryId
423
+ * @return Category
424
+ */
425
+ protected function getCategoryById($categoryId)
426
+ {
427
+ if(!isset($this->categories[$categoryId])) {
428
+ $this->categories[$categoryId] = Mage::getModel('catalog/category')->load($categoryId);
429
+ }
430
+
431
+ return $this->categories[$categoryId];
432
+ }
433
+
434
+ /**
435
+ * Return the top level category
436
+ *
437
+ * @param Product $product
438
+ * @return array
439
+ */
440
+ protected function getProductCategories($product)
441
+ {
442
+ $categories = $product->getCategoryCollection()->setStoreId($product->getStoreId())->addAttributeToSelect('name')->addAttributeToSelect('image')->addAttributeToSelect('url_key');
443
+ $productCategories = array();
444
+ foreach($categories as $category) {
445
+ if (($category->getparent_id() == 0) || ($category->getparent_id() == 1))
446
+ continue;
447
+ $productCategories[$category->getId()] = $category;
448
+ $parentCategory[] = $category->getParentId();
449
+ }
450
+
451
+ foreach($productCategories as $category) {
452
+ if(in_array($category->getParentId(), $parentCategory)) {
453
+ unset($productCategories[$category->getParentId()]);
454
+ }
455
+ }
456
+
457
+ return $productCategories;
458
+ }
459
+
460
+ /**
461
+ * Write the product materials
462
+ *
463
+ * @param Product $product
464
+ */
465
+ protected function writeMaterials($product)
466
+ {
467
+ if(!empty($this->fields['materials']) && $materials = $product->getAttributeText($this->fields['materials'])) {
468
+ $this->xml->push('materials');
469
+ $this->xml->element('material', $this->xml->encloseCData($materials));
470
+ $this->xml->pop();
471
+ }
472
+ }
473
+
474
+ /**
475
+ * Write the product colors
476
+ *
477
+ * @param Product $product
478
+ */
479
+ protected function writeColors($product)
480
+ {
481
+ if(!empty($this->fields['colors']) && $color = $product->getAttributeText($this->fields['colors'])) {
482
+ $this->xml->push('colors');
483
+ $this->xml->element('color', $this->xml->encloseCData($color));
484
+ $this->xml->pop();
485
+ }
486
+ }
487
+
488
+ /**
489
+ * Write the product models
490
+ *
491
+ * @param Product $product
492
+ */
493
+ protected function writeModels($product)
494
+ {
495
+ if(!empty($this->fields['models']) && $models = $this->getField($product, $this->fields['models'])) {
496
+ $this->xml->push('models', array('autocomplete' => 'off'));
497
+ $this->xml->element('model', $this->xml->encloseCData(substr($models, 0, 40)));
498
+ $this->xml->pop();
499
+ }
500
+ }
501
+
502
+ /**
503
+ * Write the product sizes
504
+ *
505
+ * @param Product $product
506
+ */
507
+ protected function writeSizes($product)
508
+ {
509
+ if(!empty($this->fields['sizes']) && $size = $product->getAttributeText($this->fields['sizes'])) {
510
+ $this->xml->push('sizes');
511
+ $this->xml->element('size', $this->xml->encloseCData($size));
512
+ $this->xml->pop();
513
+ }
514
+ }
515
+
516
+ /**
517
+ * Write the product genders
518
+ *
519
+ * @param Product $product
520
+ */
521
+ protected function writeGenders($product)
522
+ {
523
+ if(!empty($this->fields['gender']) && $gender = $product->getAttributeText($this->fields['gender'])) {
524
+ $this->xml->push('audience');
525
+ $this->xml->push('genders');
526
+ $this->xml->element('gender', $this->xml->encloseCData($gender));
527
+ $this->xml->pop();
528
+ $this->xml->pop();
529
+ }
530
+ }
531
+
532
+ /**
533
+ * Write the product properties
534
+ *
535
+ * @param Product $product
536
+ * @param array $stores List product store
537
+ */
538
+ protected function writeProperties($product, $stores)
539
+ {
540
+ $properties = array();
541
+ if(!empty($this->fields['properties'])) {
542
+ foreach($this->fields['properties'] as $property) {
543
+ $id = $this->getField($product, $property['value']);
544
+ if($id !== null) {
545
+
546
+
547
+ $attribute = $product->getResource()->getAttribute($property['value']);
548
+ $value = $attribute->getFrontend()->getValue($product);
549
+ $label = $attribute->getStoreLabel();
550
+
551
+ $labels = array();
552
+ switch($attribute->getfrontend_input())
553
+ {
554
+ case 'multiselect':
555
+ $values = explode(',', $value);
556
+ foreach($values as $value)
557
+ {
558
+ $value = trim($value);
559
+ $properties[] = array(
560
+ 'name' => $property['value'],
561
+ 'display_name' => substr($label, 0, 79),
562
+ 'label' => substr($value, 0, 79),
563
+ 'autocomplete' => ($property['autocomplete'] == 1 ? 'on' : 'off'));
564
+ }
565
+ break;
566
+ default:
567
+ $optionName = $value;
568
+ if(!empty($this->propertyLabel[$property['value']]['options'][$id]['per_store'][current($stores)->getId()])) {
569
+ $optionName = $this->propertyLabel[$property['value']]['options'][$id]['per_store'][current($stores)->getId()];
570
+ }
571
+ $value = is_bool($value) ? (int)$value : $value;
572
+ $properties[] = array(
573
+ 'name' => $property['value'],
574
+ 'display_name' => substr($label, 0, 79),
575
+ 'label' => substr($optionName, 0, 79),
576
+ 'autocomplete' => ($property['autocomplete'] == 1 ? 'on' : 'off'));
577
+ break;
578
+ }
579
+
580
+ }
581
+ }
582
+ }
583
+
584
+ if(!empty($properties)) {
585
+ $this->xml->push('properties');
586
+ foreach($properties as $property) {
587
+ $this->xml->emptyelement('property', $property);
588
+ }
589
+ $this->xml->pop();
590
+ }
591
+ }
592
+
593
+ /**
594
+ * Write the product prices
595
+ *
596
+ * @param Product $product
597
+ */
598
+ protected function writePrices($product, $parentProduct, $context, $store, $operations)
599
+ {
600
+ $prices = ($this->getPrices($parentProduct->getId(), $store->getWebsiteId()));
601
+
602
+ if($product->getTypeID() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
603
+ $prices['price'] = $prices['min_price'];
604
+ }
605
+
606
+ $price = Mage::helper('tax')->getPrice($product, $prices['price'], true);
607
+ if($operations) {
608
+ $operation = current($operations);
609
+ if($operation['action_operator'] === 'by_percent') {
610
+ $amount = $prices['price'] * $operation['action_amount'] / 100;
611
+ } else {
612
+ $amount = $operation['action_amount'];
613
+ }
614
+
615
+ $priceCut = $price;
616
+ $price = Mage::helper('tax')->getPrice($product, $prices['price'] - $amount, true);
617
+ $finalPrice = Mage::helper('tax')->getPrice($product, $prices['final_price'], true);
618
+ if($finalPrice < $price) {
619
+ $price = $finalPrice;
620
+ }
621
+
622
+ $priceCut = Mage::helper('directory')->currencyConvert($priceCut, Mage::app()->getStore()->getCurrentCurrencyCode(), $store->getCurrentCurrencyCode());
623
+ }
624
+ $price = Mage::helper('directory')->currencyConvert($price, Mage::app()->getStore()->getCurrentCurrencyCode(), $store->getCurrentCurrencyCode());
625
+
626
+ $this->xml->push('prices');
627
+ $this->xml->element(
628
+ 'price',
629
+ round($price, 2),
630
+ array('currency' => $context['currency'], 'type' => 'PRICE_FINAL', 'vat_included' => 'true', 'country' => strtoupper($context['country']))
631
+ );
632
+
633
+
634
+ if(isset($priceCut)) {
635
+ $this->xml->element(
636
+ 'price',
637
+ round($priceCut, 2),
638
+ array('currency' => $context['currency'], 'type' => 'PRICE_CUT', 'vat_included' => 'true', 'country' => strtoupper($context['country']))
639
+ );
640
+
641
+ }
642
+
643
+ $this->xml->pop();
644
+ }
645
+
646
+ /**
647
+ * Get product's prices
648
+ *
649
+ * @param int $productId
650
+ * @param int $websiteId
651
+ * @return array
652
+ */
653
+ protected function getPrices($productId, $websiteId)
654
+ {
655
+ $query = "SELECT price, final_price, min_price "
656
+ . "FROM catalog_product_index_price "
657
+ . "WHERE entity_id = ".(int)$productId." "
658
+ . "AND website_id = ".(int)$websiteId." "
659
+ . "AND customer_group_id = 0 "
660
+ ;
661
+
662
+ $result = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchRow($query);
663
+
664
+ if (($result['min_price']))
665
+ {
666
+ if (!($result['price']))
667
+ $result['price'] = $result['min_price'];
668
+ if (!($result['final_price']))
669
+ $result['final_price'] = $result['min_price'];
670
+ }
671
+
672
+ if ((!$result['min_price']) && (!$result['price']) && (!$result['final_price']))
673
+ {
674
+ $product = Mage::getModel('catalog/product')->load($productId);
675
+ $result['min_price'] = $product->getPrice();
676
+ $result['price'] = $product->getPrice();
677
+ $result['final_price'] = $product->getPrice();
678
+ }
679
+
680
+ return $result;
681
+ }
682
+
683
+ /**
684
+ * Write the marketing elements
685
+ *
686
+ * @param Product $product
687
+ * @param array $operations
688
+ */
689
+ protected function writeMarketing($product, $operations)
690
+ {
691
+ $this->xml->push('marketing');
692
+ $this->xml->element('is_new', ($this->getField($product, 'is_new') ? 1 : 0));
693
+ $this->xml->element('is_best_sale', ($this->getField($product, 'is_best_sale') ? 1 : 0));
694
+ $this->xml->element('is_featured', ($this->getField($product, 'is_featured') ? 1 : 0));
695
+
696
+ $isPromotional = false;
697
+ foreach($operations as $operation) {
698
+ $isPromotional = true;
699
+ $this->xml->element('operation', 1, array('display_name' => $operation['name'], 'name' => 'OPERATION_'.$operation['rule_id']));
700
+ }
701
+ $this->xml->element('is_promotional', (int)$isPromotional);
702
+
703
+ $this->xml->pop();
704
+ }
705
+
706
+ /**
707
+ * Get operations from $product
708
+ *
709
+ * @param Product $product
710
+ * @param Store $store
711
+ * @return array
712
+ */
713
+ protected function getOperations($product, $store)
714
+ {
715
+ $date = date('Y-m-d');
716
+ $query = "SELECT catalogrule.name, catalogrule.rule_id, action_operator, action_amount "
717
+ . "FROM catalogrule_product "
718
+ . "JOIN catalogrule ON catalogrule_product.rule_id = catalogrule.rule_id "
719
+ . "WHERE product_id = ".(int)$product->getId()." "
720
+ . "AND website_id = ".$store->getWebSiteId()." "
721
+ . "AND from_date < '".$date."' "
722
+ . "AND to_date > '".$date."' "
723
+ . "AND customer_group_id = 0 "
724
+ ;
725
+
726
+ return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
727
+ }
728
+
729
+ /**
730
+ * Write the dynamic elements
731
+ *
732
+ * @param Product $product
733
+ */
734
+ protected function writeMisc($product)
735
+ {
736
+ $this->xml->push('misc');
737
+ $this->xml->element('product_type', $this->xml->encloseCData($product->getTypeID()));
738
+ if(!empty($this->fields['misc'])) {
739
+ foreach($this->fields['misc'] as $misc) {
740
+ $this->xml->element($misc, $this->xml->encloseCData($this->getField($product, $misc)));
741
+ }
742
+ }
743
+ $this->xml->pop();
744
+ }
745
+
746
+ /**
747
+ * Write variants produt
748
+ *
749
+ * @param Product $product
750
+ * @param array $stores
751
+ */
752
+ protected function writeVariants($product, $stores)
753
+ {
754
+ $this->xml->push('variants');
755
+
756
+ $this->xml->push('variant', array('id' => 'fake'));
757
+ $this->writeVariant($product, $product, $stores);
758
+ $this->xml->pop();
759
+
760
+ $variantProducts = array();
761
+ switch($product->getTypeID())
762
+ {
763
+ case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
764
+ $variantProducts = $product->getTypeInstance(true)->getUsedProducts(null, $product);
765
+ break;
766
+ case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
767
+ $variantProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
768
+ break;
769
+ }
770
+
771
+ if(count($variantProducts) > 0) {
772
+ foreach($variantProducts as $variantProduct) {
773
+ $this->xml->push('variant', array('id' => $variantProduct->getId()));
774
+ $this->writeVariant($variantProduct, $product, $stores);
775
+ $this->xml->pop();
776
+ }
777
+ }
778
+
779
+ $this->xml->pop();
780
+ }
781
+
782
+ /**
783
+ * Write variant
784
+ *
785
+ * @param Product $variantProduct
786
+ * @param Product $product
787
+ * @param array $stores
788
+ */
789
+ protected function writeVariant($variantProduct, $product, $stores)
790
+ {
791
+ $this->xml->element('name', $this->xml->encloseCData($variantProduct->getName()));
792
+ $this->writeDescriptions($variantProduct);
793
+ $this->writeStore($product, $stores, $variantProduct);
794
+ $this->writeIdentifiers($variantProduct);
795
+ $this->writeProperties($variantProduct, $stores);
796
+ $this->writeMaterials($variantProduct);
797
+ $this->writeColors($variantProduct);
798
+ $this->writeModels($variantProduct);
799
+ $this->writeSizes($variantProduct);
800
+ $this->writeGenders($product);
801
+ $this->writeImageUrl($variantProduct);
802
+ $this->writeMisc($variantProduct);
803
+ }
804
+
805
+ /**
806
+ * Write a part xml to file
807
+ *
808
+ * @param string $xml
809
+ * @param boolean $close
810
+ */
811
+ protected function writePart($xml, $close = false)
812
+ {
813
+ $filename = $this->getFilename();
814
+ if ($this->file === null) {
815
+ $this->file = fopen($filename, 'a+');
816
+ }
817
+
818
+ fwrite($this->file, $xml);
819
+ if ($close) {
820
+ fclose($this->file);
821
+ $this->file = null;
822
+ }
823
+ }
824
+
825
+ /**
826
+ * Set the filename
827
+ *
828
+ * @param string $filename
829
+ */
830
+ protected function setFilename($filename)
831
+ {
832
+ if(file_exists($filename)) {
833
+ unlink($filename);
834
+ }
835
+ $this->filename = $filename;
836
+ }
837
+
838
+ /**
839
+ * Return the filename
840
+ *
841
+ * @return string Return the filename
842
+ */
843
+ protected function getFilename()
844
+ {
845
+ return $this->filename;
846
+ }
847
+
848
+ /**
849
+ * Get products to generate
850
+ *
851
+ * @param array $storeIds
852
+ * @param int $page
853
+ * @param int $limit
854
+ * @param string $type
855
+ * @return array
856
+ */
857
+ protected function getProductIds($storeIds, $type)
858
+ {
859
+ $productsInStock = $this->onlyProductsWithStock ? ' AND is_in_stock = 1' : '';
860
+ $collection = Mage::getModel('catalog/product')
861
+ ->getCollection()
862
+ ->setStoreId($storeIds)
863
+ ->addAttributeToFilter('visibility', $this->productVisible)
864
+ ->addAttributeToFilter('status', 1)
865
+ ->joinField('qty',
866
+ 'cataloginventory/stock_item',
867
+ 'qty',
868
+ 'product_id = entity_id',
869
+ '{{table}}.stock_id = 1'.$productsInStock)
870
+ ;
871
+
872
+ if ($type === MDN_Antidot_Model_Observer::GENERATE_INC) {
873
+ if($this->lastGeneration === null) {
874
+ $this->lastGeneration = Mage::helper('Antidot/LogExport')->getLastGeneration(self::TYPE);
875
+ }
876
+ $collection->addAttributeToFilter('updated_at', array('gteq' => $this->lastGeneration));
877
+ }
878
+
879
+ return $collection->getAllIds();
880
+ }
881
+ }
app/code/community/MDN/Antidot/Model/Mysql4/Export/Log.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MDN_Antidot_Model_Mysql4_Export_Log extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('Antidot/ExportLog','id');
8
+ }
9
+
10
+
11
+ }
app/code/community/MDN/Antidot/Model/Mysql4/Export/Log/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MDN_Antidot_Model_Mysql4_Export_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('Antidot/ExportLog');
9
+ }
10
+
11
+
12
+ }
app/code/community/MDN/Antidot/Model/Observer.php CHANGED
@@ -1,275 +1,290 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
17
- {
18
- const GENERATE_FULL = 'FULL';
19
- const GENERATE_INC = 'INC';
20
-
21
- /**
22
- * @var string @tmpDirectory
23
- */
24
- private $tmpDirectory;
25
- private $tmpErrorDirectory;
26
-
27
- /**
28
- * @var string Uniq request Id
29
- */
30
- private $request;
31
-
32
- /**
33
- * @var int Begin timestamp
34
- */
35
- private $begin;
36
-
37
- /**
38
- * @var string Current generation type
39
- */
40
- private $type;
41
-
42
- /**
43
- * Init the controller
44
- */
45
- protected function _construct()
46
- {
47
- $this->request = uniqid();
48
- $this->begin = microtime(true);
49
- $this->initTmpDirectory();
50
-
51
- ini_set('memory_limit', '1024M');
52
- }
53
-
54
- /**
55
- * Init the tmp directory
56
- */
57
- protected function initTmpDirectory()
58
- {
59
- $this->tmpDirectory = sys_get_temp_dir().'/antidot/';
60
- $this->tmpErrorDirectory = $this->tmpDirectory.'error/';
61
- if(!is_dir($this->tmpDirectory)) {
62
- mkdir($this->tmpDirectory, 0775);
63
- mkdir($this->tmpErrorDirectory, 0775);
64
- }
65
- }
66
-
67
- /**
68
- * Generate the full catalog file
69
- */
70
- public function catalogFullExport()
71
- {
72
- $this->log('FULL EXPORT');
73
- $this->generate(Mage::getModel('Antidot/Export_Product'), self::GENERATE_FULL);
74
- }
75
-
76
- /**
77
- * Generate the inc catalog file
78
- */
79
- public function catalogIncExport()
80
- {
81
- $this->generate(Mage::getModel('Antidot/Export_Product'), self::GENERATE_INC);
82
- }
83
-
84
- /**
85
- * Generate the category file
86
- */
87
- public function categoriesFullExport()
88
- {
89
- $this->generate(Mage::getModel('Antidot/Export_Category'), self::GENERATE_FULL);
90
- }
91
-
92
- /**
93
- * Generate files
94
- *
95
- * @param Antidot/Export_* $exportModel
96
- * @param string $type
97
- * @throws Exception
98
- */
99
- protected function generate($exportModel, $type)
100
- {
101
- $this->type = $exportModel::TYPE;
102
- $this->log('start');
103
- $log['begin'] = time();
104
- $log['items'] = 0;
105
-
106
- $files = array();
107
- foreach($this->getDefaultContext() as $context) {
108
- $this->log('generate '.$exportModel::TYPE.' '.$context['owner']);
109
- $context['store_id'] = array_keys($context['stores']);
110
-
111
- $filename = $this->tmpDirectory.sprintf($exportModel::FILENAME_XML, $context['lang']);
112
- $items = $exportModel->writeXml($context, $filename, $type);
113
- if($items === 0) {
114
- continue;
115
- }
116
-
117
- $log['items']+= $items;
118
- if ($this->schemaValidate($filename, $exportModel::XSD)) {
119
- $files[] = $filename;
120
- } else {
121
- $this->fileError($filename);
122
-
123
- $errors = Mage::helper('Antidot/XmlWriter')->getErrors();
124
- $this->log('xml schema not valid '.print_r($errors, true));
125
- Mage::helper('Antidot')->sendMail('Export failed', print_r($errors, true));
126
- continue;
127
- }
128
- }
129
-
130
- if($log['items'] === 0) {
131
- return;
132
- }
133
-
134
- $log['reference'] = 'unknown';
135
- if(!empty($files)) {
136
- $filenameZip = $type === self::GENERATE_INC ? $exportModel::FILENAME_ZIP_INC : $exportModel::FILENAME_ZIP;
137
- $filename = $this->compress($files, $filenameZip);
138
- $log['reference'] = md5($filename);
139
- $this->send($filename);
140
-
141
- $log['status'] = 'SUCCESS';
142
- $log['error'] = '';
143
- } else {
144
- $log['status'] = 'FAILED';
145
- $log['error'] = current(Mage::helper('Antidot/XmlWriter')->getErrors());
146
- }
147
- if(file_exists($filename)) {
148
- unlink($filename);
149
- }
150
-
151
- $log['end'] = time();
152
- $this->log('generate '.$exportModel::TYPE.' '.$context['owner']);
153
- $this->log('end');
154
-
155
- Mage::helper('Antidot/LogExport')->add($log['reference'], $type, $exportModel::TYPE, $log['begin'], $log['end'], $log['items'], $log['status'], $log['error']);
156
- }
157
-
158
- /**
159
- * Move file with error to another directory $tmp/antidot/error
160
- *
161
- * @param string $file
162
- */
163
- protected function fileError($file)
164
- {
165
- $files = array();
166
- if ($handle = opendir($this->tmpErrorDirectory)) {
167
- while ($fileError = readdir($handle)) {
168
- if ($fileError != "." && $fileError != "..") {
169
- $files[] = $fileError;
170
- }
171
- }
172
- closedir($handle);
173
-
174
- if(count($files) >= 5) {
175
- sort($files);
176
- unlink($this->tmpErrorDirectory.current($files));
177
- }
178
-
179
- $fileError = $this->tmpErrorDirectory.time().'-'.basename($file);
180
- rename($file, $fileError);
181
- }
182
- }
183
-
184
- /**
185
- * Compress xml file
186
- *
187
- * @param array $files
188
- * @param string $compressFile filename
189
- * @return path to file compressed
190
- */
191
- protected function compress($files, $compressFile)
192
- {
193
- $this->log('compress the file');
194
-
195
- $compressFile = dirname(current($files)).'/'.sprintf($compressFile, date('YmdHis'));
196
- Mage::helper('Antidot/Compress')->zip($files, $compressFile);
197
-
198
- return $compressFile;
199
- }
200
-
201
- /**
202
- * Send the file to antidot
203
- *
204
- * @param string $filename
205
- * @return boolean
206
- */
207
- protected function send($filename)
208
- {
209
- $this->log('send the file');
210
-
211
- $transport = Mage::getModel('Antidot/Transport');
212
-
213
- return $transport->send($filename, $transport::TRANS_FTP);
214
- }
215
-
216
- /**
217
- * Check if the xml file is valid
218
- *
219
- * @param string $filename xml file
220
- * @param string $xsd xsd file
221
- * @return boolean
222
- */
223
- protected function schemaValidate($filename, $xsd)
224
- {
225
- libxml_use_internal_errors(true);
226
- $this->log('schema validate');
227
-
228
- $xml = new DOMDocument();
229
- $xml->load($filename);
230
-
231
- return $xml->schemaValidate($xsd);
232
- }
233
-
234
- /**
235
- * Return the context default values
236
- *
237
- * @todo retrieve these data from the db
238
- * @return array
239
- */
240
- private function getDefaultContext()
241
- {
242
- $listStore = array();
243
- foreach (Mage::app()->getStores() as $store) {
244
- list($lang) = explode('_', Mage::getStoreConfig('general/locale/code', $store->getId()));
245
- $listStore[$lang][$store->getId()] = $store;
246
- }
247
-
248
- $listContext = array();
249
- foreach($listStore as $lang => $stores) {
250
- $defaultOwner = 'AFS@Store for Magento v'.Mage::getConfig()->getNode()->modules->MDN_Antidot->version;
251
- $context['owner'] = Mage::getStoreConfig('antidot/general/owner') === '' ? $defaultOwner : Mage::getStoreConfig('antidot/general/owner');
252
- $context['lang'] = $lang;
253
- $context['stores'] = $stores;
254
- $context['langs'] = count($listStore);
255
-
256
- $listContext[] = $context;
257
- }
258
-
259
- return $listContext;
260
- }
261
-
262
- /**
263
- * Write message to log
264
- *
265
- * @param string $action
266
- */
267
- private function log($action)
268
- {
269
- $message = '[antidot] ['.$this->type.'] ['.$this->request.'] '
270
- . memory_get_usage(true).' '
271
- . $action.' ('.round(microtime(true)-$this->begin, 2)."sec)";
272
-
273
- Mage::log($message, null, 'antidot.log');
274
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Observer extends Mage_Core_Model_Abstract
17
+ {
18
+ const GENERATE_FULL = 'FULL';
19
+ const GENERATE_INC = 'INC';
20
+
21
+ /**
22
+ * @var string @tmpDirectory
23
+ */
24
+ private $tmpDirectory;
25
+ private $tmpErrorDirectory;
26
+
27
+ /**
28
+ * @var string Uniq request Id
29
+ */
30
+ private $request;
31
+
32
+ /**
33
+ * @var int Begin timestamp
34
+ */
35
+ private $begin;
36
+
37
+ /**
38
+ * @var string Current generation type
39
+ */
40
+ private $type;
41
+
42
+ /**
43
+ * Init the controller
44
+ */
45
+ protected function _construct()
46
+ {
47
+ $this->request = uniqid();
48
+ $this->begin = microtime(true);
49
+ $this->initTmpDirectory();
50
+
51
+ ini_set('memory_limit', '1024M');
52
+ }
53
+
54
+ /**
55
+ * Init the tmp directory
56
+ */
57
+ protected function initTmpDirectory()
58
+ {
59
+ $this->tmpDirectory = sys_get_temp_dir().DS.'antidot'.DS;
60
+ $this->tmpErrorDirectory = $this->tmpDirectory.DS.'error'.DS;
61
+ if(!is_dir($this->tmpDirectory)) {
62
+ mkdir($this->tmpDirectory, 0775);
63
+ mkdir($this->tmpErrorDirectory, 0775);
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Generate the full catalog file
69
+ */
70
+ public function catalogFullExport()
71
+ {
72
+ $this->log('FULL EXPORT');
73
+ $this->generate(Mage::getModel('Antidot/Export_Product'), self::GENERATE_FULL);
74
+ }
75
+
76
+ /**
77
+ * Generate the inc catalog file
78
+ */
79
+ public function catalogIncExport()
80
+ {
81
+ $this->generate(Mage::getModel('Antidot/Export_Product'), self::GENERATE_INC);
82
+ }
83
+
84
+ /**
85
+ * Generate the category file
86
+ */
87
+ public function categoriesFullExport()
88
+ {
89
+ $this->generate(Mage::getModel('Antidot/Export_Category'), self::GENERATE_FULL);
90
+ }
91
+
92
+ /**
93
+ * Generate files
94
+ *
95
+ * @param Antidot/Export_* $exportModel
96
+ * @param string $type
97
+ * @throws Exception
98
+ */
99
+ protected function generate($exportModel, $type)
100
+ {
101
+ $this->type = $exportModel::TYPE;
102
+ $this->log('start');
103
+ $log['begin'] = time();
104
+ $log['items'] = 0;
105
+ $log['error'] = array();
106
+ $log['reference'] = '';
107
+
108
+ try
109
+ {
110
+
111
+ $files = array();
112
+ foreach($this->getDefaultContext() as $context) {
113
+ $this->log('generate '.$exportModel::TYPE.' '.$context['owner']);
114
+ $context['store_id'] = array_keys($context['stores']);
115
+
116
+ $filename = $this->tmpDirectory.sprintf($exportModel::FILENAME_XML, $context['lang']);
117
+ $items = $exportModel->writeXml($context, $filename, $type);
118
+ if($items === 0) {
119
+ continue;
120
+ }
121
+
122
+ $log['items']+= $items;
123
+ if ($this->schemaValidate($filename, $exportModel::XSD)) {
124
+ $files[] = $filename;
125
+ } else {
126
+ $this->fileError($filename);
127
+
128
+ $errors = Mage::helper('Antidot/XmlWriter')->getErrors();
129
+ $this->log('xml schema not valid '.print_r($errors, true));
130
+ Mage::helper('Antidot')->sendMail('Export failed', print_r($errors, true));
131
+ foreach($errors as $error)
132
+ $log['error'][] = $error;
133
+ continue;
134
+ }
135
+ }
136
+
137
+ if($log['items'] === 0) {
138
+ return;
139
+ }
140
+
141
+ $log['reference'] = 'unknown';
142
+ if(!empty($files)) {
143
+ $filenameZip = $type === self::GENERATE_INC ? $exportModel::FILENAME_ZIP_INC : $exportModel::FILENAME_ZIP;
144
+ $filename = $this->compress($files, $filenameZip);
145
+ $log['reference'] = md5($filename);
146
+ $this->send($filename);
147
+
148
+ $log['status'] = 'SUCCESS';
149
+ } else {
150
+ $log['status'] = 'FAILED';
151
+ $lastError = current(Mage::helper('Antidot/XmlWriter')->getErrors());
152
+ if ($lastError)
153
+ $log['error'][] = $lastError;
154
+ }
155
+
156
+ if(file_exists($filename)) {
157
+ unlink($filename);
158
+ }
159
+ }
160
+ catch(Exception $ex)
161
+ {
162
+ $log['error'][] = $ex->getMessage();
163
+ $log['status'] = 'FAILED';
164
+ }
165
+
166
+ $log['end'] = time();
167
+ $this->log('generate '.$exportModel::TYPE.' '.$context['owner']);
168
+ $this->log('end');
169
+
170
+ Mage::helper('Antidot/LogExport')->add($log['reference'], $type, $exportModel::TYPE, $log['begin'], $log['end'], $log['items'], $log['status'], implode(',', $log['error']));
171
+ }
172
+
173
+ /**
174
+ * Move file with error to another directory $tmp/antidot/error
175
+ *
176
+ * @param string $file
177
+ */
178
+ protected function fileError($file)
179
+ {
180
+ $files = array();
181
+ if ($handle = opendir($this->tmpErrorDirectory)) {
182
+ while ($fileError = readdir($handle)) {
183
+ if ($fileError != "." && $fileError != "..") {
184
+ $files[] = $fileError;
185
+ }
186
+ }
187
+ closedir($handle);
188
+
189
+ if(count($files) >= 5) {
190
+ sort($files);
191
+ unlink($this->tmpErrorDirectory.current($files));
192
+ }
193
+
194
+ $fileError = $this->tmpErrorDirectory.time().'-'.basename($file);
195
+ rename($file, $fileError);
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Compress xml file
201
+ *
202
+ * @param array $files
203
+ * @param string $compressFile filename
204
+ * @return path to file compressed
205
+ */
206
+ protected function compress($files, $compressFile)
207
+ {
208
+ $this->log('compress the file');
209
+
210
+ $compressFile = dirname(current($files)).'/'.sprintf($compressFile, date('YmdHis'));
211
+ Mage::helper('Antidot/Compress')->zip($files, $compressFile);
212
+
213
+ return $compressFile;
214
+ }
215
+
216
+ /**
217
+ * Send the file to antidot
218
+ *
219
+ * @param string $filename
220
+ * @return boolean
221
+ */
222
+ protected function send($filename)
223
+ {
224
+ $this->log('send the file');
225
+
226
+ $transport = Mage::getModel('Antidot/Transport');
227
+
228
+ return $transport->send($filename, $transport::TRANS_FTP);
229
+ }
230
+
231
+ /**
232
+ * Check if the xml file is valid
233
+ *
234
+ * @param string $filename xml file
235
+ * @param string $xsd xsd file
236
+ * @return boolean
237
+ */
238
+ protected function schemaValidate($filename, $xsd)
239
+ {
240
+ libxml_use_internal_errors(true);
241
+ $this->log('schema validate');
242
+
243
+ $xml = new DOMDocument();
244
+ $xml->load($filename);
245
+
246
+ return $xml->schemaValidate($xsd);
247
+ }
248
+
249
+ /**
250
+ * Return the context default values
251
+ *
252
+ * @todo retrieve these data from the db
253
+ * @return array
254
+ */
255
+ private function getDefaultContext()
256
+ {
257
+ $listStore = array();
258
+ foreach (Mage::app()->getStores() as $store) {
259
+ list($lang) = explode('_', Mage::getStoreConfig('general/locale/code', $store->getId()));
260
+ $listStore[$lang][$store->getId()] = $store;
261
+ }
262
+
263
+ $listContext = array();
264
+ foreach($listStore as $lang => $stores) {
265
+ $defaultOwner = 'AFS@Store for Magento v'.Mage::getConfig()->getNode()->modules->MDN_Antidot->version;
266
+ $context['owner'] = Mage::getStoreConfig('antidot/general/owner') === '' ? $defaultOwner : Mage::getStoreConfig('antidot/general/owner');
267
+ $context['lang'] = $lang;
268
+ $context['stores'] = $stores;
269
+ $context['langs'] = count($listStore);
270
+
271
+ $listContext[] = $context;
272
+ }
273
+
274
+ return $listContext;
275
+ }
276
+
277
+ /**
278
+ * Write message to log
279
+ *
280
+ * @param string $action
281
+ */
282
+ private function log($action)
283
+ {
284
+ $message = '[antidot] ['.$this->type.'] ['.$this->request.'] '
285
+ . memory_get_usage(true).' '
286
+ . $action.' ('.round(microtime(true)-$this->begin, 2)."sec)";
287
+
288
+ Mage::log($message, null, 'antidot.log');
289
+ }
290
  }
app/code/community/MDN/Antidot/Model/Resource/Engine/Antidot.php CHANGED
@@ -150,6 +150,7 @@ class MDN_Antidot_Model_Resource_Engine_Antidot extends MDN_Antidot_Model_Resour
150
  */
151
  protected function prepareFilters($filters)
152
  {
 
153
  $result = array();
154
  if (is_array($filters) && !empty($filters)) {
155
  foreach ($filters as $field => $value) {
@@ -160,7 +161,12 @@ class MDN_Antidot_Model_Resource_Engine_Antidot extends MDN_Antidot_Model_Resour
160
  } else {
161
  $fieldCondition = array();
162
  foreach ($value as $part) {
163
- $fieldCondition = array($field => explode(',', $part));
 
 
 
 
 
164
  break;
165
  }
166
  }
@@ -171,10 +177,25 @@ class MDN_Antidot_Model_Resource_Engine_Antidot extends MDN_Antidot_Model_Resour
171
  $result[] = $fieldCondition;
172
  }
173
  }
174
-
175
  return $result;
176
  }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  /**
179
  * Prepares query response.
180
  *
150
  */
151
  protected function prepareFilters($filters)
152
  {
153
+
154
  $result = array();
155
  if (is_array($filters) && !empty($filters)) {
156
  foreach ($filters as $field => $value) {
161
  } else {
162
  $fieldCondition = array();
163
  foreach ($value as $part) {
164
+ //explode values if facet is multi select
165
+ $isMultiSelect = $this->isMultiSelect($field);
166
+ if ($isMultiSelect)
167
+ $fieldCondition = array($field => explode(',', $part));
168
+ else
169
+ $fieldCondition = array($field => $part);
170
  break;
171
  }
172
  }
177
  $result[] = $fieldCondition;
178
  }
179
  }
180
+
181
  return $result;
182
  }
183
 
184
+ /**
185
+ * Return true if a facet allows multi select
186
+ *
187
+ * @param $field
188
+ */
189
+ public function isMultiSelect($field)
190
+ {
191
+ $facets = Mage::helper('Antidot')->getFacetsFilter();
192
+
193
+ if (isset($facets[$field]))
194
+ return $facets[$field]['multiple'];
195
+
196
+ return false;
197
+ }
198
+
199
  /**
200
  * Prepares query response.
201
  *
app/code/community/MDN/Antidot/Model/Search/Abstract.php CHANGED
@@ -1,56 +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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Search_Abstract extends Mage_Core_Model_Abstract
17
- {
18
- protected $afsService;
19
- protected $afsHost;
20
- protected $afsStatus;
21
-
22
- protected $isConfigured = false;
23
-
24
- /**
25
- * Init Antidot API
26
- */
27
- public function _construct()
28
- {
29
- set_include_path(get_include_path().':'.MAGENTO_ROOT.'/lib/antidot');
30
- require_once "afs_lib.php";
31
-
32
- if($config = Mage::getStoreConfig('antidot/web_service')) {
33
- $this->afsHost = $config['host'];
34
- $this->afsService = (int)$config['service'];
35
- $this->afsStatus = $config['status'];
36
-
37
- $this->isConfigured = true;
38
- }
39
- }
40
-
41
- /**
42
- * Return the user session
43
- *
44
- * @return string
45
- */
46
- protected function getSession()
47
- {
48
- $session = Mage::getSingleton('core/session');
49
- if(!$antidotSession = $session->getData('antidot_session')) {
50
- $antidotSession = uniqid();
51
- $session->setData('antidot_session', $antidotSession);
52
- }
53
-
54
- return $antidotSession;
55
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Search_Abstract extends Mage_Core_Model_Abstract
17
+ {
18
+ protected $afsService;
19
+ protected $afsHost;
20
+ protected $afsStatus;
21
+
22
+ protected $isConfigured = false;
23
+
24
+ /**
25
+ * Init Antidot API
26
+ */
27
+ public function _construct()
28
+ {
29
+ //set_include_path(get_include_path().':'.MAGENTO_ROOT.DS.'lib'.DS.'antidot'.DS);
30
+ require_once "antidot/afs_lib.php";
31
+
32
+ if($config = Mage::getStoreConfig('antidot/web_service')) {
33
+ $this->afsHost = $config['host'];
34
+ $this->afsService = (int)$config['service'];
35
+ $this->afsStatus = $config['status'];
36
+
37
+ $this->isConfigured = true;
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Return the user session
43
+ *
44
+ * @return string
45
+ */
46
+ protected function getSession()
47
+ {
48
+ $session = Mage::getSingleton('core/session');
49
+ if(!$antidotSession = $session->getData('antidot_session')) {
50
+ $antidotSession = uniqid();
51
+ $session->setData('antidot_session', $antidotSession);
52
+ }
53
+
54
+ return $antidotSession;
55
+ }
56
  }
app/code/community/MDN/Antidot/Model/Search/Search.php CHANGED
@@ -1,262 +1,271 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Search_Search extends MDN_Antidot_Model_Search_Abstract
17
- {
18
- /**
19
- * @var string Language used
20
- */
21
- protected $lang;
22
-
23
- /**
24
- * @var array list feed
25
- */
26
- protected $feeds = array('Catalog', 'Promote');
27
-
28
- /**
29
- * @var AfsSearch
30
- */
31
- protected $afsSearch;
32
-
33
- /**
34
- * {@inherit}
35
- */
36
- public function _construct()
37
- {
38
- parent::_construct();
39
-
40
- list($lang) = explode('_', Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId()));
41
- $this->lang = $lang;
42
-
43
- foreach (Mage::getStoreConfig('antidot/engine') as $field => $value) {
44
- if (substr($field, 0, 4) === 'feed' && $value === '1') {
45
- $this->feeds[] = ucfirst(substr($field, 5));
46
- }
47
- }
48
- $this->feeds = array_unique($this->feeds);
49
-
50
- if ($this->isConfigured) {
51
- $this->afsSearch = new AfsSearch($this->afsHost, $this->afsService, $this->afsStatus);
52
- }
53
- }
54
-
55
- /**
56
- * Get the suggest list
57
- *
58
- * @param string $query
59
- */
60
- public function search($search = null, $params = array(), $facetOnly = false)
61
- {
62
- if (!$this->isConfigured) {
63
- return;
64
- }
65
-
66
- if (!$facetOnly) {
67
- $params['filters'][] = array(
68
- 'store' => '"' . Mage::app()->getStore()->getId() . '"',
69
- 'website' => '"' . Mage::app()->getStore()->getWebsiteId() . '"',
70
- );
71
-
72
- if (!isset($params['lang'])) {
73
- $params['lang'] = $this->lang;
74
- }
75
- }
76
-
77
-
78
- $this->afsSearch->set_query($this->getQuery($search, $params));
79
- $results = $this->afsSearch->execute(AfsHelperFormat::HELPERS);
80
- Mage::log(urldecode($this->afsSearch->get_generated_url()), null, 'antidot.log');
81
-
82
- $resultAntidot = new stdClass();
83
- if ($results->in_error()) {
84
- return $resultAntidot;
85
- }
86
-
87
- $resultAntidot->spellcheck = $this->getSpellcheckFromResult($results);
88
- $resultAntidot->promote = $this->getPromoteFromResult($results);
89
- $resultAntidot->replyset = $this->getReplySetFromResult($results);
90
- $resultAntidot->replysetCategories = $this->getReplySetFromResult($results, 'Categories');
91
-
92
- return $resultAntidot;
93
- }
94
-
95
- /**
96
- * Get spellcheck from result
97
- *
98
- * @param StdClass $results
99
- * @return string
100
- */
101
- protected function getSpellcheckFromResult($results)
102
- {
103
- $spellcheck = null;
104
- try {
105
- $spellcheck = $results->get_spellchecks();
106
- if($results->has_spellcheck() && !empty($spellcheck['Catalog'][0])) {
107
- $spellcheck = $spellcheck['Catalog'][0]->get_raw_text();
108
- }
109
- } catch (Exception $e) {
110
- Mage::log($e->getMessage(), null, 'antidot.log');
111
- }
112
-
113
- return $spellcheck;
114
- }
115
-
116
- /**
117
- * Get promote from result
118
- *
119
- * @param StdClass $results
120
- * @return string
121
- */
122
- protected function getPromoteFromResult($results)
123
- {
124
- $promote = null;
125
- try {
126
- $promote = $results->get_promote();
127
- } catch (Exception $e) {
128
- Mage::log($e->getMessage(), null, 'antidot.log');
129
- }
130
-
131
- return $promote;
132
- }
133
-
134
- /**
135
- * Get Replyset from results
136
- *
137
- * @param StdClass $results
138
- * @param string $type Catalog|Product
139
- * @return ReplySetHelper|null
140
- */
141
- protected function getReplySetFromResult($results, $type = 'Catalog')
142
- {
143
- try {
144
- $replyset = $results->get_replyset($type);
145
- } catch (Exception $e) {
146
- Mage::log($e->getMessage(), null, 'antidot.log');
147
- $replyset = null;
148
- }
149
-
150
- return $replyset;
151
- }
152
-
153
- /**
154
- * Return facets list
155
- *
156
- * @return array
157
- */
158
- public function getFacets()
159
- {
160
- $facets = array();
161
-
162
- $resultAntidot = $this->search(null, array('limit' => 1), true);
163
- if (isset($resultAntidot->replyset) && $resultAntidot->replyset) {
164
- foreach ($resultAntidot->replyset->facets as $facet) {
165
- $facets[$facet->id] = $facet;
166
- }
167
- }
168
-
169
- return $facets;
170
- }
171
-
172
- /**
173
- * Prepare the Antidot query
174
- *
175
- * @param string $search
176
- * @param array $params
177
- * @return AfsQuery
178
- */
179
- protected function getQuery($search, $params)
180
- {
181
- $query = new AfsQuery();
182
- $query = $query->set_query($search);
183
- $query = $query->set_session_id($this->getSession());
184
-
185
- foreach ($this->feeds as $feed) {
186
- $query = $query->add_feed($feed);
187
- }
188
-
189
- if (isset($params['lang'])) {
190
- $query = $query->set_lang($params['lang']);
191
- }
192
-
193
- if (isset($params['filters']) && is_array($params['filters'])) {
194
- foreach ($params['filters'] as $filter) {
195
- if (is_array($filter)) {
196
- foreach ($filter as $key => $values) {
197
- $query = $query->add_filter($key, $values);
198
- }
199
- } else {
200
- $query = $query->add_filter($key, $value);
201
- }
202
- }
203
- }
204
-
205
- if (isset($params['sort']) && is_array($params['sort'])) {
206
- foreach($params['sort'] as $sort) {
207
- list($field, $dir) = explode(',', $sort);
208
- $dir = $dir === 'ASC' && $field !== 'afs:relevance' ? AfsSortOrder::ASC : AfsSortOrder::DESC;
209
- $query = $query->add_sort($field, $dir);
210
- }
211
- }
212
-
213
- if (isset($params['limit']) && is_numeric($params['limit'])) {
214
- $query = $query->set_replies((int)$params['limit']);
215
- }
216
-
217
- if (isset($params['page']) && is_numeric($params['page'])) {
218
- $query = $query->set_page((int)$params['page']);
219
- }
220
-
221
- $query = $query->add_log('AFS@Store for Magento v'.Mage::getConfig()->getNode()->modules->MDN_Antidot->version);
222
- $query = $query->add_log('Magento '.Mage::getEdition().' '.Mage::getVersion());
223
-
224
- $query = $this->setSelectionFacets($query);
225
-
226
- $query = $query->set_facets_values_sort_order(AfsFacetValuesSortMode::ITEMS, AfsSortOrder::DESC);
227
-
228
- return $query;
229
- }
230
-
231
- /**
232
- * Set selection facets
233
- *
234
- * @param AFSQuery $query
235
- * return AFSQuery
236
- */
237
- protected function setSelectionFacets($query)
238
- {
239
- $facets = Mage::helper('Antidot')->getFacetsFilter();
240
-
241
- $multiSelectionFacets = array();
242
- $monoSelectionFacets = array();
243
- foreach($facets as $facetId => $facet) {
244
- if($facet['multiple'] === '1') {
245
- $multiSelectionFacets[] = $facetId;
246
- } else {
247
- $monoSelectionFacets[] = $facetId;
248
- }
249
- }
250
-
251
-
252
- if(!empty($multiSelectionFacets)) {
253
- $query = call_user_func_array(array($query, 'set_multi_selection_facets'), $multiSelectionFacets);
254
- }
255
-
256
- if(!empty($monoSelectionFacets)) {
257
- $query = call_user_func_array(array($query, 'set_mono_selection_facets'), $monoSelectionFacets);
258
- }
259
-
260
- return $query;
261
- }
262
- }
 
 
 
 
 
 
 
 
 
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Search_Search extends MDN_Antidot_Model_Search_Abstract
17
+ {
18
+ public static $lastSearchTranslations = array();
19
+
20
+ /**
21
+ * @var string Language used
22
+ */
23
+ protected $lang;
24
+
25
+ /**
26
+ * @var array list feed
27
+ */
28
+ protected $feeds = array('Catalog', 'Promote');
29
+
30
+ /**
31
+ * @var AfsSearch
32
+ */
33
+ protected $afsSearch;
34
+
35
+ /**
36
+ * {@inherit}
37
+ */
38
+ public function _construct()
39
+ {
40
+ parent::_construct();
41
+
42
+ list($lang) = explode('_', Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId()));
43
+ $this->lang = $lang;
44
+
45
+ foreach (Mage::getStoreConfig('antidot/engine') as $field => $value) {
46
+ if (substr($field, 0, 4) === 'feed' && $value === '1') {
47
+ $this->feeds[] = ucfirst(substr($field, 5));
48
+ }
49
+ }
50
+ $this->feeds = array_unique($this->feeds);
51
+
52
+ if ($this->isConfigured) {
53
+ $this->afsSearch = new AfsSearch($this->afsHost, $this->afsService, $this->afsStatus);
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Get the suggest list
59
+ *
60
+ * @param string $query
61
+ */
62
+ public function search($search = null, $params = array(), $facetOnly = false)
63
+ {
64
+ if (!$this->isConfigured) {
65
+ return;
66
+ }
67
+
68
+ if (!$facetOnly) {
69
+ $params['filters'][] = array(
70
+ 'store' => '"' . Mage::app()->getStore()->getId() . '"',
71
+ 'website' => '"' . Mage::app()->getStore()->getWebsiteId() . '"',
72
+ );
73
+
74
+ if (!isset($params['lang'])) {
75
+ $params['lang'] = $this->lang;
76
+ }
77
+ }
78
+
79
+
80
+ $this->afsSearch->set_query($this->getQuery($search, $params));
81
+ $results = $this->afsSearch->execute(AfsHelperFormat::HELPERS);
82
+ Mage::log(urldecode($this->afsSearch->get_generated_url()), null, 'antidot.log');
83
+
84
+ $resultAntidot = new stdClass();
85
+ if ($results->in_error()) {
86
+ return $resultAntidot;
87
+ }
88
+
89
+ $resultAntidot->spellcheck = $this->getSpellcheckFromResult($results);
90
+ $resultAntidot->promote = $this->getPromoteFromResult($results);
91
+ $resultAntidot->replyset = $this->getReplySetFromResult($results);
92
+ $resultAntidot->replysetCategories = $this->getReplySetFromResult($results, 'Categories');
93
+
94
+ //save translations
95
+ foreach($resultAntidot->replyset->facets as $item)
96
+ {
97
+ self::$lastSearchTranslations[$item->id] = $item->label;
98
+ }
99
+
100
+ return $resultAntidot;
101
+ }
102
+
103
+ /**
104
+ * Get spellcheck from result
105
+ *
106
+ * @param StdClass $results
107
+ * @return string
108
+ */
109
+ protected function getSpellcheckFromResult($results)
110
+ {
111
+ $spellcheck = null;
112
+ try {
113
+ $spellcheck = $results->get_spellchecks();
114
+ if($results->has_spellcheck() && !empty($spellcheck['Catalog'][0])) {
115
+ $spellcheck = $spellcheck['Catalog'][0]->get_raw_text();
116
+ }
117
+ } catch (Exception $e) {
118
+ Mage::log($e->getMessage(), null, 'antidot.log');
119
+ }
120
+
121
+ return $spellcheck;
122
+ }
123
+
124
+ /**
125
+ * Get promote from result
126
+ *
127
+ * @param StdClass $results
128
+ * @return string
129
+ */
130
+ protected function getPromoteFromResult($results)
131
+ {
132
+ $promote = null;
133
+ try {
134
+ $promote = $results->get_promote();
135
+ } catch (Exception $e) {
136
+ Mage::log($e->getMessage(), null, 'antidot.log');
137
+ }
138
+
139
+ return $promote;
140
+ }
141
+
142
+ /**
143
+ * Get Replyset from results
144
+ *
145
+ * @param StdClass $results
146
+ * @param string $type Catalog|Product
147
+ * @return ReplySetHelper|null
148
+ */
149
+ protected function getReplySetFromResult($results, $type = 'Catalog')
150
+ {
151
+ try {
152
+ $replyset = $results->get_replyset($type);
153
+ } catch (Exception $e) {
154
+ Mage::log($e->getMessage(), null, 'antidot.log');
155
+ $replyset = null;
156
+ }
157
+
158
+ return $replyset;
159
+ }
160
+
161
+ /**
162
+ * Return facets list
163
+ *
164
+ * @return array
165
+ */
166
+ public function getFacets()
167
+ {
168
+ $facets = array();
169
+
170
+ $resultAntidot = $this->search(null, array('limit' => 1), true);
171
+ if (isset($resultAntidot->replyset) && $resultAntidot->replyset) {
172
+ foreach ($resultAntidot->replyset->facets as $facet) {
173
+ $facets[$facet->id] = $facet;
174
+ }
175
+ }
176
+
177
+ return $facets;
178
+ }
179
+
180
+ /**
181
+ * Prepare the Antidot query
182
+ *
183
+ * @param string $search
184
+ * @param array $params
185
+ * @return AfsQuery
186
+ */
187
+ protected function getQuery($search, $params)
188
+ {
189
+ $query = new AfsQuery();
190
+ $query = $query->set_query($search);
191
+ $query = $query->set_session_id($this->getSession());
192
+
193
+ foreach ($this->feeds as $feed) {
194
+ $query = $query->add_feed($feed);
195
+ }
196
+
197
+ if (isset($params['lang'])) {
198
+ $query = $query->set_lang($params['lang']);
199
+ }
200
+
201
+ if (isset($params['filters']) && is_array($params['filters'])) {
202
+ foreach ($params['filters'] as $filter) {
203
+ if (is_array($filter)) {
204
+ foreach ($filter as $key => $values) {
205
+ $query = $query->add_filter($key, $values);
206
+ }
207
+ } else {
208
+ //$query = $query->add_filter($key, $value);
209
+ }
210
+ }
211
+ }
212
+
213
+ if (isset($params['sort']) && is_array($params['sort'])) {
214
+ foreach($params['sort'] as $sort) {
215
+ list($field, $dir) = explode(',', $sort);
216
+ $dir = $dir === 'ASC' && $field !== 'afs:relevance' ? AfsSortOrder::ASC : AfsSortOrder::DESC;
217
+ $query = $query->add_sort($field, $dir);
218
+ }
219
+ }
220
+
221
+ if (isset($params['limit']) && is_numeric($params['limit'])) {
222
+ $query = $query->set_replies((int)$params['limit']);
223
+ }
224
+
225
+ if (isset($params['page']) && is_numeric($params['page'])) {
226
+ $query = $query->set_page((int)$params['page']);
227
+ }
228
+
229
+ $query = $query->add_log('AFS@Store for Magento v'.Mage::getConfig()->getNode()->modules->MDN_Antidot->version);
230
+ $query = $query->add_log('Magento '.Mage::getEdition().' '.Mage::getVersion());
231
+
232
+ $query = $this->setSelectionFacets($query);
233
+
234
+ $query = $query->set_facets_values_sort_order(AfsFacetValuesSortMode::ITEMS, AfsSortOrder::DESC);
235
+
236
+ return $query;
237
+ }
238
+
239
+ /**
240
+ * Set selection facets
241
+ *
242
+ * @param AFSQuery $query
243
+ * return AFSQuery
244
+ */
245
+ protected function setSelectionFacets($query)
246
+ {
247
+ $facets = Mage::helper('Antidot')->getFacetsFilter();
248
+
249
+ $multiSelectionFacets = array();
250
+ $monoSelectionFacets = array();
251
+ foreach($facets as $facetId => $facet) {
252
+ if (!$facetId)
253
+ continue;
254
+ if($facet['multiple'] === '1') {
255
+ $multiSelectionFacets[] = $facetId;
256
+ } else {
257
+ $monoSelectionFacets[] = $facetId;
258
+ }
259
+ }
260
+
261
+ if(!empty($multiSelectionFacets)) {
262
+ $query = call_user_func_array(array($query, 'set_multi_selection_facets'), $multiSelectionFacets);
263
+ }
264
+
265
+ if(!empty($monoSelectionFacets)) {
266
+ $query = call_user_func_array(array($query, 'set_mono_selection_facets'), $monoSelectionFacets);
267
+ }
268
+
269
+ return $query;
270
+ }
271
+ }
app/code/community/MDN/Antidot/Model/Search/Suggest.php CHANGED
@@ -1,321 +1,321 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Search_Suggest extends MDN_Antidot_Model_Search_Abstract
17
- {
18
-
19
- const URI = 'http://%s/acp?afs:service=%s&afs:status=%s&afs:feed=%s&afs:query=%s&afs:sessionId=%s';
20
-
21
- /**
22
- * List feeds to use for the query sprintf($feed, website_id, lang)
23
- *
24
- * @var array
25
- */
26
- private $feed = array(
27
- 'products' => array(
28
- 'prefix' => 'featured_products_',
29
- 'tpl' => 'featured_products_%d_%s',
30
- 'number' => 5,
31
- ),
32
- 'categories' => array(
33
- 'prefix' => 'categories_',
34
- 'tpl' => 'categories_%d_%s',
35
- 'number' => 5,
36
- ),
37
- 'brands' => array(
38
- 'prefix' => 'brands_',
39
- 'tpl' => 'brands_%d_%s',
40
- 'number' => 5,
41
- ),
42
- );
43
-
44
- /**
45
- * @var array Types sorted
46
- */
47
- protected $typeOrder = array();
48
-
49
- /**
50
- * Xslt Template
51
- *
52
- * @var string
53
- */
54
- protected $template;
55
-
56
- /**
57
- * {@inherit}
58
- */
59
- public function _construct()
60
- {
61
- parent::_construct();
62
-
63
- $config = Mage::getStoreConfig('antidot/suggest');
64
- $this->template = trim($config['template']);
65
- foreach($config as $field => $value) {
66
- if(isset($this->feed[$field]) && $value === '0') {
67
- unset($this->feed[$field]);
68
- } elseif(preg_match('/([a-z]+)_displayed/', $field, $matches)) {
69
- $field = $matches[1];
70
- if(isset($this->feed[$field])) {
71
- $this->feed[$field]['number'] = (int)$value;
72
- }
73
- } elseif(preg_match('/order_([0-4])/', $field, $matches)) {
74
- $order = $matches[1];
75
- $this->typeOrder[$value] = $order;
76
- }
77
- }
78
- $this->loadFacetAutocomplete();
79
- }
80
-
81
- /**
82
- * @return array
83
- */
84
- protected function loadFacetAutocomplete()
85
- {
86
- $facets = @unserialize(Mage::getStoreConfig('antidot/fields_product/properties'));
87
- foreach($facets as $facet) {
88
- if($facet['autocomplete'] === '1') {
89
- $this->feed['property_'.$facet['value']] = array(
90
- 'prefix' => 'property_'.$facet['value'].'_',
91
- 'tpl' => 'property_'.$facet['value'].'_%d_%s',
92
- 'number' => 5,
93
- );
94
- }
95
- }
96
- }
97
-
98
- /**
99
- * Get the suggest list
100
- *
101
- * @param string $query
102
- * @param string $format
103
- */
104
- public function get($query, $format = 'html')
105
- {
106
- $url = $this->buildUrl($query);
107
- Mage::log($url, null, 'antidot.log');
108
- if(!$content = file_get_contents($url)) {
109
- $response = array();
110
- } elseif(!$response = json_decode($content, true)) {
111
- $response = array();
112
- }
113
-
114
- $xml = $this->getXmlSuggest($response, $query);
115
- if($format === 'xml') {
116
- $this->displayXml($xml);
117
- }
118
-
119
- return $this->transformToXml($xml);
120
- }
121
-
122
- /**
123
- * Display xml
124
- *
125
- * @param string $xml
126
- */
127
- private function displayXml($xml)
128
- {
129
- header ("Content-Type:text/xml");
130
- echo $xml;
131
- exit(0);
132
- }
133
-
134
- /**
135
- * Build url to request AFS
136
- *
137
- * @param string $query
138
- * @return string
139
- */
140
- protected function buildUrl($query)
141
- {
142
- return sprintf(
143
- static::URI,
144
- $this->afsHost,
145
- $this->afsService,
146
- $this->afsStatus,
147
- $this->getFeeds(),
148
- urlencode($query),
149
- $this->getSession());
150
-
151
- }
152
-
153
- /**
154
- * Extract the items from response
155
- *
156
- * @param array $response
157
- * @return array
158
- */
159
- protected function getXmlSuggest($response, $query)
160
- {
161
- $xml = Mage::helper('Antidot/XmlWriter');
162
- $xml->init();
163
-
164
- $ns = array(
165
- 'xmlns:afs' => 'http://ref.antidot.net/v7/afs#',
166
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
167
- 'xsi:schemaLocation' => 'http://ref.antidot.net/v7/afs# http://ref.antidot.net/v7.7/acp-reply.xsd'
168
- );
169
- $xml->push('afs:replies', $ns);
170
-
171
- $xml->push('afs:header');
172
- $xml->emptyElement('afs:query', array('textQuery' => htmlentities($query)));
173
- $xml->pop();
174
-
175
- if(!is_numeric(key($response))) {
176
- $response = $this->setOrders($response);
177
- foreach($response as &$responseOrder) {
178
- $type = key($responseOrder);
179
- $data = current($responseOrder);
180
- $feed = $this->getFeed($type);
181
-
182
- $currentItems = 0;
183
- $xml->push('afs:replySet', array('name' => $type));
184
- $xml->emptyElement('afs:meta', array('uri' => $type, 'producer' => 'acp', 'totalItems' => count($data[2])));
185
- foreach($data[2] as $key => &$item) {
186
- $xml->push('afs:reply', array('label' => $data[1][$key]));
187
- $this->writeOptions($xml, $item);
188
- $xml->pop();
189
- if(++$currentItems >= $feed['number']) {
190
- break;
191
- }
192
- }
193
- $xml->pop();
194
- }
195
- }
196
- $xml->pop();
197
-
198
- return $xml->getXml();
199
- }
200
-
201
- /**
202
- * Write suggest options
203
- *
204
- * @param XmlWriter $xml
205
- * @param array $items
206
- */
207
- protected function writeOptions($xml, $item)
208
- {
209
- foreach($item as $field => $value) {
210
- if(is_array($value)) {
211
- $this->writeOptions($xml, $value);
212
- continue;
213
- }
214
-
215
- $attributes = array(
216
- 'key' => $field,
217
- 'value' => str_replace('&', '&amp;', html_entity_decode($value)),
218
- );
219
- $xml->emptyelement('afs:option', $attributes);
220
- }
221
- }
222
-
223
- /**
224
- * Set response order
225
- *
226
- * @param array $response
227
- * @return array
228
- */
229
- protected function setOrders($response)
230
- {
231
- // set orders
232
- $types = array();
233
- foreach($response as $type => $data) {
234
- $feed = $this->getFeedKey($type);
235
- if(array_key_exists($feed, $this->typeOrder)) {
236
- $types[$this->typeOrder[$feed]][$type] = $data;
237
- unset($response[$type]);
238
- }
239
- }
240
-
241
- foreach($response as $type => $data) {
242
- $types[][$type] = $data;
243
- }
244
-
245
- ksort($types);
246
- return $types;
247
- }
248
-
249
-
250
- /**
251
- * Build the feed param
252
- *
253
- * @return string
254
- */
255
- protected function getFeeds()
256
- {
257
- list($lang) = explode('_', Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId()));
258
-
259
- $feeds = '';
260
- foreach($this->feed as $feed) {
261
- $id = substr($feed['prefix'], 0, 18) !== 'featured_products_' ? Mage::app()->getStore()->getWebsiteId() : Mage::app()->getStore()->getId();
262
- $feeds.= empty($feeds) ? '' : '-';
263
- $feeds.= sprintf($feed['tpl'], $id, $lang);
264
- }
265
-
266
- return $feeds;
267
- }
268
-
269
- /**
270
- * Get feed by type
271
- *
272
- * @param string $type
273
- * @return array
274
- */
275
- protected function getFeed($type)
276
- {
277
- foreach($this->feed as $feed) {
278
- if(strpos($type, $feed['prefix']) !== false) {
279
- return $feed;
280
- }
281
- }
282
- }
283
-
284
- /**
285
- * Get the key feed
286
- *
287
- * @param string $type
288
- * @return string
289
- */
290
- protected function getFeedKey($type)
291
- {
292
- foreach($this->feed as $key => $feed) {
293
- if(strpos($type, $feed['prefix']) !== false) {
294
- return $key;
295
- }
296
- }
297
- }
298
-
299
- /**
300
- * Format the response to html format
301
- *
302
- * @param string $suggestXml Response from AFS formated
303
- * @return string
304
- */
305
- protected function transformToXml($suggestXml)
306
- {
307
- libxml_use_internal_errors(true);
308
- $xml = simplexml_load_string($suggestXml);
309
- $xsl = simplexml_load_string($this->template);
310
-
311
- $xslt = new XSLTProcessor();
312
- $xslt->importStylesheet($xsl);
313
-
314
- if(!$xml = $xslt->transformToXml($xml)) {
315
- Mage::log(print_r(libxml_get_errors(), true), null, 'antidot.log');
316
- return '';
317
- }
318
-
319
- return str_replace('<?xml version="1.0"?>', '', $xml);
320
- }
321
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Search_Suggest extends MDN_Antidot_Model_Search_Abstract
17
+ {
18
+
19
+ const URI = 'http://%s/acp?afs:service=%s&afs:status=%s&afs:feed=%s&afs:query=%s&afs:sessionId=%s';
20
+
21
+ /**
22
+ * List feeds to use for the query sprintf($feed, website_id, lang)
23
+ *
24
+ * @var array
25
+ */
26
+ private $feed = array(
27
+ 'products' => array(
28
+ 'prefix' => 'featured_products_',
29
+ 'tpl' => 'featured_products_%d_%s',
30
+ 'number' => 5,
31
+ ),
32
+ 'categories' => array(
33
+ 'prefix' => 'categories_',
34
+ 'tpl' => 'categories_%d_%s',
35
+ 'number' => 5,
36
+ ),
37
+ 'brands' => array(
38
+ 'prefix' => 'brands_',
39
+ 'tpl' => 'brands_%d_%s',
40
+ 'number' => 5,
41
+ ),
42
+ );
43
+
44
+ /**
45
+ * @var array Types sorted
46
+ */
47
+ protected $typeOrder = array();
48
+
49
+ /**
50
+ * Xslt Template
51
+ *
52
+ * @var string
53
+ */
54
+ protected $template;
55
+
56
+ /**
57
+ * {@inherit}
58
+ */
59
+ public function _construct()
60
+ {
61
+ parent::_construct();
62
+
63
+ $config = Mage::getStoreConfig('antidot/suggest');
64
+ $this->template = trim($config['template']);
65
+ foreach($config as $field => $value) {
66
+ if(isset($this->feed[$field]) && $value === '0') {
67
+ unset($this->feed[$field]);
68
+ } elseif(preg_match('/([a-z]+)_displayed/', $field, $matches)) {
69
+ $field = $matches[1];
70
+ if(isset($this->feed[$field])) {
71
+ $this->feed[$field]['number'] = (int)$value;
72
+ }
73
+ } elseif(preg_match('/order_([0-4])/', $field, $matches)) {
74
+ $order = $matches[1];
75
+ $this->typeOrder[$value] = $order;
76
+ }
77
+ }
78
+ $this->loadFacetAutocomplete();
79
+ }
80
+
81
+ /**
82
+ * @return array
83
+ */
84
+ protected function loadFacetAutocomplete()
85
+ {
86
+ $facets = @unserialize(Mage::getStoreConfig('antidot/fields_product/properties'));
87
+ foreach($facets as $facet) {
88
+ if($facet['autocomplete'] === '1') {
89
+ $this->feed['property_'.$facet['value']] = array(
90
+ 'prefix' => 'property_'.$facet['value'].'_',
91
+ 'tpl' => 'property_'.$facet['value'].'_%d_%s',
92
+ 'number' => 5,
93
+ );
94
+ }
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Get the suggest list
100
+ *
101
+ * @param string $query
102
+ * @param string $format
103
+ */
104
+ public function get($query, $format = 'html')
105
+ {
106
+ $url = $this->buildUrl($query);
107
+ Mage::log($url, null, 'antidot.log');
108
+ if(!$content = file_get_contents($url)) {
109
+ $response = array();
110
+ } elseif(!$response = json_decode($content, true)) {
111
+ $response = array();
112
+ }
113
+
114
+ $xml = $this->getXmlSuggest($response, $query);
115
+ if($format === 'xml') {
116
+ $this->displayXml($xml);
117
+ }
118
+
119
+ return $this->transformToXml($xml);
120
+ }
121
+
122
+ /**
123
+ * Display xml
124
+ *
125
+ * @param string $xml
126
+ */
127
+ private function displayXml($xml)
128
+ {
129
+ header ("Content-Type:text/xml");
130
+ echo $xml;
131
+ exit(0);
132
+ }
133
+
134
+ /**
135
+ * Build url to request AFS
136
+ *
137
+ * @param string $query
138
+ * @return string
139
+ */
140
+ protected function buildUrl($query)
141
+ {
142
+ $url = sprintf(
143
+ static::URI,
144
+ $this->afsHost,
145
+ $this->afsService,
146
+ $this->afsStatus,
147
+ $this->getFeeds(),
148
+ urlencode($query),
149
+ $this->getSession());
150
+ return $url;
151
+ }
152
+
153
+ /**
154
+ * Extract the items from response
155
+ *
156
+ * @param array $response
157
+ * @return array
158
+ */
159
+ protected function getXmlSuggest($response, $query)
160
+ {
161
+ $xml = Mage::helper('Antidot/XmlWriter');
162
+ $xml->init();
163
+
164
+ $ns = array(
165
+ 'xmlns:afs' => 'http://ref.antidot.net/v7/afs#',
166
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
167
+ 'xsi:schemaLocation' => 'http://ref.antidot.net/v7/afs# http://ref.antidot.net/v7.7/acp-reply.xsd'
168
+ );
169
+ $xml->push('afs:replies', $ns);
170
+
171
+ $xml->push('afs:header');
172
+ $xml->emptyElement('afs:query', array('textQuery' => htmlentities($query)));
173
+ $xml->pop();
174
+
175
+ if(!is_numeric(key($response))) {
176
+ $response = $this->setOrders($response);
177
+ foreach($response as &$responseOrder) {
178
+ $type = key($responseOrder);
179
+ $data = current($responseOrder);
180
+ $feed = $this->getFeed($type);
181
+
182
+ $currentItems = 0;
183
+ $xml->push('afs:replySet', array('name' => $type));
184
+ $xml->emptyElement('afs:meta', array('uri' => $type, 'producer' => 'acp', 'totalItems' => count($data[2])));
185
+ foreach($data[2] as $key => &$item) {
186
+ $xml->push('afs:reply', array('label' => $data[1][$key]));
187
+ $this->writeOptions($xml, $item);
188
+ $xml->pop();
189
+ if(++$currentItems >= $feed['number']) {
190
+ break;
191
+ }
192
+ }
193
+ $xml->pop();
194
+ }
195
+ }
196
+ $xml->pop();
197
+
198
+ return $xml->getXml();
199
+ }
200
+
201
+ /**
202
+ * Write suggest options
203
+ *
204
+ * @param XmlWriter $xml
205
+ * @param array $items
206
+ */
207
+ protected function writeOptions($xml, $item)
208
+ {
209
+ foreach($item as $field => $value) {
210
+ if(is_array($value)) {
211
+ $this->writeOptions($xml, $value);
212
+ continue;
213
+ }
214
+
215
+ $attributes = array(
216
+ 'key' => $field,
217
+ 'value' => str_replace('&', '&amp;', html_entity_decode($value)),
218
+ );
219
+ $xml->emptyelement('afs:option', $attributes);
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Set response order
225
+ *
226
+ * @param array $response
227
+ * @return array
228
+ */
229
+ protected function setOrders($response)
230
+ {
231
+ // set orders
232
+ $types = array();
233
+ foreach($response as $type => $data) {
234
+ $feed = $this->getFeedKey($type);
235
+ if(array_key_exists($feed, $this->typeOrder)) {
236
+ $types[$this->typeOrder[$feed]][$type] = $data;
237
+ unset($response[$type]);
238
+ }
239
+ }
240
+
241
+ foreach($response as $type => $data) {
242
+ $types[][$type] = $data;
243
+ }
244
+
245
+ ksort($types);
246
+ return $types;
247
+ }
248
+
249
+
250
+ /**
251
+ * Build the feed param
252
+ *
253
+ * @return string
254
+ */
255
+ protected function getFeeds()
256
+ {
257
+ list($lang) = explode('_', Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId()));
258
+
259
+ $feeds = '';
260
+ foreach($this->feed as $feed) {
261
+ $id = substr($feed['prefix'], 0, 18) !== 'featured_products_' ? Mage::app()->getStore()->getWebsiteId() : Mage::app()->getStore()->getId();
262
+ $feeds.= empty($feeds) ? '' : '&afs:feed='; //for AFS engine v7.7
263
+ $feeds.= sprintf($feed['tpl'], $id, $lang);
264
+ }
265
+
266
+ return $feeds;
267
+ }
268
+
269
+ /**
270
+ * Get feed by type
271
+ *
272
+ * @param string $type
273
+ * @return array
274
+ */
275
+ protected function getFeed($type)
276
+ {
277
+ foreach($this->feed as $feed) {
278
+ if(strpos($type, $feed['prefix']) !== false) {
279
+ return $feed;
280
+ }
281
+ }
282
+ }
283
+
284
+ /**
285
+ * Get the key feed
286
+ *
287
+ * @param string $type
288
+ * @return string
289
+ */
290
+ protected function getFeedKey($type)
291
+ {
292
+ foreach($this->feed as $key => $feed) {
293
+ if(strpos($type, $feed['prefix']) !== false) {
294
+ return $key;
295
+ }
296
+ }
297
+ }
298
+
299
+ /**
300
+ * Format the response to html format
301
+ *
302
+ * @param string $suggestXml Response from AFS formated
303
+ * @return string
304
+ */
305
+ protected function transformToXml($suggestXml)
306
+ {
307
+ libxml_use_internal_errors(true);
308
+ $xml = simplexml_load_string($suggestXml);
309
+ $xsl = simplexml_load_string($this->template);
310
+
311
+ $xslt = new XSLTProcessor();
312
+ $xslt->importStylesheet($xsl);
313
+
314
+ if(!$xml = $xslt->transformToXml($xml)) {
315
+ Mage::log(print_r(libxml_get_errors(), true), null, 'antidot.log');
316
+ return '';
317
+ }
318
+
319
+ return str_replace('<?xml version="1.0"?>', '', $xml);
320
+ }
321
+ }
app/code/community/MDN/Antidot/Model/System/Config/ArticleAttribute.php CHANGED
@@ -1,49 +1,49 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_System_Config_ArticleAttribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
17
- {
18
- protected $options = false;
19
-
20
- /**
21
- * {@inherit}
22
- */
23
- public function getAllOptions()
24
- {
25
- if (!$this->_options) {
26
- $pageCollection = Mage::getModel('cms/page')->getCollection();
27
- foreach($pageCollection as $page) {
28
- $attributes = array_keys($page->get());
29
- break;
30
- }
31
-
32
- $options = array();
33
- foreach ($attributes as $code) {
34
- $options[] = array('value' => $code, 'label' => $code);
35
- }
36
-
37
- $this->_options = $options;
38
- }
39
- return $this->_options;
40
- }
41
-
42
- /**
43
- * {@inherit}
44
- */
45
- public function toOptionArray()
46
- {
47
- return $this->getAllOptions();
48
- }
49
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_System_Config_ArticleAttribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
17
+ {
18
+ protected $options = false;
19
+
20
+ /**
21
+ * {@inherit}
22
+ */
23
+ public function getAllOptions()
24
+ {
25
+ if (!$this->_options) {
26
+ $pageCollection = Mage::getModel('cms/page')->getCollection();
27
+ foreach($pageCollection as $page) {
28
+ $attributes = array_keys($page->get());
29
+ break;
30
+ }
31
+
32
+ $options = array();
33
+ foreach ($attributes as $code) {
34
+ $options[] = array('value' => $code, 'label' => $code);
35
+ }
36
+
37
+ $this->_options = $options;
38
+ }
39
+ return $this->_options;
40
+ }
41
+
42
+ /**
43
+ * {@inherit}
44
+ */
45
+ public function toOptionArray()
46
+ {
47
+ return $this->getAllOptions();
48
+ }
49
  }
app/code/community/MDN/Antidot/Model/System/Config/CategoryAttribute.php CHANGED
@@ -1,78 +1,78 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_System_Config_CategoryAttribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
17
- {
18
- protected $options = false;
19
-
20
- /**
21
- * @var array Attribute type
22
- */
23
- protected $attributesType = array(
24
- 'name' => 'text',
25
- 'description' => array('text', 'textarea'),
26
- 'keywords' => array('text', 'textarea'),
27
- );
28
-
29
- public function getAllOptions() {}
30
-
31
- /**
32
- * {@inherit}
33
- */
34
- public function _getAllOptions($type)
35
- {
36
- if (!$this->_options) {
37
- $this->_options = array();
38
- foreach($this->getActiveCategories() as $category) {
39
- foreach($category->getAttributes() as $attribute) {
40
- if(in_array($attribute->getFrontendInput(), (array)$type)) {
41
- $this->_options[$attribute->getAttributeCode()] = array('value' => $attribute->getAttributeCode(), 'label' => $attribute->getName());
42
- }
43
- }
44
- }
45
- }
46
-
47
- return $this->_options;
48
- }
49
-
50
- /**
51
- * Return the active categories
52
- *
53
- * @return Collection
54
- */
55
- protected function getActiveCategories()
56
- {
57
- return Mage::getModel('catalog/category')
58
- ->getCollection()
59
- ->addAttributeToSelect('*')
60
- ->addAttributeToFilter('is_active', 1);
61
- }
62
-
63
- /**
64
- * {@inherit}
65
- */
66
- public function toOptionArray($elementName)
67
- {
68
- $type = null;
69
- if(preg_match('/groups\[fields_category\]\[fields\]\[([a-zA-Z0-9_]+)\]\[value\]/', $elementName, $matches)) {
70
- $field = $matches[1];
71
- if(isset($this->attributesType[$field])) {
72
- $type = $this->attributesType[$field];
73
- }
74
- }
75
-
76
- return $this->_getAllOptions($type);
77
- }
78
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_System_Config_CategoryAttribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
17
+ {
18
+ protected $options = false;
19
+
20
+ /**
21
+ * @var array Attribute type
22
+ */
23
+ protected $attributesType = array(
24
+ 'name' => 'text',
25
+ 'description' => array('text', 'textarea'),
26
+ 'keywords' => array('text', 'textarea'),
27
+ );
28
+
29
+ public function getAllOptions() {}
30
+
31
+ /**
32
+ * {@inherit}
33
+ */
34
+ public function _getAllOptions($type)
35
+ {
36
+ if (!$this->_options) {
37
+ $this->_options = array();
38
+ foreach($this->getActiveCategories() as $category) {
39
+ foreach($category->getAttributes() as $attribute) {
40
+ if(in_array($attribute->getFrontendInput(), (array)$type)) {
41
+ $this->_options[$attribute->getAttributeCode()] = array('value' => $attribute->getAttributeCode(), 'label' => $attribute->getName());
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ return $this->_options;
48
+ }
49
+
50
+ /**
51
+ * Return the active categories
52
+ *
53
+ * @return Collection
54
+ */
55
+ protected function getActiveCategories()
56
+ {
57
+ return Mage::getModel('catalog/category')
58
+ ->getCollection()
59
+ ->addAttributeToSelect('*')
60
+ ->addAttributeToFilter('is_active', 1);
61
+ }
62
+
63
+ /**
64
+ * {@inherit}
65
+ */
66
+ public function toOptionArray($elementName)
67
+ {
68
+ $type = null;
69
+ if(preg_match('/groups\[fields_category\]\[fields\]\[([a-zA-Z0-9_]+)\]\[value\]/', $elementName, $matches)) {
70
+ $field = $matches[1];
71
+ if(isset($this->attributesType[$field])) {
72
+ $type = $this->attributesType[$field];
73
+ }
74
+ }
75
+
76
+ return $this->_getAllOptions($type);
77
+ }
78
  }
app/code/community/MDN/Antidot/Model/System/Config/Facet.php CHANGED
@@ -30,10 +30,13 @@ class MDN_Antidot_Model_System_Config_Facet
30
  $this->options = array();
31
  foreach($search->getFacets() as $facetId => $facet) {
32
  if($typeExclude === null || $facet->get_type() !== $typeExclude) {
33
- $this->options[] = array('value' => $facetId.'|'.$facet->label, 'label' => $facet->label.' ('.$facet->get_type().')');
34
  }
35
  }
36
 
 
 
 
37
  return $this->options;
38
  } catch(Exception $e) {
39
  $this->options = array();
@@ -42,4 +45,14 @@ class MDN_Antidot_Model_System_Config_Facet
42
 
43
  return $this->options;
44
  }
 
 
 
 
 
 
 
 
 
 
45
  }
30
  $this->options = array();
31
  foreach($search->getFacets() as $facetId => $facet) {
32
  if($typeExclude === null || $facet->get_type() !== $typeExclude) {
33
+ $this->options[] = array('value' => $facetId.'|'.$facet->label, 'label' => $facetId.' ('.$facet->get_type().')');
34
  }
35
  }
36
 
37
+ //sort facets
38
+ usort($this->options, array("MDN_Antidot_Model_System_Config_Facet", "sortFacetPerLabel"));
39
+
40
  return $this->options;
41
  } catch(Exception $e) {
42
  $this->options = array();
45
 
46
  return $this->options;
47
  }
48
+
49
+ public static function sortFacetPerLabel($a, $b)
50
+ {
51
+ $al = $a['label'];
52
+ $bl = $b['label'];
53
+ if ($al == $bl) {
54
+ return 0;
55
+ }
56
+ return ($al > $bl) ? +1 : -1;
57
+ }
58
  }
app/code/community/MDN/Antidot/Model/System/Config/ProductAttribute.php CHANGED
@@ -1,103 +1,104 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_System_Config_ProductAttribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
17
- {
18
- protected $options = false;
19
-
20
- /**
21
- * @var array Attribute type
22
- */
23
- protected $attributesType = array(
24
- 'name' => 'text',
25
- 'short_name' => 'text',
26
- 'description' => array('text', 'textarea'),
27
- 'keywords' => array('text', 'textarea'),
28
- 'is_promotional' => 'boolean',
29
- 'is_new' => 'boolean',
30
- 'is_best_sale' => 'boolean',
31
- 'is_featured' => 'boolean',
32
- 'materials' => array('text', 'select'),
33
- 'colors' => array('text', 'select'),
34
- 'models' => array('text', 'select'),
35
- 'sizes' => array('text', 'select'),
36
- 'manufacturer' => array('text', 'select'),
37
- 'reseller' => 'text',
38
- 'supplier' => 'text',
39
- 'gtin' => 'text',
40
- 'identifier' => 'text',
41
- 'misc' => 'text',
42
- 'properties' => 'text',
43
- );
44
-
45
- public function getAllOptions() {}
46
-
47
- /**
48
- * {@inherit}
49
- */
50
- public function _getAllOptions($type)
51
- {
52
- $key = md5(serialize((array)$type));
53
- if (!$this->_options[$key]) {
54
- $options[] = array('value' => '', 'label' => '');
55
- if($type === null || in_array('text', (array)$type)) {
56
- $options[] = array('value' => 'sku', 'label' => 'sku');
57
- }
58
-
59
- foreach ($this->getAttributes($type) as $attribute) {
60
- $options[] = array(
61
- 'value' => $attribute->getAttributeCode(),
62
- 'label' => $attribute->getName(),
63
- );
64
- }
65
-
66
- $this->_options[$key] = $options;
67
- }
68
- return $this->_options[$key];
69
- }
70
-
71
- /**
72
- * {@inherit}
73
- */
74
- protected function getAttributes($type)
75
- {
76
- $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getId();
77
- $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
78
- ->setEntityTypeFilter($entityTypeId)
79
- ->addFieldToFilter('backend_type', array('neq' => 'static'));
80
-
81
- if($type !== null) {
82
- $attributes->addFieldToFilter('frontend_input', array('in' => (array)$type));
83
- }
84
-
85
- return $attributes;
86
- }
87
-
88
- /**
89
- * {@inherit}
90
- */
91
- public function toOptionArray($elementName)
92
- {
93
- $type = null;
94
- if(preg_match('/groups\[fields_product\]\[fields\]\[([a-zA-Z0-9_]+)\]\[value\]/', $elementName, $matches)) {
95
- $field = $matches[1];
96
- if(isset($this->attributesType[$field])) {
97
- $type = $this->attributesType[$field];
98
- }
99
- }
100
-
101
- return $this->_getAllOptions($type);
102
- }
 
103
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_System_Config_ProductAttribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
17
+ {
18
+ protected $options = false;
19
+
20
+ /**
21
+ * @var array Attribute type
22
+ */
23
+ protected $attributesType = array(
24
+ 'name' => 'text',
25
+ 'short_name' => 'text',
26
+ 'description' => array('text', 'textarea'),
27
+ 'keywords' => array('text', 'textarea'),
28
+ 'is_promotional' => 'boolean',
29
+ 'is_new' => 'boolean',
30
+ 'is_best_sale' => 'boolean',
31
+ 'is_featured' => 'boolean',
32
+ 'materials' => array('text', 'select'),
33
+ 'colors' => array('text', 'select'),
34
+ 'models' => array('text', 'select'),
35
+ 'sizes' => array('text', 'select'),
36
+ 'manufacturer' => array('text', 'select'),
37
+ 'reseller' => 'text',
38
+ 'supplier' => 'text',
39
+ 'gtin' => 'text',
40
+ 'identifier' => 'text',
41
+ 'misc' => 'text',
42
+ 'properties' => 'text',
43
+ );
44
+
45
+ public function getAllOptions() {}
46
+
47
+ /**
48
+ * {@inherit}
49
+ */
50
+ public function _getAllOptions($type)
51
+ {
52
+ $key = md5(serialize((array)$type));
53
+ if (!$this->_options[$key]) {
54
+ $options[] = array('value' => '', 'label' => '');
55
+ if($type === null || in_array('text', (array)$type)) {
56
+ $options[] = array('value' => 'sku', 'label' => 'sku');
57
+ }
58
+
59
+ foreach ($this->getAttributes($type) as $attribute) {
60
+ $options[] = array(
61
+ 'value' => $attribute->getAttributeCode(),
62
+ 'label' => $attribute->getName(),
63
+ );
64
+ }
65
+
66
+ $this->_options[$key] = $options;
67
+ }
68
+ return $this->_options[$key];
69
+ }
70
+
71
+ /**
72
+ * {@inherit}
73
+ */
74
+ protected function getAttributes($type)
75
+ {
76
+ $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getId();
77
+ $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
78
+ ->setEntityTypeFilter($entityTypeId)
79
+ ->addFieldToFilter('backend_type', array('neq' => 'static'))
80
+ ->addFieldToFilter('attribute_code', array('neq' => 'price'));
81
+
82
+ if($type !== null) {
83
+ $attributes->addFieldToFilter('frontend_input', array('in' => (array)$type));
84
+ }
85
+
86
+ return $attributes;
87
+ }
88
+
89
+ /**
90
+ * {@inherit}
91
+ */
92
+ public function toOptionArray($elementName)
93
+ {
94
+ $type = null;
95
+ if(preg_match('/groups\[fields_product\]\[fields\]\[([a-zA-Z0-9_]+)\]\[value\]/', $elementName, $matches)) {
96
+ $field = $matches[1];
97
+ if(isset($this->attributesType[$field])) {
98
+ $type = $this->attributesType[$field];
99
+ }
100
+ }
101
+
102
+ return $this->_getAllOptions($type);
103
+ }
104
  }
app/code/community/MDN/Antidot/Model/System/Config/Sort.php CHANGED
@@ -36,7 +36,7 @@ class MDN_Antidot_Model_System_Config_Sort
36
  $this->initMarketingFields();
37
  $options = array();
38
  $options[] = array('value' => 'afs:relevance|Relevance', 'label' => Mage::helper('Antidot')->__('Relevance'));
39
- $options[] = array('value' => 'position|Position', 'label' => Mage::helper('Antidot')->__('Position'));
40
  $options[] = array('value' => 'name|Name', 'label' => Mage::helper('Antidot')->__('Name'));
41
 
42
  foreach($this->marketingFields as $field => $label) {
36
  $this->initMarketingFields();
37
  $options = array();
38
  $options[] = array('value' => 'afs:relevance|Relevance', 'label' => Mage::helper('Antidot')->__('Relevance'));
39
+ //$options[] = array('value' => 'position|Position', 'label' => Mage::helper('Antidot')->__('Position'));
40
  $options[] = array('value' => 'name|Name', 'label' => Mage::helper('Antidot')->__('Name'));
41
 
42
  foreach($this->marketingFields as $field => $label) {
app/code/community/MDN/Antidot/Model/System/Config/Suggest/Type.php CHANGED
@@ -1,55 +1,55 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_System_Config_Suggest_Type
17
- {
18
- protected $defaultTypes = array('categories', 'products', 'brands');
19
- protected $types = array();
20
-
21
- /**
22
- * Return the types list
23
- *
24
- * @return array
25
- */
26
- public function toOptionArray()
27
- {
28
- $options = array();
29
- foreach ($this->getTypes() as $v) {
30
- $options[] = array(
31
- 'value' => $v,
32
- 'label' => Mage::helper('Antidot')->__($v)
33
- );
34
- }
35
-
36
- return $options;
37
- }
38
-
39
- /**
40
- * Return available types, and move first element to the end
41
- *
42
- * @return array
43
- */
44
- protected function getTypes()
45
- {
46
- if(empty($this->types)) {
47
- $this->types = $this->defaultTypes;
48
- } else {
49
- $tmpType = array_shift($this->types);
50
- $this->types[] = $tmpType;
51
- }
52
-
53
- return $this->types;
54
- }
55
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_System_Config_Suggest_Type
17
+ {
18
+ protected $defaultTypes = array('categories', 'products', 'brands');
19
+ protected $types = array();
20
+
21
+ /**
22
+ * Return the types list
23
+ *
24
+ * @return array
25
+ */
26
+ public function toOptionArray()
27
+ {
28
+ $options = array();
29
+ foreach ($this->getTypes() as $v) {
30
+ $options[] = array(
31
+ 'value' => $v,
32
+ 'label' => Mage::helper('Antidot')->__($v)
33
+ );
34
+ }
35
+
36
+ return $options;
37
+ }
38
+
39
+ /**
40
+ * Return available types, and move first element to the end
41
+ *
42
+ * @return array
43
+ */
44
+ protected function getTypes()
45
+ {
46
+ if(empty($this->types)) {
47
+ $this->types = $this->defaultTypes;
48
+ } else {
49
+ $tmpType = array_shift($this->types);
50
+ $this->types[] = $tmpType;
51
+ }
52
+
53
+ return $this->types;
54
+ }
55
+ }
app/code/community/MDN/Antidot/Model/Transport.php CHANGED
@@ -1,37 +1,37 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Transport extends Mage_Core_Model_Abstract
17
- {
18
-
19
- const TRANS_FILE = 'file';
20
- const TRANS_FTP = 'ftp';
21
- const TRANS_HTTP = 'http';
22
-
23
- /**
24
- * Send files to Antidot
25
- *
26
- * @param string $file File to send
27
- * @param string $type The transport type used to send the file
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
-
35
- throw new Exception('The type transport "'.$type.'" does not exist');
36
- }
37
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Transport extends Mage_Core_Model_Abstract
17
+ {
18
+
19
+ const TRANS_FILE = 'file';
20
+ const TRANS_FTP = 'ftp';
21
+ const TRANS_HTTP = 'http';
22
+
23
+ /**
24
+ * Send files to Antidot
25
+ *
26
+ * @param string $file File to send
27
+ * @param string $type The transport type used to send the file
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
+
35
+ throw new Exception('The type transport "'.$type.'" does not exist');
36
+ }
37
  }
app/code/community/MDN/Antidot/Model/Transport/Abstract.php CHANGED
@@ -1,19 +1,19 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Transport_Abstract extends Mage_Core_Model_Abstract
17
- {
18
-
19
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Transport_Abstract extends Mage_Core_Model_Abstract
17
+ {
18
+
19
  }
app/code/community/MDN/Antidot/Model/Transport/File.php CHANGED
@@ -1,28 +1,28 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Transport_File extends MDN_Antidot_Model_Transport_Abstract implements MDN_Antidot_Model_Transport_Interface
17
- {
18
-
19
- const DIRECTORY = '/home/bmsoliv2/www/magento/';
20
-
21
- /**
22
- * {@inherit}
23
- */
24
- public function send($file)
25
- {
26
- return rename($file, self::DIRECTORY.'/'.basename($file));
27
- }
28
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Transport_File extends MDN_Antidot_Model_Transport_Abstract implements MDN_Antidot_Model_Transport_Interface
17
+ {
18
+
19
+ const DIRECTORY = '/home/bmsoliv2/www/magento/';
20
+
21
+ /**
22
+ * {@inherit}
23
+ */
24
+ public function send($file)
25
+ {
26
+ return rename($file, self::DIRECTORY.'/'.basename($file));
27
+ }
28
+ }
app/code/community/MDN/Antidot/Model/Transport/Ftp.php CHANGED
@@ -1,51 +1,57 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Transport_Ftp extends MDN_Antidot_Model_Transport_Abstract implements MDN_Antidot_Model_Transport_Interface
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- public function send($file)
23
- {
24
- $ftpConfig = Mage::getStoreConfig('antidot/ftp');
25
- foreach($ftpConfig as $key => $config) {
26
- if(empty($config) && $key !== 'port') {
27
- throw new Exception("The ftp $key is required");
28
- }
29
- }
30
-
31
- if(!$fHandle = fopen($file, 'r')) {
32
- throw new Exception("Can't read file ".$file);
33
- }
34
-
35
- $url = 'sftp://'
36
- .$ftpConfig['login'].':'.$ftpConfig['password']
37
- .'@upload.antidot.net/'.$ftpConfig['directory'].'/'.basename($file);
38
-
39
- $curl = curl_init();
40
- curl_setopt($curl, CURLOPT_URL, $url);
41
- curl_setopt($curl, CURLOPT_UPLOAD, 1);
42
- curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_SFTP);
43
- curl_setopt($curl, CURLOPT_INFILE, $fHandle);
44
- curl_setopt($curl, CURLOPT_INFILESIZE, filesize($file));
45
- curl_exec($curl);
46
-
47
- if (curl_errno($curl) != 0) {
48
- throw new Exception("Can't send the file to ftp");
49
- }
50
- }
51
- }
 
 
 
 
 
 
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Transport_Ftp extends MDN_Antidot_Model_Transport_Abstract implements MDN_Antidot_Model_Transport_Interface
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ public function send($file)
23
+ {
24
+ $ftpConfig = Mage::getStoreConfig('antidot/ftp');
25
+ if (!$ftpConfig)
26
+ throw new Exception('No ftp configuration set');
27
+
28
+ foreach($ftpConfig as $key => $config) {
29
+ if(empty($config) && $key !== 'port') {
30
+ throw new Exception("The ftp $key is required");
31
+ }
32
+ }
33
+ Mage::log('Ftp connect with : '.$configString, null, 'antidot.log');
34
+
35
+ if(!$fHandle = fopen($file, 'r')) {
36
+ throw new Exception("Can't read file ".$file);
37
+ }
38
+
39
+ $url = 'sftp://'
40
+ .$ftpConfig['login'].':'.$ftpConfig['password']
41
+ .'@upload.antidot.net/'.$ftpConfig['directory'].'/'.basename($file);
42
+ Mage::log('Ftp connect with : '.$url, null, 'antidot.log');
43
+
44
+ $curl = curl_init();
45
+ curl_setopt($curl, CURLOPT_URL, $url);
46
+ curl_setopt($curl, CURLOPT_UPLOAD, 1);
47
+ curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_SFTP);
48
+ curl_setopt($curl, CURLOPT_INFILE, $fHandle);
49
+ curl_setopt($curl, CURLOPT_INFILESIZE, filesize($file));
50
+ curl_exec($curl);
51
+
52
+ $errorNo = curl_errno($curl);
53
+ if ($errorNo != 0) {
54
+ throw new Exception("Can't send the file to ftp (error : ".$errorNo.")");
55
+ }
56
+ }
57
+ }
app/code/community/MDN/Antidot/Model/Transport/Http.php CHANGED
@@ -1,26 +1,26 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Model_Transport_Http extends MDN_Antidot_Model_Transport_Abstract implements MDN_Antidot_Model_Transport_Interface
17
- {
18
-
19
- /**
20
- * {@inherit}
21
- */
22
- public function send($file)
23
- {
24
-
25
- }
26
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Model_Transport_Http extends MDN_Antidot_Model_Transport_Abstract implements MDN_Antidot_Model_Transport_Interface
17
+ {
18
+
19
+ /**
20
+ * {@inherit}
21
+ */
22
+ public function send($file)
23
+ {
24
+
25
+ }
26
+ }
app/code/community/MDN/Antidot/Model/Transport/Interface.php CHANGED
@@ -1,24 +1,24 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- interface MDN_Antidot_Model_Transport_Interface
17
- {
18
- /**
19
- * Send file to Antidot
20
- *
21
- * @param string $file Files to send
22
- */
23
- public function send($files);
24
  }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ interface MDN_Antidot_Model_Transport_Interface
17
+ {
18
+ /**
19
+ * Send file to Antidot
20
+ *
21
+ * @param string $file Files to send
22
+ */
23
+ public function send($files);
24
  }
app/code/community/MDN/Antidot/controllers/Admin/PushController.php CHANGED
@@ -1,36 +1,43 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Admin_PushController extends Mage_Adminhtml_Controller_Action
17
- {
18
-
19
- /**
20
- * Generate the category file, call from back office
21
- */
22
- public function CategoryAction()
23
- {
24
- Mage::getModel('Antidot/Observer')->categoriesFullExport();
25
- $this->_redirectReferer();
26
- }
27
-
28
- /**
29
- * Generate the catalog file, call from back office
30
- */
31
- public function ProductAction()
32
- {
33
- Mage::getModel('Antidot/Observer')->catalogFullExport();
34
- $this->_redirectReferer();
35
- }
36
- }
 
 
 
 
 
 
 
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Admin_PushController extends Mage_Adminhtml_Controller_Action
17
+ {
18
+
19
+ /**
20
+ * Generate the category file, call from back office
21
+ */
22
+ public function CategoryAction()
23
+ {
24
+ Mage::getModel('Antidot/Observer')->categoriesFullExport();
25
+ $this->_redirectReferer();
26
+ }
27
+
28
+ /**
29
+ * Generate the catalog file, call from back office
30
+ */
31
+ public function ProductAction()
32
+ {
33
+ try
34
+ {
35
+ Mage::getModel('Antidot/Observer')->catalogFullExport();
36
+ }
37
+ catch(Exception $ex)
38
+ {
39
+ Mage::getSingleton('adminhtml/session')->addError(mage::helper('Antidot')->__('An error occured : %s', $ex->getMessage()));
40
+ }
41
+ $this->_redirectReferer();
42
+ }
43
+ }
app/code/community/MDN/Antidot/controllers/Front/SearchController.php CHANGED
@@ -1,35 +1,35 @@
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
- * @author : Olivier ZIMMERMANN
14
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
- */
16
- class MDN_Antidot_Front_SearchController extends Mage_Core_Controller_Front_Action
17
- {
18
-
19
- /**
20
- * Method call by autocomplete
21
- */
22
- public function SuggestAction()
23
- {
24
- if (!$query = $this->getRequest()->getParam('q', false)) {
25
- $this->getResponse()->setRedirect(Mage::getSingleton('core/url')->getBaseUrl());
26
- }
27
-
28
- $format = 'html';
29
- if ($formatParam = $this->getRequest()->getParam('format', false)) {
30
- $format = $formatParam;
31
- }
32
-
33
- $this->getResponse()->setBody(Mage::getModel('Antidot/Search_Suggest')->get($query, $format));
34
- }
35
- }
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) 2009 Maison du Logiciel (http://www.maisondulogiciel.com)
13
+ * @author : Olivier ZIMMERMANN
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ class MDN_Antidot_Front_SearchController extends Mage_Core_Controller_Front_Action
17
+ {
18
+
19
+ /**
20
+ * Method call by autocomplete
21
+ */
22
+ public function SuggestAction()
23
+ {
24
+ if (!$query = $this->getRequest()->getParam('q', false)) {
25
+ $this->getResponse()->setRedirect(Mage::getSingleton('core/url')->getBaseUrl());
26
+ }
27
+
28
+ $format = 'html';
29
+ if ($formatParam = $this->getRequest()->getParam('format', false)) {
30
+ $format = $formatParam;
31
+ }
32
+
33
+ $this->getResponse()->setBody(Mage::getModel('Antidot/Search_Suggest')->get($query, $format));
34
+ }
35
+ }
app/code/community/MDN/Antidot/etc/config.xml CHANGED
@@ -1,393 +1,468 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <crontab>
4
- <jobs>
5
- <antidot_catalog_full_export>
6
- <schedule><cron_expr>00 2 * * *</cron_expr></schedule>
7
- <run><model>Antidot/Observer::catalogFullExport</model></run>
8
- </antidot_catalog_full_export>
9
- <antidot_catalog_inc_export>
10
- <schedule><cron_expr>45 7-20 * * *</cron_expr></schedule>
11
- <run><model>Antidot/Observer::catalogIncExport</model></run>
12
- </antidot_catalog_inc_export>
13
- <antidot_categories_full_export>
14
- <schedule><cron_expr>00 21 * * *</cron_expr></schedule>
15
- <run><model>Antidot/Observer::categoriesFullExport</model></run>
16
- </antidot_categories_full_export>
17
- </jobs>
18
- </crontab>
19
- <modules>
20
- <MDN_Antidot>
21
- <version>1.0.2</version>
22
- </MDN_Antidot>
23
- </modules>
24
- <global>
25
- <helpers>
26
- <Antidot>
27
- <class>MDN_Antidot_Helper</class>
28
- </Antidot>
29
- <catalogsearch>
30
- <rewrite>
31
- <data>MDN_Antidot_Helper_CatalogSearch_Data</data>
32
- </rewrite>
33
- </catalogsearch>
34
- </helpers>
35
- <blocks>
36
- <Antidot>
37
- <class>MDN_Antidot_Block</class>
38
- </Antidot>
39
- <catalogsearch>
40
- <rewrite>
41
- <layer>MDN_Antidot_Block_Catalogsearch_Layer</layer>
42
- <result>MDN_Antidot_Block_Catalogsearch_Result</result>
43
- </rewrite>
44
- </catalogsearch>
45
- </blocks>
46
- <models>
47
-
48
- <Antidot>
49
- <class>MDN_Antidot_Model</class>
50
- <resourceModel>Antidot_engine</resourceModel>
51
- </Antidot>
52
-
53
- <Antidot_engine>
54
- <class>MDN_Antidot_Model_Resource</class>
55
- <entities></entities>
56
- </Antidot_engine>
57
-
58
- </models>
59
- <resources>
60
- <Antidot_setup>
61
- <setup>
62
- <module>MDN_Antidot</module>
63
- <class>Mage_Eav_Model_Entity_Setup</class>
64
- </setup>
65
- <connection>
66
- <use>core_setup</use>
67
- </connection>
68
- </Antidot_setup>
69
- <Antidot_write>
70
- <connection>
71
- <use>core_write</use>
72
- </connection>
73
- </Antidot_write>
74
- <Antidot_read>
75
- <connection>
76
- <use>core_read</use>
77
- </connection>
78
- </Antidot_read>
79
- </resources>
80
-
81
- </global>
82
- <adminhtml>
83
- <translate>
84
- <modules>
85
- <MDN_Antidot>
86
- <files>
87
- <default>MDN_Antidot.csv</default>
88
- </files>
89
- </MDN_Antidot>
90
- </modules>
91
- </translate>
92
-
93
- <layout>
94
- <updates>
95
- <Antidot>
96
- <file>antidot.xml</file>
97
- </Antidot>
98
- </updates>
99
- </layout>
100
- <acl>
101
- <resources>
102
- <admin>
103
- <children>
104
- <system>
105
- <children>
106
- <config>
107
- <children>
108
- <antidot module="Antidot">
109
- <title>Antidot</title>
110
- </antidot>
111
- </children>
112
- </config>
113
- </children>
114
- </system>
115
- </children>
116
- </admin>
117
- </resources>
118
- </acl>
119
- </adminhtml>
120
-
121
- <frontend>
122
- <routers>
123
- <Antidot>
124
- <use>standard</use>
125
- <args>
126
- <module>MDN_Antidot</module>
127
- <frontName>Antidot</frontName>
128
- </args>
129
- </Antidot>
130
- </routers>
131
- <layout>
132
- <updates>
133
- <Antidot>
134
- <file>antidot.xml</file>
135
- </Antidot>
136
- </updates>
137
- </layout>
138
- </frontend>
139
-
140
- <admin>
141
- <routers>
142
- <Antidot>
143
- <use>admin</use>
144
- <args>
145
- <module>MDN_Antidot</module>
146
- <frontName>Antidot</frontName>
147
- </args>
148
- </Antidot>
149
- </routers>
150
- </admin>
151
-
152
- <default>
153
- <antidot>
154
- <web_service>
155
- <status>rc</status>
156
- </web_service>
157
- <engine>
158
- <spellcheck>Did you mean {spellcheck} ?</spellcheck>
159
- <price_facet>From {min}€ to {max}€</price_facet>
160
- <feed_catalog>1</feed_catalog>
161
- <facet_multiple>0</facet_multiple>
162
- <facet_options>100</facet_options>
163
- <default_sort>a:1:{s:18:"_1395736930373_373";a:2:{s:5:"field";s:23:"afs:relevance|Relevance";s:3:"dir";s:4:"desc";}}</default_sort>
164
- </engine>
165
- <suggest>
166
- <enable>1</enable>
167
- <products>1</products>
168
- <brands>1</brands>
169
- <categories>1</categories>
170
- <products_displayed>10</products_displayed>
171
- <brands_displayed>10</brands_displayed>
172
- <categories_displayed>10</categories_displayed>
173
- <template>
174
- <![CDATA[
175
- <?xml version="1.0" encoding="UTF-8"?>
176
- <xsl:stylesheet xmlns:afs="http://ref.antidot.net/v7/afs#"
177
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
178
- <!-- Titles to translate in localized storeviews -->
179
- <xsl:variable name="results-title">Our suggestions...</xsl:variable>
180
- <xsl:variable name="no-result-title">No suggestions.</xsl:variable>
181
- <xsl:variable name="see-more-products">See more products</xsl:variable>
182
- <!-- Column titles -->
183
- <xsl:variable name="products-title">Products</xsl:variable>
184
- <xsl:variable name="categories-title">Categories</xsl:variable>
185
- <xsl:variable name="brands-title">Brands</xsl:variable>
186
-
187
- <!-- Main HTML template -->
188
- <xsl:template match="afs:replies">
189
- <ul class="ajax-search">
190
- <li class="search-container-top"/>
191
- <xsl:choose>
192
- <xsl:when test="afs:replySet">
193
- <li class="header-text">
194
- <xsl:value-of select="$results-title"/>
195
- </li>
196
- <xsl:apply-templates select="afs:replySet"/>
197
- <a>
198
- <xsl:attribute name="href">/index.php/catalogsearch/result/?q=<xsl:value-of
199
- select="afs:header/afs:query/@textQuery"/>*</xsl:attribute>
200
- <xsl:value-of select="$see-more-products"/>
201
- </a>
202
- </xsl:when>
203
- <xsl:otherwise>
204
- <li class="header-text">
205
- <xsl:value-of select="$no-result-title"/>
206
- </li>
207
- </xsl:otherwise>
208
- </xsl:choose>
209
- </ul>
210
- </xsl:template>
211
-
212
- <!-- Suggestions column main template -->
213
- <xsl:template match="afs:replySet">
214
- <xsl:variable name="title">
215
- <!-- Use of 'starts-with/substring-before' is needed to be compliant with multiple storeviews/languages which give suffixes to replySet name -->
216
- <xsl:choose>
217
- <xsl:when test="starts-with(@name,'categories')">
218
- <xsl:value-of select="$categories-title"/>
219
- </xsl:when>
220
- <xsl:when test="starts-with(@name,'featured_products')">
221
- <xsl:value-of select="$products-title"/>
222
- </xsl:when>
223
- <xsl:when test="starts-with(@name,'brands')">
224
- <xsl:value-of select="$brands-title"/>
225
- </xsl:when>
226
- <xsl:otherwise>
227
- <xsl:value-of select="substring-before(@name,'_')"/>
228
- </xsl:otherwise>
229
- </xsl:choose>
230
- </xsl:variable>
231
- <li class="title">
232
- <span>
233
- <xsl:value-of select="$title"/> (<xsl:value-of select="afs:meta/@totalItems"/>) :
234
- </span>
235
- </li>
236
- <xsl:apply-templates select="afs:reply"/>
237
- </xsl:template>
238
-
239
- <!-- Template common to basic and products replies -->
240
- <xsl:template match="afs:reply">
241
- <li>
242
- <!-- Show thumbnail if any -->
243
- <xsl:apply-templates select="afs:option[@key='url_thumbnail']" mode="url_thumbnail"/>
244
- <a>
245
- <xsl:apply-templates select="afs:option[@key='url']" mode="href"/>
246
- <xsl:attribute name="title">
247
- <xsl:value-of select="@label"/>
248
- </xsl:attribute>
249
- <!-- Apply basic or product template -->
250
- <xsl:apply-templates
251
- select="self::node()[afs:option[@key='url'] and not(afs:option[@key='price'])]"
252
- mode="basic"/>
253
- <xsl:apply-templates select="self::node()[afs:option[@key='price']]" mode="product"
254
- />
255
- </a>
256
- </li>
257
- </xsl:template>
258
-
259
- <!-- Thumbnail display -->
260
- <xsl:template match="afs:option" mode="url_thumbnail">
261
- <div class="image" style="float: left; margin-right:5px;">
262
- <img width="35">
263
- <xsl:attribute name="src">
264
- <xsl:value-of select="@value"/>
265
- </xsl:attribute>
266
- </img>
267
- </div>
268
- </xsl:template>
269
-
270
- <!-- Creates href link -->
271
- <xsl:template match="afs:option" mode="href">
272
- <xsl:attribute name="href">
273
- <xsl:value-of select="@value"/>
274
- </xsl:attribute>
275
- </xsl:template>
276
-
277
- <!-- Basic suggestion template -->
278
- <xsl:template match="afs:reply" mode="basic">
279
- <div class="name">
280
- <xsl:value-of select="@label"/>
281
- <span style="padding-left: 5px;"/>
282
- </div>
283
- </xsl:template>
284
-
285
- <!-- Product rich template: uses custom metadata like price -->
286
- <xsl:template match="afs:reply" mode="product">
287
- <xsl:variable name="currency">
288
- <xsl:value-of select="afs:option[@key='currency_sign']/@value"/>
289
- </xsl:variable>
290
- <xsl:variable name="price_display">
291
- <xsl:value-of select="afs:option[@key='price']/@value"/>
292
- <xsl:value-of select="$currency"/>
293
- </xsl:variable>
294
- <div class="name">
295
- <xsl:value-of select="@label"/>
296
- <span style="padding-left: 5px;">
297
- <xsl:choose>
298
- <xsl:when test="afs:option[@key='price_cut']">
299
- <s>
300
- <xsl:value-of select="afs:option[@key='price_cut']/@value"/>
301
- <xsl:value-of select="$currency"/>
302
- </s>&#160; <xsl:value-of select="$price_display"/>
303
- </xsl:when>
304
- <xsl:otherwise>
305
- <xsl:value-of select="$price_display"/>
306
- </xsl:otherwise>
307
- </xsl:choose>
308
- </span>
309
- </div>
310
- </xsl:template>
311
-
312
- </xsl:stylesheet>
313
- ]]>
314
- </template>
315
- <suggest_xml>
316
- <![CDATA[
317
- &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br />
318
- &lt;feeds&gt;<br />
319
- &lt;feed name=&quot;catalog_fr&quot;&gt;<br />
320
- &lt;AFS&gt;<br />
321
- &lt;Suggestions&gt;<br />
322
- &lt;Suggestion label=&quot;T-Shirt manches courtes&quot;&gt;<br />
323
- &lt;Option key=&quot;category&quot; value=&quot;T-shirt&quot;/&gt;<br />
324
- &lt;Option key=&quot;category&quot; value=&quot;T-shirts b&eacute;b&eacute;&quot;/&gt;<br />
325
- &lt;Option key=&quot;category&quot; value=&quot;Quechua&quot;/&gt;<br />
326
- &lt;Option key=&quot;category&quot; value=&quot;Randonn&eacute;e&quot;/&gt;<br />
327
- &lt;/Suggestion&gt;<br />
328
- &lt;/Suggestions&gt;<br />
329
- &lt;/AFS&gt;<br />
330
- &lt;/feed&gt;<br />
331
- &lt;feed name=&quot;brands_fr&quot;&gt;<br />
332
- &lt;AFS&gt;<br />
333
- &lt;Suggestions&gt;<br />
334
- &lt;Suggestion label=&quot;QUECHUA&quot;/&gt;<br />
335
- &lt;/Suggestions&gt;<br />
336
- &lt;/AFS&gt;<br />
337
- &lt;/feed&gt;<br />
338
- &lt;feed name=&quot;categories_fr&quot;&gt;<br />
339
- &lt;AFS&gt;<br />
340
- &lt;Suggestions&gt;<br />
341
- &lt;Suggestion label=&quot;T-shirt&quot;&gt;<br />
342
- &lt;Option key=&quot;id&quot; value=&quot;50657&quot;/&gt;<br />
343
- &lt;Option key=&quot;url&quot; value=&quot;%2fF-50657-t_shirt&quot;/&gt;<br />
344
- &lt;Option key=&quot;level&quot; value=&quot;1&quot;/&gt;<br />
345
- &lt;/Suggestion&gt;<br />
346
- &lt;Suggestion label=&quot;T-shirts b&eacute;b&eacute;&quot;&gt;<br />
347
- &lt;Option key=&quot;id&quot; value=&quot;308392&quot;/&gt;<br />
348
- &lt;Option key=&quot;url&quot; value=&quot;%2fC-308392-t_shirts&quot;/&gt;<br />
349
- &lt;Option key=&quot;level&quot; value=&quot;1&quot;/&gt;<br />
350
- &lt;/Suggestion&gt;<br />
351
- &lt;Suggestion label=&quot;Quechua&quot;&gt;<br />
352
- &lt;Option key=&quot;id&quot; value=&quot;309970&quot;/&gt;<br />
353
- &lt;Option key=&quot;url&quot; value=&quot;%2fC-309970-quechua&quot;/&gt;<br />
354
- &lt;Option key=&quot;level&quot; value=&quot;1&quot;/&gt;<br />
355
- &lt;/Suggestion&gt;<br />
356
- &lt;Suggestion label=&quot;Randonn&eacute;e&quot;&gt;<br />
357
- &lt;Option key=&quot;id&quot; value=&quot;313441&quot;/&gt;<br />
358
- &lt;Option key=&quot;url&quot; value=&quot;%2fC-313441-randonnee&quot;/&gt;<br />
359
- &lt;Option key=&quot;level&quot; value=&quot;1&quot;/&gt;<br />
360
- &lt;/Suggestion&gt;<br />
361
- &lt;/Suggestions&gt;<br />
362
- &lt;/AFS&gt;<br />
363
- &lt;/feed&gt;<br />
364
- &lt;/feeds&gt;
365
- ]]>
366
- </suggest_xml>
367
- <order_1>categories</order_1>
368
- <order_2>products</order_2>
369
- <order_3>brands</order_3>
370
- </suggest>
371
- <fields_category>
372
- <name>name</name>
373
- <keywords>meta_keywords</keywords>
374
- <description>description</description>
375
- </fields_category>
376
- <fields_product>
377
- <in_stock_only>0</in_stock_only>
378
- <name>name</name>
379
- <short_name>short_name</short_name>
380
- <colors>color</colors>
381
- <models>model</models>
382
- <manufacturer>manufacturer</manufacturer>
383
- <gender>gender</gender>
384
- <description>a:1:{s:18:"_1390211203389_389";a:1:{s:5:"value";s:11:"description";}}</description>
385
- <keywords>meta_keyword</keywords>
386
- <identifier>a:1:{s:18:"_1389092688608_608";a:1:{s:5:"value";s:3:"sku";}}</identifier>
387
- </fields_product>
388
- <promote>
389
- <redirect>no_result</redirect>
390
- </promote>
391
- </antidot>
392
- </default>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <crontab>
4
+ <jobs>
5
+ <antidot_catalog_full_export>
6
+ <schedule><cron_expr>00 2 * * *</cron_expr></schedule>
7
+ <run><model>Antidot/Observer::catalogFullExport</model></run>
8
+ </antidot_catalog_full_export>
9
+ <antidot_catalog_inc_export>
10
+ <schedule><cron_expr>45 7-20 * * *</cron_expr></schedule>
11
+ <run><model>Antidot/Observer::catalogIncExport</model></run>
12
+ </antidot_catalog_inc_export>
13
+ <antidot_categories_full_export>
14
+ <schedule><cron_expr>00 21 * * *</cron_expr></schedule>
15
+ <run><model>Antidot/Observer::categoriesFullExport</model></run>
16
+ </antidot_categories_full_export>
17
+ </jobs>
18
+ </crontab>
19
+ <modules>
20
+ <MDN_Antidot>
21
+ <version>1.0.6</version>
22
+ </MDN_Antidot>
23
+ </modules>
24
+ <global>
25
+ <helpers>
26
+ <Antidot>
27
+ <class>MDN_Antidot_Helper</class>
28
+ </Antidot>
29
+ <catalogsearch>
30
+ <rewrite>
31
+ <data>MDN_Antidot_Helper_CatalogSearch_Data</data>
32
+ </rewrite>
33
+ </catalogsearch>
34
+ </helpers>
35
+ <blocks>
36
+ <Antidot>
37
+ <class>MDN_Antidot_Block</class>
38
+ </Antidot>
39
+ <catalogsearch>
40
+ <rewrite>
41
+ <layer>MDN_Antidot_Block_Catalogsearch_Layer</layer>
42
+ <result>MDN_Antidot_Block_Catalogsearch_Result</result>
43
+ </rewrite>
44
+ </catalogsearch>
45
+ </blocks>
46
+ <models>
47
+
48
+ <Antidot>
49
+ <class>MDN_Antidot_Model</class>
50
+ <resourceModel>Antidot_engine</resourceModel>
51
+ </Antidot>
52
+
53
+ <Antidot_engine>
54
+ <class>MDN_Antidot_Model_Resource</class>
55
+ <entities></entities>
56
+ </Antidot_engine>
57
+
58
+ </models>
59
+ <resources>
60
+ <Antidot_setup>
61
+ <setup>
62
+ <module>MDN_Antidot</module>
63
+ <class>Mage_Eav_Model_Entity_Setup</class>
64
+ </setup>
65
+ <connection>
66
+ <use>core_setup</use>
67
+ </connection>
68
+ </Antidot_setup>
69
+ <Antidot_write>
70
+ <connection>
71
+ <use>core_write</use>
72
+ </connection>
73
+ </Antidot_write>
74
+ <Antidot_read>
75
+ <connection>
76
+ <use>core_read</use>
77
+ </connection>
78
+ </Antidot_read>
79
+ </resources>
80
+
81
+ </global>
82
+ <adminhtml>
83
+ <translate>
84
+ <modules>
85
+ <MDN_Antidot>
86
+ <files>
87
+ <default>MDN_Antidot.csv</default>
88
+ </files>
89
+ </MDN_Antidot>
90
+ </modules>
91
+ </translate>
92
+
93
+ <layout>
94
+ <updates>
95
+ <Antidot>
96
+ <file>antidot.xml</file>
97
+ </Antidot>
98
+ </updates>
99
+ </layout>
100
+ <acl>
101
+ <resources>
102
+ <admin>
103
+ <children>
104
+ <system>
105
+ <children>
106
+ <config>
107
+ <children>
108
+ <antidot module="Antidot">
109
+ <title>Antidot</title>
110
+ </antidot>
111
+ </children>
112
+ </config>
113
+ </children>
114
+ </system>
115
+ </children>
116
+ </admin>
117
+ </resources>
118
+ </acl>
119
+ </adminhtml>
120
+
121
+ <frontend>
122
+ <routers>
123
+ <Antidot>
124
+ <use>standard</use>
125
+ <args>
126
+ <module>MDN_Antidot</module>
127
+ <frontName>Antidot</frontName>
128
+ </args>
129
+ </Antidot>
130
+ </routers>
131
+ <layout>
132
+ <updates>
133
+ <Antidot>
134
+ <file>antidot.xml</file>
135
+ </Antidot>
136
+ </updates>
137
+ </layout>
138
+ </frontend>
139
+
140
+ <admin>
141
+ <routers>
142
+ <Antidot>
143
+ <use>admin</use>
144
+ <args>
145
+ <module>MDN_Antidot</module>
146
+ <frontName>Antidot</frontName>
147
+ </args>
148
+ </Antidot>
149
+ </routers>
150
+ </admin>
151
+
152
+ <default>
153
+ <antidot>
154
+ <web_service>
155
+ <status>rc</status>
156
+ </web_service>
157
+ <engine>
158
+ <spellcheck>Did you mean {spellcheck} ?</spellcheck>
159
+ <price_facet>From {min}€ to {max}€</price_facet>
160
+ <feed_catalog>1</feed_catalog>
161
+ <facet_multiple>0</facet_multiple>
162
+ <facet_options>100</facet_options>
163
+ <default_sort>a:1:{s:18:"_1395736930373_373";a:2:{s:5:"field";s:23:"afs:relevance|Relevance";s:3:"dir";s:4:"desc";}}</default_sort>
164
+ </engine>
165
+ <suggest>
166
+ <enable>1</enable>
167
+ <products>1</products>
168
+ <brands>1</brands>
169
+ <categories>1</categories>
170
+ <products_displayed>10</products_displayed>
171
+ <brands_displayed>10</brands_displayed>
172
+ <categories_displayed>10</categories_displayed>
173
+ <template>
174
+ <![CDATA[
175
+ <?xml version="1.0" encoding="UTF-8"?>
176
+ <xsl:stylesheet xmlns:afs="http://ref.antidot.net/v7/afs#"
177
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
178
+ <!-- Titles to translate in localized storeviews -->
179
+ <xsl:variable name="results-title">Our suggestions...</xsl:variable>
180
+ <xsl:variable name="no-result-title">No suggestions.</xsl:variable>
181
+ <xsl:variable name="see-more-products">See more products</xsl:variable>
182
+ <!-- Column titles -->
183
+ <xsl:variable name="products-title">Products</xsl:variable>
184
+ <xsl:variable name="categories-title">Categories</xsl:variable>
185
+ <xsl:variable name="brands-title">Brands</xsl:variable>
186
+
187
+ <!-- Default search url: customize if needed -->
188
+ <xsl:variable name="searchUrl">/index.php/catalogsearch/result/?q=</xsl:variable>
189
+
190
+ <!-- Main HTML template -->
191
+ <xsl:template match="afs:replies">
192
+ <ul class="ajax-search">
193
+ <li class="search-container-top"/>
194
+ <xsl:choose>
195
+ <xsl:when test="afs:replySet">
196
+ <li class="header-text">
197
+ <xsl:value-of select="$results-title"/>
198
+ </li>
199
+ <xsl:apply-templates select="afs:replySet"/>
200
+ <a>
201
+ <xsl:attribute name="href"><xsl:value-of select="$searchUrl"/><xsl:value-of
202
+ select="afs:header/afs:query/@textQuery"/>*</xsl:attribute>
203
+ <xsl:value-of select="$see-more-products"/>
204
+ </a>
205
+ </xsl:when>
206
+ <xsl:otherwise>
207
+ <li class="header-text">
208
+ <xsl:value-of select="$no-result-title"/>
209
+ </li>
210
+ </xsl:otherwise>
211
+ </xsl:choose>
212
+ </ul>
213
+ </xsl:template>
214
+
215
+ <!-- Suggestions column main template -->
216
+ <xsl:template match="afs:replySet">
217
+ <xsl:variable name="title">
218
+ <!-- Use of 'starts-with/substring-before' is needed to be compliant with multiple storeviews/languages which give suffixes to replySet name -->
219
+ <xsl:choose>
220
+ <xsl:when test="starts-with(@name,'categories')">
221
+ <xsl:value-of select="$categories-title"/>
222
+ </xsl:when>
223
+ <xsl:when test="starts-with(@name,'featured_products')">
224
+ <xsl:value-of select="$products-title"/>
225
+ </xsl:when>
226
+ <xsl:when test="starts-with(@name,'brands')">
227
+ <xsl:value-of select="$brands-title"/>
228
+ </xsl:when>
229
+ <xsl:when test="starts-with(@name,'property_')">
230
+ <xsl:call-template name="upperCaseFirstLetter">
231
+ <xsl:with-param name="str">
232
+ <xsl:value-of
233
+ select="translate(substring(substring-after(@name,'property_'),1,string-length(@name)-14),'_',' ')"
234
+ />
235
+ </xsl:with-param>
236
+ </xsl:call-template>
237
+ </xsl:when>
238
+ <xsl:otherwise>
239
+ <xsl:call-template name="upperCaseFirstLetter">
240
+ <xsl:with-param name="str">
241
+ <xsl:value-of select="substring-before(@name,'_')"/>
242
+ </xsl:with-param>
243
+ </xsl:call-template>
244
+ </xsl:otherwise>
245
+ </xsl:choose>
246
+ </xsl:variable>
247
+ <li class="title">
248
+ <span>
249
+ <xsl:value-of select="$title"/> (<xsl:value-of select="afs:meta/@totalItems"/>) :
250
+ </span>
251
+ </li>
252
+ <xsl:apply-templates select="afs:reply"/>
253
+ </xsl:template>
254
+
255
+ <!-- Template common to basic and products replies -->
256
+ <xsl:template match="afs:reply">
257
+ <li>
258
+ <!-- Show thumbnail if any -->
259
+ <xsl:apply-templates select="afs:option[@key='url_thumbnail']" mode="url_thumbnail"/>
260
+ <a>
261
+ <!-- Direct link if available, else search link (with filter if available) -->
262
+ <xsl:choose>
263
+ <!-- Direct link to target page -->
264
+ <xsl:when test="afs:option[@key='url']">
265
+ <xsl:apply-templates select="afs:option[@key='url']" mode="href"/>
266
+ </xsl:when>
267
+ <!-- Query with filter (avoid noisy results) -->
268
+ <xsl:when test="afs:option[@key='id'] or parent::afs:replySet[starts-with(@name,'property_')]">
269
+ <xsl:variable name="filterName">
270
+ <xsl:choose>
271
+ <xsl:when
272
+ test="parent::afs:replySet[starts-with(@name,'property_')]">
273
+ <xsl:value-of
274
+ select="substring(substring-after(parent::afs:replySet/@name,'property_'),1,string-length(parent::afs:replySet/@name)-14)"
275
+ />
276
+ </xsl:when>
277
+ <xsl:otherwise>
278
+ <xsl:value-of
279
+ select="substring(parent::afs:replySet/@name,1,string-length(parent::afs:replySet/@name)-5)"
280
+ />
281
+ </xsl:otherwise>
282
+ </xsl:choose>
283
+ </xsl:variable>
284
+ <xsl:attribute name="href">
285
+ <xsl:value-of select="$searchUrl"/>
286
+ <!-- We set plain text query because empty query is not allowed -->
287
+ <xsl:value-of select="@label"/>
288
+ <xsl:text>&amp;</xsl:text>
289
+ <xsl:value-of select="$filterName"/>
290
+ <xsl:text>=%22</xsl:text>
291
+ <xsl:choose>
292
+ <xsl:when
293
+ test="afs:option[@key='id' and normalize-space(@value)!='']">
294
+ <xsl:value-of select="afs:option[@key='id']/@value"/>
295
+ </xsl:when>
296
+ <xsl:otherwise>
297
+ <xsl:value-of select="@label"/>
298
+ </xsl:otherwise>
299
+ </xsl:choose>
300
+ <xsl:text>%22</xsl:text>
301
+ </xsl:attribute>
302
+ </xsl:when>
303
+ <!-- Basic text query -->
304
+ <xsl:otherwise>
305
+ <xsl:attribute name="href">
306
+ <xsl:value-of select="$searchUrl"/>
307
+ <xsl:value-of select="@label"/>
308
+ </xsl:attribute>
309
+ </xsl:otherwise>
310
+ </xsl:choose>
311
+ <xsl:attribute name="title">
312
+ <xsl:value-of select="@label"/>
313
+ </xsl:attribute>
314
+ <!-- Choose which template to apply for displaying suggestion:
315
+ basic (label only) or product (with thumbnbail, price, etc.) -->
316
+ <xsl:apply-templates select="self::node()[not(afs:option[@key='price'])]"
317
+ mode="basic"/>
318
+ <xsl:apply-templates select="self::node()[afs:option[@key='price']]" mode="product"
319
+ />
320
+ </a>
321
+ </li>
322
+ </xsl:template>
323
+
324
+ <!-- Thumbnail display -->
325
+ <xsl:template match="afs:option" mode="url_thumbnail">
326
+ <div class="image" style="float: left; margin-right:5px;">
327
+ <img width="35">
328
+ <xsl:attribute name="src">
329
+ <xsl:value-of select="@value"/>
330
+ </xsl:attribute>
331
+ </img>
332
+ </div>
333
+ </xsl:template>
334
+
335
+ <!-- Creates href link -->
336
+ <xsl:template match="afs:option" mode="href">
337
+ <xsl:attribute name="href">
338
+ <xsl:value-of select="@value"/>
339
+ </xsl:attribute>
340
+ </xsl:template>
341
+
342
+ <!-- Basic suggestion template -->
343
+ <xsl:template match="afs:reply" mode="basic">
344
+ <div class="name">
345
+ <xsl:value-of select="@label"/>
346
+ <span style="padding-left: 5px;"/>
347
+ </div>
348
+ </xsl:template>
349
+
350
+ <!-- Product rich template: uses custom metadata like price -->
351
+ <xsl:template match="afs:reply" mode="product">
352
+ <xsl:variable name="currency">
353
+ <xsl:value-of select="afs:option[@key='currency_sign']/@value"/>
354
+ </xsl:variable>
355
+ <xsl:variable name="price_display">
356
+ <xsl:value-of select="afs:option[@key='price']/@value"/>
357
+ <xsl:value-of select="$currency"/>
358
+ </xsl:variable>
359
+ <div class="name">
360
+ <xsl:value-of select="@label"/>
361
+ <span style="padding-left: 5px;">
362
+ <xsl:choose>
363
+ <xsl:when test="afs:option[@key='price_cut']">
364
+ <s>
365
+ <xsl:value-of select="afs:option[@key='price_cut']/@value"/>
366
+ <xsl:value-of select="$currency"/>
367
+ </s>&#160; <xsl:value-of select="$price_display"/>
368
+ </xsl:when>
369
+ <xsl:otherwise>
370
+ <xsl:value-of select="$price_display"/>
371
+ </xsl:otherwise>
372
+ </xsl:choose>
373
+ </span>
374
+ </div>
375
+ </xsl:template>
376
+
377
+ <!-- Translate first letter of a string into a upper case if it was lower -->
378
+ <xsl:template name="upperCaseFirstLetter">
379
+ <xsl:param name="str"/>
380
+ <xsl:variable name="vUpper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
381
+ <xsl:variable name="vLower" select="'abcdefghijklmnopqrstuvwxyz'"/>
382
+ <xsl:value-of
383
+ select="concat(translate(substring($str,1,1),$vLower,$vUpper),substring($str,2))"/>
384
+ </xsl:template>
385
+
386
+ </xsl:stylesheet>
387
+
388
+ ]]>
389
+ </template>
390
+ <suggest_xml>
391
+ <![CDATA[
392
+ &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br />
393
+ &lt;feeds&gt;<br />
394
+ &lt;feed name=&quot;catalog_fr&quot;&gt;<br />
395
+ &lt;AFS&gt;<br />
396
+ &lt;Suggestions&gt;<br />
397
+ &lt;Suggestion label=&quot;T-Shirt manches courtes&quot;&gt;<br />
398
+ &lt;Option key=&quot;category&quot; value=&quot;T-shirt&quot;/&gt;<br />
399
+ &lt;Option key=&quot;category&quot; value=&quot;T-shirts b&eacute;b&eacute;&quot;/&gt;<br />
400
+ &lt;Option key=&quot;category&quot; value=&quot;Quechua&quot;/&gt;<br />
401
+ &lt;Option key=&quot;category&quot; value=&quot;Randonn&eacute;e&quot;/&gt;<br />
402
+ &lt;/Suggestion&gt;<br />
403
+ &lt;/Suggestions&gt;<br />
404
+ &lt;/AFS&gt;<br />
405
+ &lt;/feed&gt;<br />
406
+ &lt;feed name=&quot;brands_fr&quot;&gt;<br />
407
+ &lt;AFS&gt;<br />
408
+ &lt;Suggestions&gt;<br />
409
+ &lt;Suggestion label=&quot;QUECHUA&quot;/&gt;<br />
410
+ &lt;/Suggestions&gt;<br />
411
+ &lt;/AFS&gt;<br />
412
+ &lt;/feed&gt;<br />
413
+ &lt;feed name=&quot;categories_fr&quot;&gt;<br />
414
+ &lt;AFS&gt;<br />
415
+ &lt;Suggestions&gt;<br />
416
+ &lt;Suggestion label=&quot;T-shirt&quot;&gt;<br />
417
+ &lt;Option key=&quot;id&quot; value=&quot;50657&quot;/&gt;<br />
418
+ &lt;Option key=&quot;url&quot; value=&quot;%2fF-50657-t_shirt&quot;/&gt;<br />
419
+ &lt;Option key=&quot;level&quot; value=&quot;1&quot;/&gt;<br />
420
+ &lt;/Suggestion&gt;<br />
421
+ &lt;Suggestion label=&quot;T-shirts b&eacute;b&eacute;&quot;&gt;<br />
422
+ &lt;Option key=&quot;id&quot; value=&quot;308392&quot;/&gt;<br />
423
+ &lt;Option key=&quot;url&quot; value=&quot;%2fC-308392-t_shirts&quot;/&gt;<br />
424
+ &lt;Option key=&quot;level&quot; value=&quot;1&quot;/&gt;<br />
425
+ &lt;/Suggestion&gt;<br />
426
+ &lt;Suggestion label=&quot;Quechua&quot;&gt;<br />
427
+ &lt;Option key=&quot;id&quot; value=&quot;309970&quot;/&gt;<br />
428
+ &lt;Option key=&quot;url&quot; value=&quot;%2fC-309970-quechua&quot;/&gt;<br />
429
+ &lt;Option key=&quot;level&quot; value=&quot;1&quot;/&gt;<br />
430
+ &lt;/Suggestion&gt;<br />
431
+ &lt;Suggestion label=&quot;Randonn&eacute;e&quot;&gt;<br />
432
+ &lt;Option key=&quot;id&quot; value=&quot;313441&quot;/&gt;<br />
433
+ &lt;Option key=&quot;url&quot; value=&quot;%2fC-313441-randonnee&quot;/&gt;<br />
434
+ &lt;Option key=&quot;level&quot; value=&quot;1&quot;/&gt;<br />
435
+ &lt;/Suggestion&gt;<br />
436
+ &lt;/Suggestions&gt;<br />
437
+ &lt;/AFS&gt;<br />
438
+ &lt;/feed&gt;<br />
439
+ &lt;/feeds&gt;
440
+ ]]>
441
+ </suggest_xml>
442
+ <order_1>categories</order_1>
443
+ <order_2>products</order_2>
444
+ <order_3>brands</order_3>
445
+ </suggest>
446
+ <fields_category>
447
+ <name>name</name>
448
+ <keywords>meta_keywords</keywords>
449
+ <description>description</description>
450
+ </fields_category>
451
+ <fields_product>
452
+ <in_stock_only>0</in_stock_only>
453
+ <name>name</name>
454
+ <short_name>short_name</short_name>
455
+ <colors>color</colors>
456
+ <models>model</models>
457
+ <manufacturer>manufacturer</manufacturer>
458
+ <gender>gender</gender>
459
+ <description>a:1:{s:18:"_1390211203389_389";a:1:{s:5:"value";s:17:"short_description";}}</description>
460
+ <keywords>meta_keyword</keywords>
461
+ <identifier>a:1:{s:18:"_1389092688608_608";a:1:{s:5:"value";s:3:"sku";}}</identifier>
462
+ </fields_product>
463
+ <promote>
464
+ <redirect>no_result</redirect>
465
+ </promote>
466
+ </antidot>
467
+ </default>
468
  </config>
app/code/community/MDN/Antidot/etc/system.xml CHANGED
@@ -1,636 +1,636 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <antidot translate="label" module="Antidot">
5
- <label>AFS@Store</label>
6
- <tab>catalog</tab>
7
- <frontend_type>text</frontend_type>
8
- <sort_order>500</sort_order>
9
- <show_in_default>1</show_in_default>
10
- <show_in_website>1</show_in_website>
11
- <show_in_store>1</show_in_store>
12
- <groups>
13
- <general>
14
- <label>General</label>
15
- <comment><![CDATA[<a href="https://bo.afs-antidot.net/" target="_blank" style="font-size:16px">Antidot Back office (Analytics, Synonyms, Promote)</a>]]></comment>
16
- <frontend_type>text</frontend_type>
17
- <sort_order>1</sort_order>
18
- <show_in_default>1</show_in_default>
19
- <show_in_website>1</show_in_website>
20
- <show_in_store>1</show_in_store>
21
- <fields>
22
- <version translate="label">
23
- <label>AFS@Store Extension Version</label>
24
- <frontend_model>Antidot/System_Config_Html_Version</frontend_model>
25
- <sort_order>1</sort_order>
26
- <show_in_default>1</show_in_default>
27
- <show_in_website>1</show_in_website>
28
- <show_in_store>1</show_in_store>
29
- <comment>Communicate this version to the support team if you need help</comment>
30
- </version>
31
- <owner translate="label">
32
- <label>Organization name</label>
33
- <frontend_type>text</frontend_type>
34
- <sort_order>10</sort_order>
35
- <show_in_default>1</show_in_default>
36
- <show_in_website>1</show_in_website>
37
- <show_in_store>1</show_in_store>
38
- <comment>Useful for support team</comment>
39
- </owner>
40
- <email translate="label">
41
- <label>E-mail</label>
42
- <frontend_type>text</frontend_type>
43
- <sort_order>12</sort_order>
44
- <show_in_default>1</show_in_default>
45
- <show_in_website>0</show_in_website>
46
- <show_in_store>0</show_in_store>
47
- <comment>Used to send alert when an error occured</comment>
48
- </email>
49
- </fields>
50
-
51
- </general>
52
-
53
- <ftp>
54
- <label>Data upload parameters</label>
55
- <frontend_type>text</frontend_type>
56
- <sort_order>2</sort_order>
57
- <show_in_default>1</show_in_default>
58
- <show_in_website>0</show_in_website>
59
- <show_in_store>0</show_in_store>
60
- <fields>
61
- <host translate="label">
62
- <label>Host</label>
63
- <frontend_type>text</frontend_type>
64
- <sort_order>1</sort_order>
65
- <show_in_default>1</show_in_default>
66
- <comment>Host to connect to Antidot to push files</comment>
67
- </host>
68
- <directory translate="label">
69
- <label>Upload Directory</label>
70
- <frontend_type>text</frontend_type>
71
- <sort_order>2</sort_order>
72
- <show_in_default>1</show_in_default>
73
- <comment>Directory to upload files</comment>
74
- </directory>
75
- <login translate="label">
76
- <label>Login</label>
77
- <frontend_type>text</frontend_type>
78
- <sort_order>3</sort_order>
79
- <show_in_default>1</show_in_default>
80
- <comment>Your Antidot FTP Login</comment>
81
- </login>
82
- <password translate="label">
83
- <label>Password</label>
84
- <frontend_type>password</frontend_type>
85
- <sort_order>4</sort_order>
86
- <show_in_default>1</show_in_default>
87
- <comment>Your Antidot FTP Password</comment>
88
- </password>
89
- </fields>
90
- </ftp>
91
-
92
- <web_service>
93
- <label>Web services</label>
94
- <frontend_type>text</frontend_type>
95
- <sort_order>3</sort_order>
96
- <show_in_default>1</show_in_default>
97
- <show_in_website>0</show_in_website>
98
- <show_in_store>0</show_in_store>
99
- <fields>
100
- <host translate="label">
101
- <label>Host</label>
102
- <frontend_type>text</frontend_type>
103
- <sort_order>1</sort_order>
104
- <show_in_default>1</show_in_default>
105
- <comment>Web service host to communicate with Antidot</comment>
106
- </host>
107
- <service translate="label">
108
- <label>Service ID</label>
109
- <frontend_type>text</frontend_type>
110
- <sort_order>2</sort_order>
111
- <show_in_default>1</show_in_default>
112
- <comment>Antidot service ID</comment>
113
- </service>
114
- <status translate="label">
115
- <label>Status</label>
116
- <frontend_type>select</frontend_type>
117
- <source_model>Antidot/System_Config_WSStatus</source_model>
118
- <sort_order>3</sort_order>
119
- <show_in_default>1</show_in_default>
120
- <comment>Web service status. Go live only with 'stable' status on your production site</comment>
121
- </status>
122
- </fields>
123
- </web_service>
124
-
125
- <fields_product>
126
- <label>Products fields mapping</label>
127
- <frontend_type>text</frontend_type>
128
- <sort_order>4</sort_order>
129
- <show_in_default>1</show_in_default>
130
- <show_in_website>1</show_in_website>
131
- <show_in_store>1</show_in_store>
132
- <comment>These settings are related to the product file generation, used for AFS@Store indexing. You can match to existing attributes in Magento and add your own properties. Standard Magento attributes such as urls, categories, prices, quantities, promotions are automatically inherited by this mapping. Use this form to map specific fields from your data model</comment>
133
- <fields>
134
- <in_stock_only translate="label">
135
- <label>Include out of stock products</label>
136
- <frontend_type>select</frontend_type>
137
- <source_model>adminhtml/system_config_source_yesno</source_model>
138
- <sort_order>5</sort_order>
139
- <show_in_default>1</show_in_default>
140
- <show_in_website>1</show_in_website>
141
- <show_in_store>1</show_in_store>
142
- <comment>Change this setting if you want to include out of stock products</comment>
143
- </in_stock_only>
144
- <name translate="label">
145
- <label>Name</label>
146
- <frontend_type>select</frontend_type>
147
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
148
- <sort_order>10</sort_order>
149
- <show_in_default>1</show_in_default>
150
- <show_in_website>1</show_in_website>
151
- <show_in_store>1</show_in_store>
152
- </name>
153
- <short_name translate="label">
154
- <label>Short name</label>
155
- <frontend_type>select</frontend_type>
156
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
157
- <sort_order>11</sort_order>
158
- <show_in_default>1</show_in_default>
159
- <show_in_website>1</show_in_website>
160
- <show_in_store>1</show_in_store>
161
- </short_name>
162
- <manufacturer translate="label">
163
- <label>Brand</label>
164
- <frontend_type>select</frontend_type>
165
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
166
- <sort_order>13</sort_order>
167
- <show_in_default>1</show_in_default>
168
- <show_in_website>1</show_in_website>
169
- <show_in_store>1</show_in_store>
170
- </manufacturer>
171
- <description translate="label">
172
- <label>Description</label>
173
- <frontend_type>select</frontend_type>
174
- <frontend_model>Antidot/System_Config_Form_Field_Array_ProductIdentifier</frontend_model>
175
- <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
176
- <sort_order>20</sort_order>
177
- <show_in_default>1</show_in_default>
178
- <show_in_website>1</show_in_website>
179
- <show_in_store>1</show_in_store>
180
- <comment>Additional fields for plain text indexation</comment>
181
- </description>
182
- <keywords translate="label">
183
- <label>Keywords</label>
184
- <frontend_type>select</frontend_type>
185
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
186
- <sort_order>30</sort_order>
187
- <show_in_default>1</show_in_default>
188
- <show_in_website>1</show_in_website>
189
- <show_in_store>1</show_in_store>
190
- </keywords>
191
- <is_new translate="label">
192
- <label>Is new</label>
193
- <frontend_type>select</frontend_type>
194
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
195
- <sort_order>50</sort_order>
196
- <show_in_default>1</show_in_default>
197
- <show_in_website>1</show_in_website>
198
- <show_in_store>1</show_in_store>
199
- <comment>This attribute may be used as searchandizing criterium to manage Product search/autocomplete order</comment>
200
- </is_new>
201
- <is_best_sale translate="label">
202
- <label>Is top sale</label>
203
- <frontend_type>select</frontend_type>
204
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
205
- <sort_order>60</sort_order>
206
- <show_in_default>1</show_in_default>
207
- <show_in_website>1</show_in_website>
208
- <show_in_store>1</show_in_store>
209
- <comment>This attribute may be used as searchandizing criterium to manage Product search/autocomplete order</comment>
210
- </is_best_sale>
211
- <is_featured translate="label">
212
- <label>Is featured</label>
213
- <frontend_type>select</frontend_type>
214
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
215
- <sort_order>70</sort_order>
216
- <show_in_default>1</show_in_default>
217
- <show_in_website>1</show_in_website>
218
- <show_in_store>1</show_in_store>
219
- <comment>This attribute may be used as searchandizing criterium to manage Product search/autocomplete order</comment>
220
- </is_featured>
221
- <materials translate="label">
222
- <label>Material</label>
223
- <frontend_type>select</frontend_type>
224
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
225
- <sort_order>90</sort_order>
226
- <show_in_default>1</show_in_default>
227
- <show_in_website>1</show_in_website>
228
- <show_in_store>1</show_in_store>
229
- </materials>
230
- <colors translate="label">
231
- <label>Color</label>
232
- <frontend_type>select</frontend_type>
233
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
234
- <sort_order>100</sort_order>
235
- <show_in_default>1</show_in_default>
236
- <show_in_website>1</show_in_website>
237
- <show_in_store>1</show_in_store>
238
- </colors>
239
- <models translate="label">
240
- <label>Model</label>
241
- <frontend_type>select</frontend_type>
242
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
243
- <sort_order>110</sort_order>
244
- <show_in_default>1</show_in_default>
245
- <show_in_website>1</show_in_website>
246
- <show_in_store>1</show_in_store>
247
- </models>
248
- <sizes translate="label">
249
- <label>Size</label>
250
- <frontend_type>select</frontend_type>
251
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
252
- <sort_order>120</sort_order>
253
- <show_in_default>1</show_in_default>
254
- <show_in_website>1</show_in_website>
255
- <show_in_store>1</show_in_store>
256
- </sizes>
257
- <gender translate="label">
258
- <label>Gender</label>
259
- <frontend_type>select</frontend_type>
260
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
261
- <sort_order>125</sort_order>
262
- <show_in_default>1</show_in_default>
263
- <show_in_website>1</show_in_website>
264
- <show_in_store>1</show_in_store>
265
- </gender>
266
- <gtin translate="label">
267
- <label>GTIN / EAN</label>
268
- <frontend_type>select</frontend_type>
269
- <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
270
- <sort_order>125</sort_order>
271
- <show_in_default>1</show_in_default>
272
- <show_in_website>1</show_in_website>
273
- <show_in_store>1</show_in_store>
274
- </gtin>
275
- <identifier translate="label">
276
- <label>Identifier</label>
277
- <frontend_model>Antidot/System_Config_Form_Field_Array_ProductIdentifier</frontend_model>
278
- <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
279
- <sort_order>160</sort_order>
280
- <show_in_default>1</show_in_default>
281
- <show_in_website>1</show_in_website>
282
- <show_in_store>1</show_in_store>
283
- <comment>Configure additional identifiers here (your reference, manufacturer reference, supplier reference, OEM ...)</comment>
284
- </identifier>
285
- <properties translate="label">
286
- <label>Additional facets</label>
287
- <frontend_model>Antidot/System_Config_Form_Field_Array_ProductAdditionalFacet</frontend_model>
288
- <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
289
- <sort_order>180</sort_order>
290
- <show_in_default>1</show_in_default>
291
- <show_in_website>1</show_in_website>
292
- <show_in_store>1</show_in_store>
293
- <comment>Additional attributes to filter results and optionally appear as autocomplete suggestions</comment>
294
- </properties>
295
- </fields>
296
- </fields_product>
297
-
298
- <!--<fields_category>
299
- <label>Categories fields mapping</label>
300
- <frontend_type>text</frontend_type>
301
- <sort_order>5</sort_order>
302
- <show_in_default>1</show_in_default>
303
- <show_in_website>1</show_in_website>
304
- <show_in_store>1</show_in_store>
305
- <comment>These settings are related to the category file generation, used for AFS@Store indexing :</comment>
306
- <fields>
307
- <name translate="label">
308
- <label>Name</label>
309
- <frontend_type>select</frontend_type>
310
- <frontend_model>Antidot/System_Config_Form_Field_CategoryAttribute</frontend_model>
311
- <sort_order>1</sort_order>
312
- <show_in_default>1</show_in_default>
313
- <show_in_website>1</show_in_website>
314
- <show_in_store>1</show_in_store>
315
- <comment>Category attribute to use as category name</comment>
316
- </name>
317
- <description translate="label">
318
- <label>Description</label>
319
- <frontend_type>select</frontend_type>
320
- <frontend_model>Antidot/System_Config_Form_Field_CategoryAttribute</frontend_model>
321
- <sort_order>2</sort_order>
322
- <show_in_default>1</show_in_default>
323
- <show_in_website>1</show_in_website>
324
- <show_in_store>1</show_in_store>
325
- <comment>Category attribute to use as category description</comment>
326
- </description>
327
- <keywords translate="label">
328
- <label>Keywords</label>
329
- <frontend_type>select</frontend_type>
330
- <frontend_model>Antidot/System_Config_Form_Field_CategoryAttribute</frontend_model>
331
- <sort_order>3</sort_order>
332
- <show_in_default>1</show_in_default>
333
- <show_in_website>1</show_in_website>
334
- <show_in_store>1</show_in_store>
335
- <comment>Category attribute to use as category keywords</comment>
336
- </keywords>
337
- </fields>
338
- </fields_category>-->
339
-
340
- <suggest>
341
- <label>Autocomplete</label>
342
- <frontend_type>text</frontend_type>
343
- <sort_order>6</sort_order>
344
- <show_in_default>1</show_in_default>
345
- <show_in_website>1</show_in_website>
346
- <show_in_store>1</show_in_store>
347
- <fields>
348
- <enable translate="label">
349
- <label>Enable</label>
350
- <frontend_type>select</frontend_type>
351
- <source_model>Antidot/System_Config_Engine</source_model>
352
- <sort_order>1</sort_order>
353
- <show_in_default>1</show_in_default>
354
- <show_in_website>1</show_in_website>
355
- <show_in_store>1</show_in_store>
356
- <comment>Select Magento or AFS@Store (recommended) autocomplete engine. Rollback to Magento only if you experience issues</comment>
357
- </enable>
358
- <products translate="label">
359
- <label>Display products ?</label>
360
- <frontend_type>select</frontend_type>
361
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
362
- <sort_order>20</sort_order>
363
- <show_in_default>1</show_in_default>
364
- <show_in_website>1</show_in_website>
365
- <show_in_store>1</show_in_store>
366
- <comment>Display products in auto complete results</comment>
367
- </products>
368
- <products_displayed translate="label">
369
- <label>Number of products displayed</label>
370
- <frontend_type>select</frontend_type>
371
- <source_model>Antidot/System_Config_Number</source_model>
372
- <sort_order>21</sort_order>
373
- <show_in_default>1</show_in_default>
374
- <show_in_website>1</show_in_website>
375
- <show_in_store>1</show_in_store>
376
- <comment>Select the maximum number of products to display</comment>
377
- </products_displayed>
378
- <brands translate="label">
379
- <label>Display brands</label>
380
- <frontend_type>select</frontend_type>
381
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
382
- <sort_order>30</sort_order>
383
- <show_in_default>1</show_in_default>
384
- <show_in_website>1</show_in_website>
385
- <show_in_store>1</show_in_store>
386
- <comment>Display brands in auto complete results</comment>
387
- </brands>
388
- <brands_displayed translate="label">
389
- <label>Number of brands displayed</label>
390
- <frontend_type>select</frontend_type>
391
- <source_model>Antidot/System_Config_Number</source_model>
392
- <sort_order>31</sort_order>
393
- <show_in_default>1</show_in_default>
394
- <show_in_website>1</show_in_website>
395
- <show_in_store>1</show_in_store>
396
- <comment>Select the maximum number of brands to display</comment>
397
- </brands_displayed>
398
- <categories translate="label">
399
- <label>Categories</label>
400
- <frontend_type>select</frontend_type>
401
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
402
- <sort_order>40</sort_order>
403
- <show_in_default>1</show_in_default>
404
- <show_in_website>1</show_in_website>
405
- <show_in_store>1</show_in_store>
406
- <comment>Display categories in auto complete results</comment>
407
- </categories>
408
- <categories_displayed translate="label">
409
- <label>Number of categories displayed</label>
410
- <frontend_type>select</frontend_type>
411
- <source_model>Antidot/System_Config_Number</source_model>
412
- <sort_order>41</sort_order>
413
- <show_in_default>1</show_in_default>
414
- <show_in_website>1</show_in_website>
415
- <show_in_store>1</show_in_store>
416
- <comment>Select the maximum number of categories to display</comment>
417
- </categories_displayed>
418
- <template translate="label">
419
- <label>Template</label>
420
- <frontend_type>textarea</frontend_type>
421
- <sort_order>51</sort_order>
422
- <show_in_default>1</show_in_default>
423
- <show_in_website>1</show_in_website>
424
- <show_in_store>1</show_in_store>
425
- <comment>Configure here the XSLT template to display ACP results. Caution: if your template set his own sort order for columns, then 'Sort order' above settings will not work anymore</comment>
426
- </template>
427
- <show_xml>
428
- <label>Example</label>
429
- <frontend_model>Antidot/System_Config_Html_ShowXml</frontend_model>
430
- <sort_order>50</sort_order>
431
- <show_in_default>1</show_in_default>
432
- <show_in_website>0</show_in_website>
433
- <show_in_store>0</show_in_store>
434
- <comment>Display a popup with a sample of XML code that will be transformed with the XSLT stylesheet.</comment>
435
- </show_xml>
436
- <restore_template>
437
- <label></label>
438
- <frontend_model>Antidot/System_Config_Button_RestoreTemplate</frontend_model>
439
- <sort_order>52</sort_order>
440
- <show_in_default>1</show_in_default>
441
- <show_in_website>0</show_in_website>
442
- <show_in_store>0</show_in_store>
443
- <comment>Restore the default XSLT template (usefull if you broke it !)</comment>
444
- </restore_template>
445
- <order_1 translate="label">
446
- <label>Sort order</label>
447
- <frontend_type>select</frontend_type>
448
- <source_model>Antidot/System_Config_Suggest_Type</source_model>
449
- <sort_order>42</sort_order>
450
- <show_in_default>1</show_in_default>
451
- <show_in_website>1</show_in_website>
452
- <show_in_store>1</show_in_store>
453
- <comment>First collection to display in suggest</comment>
454
- </order_1>
455
- <order_2 translate="label">
456
- <frontend_type>select</frontend_type>
457
- <source_model>Antidot/System_Config_Suggest_Type</source_model>
458
- <sort_order>43</sort_order>
459
- <show_in_default>1</show_in_default>
460
- <show_in_website>1</show_in_website>
461
- <show_in_store>1</show_in_store>
462
- <comment>Second collection to display in suggest</comment>
463
- </order_2>
464
- <order_3 translate="label">
465
- <frontend_type>select</frontend_type>
466
- <source_model>Antidot/System_Config_Suggest_Type</source_model>
467
- <sort_order>44</sort_order>
468
- <show_in_default>1</show_in_default>
469
- <show_in_website>1</show_in_website>
470
- <show_in_store>1</show_in_store>
471
- <comment>Third collection to display in suggest</comment>
472
- </order_3>
473
- </fields>
474
- </suggest>
475
-
476
- <engine>
477
- <label>Search engine</label>
478
- <frontend_type>text</frontend_type>
479
- <sort_order>7</sort_order>
480
- <show_in_default>1</show_in_default>
481
- <show_in_website>1</show_in_website>
482
- <show_in_store>1</show_in_store>
483
- <fields>
484
- <engine translate="label">
485
- <label>Search Engine</label>
486
- <frontend_type>select</frontend_type>
487
- <source_model>Antidot/System_Config_Engine</source_model>
488
- <backend_model>Antidot/System_Config_backend_engine</backend_model>
489
- <sort_order>19</sort_order>
490
- <show_in_default>1</show_in_default>
491
- <show_in_website>1</show_in_website>
492
- <show_in_store>1</show_in_store>
493
- <comment>Select Magento or AFS@Store (recommended) search engine. Rollback to Magento only if you experience issues</comment>
494
- </engine>
495
- <feed_categories translate="label">
496
- <label>Display categories</label>
497
- <frontend_type>select</frontend_type>
498
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
499
- <sort_order>40</sort_order>
500
- <show_in_default>1</show_in_default>
501
- <show_in_website>1</show_in_website>
502
- <show_in_store>1</show_in_store>
503
- <comment>Display categories matching to search query (require template customization)</comment>
504
- </feed_categories>
505
- <spellcheck translate="label">
506
- <label>Spellcheck sentence</label>
507
- <frontend_type>text</frontend_type>
508
- <sort_order>45</sort_order>
509
- <show_in_default>1</show_in_default>
510
- <show_in_website>1</show_in_website>
511
- <show_in_store>1</show_in_store>
512
- <comment>Text to display when a spellcheck suggestion is available. Use {spellcheck} keyword to include AFS@Store suggestion in your text</comment>
513
- </spellcheck>
514
- <facets translate="label">
515
- <label>Facets</label>
516
- <frontend_model>Antidot/System_Config_Form_Field_Array_Facet</frontend_model>
517
- <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
518
- <sort_order>50</sort_order>
519
- <show_in_default>1</show_in_default>
520
- <show_in_website>1</show_in_website>
521
- <show_in_store>1</show_in_store>
522
- <comment>Select the facets (and the order) you want to enable on the search page</comment>
523
- </facets>
524
- <facet_options translate="label">
525
- <label>Max number of facet values</label>
526
- <frontend_type>text</frontend_type>
527
- <sort_order>60</sort_order>
528
- <show_in_default>1</show_in_default>
529
- <show_in_website>1</show_in_website>
530
- <show_in_store>1</show_in_store>
531
- <comment>Max number of options to display for a facet (additional results will be hidden)</comment>
532
- </facet_options>
533
- <price_facet translate="label">
534
- <label>Price facet label</label>
535
- <frontend_type>text</frontend_type>
536
- <sort_order>62</sort_order>
537
- <show_in_default>1</show_in_default>
538
- <show_in_website>1</show_in_website>
539
- <show_in_store>1</show_in_store>
540
- <comment>Text to display for each price ranges : use {min} and {max} codes to include values in your text</comment>
541
- </price_facet>
542
- <sortable translate="label">
543
- <label>Sort options</label>
544
- <frontend_model>Antidot/System_Config_Form_Field_Array_Sort</frontend_model>
545
- <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
546
- <sort_order>180</sort_order>
547
- <show_in_default>1</show_in_default>
548
- <show_in_website>1</show_in_website>
549
- <show_in_store>1</show_in_store>
550
- <comment>Select sort options available in sort drop down menu</comment>
551
- </sortable>
552
- <default_sort translate="label">
553
- <label>Default sort</label>
554
- <frontend_model>Antidot/System_Config_Form_Field_Array_DefaultSort</frontend_model>
555
- <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
556
- <sort_order>190</sort_order>
557
- <show_in_default>1</show_in_default>
558
- <show_in_website>1</show_in_website>
559
- <show_in_store>1</show_in_store>
560
- <comment>Default sort to apply</comment>
561
- </default_sort>
562
- </fields>
563
- </engine>
564
-
565
- <promote>
566
- <label>Merchandising</label>
567
- <frontend_type>text</frontend_type>
568
- <sort_order>8</sort_order>
569
- <show_in_default>1</show_in_default>
570
- <show_in_website>1</show_in_website>
571
- <show_in_store>1</show_in_store>
572
- <fields>
573
- <redirect translate="label">
574
- <label>Promote redirect</label>
575
- <frontend_type>select</frontend_type>
576
- <source_model>Antidot/System_Config_PromoteRedirect</source_model>
577
- <sort_order>19</sort_order>
578
- <show_in_default>1</show_in_default>
579
- <show_in_website>1</show_in_website>
580
- <show_in_store>1</show_in_store>
581
- <comment>Allows you to choose how Promote campaigns created in Antidot Back-Office are used to redirect search towards internal urls</comment>
582
- </redirect>
583
- </fields>
584
- </promote>
585
-
586
- <action>
587
- <label>On-demand Data Upload</label>
588
- <frontend_type>text</frontend_type>
589
- <sort_order>10</sort_order>
590
- <show_in_default>1</show_in_default>
591
- <show_in_website>0</show_in_website>
592
- <show_in_store>0</show_in_store>
593
- <fields>
594
- <!--<push_categories>
595
- <label>Push categories</label>
596
- <frontend_model>Antidot/System_Config_Button_PushCategories</frontend_model>
597
- <sort_order>1</sort_order>
598
- <show_in_default>1</show_in_default>
599
- <show_in_website>0</show_in_website>
600
- <show_in_store>0</show_in_store>
601
- <comment>Manually push category index to AFS@Store (usefull when you change configuration above)</comment>
602
- </push_categories>-->
603
- <push_products>
604
- <label>Push products</label>
605
- <frontend_model>Antidot/System_Config_Button_PushProducts</frontend_model>
606
- <sort_order>2</sort_order>
607
- <show_in_default>1</show_in_default>
608
- <show_in_website>0</show_in_website>
609
- <show_in_store>0</show_in_store>
610
- <comment>Manually push products index to AFS@Store (usefull when you change configuration above)</comment>
611
- </push_products>
612
- </fields>
613
- </action>
614
-
615
- <generation>
616
- <label>Data upload report</label>
617
- <frontend_type>text</frontend_type>
618
- <sort_order>15</sort_order>
619
- <show_in_default>1</show_in_default>
620
- <show_in_website>0</show_in_website>
621
- <show_in_store>0</show_in_store>
622
- <comment>Last index push history logs</comment>
623
- <fields>
624
- <log>
625
- <frontend_model>Antidot/System_Config_Html_Export</frontend_model>
626
- <sort_order>1</sort_order>
627
- <show_in_default>1</show_in_default>
628
- <show_in_website>0</show_in_website>
629
- <show_in_store>0</show_in_store>
630
- </log>
631
- </fields>
632
- </generation>
633
- </groups>
634
- </antidot>
635
- </sections>
636
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <antidot translate="label" module="Antidot">
5
+ <label>AFS@Store</label>
6
+ <tab>catalog</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>500</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <general>
14
+ <label>General</label>
15
+ <comment><![CDATA[<a href="https://bo.afs-antidot.net/" target="_blank" style="font-size:16px">Antidot Back office (Analytics, Synonyms, Promote)</a>]]></comment>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <fields>
22
+ <version translate="label">
23
+ <label>AFS@Store Extension Version</label>
24
+ <frontend_model>Antidot/System_Config_Html_Version</frontend_model>
25
+ <sort_order>1</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ <comment>Communicate this version to the support team if you need help</comment>
30
+ </version>
31
+ <owner translate="label">
32
+ <label>Organization name</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>10</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ <comment>Useful for support team</comment>
39
+ </owner>
40
+ <email translate="label">
41
+ <label>E-mail</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>12</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>0</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ <comment>Used to send alert when an error occured</comment>
48
+ </email>
49
+ </fields>
50
+
51
+ </general>
52
+
53
+ <ftp>
54
+ <label>Data upload parameters</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>2</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>0</show_in_website>
59
+ <show_in_store>0</show_in_store>
60
+ <fields>
61
+ <host translate="label">
62
+ <label>Host</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>1</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <comment>Host to connect to Antidot to push files</comment>
67
+ </host>
68
+ <directory translate="label">
69
+ <label>Upload Directory</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>2</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <comment>Directory to upload files</comment>
74
+ </directory>
75
+ <login translate="label">
76
+ <label>Login</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>3</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <comment>Your Antidot FTP Login</comment>
81
+ </login>
82
+ <password translate="label">
83
+ <label>Password</label>
84
+ <frontend_type>password</frontend_type>
85
+ <sort_order>4</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <comment>Your Antidot FTP Password</comment>
88
+ </password>
89
+ </fields>
90
+ </ftp>
91
+
92
+ <web_service>
93
+ <label>Web services</label>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>3</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>0</show_in_website>
98
+ <show_in_store>0</show_in_store>
99
+ <fields>
100
+ <host translate="label">
101
+ <label>Host</label>
102
+ <frontend_type>text</frontend_type>
103
+ <sort_order>1</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <comment>Web service host to communicate with Antidot</comment>
106
+ </host>
107
+ <service translate="label">
108
+ <label>Service ID</label>
109
+ <frontend_type>text</frontend_type>
110
+ <sort_order>2</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <comment>Antidot service ID</comment>
113
+ </service>
114
+ <status translate="label">
115
+ <label>Status</label>
116
+ <frontend_type>select</frontend_type>
117
+ <source_model>Antidot/System_Config_WSStatus</source_model>
118
+ <sort_order>3</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <comment>Web service status. Go live only with 'stable' status on your production site</comment>
121
+ </status>
122
+ </fields>
123
+ </web_service>
124
+
125
+ <fields_product>
126
+ <label>Products fields mapping</label>
127
+ <frontend_type>text</frontend_type>
128
+ <sort_order>4</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ <comment>These settings are related to the product file generation, used for AFS@Store indexing. You can match to existing attributes in Magento and add your own properties. Standard Magento attributes such as urls, categories, prices, quantities, promotions are automatically inherited by this mapping. Use this form to map specific fields from your data model</comment>
133
+ <fields>
134
+ <in_stock_only translate="label">
135
+ <label>Include out of stock products</label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>adminhtml/system_config_source_yesno</source_model>
138
+ <sort_order>5</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ <comment>Change this setting if you want to include out of stock products</comment>
143
+ </in_stock_only>
144
+ <name translate="label">
145
+ <label>Name</label>
146
+ <frontend_type>select</frontend_type>
147
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
148
+ <sort_order>10</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ </name>
153
+ <short_name translate="label">
154
+ <label>Short name</label>
155
+ <frontend_type>select</frontend_type>
156
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
157
+ <sort_order>11</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+ </short_name>
162
+ <manufacturer translate="label">
163
+ <label>Brand</label>
164
+ <frontend_type>select</frontend_type>
165
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
166
+ <sort_order>13</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
+ </manufacturer>
171
+ <description translate="label">
172
+ <label>Description</label>
173
+ <frontend_type>select</frontend_type>
174
+ <frontend_model>Antidot/System_Config_Form_Field_Array_ProductIdentifier</frontend_model>
175
+ <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
176
+ <sort_order>20</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>1</show_in_store>
180
+ <comment>Additional fields for plain text indexation</comment>
181
+ </description>
182
+ <keywords translate="label">
183
+ <label>Keywords</label>
184
+ <frontend_type>select</frontend_type>
185
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
186
+ <sort_order>30</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </keywords>
191
+ <is_new translate="label">
192
+ <label>Is new</label>
193
+ <frontend_type>select</frontend_type>
194
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
195
+ <sort_order>50</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ <comment>This attribute may be used as searchandizing criterium to manage Product search/autocomplete order</comment>
200
+ </is_new>
201
+ <is_best_sale translate="label">
202
+ <label>Is top sale</label>
203
+ <frontend_type>select</frontend_type>
204
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
205
+ <sort_order>60</sort_order>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <show_in_store>1</show_in_store>
209
+ <comment>This attribute may be used as searchandizing criterium to manage Product search/autocomplete order</comment>
210
+ </is_best_sale>
211
+ <is_featured translate="label">
212
+ <label>Is featured</label>
213
+ <frontend_type>select</frontend_type>
214
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
215
+ <sort_order>70</sort_order>
216
+ <show_in_default>1</show_in_default>
217
+ <show_in_website>1</show_in_website>
218
+ <show_in_store>1</show_in_store>
219
+ <comment>This attribute may be used as searchandizing criterium to manage Product search/autocomplete order</comment>
220
+ </is_featured>
221
+ <materials translate="label">
222
+ <label>Material</label>
223
+ <frontend_type>select</frontend_type>
224
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
225
+ <sort_order>90</sort_order>
226
+ <show_in_default>1</show_in_default>
227
+ <show_in_website>1</show_in_website>
228
+ <show_in_store>1</show_in_store>
229
+ </materials>
230
+ <colors translate="label">
231
+ <label>Color</label>
232
+ <frontend_type>select</frontend_type>
233
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
234
+ <sort_order>100</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ </colors>
239
+ <models translate="label">
240
+ <label>Model</label>
241
+ <frontend_type>select</frontend_type>
242
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
243
+ <sort_order>110</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ </models>
248
+ <sizes translate="label">
249
+ <label>Size</label>
250
+ <frontend_type>select</frontend_type>
251
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
252
+ <sort_order>120</sort_order>
253
+ <show_in_default>1</show_in_default>
254
+ <show_in_website>1</show_in_website>
255
+ <show_in_store>1</show_in_store>
256
+ </sizes>
257
+ <gender translate="label">
258
+ <label>Gender</label>
259
+ <frontend_type>select</frontend_type>
260
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
261
+ <sort_order>125</sort_order>
262
+ <show_in_default>1</show_in_default>
263
+ <show_in_website>1</show_in_website>
264
+ <show_in_store>1</show_in_store>
265
+ </gender>
266
+ <gtin translate="label">
267
+ <label>GTIN / EAN</label>
268
+ <frontend_type>select</frontend_type>
269
+ <frontend_model>Antidot/System_Config_Form_Field_ProductAttribute</frontend_model>
270
+ <sort_order>125</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>1</show_in_website>
273
+ <show_in_store>1</show_in_store>
274
+ </gtin>
275
+ <identifier translate="label">
276
+ <label>Identifier</label>
277
+ <frontend_model>Antidot/System_Config_Form_Field_Array_ProductIdentifier</frontend_model>
278
+ <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
279
+ <sort_order>160</sort_order>
280
+ <show_in_default>1</show_in_default>
281
+ <show_in_website>1</show_in_website>
282
+ <show_in_store>1</show_in_store>
283
+ <comment>Configure additional identifiers here (your reference, manufacturer reference, supplier reference, OEM ...)</comment>
284
+ </identifier>
285
+ <properties translate="label">
286
+ <label>Additional facets</label>
287
+ <frontend_model>Antidot/System_Config_Form_Field_Array_ProductAdditionalFacet</frontend_model>
288
+ <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
289
+ <sort_order>180</sort_order>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>1</show_in_website>
292
+ <show_in_store>1</show_in_store>
293
+ <comment>Additional attributes to filter results and optionally appear as autocomplete suggestions</comment>
294
+ </properties>
295
+ </fields>
296
+ </fields_product>
297
+
298
+ <!--<fields_category>
299
+ <label>Categories fields mapping</label>
300
+ <frontend_type>text</frontend_type>
301
+ <sort_order>5</sort_order>
302
+ <show_in_default>1</show_in_default>
303
+ <show_in_website>1</show_in_website>
304
+ <show_in_store>1</show_in_store>
305
+ <comment>These settings are related to the category file generation, used for AFS@Store indexing :</comment>
306
+ <fields>
307
+ <name translate="label">
308
+ <label>Name</label>
309
+ <frontend_type>select</frontend_type>
310
+ <frontend_model>Antidot/System_Config_Form_Field_CategoryAttribute</frontend_model>
311
+ <sort_order>1</sort_order>
312
+ <show_in_default>1</show_in_default>
313
+ <show_in_website>1</show_in_website>
314
+ <show_in_store>1</show_in_store>
315
+ <comment>Category attribute to use as category name</comment>
316
+ </name>
317
+ <description translate="label">
318
+ <label>Description</label>
319
+ <frontend_type>select</frontend_type>
320
+ <frontend_model>Antidot/System_Config_Form_Field_CategoryAttribute</frontend_model>
321
+ <sort_order>2</sort_order>
322
+ <show_in_default>1</show_in_default>
323
+ <show_in_website>1</show_in_website>
324
+ <show_in_store>1</show_in_store>
325
+ <comment>Category attribute to use as category description</comment>
326
+ </description>
327
+ <keywords translate="label">
328
+ <label>Keywords</label>
329
+ <frontend_type>select</frontend_type>
330
+ <frontend_model>Antidot/System_Config_Form_Field_CategoryAttribute</frontend_model>
331
+ <sort_order>3</sort_order>
332
+ <show_in_default>1</show_in_default>
333
+ <show_in_website>1</show_in_website>
334
+ <show_in_store>1</show_in_store>
335
+ <comment>Category attribute to use as category keywords</comment>
336
+ </keywords>
337
+ </fields>
338
+ </fields_category>-->
339
+
340
+ <suggest>
341
+ <label>Autocomplete</label>
342
+ <frontend_type>text</frontend_type>
343
+ <sort_order>6</sort_order>
344
+ <show_in_default>1</show_in_default>
345
+ <show_in_website>1</show_in_website>
346
+ <show_in_store>1</show_in_store>
347
+ <fields>
348
+ <enable translate="label">
349
+ <label>Enable</label>
350
+ <frontend_type>select</frontend_type>
351
+ <source_model>Antidot/System_Config_Engine</source_model>
352
+ <sort_order>1</sort_order>
353
+ <show_in_default>1</show_in_default>
354
+ <show_in_website>1</show_in_website>
355
+ <show_in_store>1</show_in_store>
356
+ <comment>Select Magento or AFS@Store (recommended) autocomplete engine. Rollback to Magento only if you experience issues</comment>
357
+ </enable>
358
+ <products translate="label">
359
+ <label>Display products ?</label>
360
+ <frontend_type>select</frontend_type>
361
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
362
+ <sort_order>20</sort_order>
363
+ <show_in_default>1</show_in_default>
364
+ <show_in_website>1</show_in_website>
365
+ <show_in_store>1</show_in_store>
366
+ <comment>Display products in auto complete results</comment>
367
+ </products>
368
+ <products_displayed translate="label">
369
+ <label>Number of products displayed</label>
370
+ <frontend_type>select</frontend_type>
371
+ <source_model>Antidot/System_Config_Number</source_model>
372
+ <sort_order>21</sort_order>
373
+ <show_in_default>1</show_in_default>
374
+ <show_in_website>1</show_in_website>
375
+ <show_in_store>1</show_in_store>
376
+ <comment>Select the maximum number of products to display</comment>
377
+ </products_displayed>
378
+ <brands translate="label">
379
+ <label>Display brands</label>
380
+ <frontend_type>select</frontend_type>
381
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
382
+ <sort_order>30</sort_order>
383
+ <show_in_default>1</show_in_default>
384
+ <show_in_website>1</show_in_website>
385
+ <show_in_store>1</show_in_store>
386
+ <comment>Display brands in auto complete results</comment>
387
+ </brands>
388
+ <brands_displayed translate="label">
389
+ <label>Number of brands displayed</label>
390
+ <frontend_type>select</frontend_type>
391
+ <source_model>Antidot/System_Config_Number</source_model>
392
+ <sort_order>31</sort_order>
393
+ <show_in_default>1</show_in_default>
394
+ <show_in_website>1</show_in_website>
395
+ <show_in_store>1</show_in_store>
396
+ <comment>Select the maximum number of brands to display</comment>
397
+ </brands_displayed>
398
+ <categories translate="label">
399
+ <label>Categories</label>
400
+ <frontend_type>select</frontend_type>
401
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
402
+ <sort_order>40</sort_order>
403
+ <show_in_default>1</show_in_default>
404
+ <show_in_website>1</show_in_website>
405
+ <show_in_store>1</show_in_store>
406
+ <comment>Display categories in auto complete results</comment>
407
+ </categories>
408
+ <categories_displayed translate="label">
409
+ <label>Number of categories displayed</label>
410
+ <frontend_type>select</frontend_type>
411
+ <source_model>Antidot/System_Config_Number</source_model>
412
+ <sort_order>41</sort_order>
413
+ <show_in_default>1</show_in_default>
414
+ <show_in_website>1</show_in_website>
415
+ <show_in_store>1</show_in_store>
416
+ <comment>Select the maximum number of categories to display</comment>
417
+ </categories_displayed>
418
+ <template translate="label">
419
+ <label>Template</label>
420
+ <frontend_type>textarea</frontend_type>
421
+ <sort_order>51</sort_order>
422
+ <show_in_default>1</show_in_default>
423
+ <show_in_website>1</show_in_website>
424
+ <show_in_store>1</show_in_store>
425
+ <comment>Configure here the XSLT template to display ACP results. Caution: if your template set his own sort order for columns, then 'Sort order' above settings will not work anymore</comment>
426
+ </template>
427
+ <show_xml>
428
+ <label>Example</label>
429
+ <frontend_model>Antidot/System_Config_Html_ShowXml</frontend_model>
430
+ <sort_order>50</sort_order>
431
+ <show_in_default>1</show_in_default>
432
+ <show_in_website>0</show_in_website>
433
+ <show_in_store>0</show_in_store>
434
+ <comment>Display a popup with a sample of XML code that will be transformed with the XSLT stylesheet.</comment>
435
+ </show_xml>
436
+ <restore_template>
437
+ <label></label>
438
+ <frontend_model>Antidot/System_Config_Button_RestoreTemplate</frontend_model>
439
+ <sort_order>52</sort_order>
440
+ <show_in_default>1</show_in_default>
441
+ <show_in_website>0</show_in_website>
442
+ <show_in_store>0</show_in_store>
443
+ <comment>Restore the default XSLT template (usefull if you broke it !)</comment>
444
+ </restore_template>
445
+ <order_1 translate="label">
446
+ <label>Sort order</label>
447
+ <frontend_type>select</frontend_type>
448
+ <source_model>Antidot/System_Config_Suggest_Type</source_model>
449
+ <sort_order>42</sort_order>
450
+ <show_in_default>1</show_in_default>
451
+ <show_in_website>1</show_in_website>
452
+ <show_in_store>1</show_in_store>
453
+ <comment>First collection to display in suggest</comment>
454
+ </order_1>
455
+ <order_2 translate="label">
456
+ <frontend_type>select</frontend_type>
457
+ <source_model>Antidot/System_Config_Suggest_Type</source_model>
458
+ <sort_order>43</sort_order>
459
+ <show_in_default>1</show_in_default>
460
+ <show_in_website>1</show_in_website>
461
+ <show_in_store>1</show_in_store>
462
+ <comment>Second collection to display in suggest</comment>
463
+ </order_2>
464
+ <order_3 translate="label">
465
+ <frontend_type>select</frontend_type>
466
+ <source_model>Antidot/System_Config_Suggest_Type</source_model>
467
+ <sort_order>44</sort_order>
468
+ <show_in_default>1</show_in_default>
469
+ <show_in_website>1</show_in_website>
470
+ <show_in_store>1</show_in_store>
471
+ <comment>Third collection to display in suggest</comment>
472
+ </order_3>
473
+ </fields>
474
+ </suggest>
475
+
476
+ <engine>
477
+ <label>Search engine</label>
478
+ <frontend_type>text</frontend_type>
479
+ <sort_order>7</sort_order>
480
+ <show_in_default>1</show_in_default>
481
+ <show_in_website>1</show_in_website>
482
+ <show_in_store>1</show_in_store>
483
+ <fields>
484
+ <engine translate="label">
485
+ <label>Search Engine</label>
486
+ <frontend_type>select</frontend_type>
487
+ <source_model>Antidot/System_Config_Engine</source_model>
488
+ <backend_model>Antidot/System_Config_backend_engine</backend_model>
489
+ <sort_order>19</sort_order>
490
+ <show_in_default>1</show_in_default>
491
+ <show_in_website>1</show_in_website>
492
+ <show_in_store>1</show_in_store>
493
+ <comment>Select Magento or AFS@Store (recommended) search engine. Rollback to Magento only if you experience issues</comment>
494
+ </engine>
495
+ <feed_categories translate="label">
496
+ <label>Display categories</label>
497
+ <frontend_type>select</frontend_type>
498
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
499
+ <sort_order>40</sort_order>
500
+ <show_in_default>1</show_in_default>
501
+ <show_in_website>1</show_in_website>
502
+ <show_in_store>1</show_in_store>
503
+ <comment>Display categories matching to search query (require template customization)</comment>
504
+ </feed_categories>
505
+ <spellcheck translate="label">
506
+ <label>Spellcheck sentence</label>
507
+ <frontend_type>text</frontend_type>
508
+ <sort_order>45</sort_order>
509
+ <show_in_default>1</show_in_default>
510
+ <show_in_website>1</show_in_website>
511
+ <show_in_store>1</show_in_store>
512
+ <comment>Text to display when a spellcheck suggestion is available. Use {spellcheck} keyword to include AFS@Store suggestion in your text</comment>
513
+ </spellcheck>
514
+ <facets translate="label">
515
+ <label>Facets</label>
516
+ <frontend_model>Antidot/System_Config_Form_Field_Array_Facet</frontend_model>
517
+ <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
518
+ <sort_order>50</sort_order>
519
+ <show_in_default>1</show_in_default>
520
+ <show_in_website>1</show_in_website>
521
+ <show_in_store>1</show_in_store>
522
+ <comment>Select the facets (and the order) you want to enable on the search page</comment>
523
+ </facets>
524
+ <facet_options translate="label">
525
+ <label>Max number of facet values</label>
526
+ <frontend_type>text</frontend_type>
527
+ <sort_order>60</sort_order>
528
+ <show_in_default>1</show_in_default>
529
+ <show_in_website>1</show_in_website>
530
+ <show_in_store>1</show_in_store>
531
+ <comment>Max number of options to display for a facet (additional results will be hidden)</comment>
532
+ </facet_options>
533
+ <price_facet translate="label">
534
+ <label>Price facet label</label>
535
+ <frontend_type>text</frontend_type>
536
+ <sort_order>62</sort_order>
537
+ <show_in_default>1</show_in_default>
538
+ <show_in_website>1</show_in_website>
539
+ <show_in_store>1</show_in_store>
540
+ <comment>Text to display for each price ranges : use {min} and {max} codes to include values in your text</comment>
541
+ </price_facet>
542
+ <sortable translate="label">
543
+ <label>Sort options</label>
544
+ <frontend_model>Antidot/System_Config_Form_Field_Array_Sort</frontend_model>
545
+ <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
546
+ <sort_order>180</sort_order>
547
+ <show_in_default>1</show_in_default>
548
+ <show_in_website>1</show_in_website>
549
+ <show_in_store>1</show_in_store>
550
+ <comment>Select sort options available in sort drop down menu</comment>
551
+ </sortable>
552
+ <default_sort translate="label">
553
+ <label>Default sort</label>
554
+ <frontend_model>Antidot/System_Config_Form_Field_Array_DefaultSort</frontend_model>
555
+ <backend_model>Adminhtml/System_Config_Backend_Serialized_Array</backend_model>
556
+ <sort_order>190</sort_order>
557
+ <show_in_default>1</show_in_default>
558
+ <show_in_website>1</show_in_website>
559
+ <show_in_store>1</show_in_store>
560
+ <comment>Default sort to apply</comment>
561
+ </default_sort>
562
+ </fields>
563
+ </engine>
564
+
565
+ <promote>
566
+ <label>Merchandising</label>
567
+ <frontend_type>text</frontend_type>
568
+ <sort_order>8</sort_order>
569
+ <show_in_default>1</show_in_default>
570
+ <show_in_website>1</show_in_website>
571
+ <show_in_store>1</show_in_store>
572
+ <fields>
573
+ <redirect translate="label">
574
+ <label>Promote redirect</label>
575
+ <frontend_type>select</frontend_type>
576
+ <source_model>Antidot/System_Config_PromoteRedirect</source_model>
577
+ <sort_order>19</sort_order>
578
+ <show_in_default>1</show_in_default>
579
+ <show_in_website>1</show_in_website>
580
+ <show_in_store>1</show_in_store>
581
+ <comment>Allows you to choose how Promote campaigns created in Antidot Back-Office are used to redirect search towards internal urls</comment>
582
+ </redirect>
583
+ </fields>
584
+ </promote>
585
+
586
+ <action>
587
+ <label>On-demand Data Upload</label>
588
+ <frontend_type>text</frontend_type>
589
+ <sort_order>10</sort_order>
590
+ <show_in_default>1</show_in_default>
591
+ <show_in_website>0</show_in_website>
592
+ <show_in_store>0</show_in_store>
593
+ <fields>
594
+ <!--<push_categories>
595
+ <label>Push categories</label>
596
+ <frontend_model>Antidot/System_Config_Button_PushCategories</frontend_model>
597
+ <sort_order>1</sort_order>
598
+ <show_in_default>1</show_in_default>
599
+ <show_in_website>0</show_in_website>
600
+ <show_in_store>0</show_in_store>
601
+ <comment>Manually push category index to AFS@Store (usefull when you change configuration above)</comment>
602
+ </push_categories>-->
603
+ <push_products>
604
+ <label>Push products</label>
605
+ <frontend_model>Antidot/System_Config_Button_PushProducts</frontend_model>
606
+ <sort_order>2</sort_order>
607
+ <show_in_default>1</show_in_default>
608
+ <show_in_website>0</show_in_website>
609
+ <show_in_store>0</show_in_store>
610
+ <comment>Manually push products index to AFS@Store (usefull when you change configuration above)</comment>
611
+ </push_products>
612
+ </fields>
613
+ </action>
614
+
615
+ <generation>
616
+ <label>Data upload report</label>
617
+ <frontend_type>text</frontend_type>
618
+ <sort_order>15</sort_order>
619
+ <show_in_default>1</show_in_default>
620
+ <show_in_website>0</show_in_website>
621
+ <show_in_store>0</show_in_store>
622
+ <comment>Last index push history logs</comment>
623
+ <fields>
624
+ <log>
625
+ <frontend_model>Antidot/System_Config_Html_Export</frontend_model>
626
+ <sort_order>1</sort_order>
627
+ <show_in_default>1</show_in_default>
628
+ <show_in_website>0</show_in_website>
629
+ <show_in_store>0</show_in_store>
630
+ </log>
631
+ </fields>
632
+ </generation>
633
+ </groups>
634
+ </antidot>
635
+ </sections>
636
  </config>
app/code/community/MDN/Antidot/sql/Antidot_setup/mysql4-install-0.9.php CHANGED
@@ -1,25 +1,25 @@
1
- <?php
2
-
3
- $installer = $this;
4
-
5
- $installer->startSetup();
6
-
7
- /**
8
- * Create table 'antidot/export'
9
- */
10
- $installer->run("
11
- CREATE TABLE `antidot_export` (
12
- `id` INT unsigned NOT NULL AUTO_INCREMENT,
13
- `reference` VARCHAR(64) DEFAULT '',
14
- `type` ENUM('FULL', 'INC') NOT NULL DEFAULT 'FULL',
15
- `element` ENUM('CATALOG', 'CATEGORY') NOT NULL,
16
- `begin_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
17
- `end_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
18
- `items_processed` INT NOT NULL DEFAULT 0,
19
- `status` ENUM('SUCCESS', 'FAILED') NOT NULL,
20
- `error` VARCHAR(255) DEFAULT '',
21
- PRIMARY KEY (`id`)
22
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
23
- ");
24
-
25
  $installer->endSetup();
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ /**
8
+ * Create table 'antidot/export'
9
+ */
10
+ $installer->run("
11
+ CREATE TABLE `antidot_export` (
12
+ `id` INT unsigned NOT NULL AUTO_INCREMENT,
13
+ `reference` VARCHAR(64) DEFAULT '',
14
+ `type` ENUM('FULL', 'INC') NOT NULL DEFAULT 'FULL',
15
+ `element` ENUM('CATALOG', 'CATEGORY') NOT NULL,
16
+ `begin_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
17
+ `end_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
18
+ `items_processed` INT NOT NULL DEFAULT 0,
19
+ `status` ENUM('SUCCESS', 'FAILED') NOT NULL,
20
+ `error` VARCHAR(255) DEFAULT '',
21
+ PRIMARY KEY (`id`)
22
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
23
+ ");
24
+
25
  $installer->endSetup();
app/design/frontend/default/default/layout/antidot.xml CHANGED
@@ -1,11 +1,11 @@
1
- <?xml version="1.0"?>
2
-
3
- <layout version="0.1.0">
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>
10
-
11
- </layout>
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
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>
10
+
11
+ </layout>
app/design/frontend/default/default/template/antidot/catalogsearch/result/category.phtml CHANGED
@@ -1,10 +1,10 @@
1
- <?php if ($this->getCategories()->getSize() > 0): ?>
2
-
3
- <h2><?php echo $this->__('Categories matching to your search :'); ?></h2>
4
-
5
- <ul>
6
- <?php foreach($this->getCategories() as $cat): ?>
7
- <li><a href="<?php echo $this->getCategoryUrl($cat); ?>"><?php echo $cat->getName(); ?></a></li>
8
- <?php endforeach; ?>
9
- </ul>
10
- <?php endif; ?>
1
+ <?php if ($this->getCategories()->getSize() > 0): ?>
2
+
3
+ <h2><?php echo $this->__('Categories matching to your search :'); ?></h2>
4
+
5
+ <ul>
6
+ <?php foreach($this->getCategories() as $cat): ?>
7
+ <li><a href="<?php echo $this->getCategoryUrl($cat); ?>"><?php echo $cat->getName(); ?></a></li>
8
+ <?php endforeach; ?>
9
+ </ul>
10
+ <?php endif; ?>
app/etc/modules/MDN_Antidot.xml CHANGED
@@ -1,9 +1,9 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <MDN_Antidot>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </MDN_Antidot>
8
- </modules>
9
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <MDN_Antidot>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </MDN_Antidot>
8
+ </modules>
9
  </config>
package.xml CHANGED
@@ -1,18 +1,25 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>afs-store</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>LGPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Use AFS STORE search engine seamlessly in Magento</summary>
10
  <description>Use AFS STORE search engine seamlessly in Magento</description>
11
- <notes>First stable release including ACP &amp; Search</notes>
12
- <authors><author><name>BoostMyShop</name><user>olixelle</user><email>contact@boostmyshop.com</email></author></authors>
13
- <date>2014-05-12</date>
14
- <time>14:23:09</time>
15
- <contents><target name="magecommunity"><dir name="MDN"><dir name="Antidot"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="c8147e06452988877fd23de97e47ba7d"/><file name="Boolean.php" hash="0d301b2ca3c1c1e60a69dbfc043a8520"/><file name="Category.php" hash="695722041376ff47c15c78b233e32f29"/><file name="Decimal.php" hash="a5a605767a6b3322dcab4715f107b71c"/><file name="Price.php" hash="3e8fe52c943c4d7cc21062ebd63ff9a0"/></dir><file name="View.php" hash="95d6226dc5e264422511bc19dcf23358"/></dir></dir><dir name="Catalogsearch"><file name="Category.php" hash="48fc1ed0efa8ba5cb4efcd44ccfe6e7d"/><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4b7dd735852366d7d999afaf1c5ad4b9"/></dir></dir><file name="Layer.php" hash="af32668e618033cda4adab8a12ebabcc"/><file name="Result.php" hash="9c3076c2a22ebf198f24f36a6d19f75c"/></dir><dir name="Html"><file name="Select.php" hash="444e61ba3c74e79304a6162aa5f8ec4d"/></dir><dir name="System"><dir name="Config"><dir name="Button"><file name="PushArticles.php" hash="adf103726122fad10d7928b986c217e8"/><file name="PushBrands.php" hash="db6762def13f00189688f8a17ce229c0"/><file name="PushCategories.php" hash="a7103c1e3d901f323eba136f55ed1ca3"/><file name="PushProducts.php" hash="21efb0a2d2a952935b07e5a731cc97e0"/><file name="RestoreTemplate.php" hash="2fa930171ff68d0fce3f8e2b65e411f7"/><file name="ShowXml.php" hash="cf023e0fd7c4b7c9f89f2ae74e273bd6"/></dir><dir name="Form"><dir name="Field"><dir name="Array"><file name="Additional.php" hash="0b5f60b05f733e6b3306a6d2518986f1"/><file name="ArticleAdditional.php" hash="f13e96fdf169329103b44c1894f27918"/><file name="ArticleIdentifier.php" hash="a727518637b2cbcfa049140acd5b49b5"/><file name="DefaultSort.php" hash="a37e135242839f1ec493b52117cceadb"/><file name="Facet.php" hash="49629e67f8682978fb9c6bfb5e0ef43d"/><file name="Identifier.php" hash="6a50da7a2d0874ff06cdd5b88f2975ba"/><file name="ProductAdditionalFacet.php" hash="e366499487e206acf24db16ae81fd160"/><file name="ProductAdditionalField.php" hash="9c2e0197dc8ef5ee130f8dbb88b8dad7"/><file name="ProductIdentifier.php" hash="986d9491f39d21b0081fbf6e0ba2df45"/><file name="Sort.php" hash="6f736b18f06a5fa5fc6e68ef3065a61a"/></dir><file name="CategoryAttribute.php" hash="6f20dd2ee95865d458ab37318ea47ad5"/><file name="ProductAttribute.php" hash="7c3d63655231ebce61dae2210f7757c8"/></dir></dir><dir name="Html"><file name="Export.php" hash="0ea2693c442d1145369c610b5e25f97c"/><file name="ShowXml.php" hash="4b4012d9973dd397a91734f73d09df17"/><file name="Version.php" hash="7e780d7a124dffb964c63e7136bf161a"/></dir></dir></dir></dir><dir name="Helper"><file name="Antidot.php" hash="2482caf04d13e27c7c8bf9d18050008c"/><dir name="CatalogSearch"><file name="Data.php" hash="8004d6ed201cfa5af55fade4d79e21c0"/></dir><file name="Compress.php" hash="9c45838fe9fd2542f77575d55eb6b75b"/><file name="Data.php" hash="78fa132f36b6bdb9d6788b78a4eba6b6"/><file name="LogExport.php" hash="e0ca6d8a03a8153d74a7d4531e8bcbda"/><file name="Url.php" hash="692af850b3aca4b8a051c0ec89b55336"/><file name="XmlWriter.php" hash="e2fc516875648d230da0cb276369b907"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4a95baa6605e8d47ecf315c3cbd995b1"/><file name="Boolean.php" hash="7151f37fda430c2ceea55db8e39b0dc4"/><file name="Category.php" hash="062b705848d8be4fbba569c7f6bdfbe5"/><file name="Decimal.php" hash="32dc400184631b7913e68224f9aac9a2"/><file name="Item.php" hash="10cb250f8c2e8a763a18cf16f0f1800e"/><file name="Price.php" hash="946b42279612884380b984fef527a212"/></dir></dir><file name="Layer.php" hash="c83e63e6725830e545ab13890f69c5b7"/></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="bf11dd5aa6dece8d011e57bd7fd26766"/></dir></dir><file name="Layer.php" hash="987132f3253b7210e42c8b3eebb5e1d9"/><dir name="Resource"><file name="Attribute.php" hash="02a51ad9ada3d4da6fc7f59bfcb8e246"/></dir></dir><dir name="Export"><file name="Abstract.php" hash="6527a3f85783720ced1e4d9b497c8751"/><file name="Article.php" hash="20fccab80948feac89922c4c68c8695c"/><file name="Brand.php" hash="931784fed243fba8a89b6e4c86eb2236"/><file name="Category.php" hash="22122d4d7221d8016e8c4b0ee9904843"/><file name="Product.php" hash="5801589d106825155e88aa8123cd9449"/></dir><file name="Observer.php" hash="f1de28d18e03107608907279dade1f9d"/><dir name="Resource"><file name="Advanced.php" hash="39a9d8a23da4824b32037b0365669c72"/><dir name="Catalog"><dir name="Product"><file name="Collection.php" hash="f253ebede0e548be73d85c374fd8a331"/></dir></dir><dir name="Engine"><file name="Abstract.php" hash="c1e1d44104e448d4d1df49c53f7147b9"/><file name="Antidot.php" hash="f74272bd017e6afc6a17bd0a20dee5c1"/></dir></dir><dir name="Search"><file name="Abstract.php" hash="63b695ed35d116e5d223aebd7dec25f8"/><file name="Search.php" hash="07a7b9cc16b38ebd706c1c6566fb8afa"/><file name="Suggest.php" hash="a042c3717dd3bdd6e2464a5a1dd3cd2c"/></dir><dir name="System"><dir name="Config"><file name="ArticleAttribute.php" hash="ccc11c71e31f2bf58575ef261c2fe35a"/><dir name="Backend"><file name="Engine.php" hash="301dbcfff7ca9034b731443686b85a2e"/></dir><file name="CategoryAttribute.php" hash="d6d205572e0a840a5c2a1b0296594d49"/><file name="Dir.php" hash="7df80dbf0ee36504dba95c1d243e88ff"/><file name="DisableEnable.php" hash="903763b2023bb0c8c53ba050a9effc0e"/><file name="Engine.php" hash="8547fb84cbdfb1e61526da1ac79e2d1c"/><file name="Facet.php" hash="ce8a4b0e5be47bb828310e8a0f293320"/><file name="Number.php" hash="addd25d977b6dfdab80e1d010ca3bd12"/><file name="Options.php" hash="341e4677d0a060a63731fb9015d66ae4"/><file name="ProductAttribute.php" hash="b885e5baa099a62258f8d1fd954c6bf7"/><file name="PromoteRedirect.php" hash="9639c16ad74cfc680bd3b727ba2cf331"/><file name="Sort.php" hash="22ba7055ad65ff230c603c933a083025"/><dir name="Suggest"><file name="Type.php" hash="26908c98c872acab7c406ba449b376a8"/></dir><file name="WSStatus.php" hash="b469dc276dd3623e51f79ec433791bcc"/></dir></dir><dir name="Transport"><file name="Abstract.php" hash="f01d999bf5bd64700c9f1eeae86f896f"/><file name="File.php" hash="43db86dc194f4598eea857e650ee59fa"/><file name="Ftp.php" hash="f4361acfdd8e30f97f0fefac5e8f69ff"/><file name="Http.php" hash="2afc01bbdb61876a750eb9b019589fee"/><file name="Interface.php" hash="ac822457a85aa2c19d3e62c4539c6a16"/></dir><file name="Transport.php" hash="89b92e06f6fe837ba314884f3bcc0bf6"/></dir><dir name="controllers"><dir name="Admin"><file name="PushController.php" hash="063b40a8885c1d874c8f9c56115dc499"/></dir><dir name="Front"><file name="SearchController.php" hash="b172297f2561bbbd209666ba00dadf59"/></dir></dir><dir name="etc"><file name="config.xml" hash="fe1b892b94c28c7a53538b1d01727064"/><file name="system.xml" hash="672d7dda908b7350988f0b9b60ef7786"/></dir><dir name="sql"><dir name="Antidot_setup"><file name="mysql4-install-0.9.php" hash="bec9abcb3c25cdf5ae984af2d913fa90"/></dir></dir></dir></dir></target><target name="magelib"><dir name="antidot"><dir name="AFS"><dir name="ACP"><file name="Makefile" hash="0f76232bfabc275a3dac973666fb5dae"/><dir name="TEST"><file name="Makefile" hash="ce56cc786e1df50148e1d3222c05e5f8"/><file name="acpConnectorTest.php" hash="25a8194f3dc8895640df4f4bba895d8e"/><file name="acpQueryTest.php" hash="74ad65a4af639a409ee72a75a2a043d6"/><file name="acpReplysetHelperTest.php" hash="4f0a0d471a06e139cd11c715b67ebe81"/><file name="acpResponseHelperTest.php" hash="6d30f99108db0d9956aef9ba5e1d88df"/><file name="acpTest.php" hash="d6119d150543e7943ba4e9907901ae5d"/></dir><file name="afs_acp.php" hash="78dbfbc92f68469c92898f1da4263e68"/><file name="afs_acp_configuration.php" hash="2d644cc6c5bf2cdaeca5780576c4bf0e"/><file name="afs_acp_connector.php" hash="cf872314b38a86ebe7bb56b19bce9236"/><file name="afs_acp_exception.php" hash="f610d2cc37a15d4b981d7b43939414ad"/><file name="afs_acp_query.php" hash="ced0629355f5d4fc1c219d1adb03297d"/><file name="afs_acp_query_manager.php" hash="b3348972a850c904fc664b4e27671439"/><file name="afs_acp_reply_helper.php" hash="b0259f24f10d2e92ed6e3b8cdaaacc44"/><file name="afs_acp_replyset_helper.php" hash="07e7fdb88a42a399c96261c47ffb0231"/><file name="afs_acp_response_helper.php" hash="33a66106fd3a94194514a0d8d39af1cd"/></dir><file name="Makefile" hash="7bb31592939024f74745d6b6cb7fec0b"/><dir name="SEARCH"><dir name="FILTER"><file name="Makefile" hash="d42338199c6857ded179af2117b9f571"/><dir name="TEST"><file name="Makefile" hash="ab37090c6c5e7af1b260376237737700"/><file name="filterBuilderTest.php" hash="161ff5c8e73914eef884d17456afa133"/><file name="filterCombinationTest.php" hash="2162288d5255d3b24fe94d75b939aa51"/><file name="filterTest.php" hash="1682c0a4d50158a8d2c9369d30e45a18"/><file name="groupFilterTest.php" hash="1ebe8ce7344ed64b93cf94632d3b0184"/></dir><file name="afs_combinable_filter.php" hash="336e6c6bc9ebae3f58602d23ef734182"/><file name="afs_combinator_filter.php" hash="e2fc560b9c0c31f20c73f2057a8b7b69"/><file name="afs_filter.php" hash="1efc032fd2615c82c350f69ba11860fa"/><file name="afs_filter_exception.php" hash="ccce583c63a4a65f7f0a27fc4a487505"/><file name="afs_filter_wrapper.php" hash="30dec104456abc037019ad93922b5afd"/><file name="afs_group_filter.php" hash="b95fa3bc0e26bc39dfc53a6010bce32f"/><file name="afs_operator_filter.php" hash="c7ea43c8d64eedbe33397f61737e0226"/><file name="afs_valued_filter.php" hash="483653071734f77972c9b9771e187d82"/></dir><file name="Makefile" hash="0f76232bfabc275a3dac973666fb5dae"/><dir name="TEST"><file name="Makefile" hash="ce56cc786e1df50148e1d3222c05e5f8"/><file name="clientDataHelperTest.php" hash="523abcf4ab7a42e16c39c2b02bae927c"/><file name="clusterHelperTest.php" hash="e112e7c756f63c8e8ceb554281b418c9"/><file name="conceptHelperTest.php" hash="b44e39b62d0537bf1f7b7feb23f8111f"/><file name="facetDefaultTest.php" hash="382e4ea35e1c7173371b4a84046a38e5"/><file name="facetHelperTest.php" hash="2c6fbec3f1d4dd6e37c089ac835a88b0"/><file name="facetManagerTest.php" hash="bbef8e207c387dbe6a26142fd55264d5"/><file name="facetTest.php" hash="f0264af2550394a4a3d944bc86dac667"/><file name="facetValuesSortOrderTest.php" hash="b650080bf9b2cce2ac42a245cb84c911"/><file name="feedCoderTest.php" hash="f2b5dfdd4fa3c4e5d14c790d15235146"/><file name="filterCoderTest.php" hash="46249fa13edccf1e5d5000daf2573b77"/><file name="headerHelperTest.php" hash="62185c34e1e9015bb12014d719287f06"/><file name="helperConfigurationTest.php" hash="be3f74e53e27744e8214f3c341172796"/><file name="intervalTest.php" hash="912389dad049853f6bf0b4eab2af5034"/><file name="metaHelperTest.php" hash="080f160b54636c4eee743544a6a12bee"/><file name="pagerHelperTest.php" hash="b756d39c29c1d3cfb2733ab13062542e"/><file name="promoteReplyHelperTest.php" hash="7cbb68a7f50c2bd2ef11a085ac94deb2"/><file name="promoteReplysetHelperTest.php" hash="749180b072997539d322c88c97c586d6"/><file name="queryCoderTest.php" hash="064979c30a7e215c486e34abce79b1b5"/><file name="queryTest.php" hash="c48bc5a88a788bbc4a26604b86d60454"/><file name="replyHelperTest.php" hash="5b3cfec02c640282bf4fec92353801d6"/><file name="replysetHelperTest.php" hash="fdb55d9a09f9198fb26b5fab3edc58c3"/><file name="responseHelperTest.php" hash="35969ff7882d97b93aa874fafd4b55c3"/><file name="searchConnectorTest.php" hash="9201de573884b643041b6c32bc535e7e"/><file name="searchQueryManagerTest.php" hash="2334d06f4247abfd69c2b4dc842cc404"/><file name="searchTest.php" hash="eeb7a86bd5b48108434fb93da4e0c0f2"/><file name="spellcheckHelperTest.php" hash="49960fb90055dcf265ef41e491c11325"/><file name="spellcheckTextVisitorTest.php" hash="203f0d08f548a39135517a41f6e9e43a"/><file name="textVisitorTest.php" hash="b722845dd0f5f953574cb51284ad025b"/></dir><file name="afs_base_reply_helper.php" hash="c1c3961f3cc03924fda382adf6e6c419"/><file name="afs_base_replyset_helper.php" hash="096b124a3ebdc6e8d6beb359bd8bb7c5"/><file name="afs_client_data_exception.php" hash="899957af974d04aa7eaca44903a7f86c"/><file name="afs_client_data_helper.php" hash="b2383fc244d6bbcda6de7387ae7b1b0d"/><file name="afs_cluster_exception.php" hash="86d97623db7aebaa28a20857ce2cf17f"/><file name="afs_cluster_helper.php" hash="60b7fbcc869a672929ef9fc6d840d2b2"/><file name="afs_coder_base.php" hash="fb87fbea43d12695154b3b6102e2a019"/><file name="afs_coder_interface.php" hash="3b179b2513e215751ee4edd190b2a719"/><file name="afs_concept_helper.php" hash="982cf3d2063c565cf19cc6136b049066"/><file name="afs_count.php" hash="9f83f3baa3cf4462c0db786f4eea479a"/><file name="afs_facet.php" hash="b5d89249e71741b0558dbb762ad1a077"/><file name="afs_facet_combination.php" hash="005e9742ee032194b86856195dd59f7d"/><file name="afs_facet_default.php" hash="cbcb5d28b7b00815ce5248017065e84b"/><file name="afs_facet_exception.php" hash="f1f0afdbf9a727b53c4731e5a40ac417"/><file name="afs_facet_helper.php" hash="63bf1e4b92cf1e1bdf06b7da54afd5f9"/><file name="afs_facet_helper_retriever.php" hash="5628cc41c50ab25fd3336df302d903f4"/><file name="afs_facet_layout.php" hash="c83f6fef1c13ba3cda667c611841ff87"/><file name="afs_facet_manager.php" hash="3f022435274cbb500699ea054461f4bf"/><file name="afs_facet_mode.php" hash="17f17d277168a017e66364be5ac85394"/><file name="afs_facet_sort.php" hash="0d7ba4059b10da9981b9c801355cb874"/><file name="afs_facet_type.php" hash="6df82cbfa627629f9523437994d1fbb1"/><file name="afs_facet_value_formatter.php" hash="d6580281f9ef5c0820615ac385aae863"/><file name="afs_facet_values_sort_mode.php" hash="17def98365132c810515f8cf3c6fb006"/><file name="afs_facet_values_sort_order.php" hash="f95f77cb5dd7015e4f2e6094ddba49a6"/><file name="afs_feed_coder.php" hash="0df08c2d4e30c9b99d56ce7fdbc1b40b"/><file name="afs_filter_coder.php" hash="6a528ece8d5999aab9eb0fffabea25e3"/><file name="afs_header_helper.php" hash="3b30d839efe9128773c82d47cbd591b8"/><file name="afs_helper_configuration.php" hash="dbd0378574fbc5729babfbddfef0fd67"/><file name="afs_interval.php" hash="dbf9749881be0a2b063f8a33dff214f3"/><file name="afs_interval_exception.php" hash="40f223de231df03aae59596c1a493065"/><file name="afs_meta_helper.php" hash="8403689868c98db725ebd11748508c8b"/><file name="afs_pager_helper.php" hash="8e93f8c060d2fedabbcbad5607a27807"/><file name="afs_producer.php" hash="7c8c515ccb8126523fa0d09a7f759dd5"/><file name="afs_promote_reply_helper.php" hash="b582c3064f0dff62514e28e91d715cf9"/><file name="afs_promote_replyset_helper.php" hash="fdefc6f8a686addb31ea9b6c0a3fa5ad"/><file name="afs_query.php" hash="015bc3e7d007943708f064a34582d6ef"/><file name="afs_query_coder.php" hash="87021c05f45168f11eae4045b999b347"/><file name="afs_query_coder_interface.php" hash="dd16f17b3606a7418c1c714475b19b51"/><file name="afs_query_object_interface.php" hash="a9af13e2c856e4136ccadfff60f72d36"/><file name="afs_raw_text_visitor.php" hash="fd574583c4c9110165c1cadc67b832de"/><file name="afs_reply_helper.php" hash="04a65217b88a53a951d687455986b2a6"/><file name="afs_reply_helper_factory.php" hash="119fba6f39a19ef27fb8c864158cc7a2"/><file name="afs_replyset_helper.php" hash="190b08443559c28a204e8cfb6826d441"/><file name="afs_response_exception.php" hash="0a865bb92fb700ae555dcb5ae675f644"/><file name="afs_response_helper.php" hash="1805fd45c11ef77121867bb84850bedd"/><file name="afs_search.php" hash="11770cf52edd84331988bf61228ab24a"/><file name="afs_search_connector.php" hash="17242fb6536f4596b2c0198a16986310"/><file name="afs_search_query_manager.php" hash="91ee821f87eaeb9f14d5313a19b3f807"/><file name="afs_sort_builtins.php" hash="0cc1617a62f1a834a28d7d2ac249b081"/><file name="afs_sort_coder.php" hash="543015ed1d40caa40317a231476ea06c"/><file name="afs_sort_order.php" hash="7755deb99386650c9974871474168cda"/><file name="afs_spellcheck_helper.php" hash="bb5465848ada7a9df9875f2565fb9686"/><file name="afs_spellcheck_text_helper.php" hash="3ca5c3118660aa600aadb504ceff6c4c"/><file name="afs_spellcheck_text_visitor.php" hash="c44c23ae21f61b065e457911bbc45ed2"/><file name="afs_text_helper.php" hash="59c4ae24560948c3af0f4adbf6bd1803"/><file name="afs_text_visitor.php" hash="867b44a280403cd4567358ec6d59588a"/></dir><file name="afs_configuration_base.php" hash="f26dd9efda4923cc2c71057f21be97d9"/><file name="afs_connector.php" hash="3e000a037ca1d64587a90f53dd6c888b"/><file name="afs_exception.php" hash="c1840fe279f9cb313cec151012ed4513"/><file name="afs_origin.php" hash="a6b7e39a687210572c116afcbea0e7cb"/><file name="afs_query_base.php" hash="63b8fba7bb5c17150e4af0e765deab27"/><file name="afs_response_helper_base.php" hash="b087f7bdad35ed0526566042ef9afc8c"/></dir><dir name="AIF"><file name="Makefile" hash="2d232abf9913fcabb44033d5e5d1ebfd"/><dir name="TEST"><file name="Makefile" hash="24d3030d27e88732028d14fb1d81c203"/><file name="afsMultipartResponseTest.php" hash="70a64d0d599ea01806fac2126fb3680a"/><file name="authenticationTest.php" hash="2e476e9ab15ee221ddd63bb555262a28"/><file name="bowsInformationTest.php" hash="3bbfe71f431a35f0285afdca40906874"/><file name="documentManagerTest.php" hash="ad90a6146f5aeee383355bb05425b3dd"/><file name="documentTest.php" hash="59b204b10b90cd764b259ad4c2bc043a"/><file name="pafConnectorTest.php" hash="ac2928b501d9ea167af43dbf3adafa7d"/><file name="pafLiveTest.php" hash="92862c31d151c34b2caf44bff9d0fb80"/></dir><file name="afs_about_connector.php" hash="8972264a9b7cce237ad1a4b47852b529"/><file name="afs_authentication.php" hash="4285035550c9681a047b85abbca64936"/><file name="afs_bows_connector.php" hash="47a6bcafd5eba2361d2cea409f60d3f7"/><file name="afs_bows_connector_interface.php" hash="8fdf9749f0500a39741d696feb55af14"/><file name="afs_bows_exception.php" hash="1bd8657a37b8b4a9e08bfc4eb6b7e416"/><file name="afs_bows_information.php" hash="1f96a4cd84b2332f1186f9e0cea8542d"/><file name="afs_bows_information_cache.php" hash="1ae9a9243342c4e58a52e70473b68472"/><file name="afs_document.php" hash="6a04f43252f67f6dd90cc23d03fa2b63"/><file name="afs_document_manager.php" hash="8c5c0105d9337b7ae6a9f041f643ea88"/><file name="afs_multipart_response.php" hash="f2077c9eaf121fabdb2fc26c23b2e256"/><file name="afs_paf_connector.php" hash="96111b0536c83874b7c06ada5577106b"/><file name="afs_paf_live_connector.php" hash="9efeb2716f6d95e666f9c37726869fe7"/><file name="afs_paf_upload_reply.php" hash="0cb4905d1c894637d5e6acbd2cffc112"/><file name="afs_token_authentication.php" hash="1f003310f156f0a71db1d273375172d8"/><file name="afs_user_authentication.php" hash="03deeead93ee32753f2f7f80cfc011f4"/></dir><dir name="COMMON"><file name="Makefile" hash="7bb31592939024f74745d6b6cb7fec0b"/><dir name="TEST"><file name="Makefile" hash="d568cfe3683543f363312aa4b6d2bbad"/><file name="languageTest.php" hash="ad0f75b1c2f320c81eba32cade86191c"/><file name="toolsTest.php" hash="9276cb1a275d697f8e8365f2ac340cdf"/><file name="userSessionManagerTest.php" hash="b2b78d6fa156f1a61065f8ee5bfc6e0b"/></dir><file name="afs_connector_base.php" hash="b6b1f091ec71e5b92e4a1e5ca958255f"/><file name="afs_connector_interface.php" hash="68ad5e20a861b85dbf198f79cd2afd4c"/><file name="afs_exception.php" hash="c45bcd565a4124da5d6b23a21d5845a5"/><file name="afs_helper_base.php" hash="839cca78a663c3a22b4a8e35d1460129"/><file name="afs_helper_format.php" hash="30a3f6e945db7412ef95e83e7b0b5898"/><file name="afs_language.php" hash="277acb15b86089b37c812c47f2141d3c"/><file name="afs_service.php" hash="12c00c906e130860120552c40fa9dbc2"/><file name="afs_service_status.php" hash="1dee172850a76b46987534df89013878"/><file name="afs_tools.php" hash="26f6c01c5a61987925385e7a35260399"/><file name="afs_user_session_manager.php" hash="abd625f6b7b5cecf386dac9d82887764"/><file name="afs_versions.php" hash="29dda789ed7b363dc512e3c52a9d80ce"/><dir name="php-SAI"><file name="README.md" hash="63ab581c83fe44918e6d074e20f08f95"/><dir name="lib"><dir name="Curl"><file name="Handle.php" hash="0fc7132737da7cee7df6b974447864ac"/></dir><file name="Curl.php" hash="358e4d3afca2035ee4d3f99f372ed15a"/><file name="CurlInterface.php" hash="714fa045dd4546d0c92cd022efb09422"/><file name="CurlStub.php" hash="fbdc0ece6321c5b5a1e27a65449f4a1f"/><dir name="rb_temp"><file name="HttpClient.php" hash="091b91c98acf9f1cd6c3d6d75cddfb88"/><file name="MultiCurl.php" hash="916e85d73bae6e136f889166ebc6db17"/><file name="SimpleCurl.php" hash="c296966a8bda96e03b464a1d3a9c8e06"/></dir></dir><dir name="tests"><file name="SAI_CurlStubTest.php" hash="bce69cbb17a40bd4eeba6bad1133216e"/></dir><file name=".gitignore" hash="455ed27e3ee2636761d16f833e4d3984"/></dir></dir><file name="COPYING" hash="b234ee4d69f5fce4486a80fdaf4a4263"/><file name="COPYING.LESSER" hash="4fbd65380cdd255951079008b364516c"/><file name="FAQ.md" hash="7d7c886674d70a0047303c5d93de6165"/><file name="Makefile" hash="225475a5a4a0204cecbb77621ff38bb2"/><file name="README.md" hash="c38fa0e7c5aa391c2842affdf89c4795"/><file name="afs_lib.doxygen" hash="4f5839371b1b6ba64f76029bc5865dbf"/><file name="afs_lib.php" hash="4e93523d71e8b083654ac85cb24f8c68"/><file name="afs_version.php" hash="c8db9ed5ee1881b6e31a60a471a81b8a"/><dir name="doc"><file name="afs_filter_documentation.dox" hash="3bf4b96e25d95ce5953b822038c6f135"/><file name="afs_paf_upload.dox" hash="d36893db0234f171e6cfb43f6e13d47c"/><file name="afs_search.dox" hash="b1c5ab8728703822f910852cd17561f4"/><file name="afs_search_coder.dox" hash="77709e1bc691301017f0982e0348a9b9"/><file name="afs_search_query.dox" hash="21dcd1734a165a4cb3b4f62c42a6a0be"/><file name="afs_search_reply.dox" hash="cdb1d42447671f4352927b40b3f8f37d"/><dir name="data"><file name="acp_helper_example.php" hash="2815890e7afbae78e7eb4e6fc5c88f6f"/><file name="full_example.php" hash="e152a964d06e55de460c596070c714d8"/><file name="full_lightweight_example.php" hash="eac3bb2d251052f547a9f737e5cd0461"/><file name="raw_example.php" hash="ed86e971114243f3b28fa39bcaa972b8"/><dir name="templates"><file name="error_template.html" hash="70f44bd0f45470d379a11d0a2fe507e4"/><file name="facet_template.html" hash="6836005a7dae45e9415273f1eb6b78e2"/><file name="facet_values_template.html" hash="9b41f2b55a1cecae5724b4fcd4a46cfb"/><file name="meta_template.html" hash="e664a3bb222d272ce2451fb10bf46de4"/><file name="pager_template.html" hash="2700ab5b60a1f9553b1c39374fda63d4"/><file name="result_template.html" hash="1572a4ef4e8dda0b3db1ea77bbed4a98"/><file name="spellcheck_template.html" hash="8042054a1f5a271b47c77f81436c4791"/></dir></dir><file name="detailled_integration_example_with_template.dox" hash="26ef377a6ef546b636a0e254d11d01f5"/><file name="lightweight_integration_example_with_template.dox" hash="5a388d2dbfad63ad6ec353407b79a6bb"/><file name="logo-antidot-long-200x41.png" hash="1ceac3fff767fb5e395bd767344a3d13"/><file name="main.dox" hash="ca3e97f95deead927fb3298ecafbad5e"/><file name="raw_integration_example.dox" hash="56a7126d008c2e49abdf9bf0b5ec9717"/><file name="template_prerequisites.dox" hash="baa24a943e19ff3654227850bd316abb"/><file name="templates_in_details.dox" hash="5e8db94382f1fbd6c4e0b424a9edc9a3"/></dir><file name="rules.mk" hash="9e3570d254b92d571849718d98492192"/><dir name="scripts"><file name="gen_doc.sh" hash="0f6fc60aca94da563397d3c710bd9d33"/><file name="increment_version.sh" hash="431db9c60d2f94d251be07957787fcb0"/><file name="print_version.sh" hash="a05ddc19cd27ff185721fe2bd0cffc25"/><file name="version_management.sh" hash="3d5ecd39f45ba081144b3033dbd14330"/></dir><file name=".gitignore" hash="14de6527ce1e67cea1543b75a2322165"/></dir></target><target name="mage"><dir name="js"><dir name="mdn"><dir name="antidot"><file name="CollapsibleLists.js" hash="86792ecde0c2759ba85e0d863dd147ce"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="mdn"><dir name="antidot"><file name="CollapsibleLists.css" hash="c956d83facc41a97bf14726dcb953edb"/></dir></dir></dir><dir name="images"><dir name="mdn"><dir name="antidot"><file name="base.gif" hash="1f71b021e061a4948d69adc4ff10ccad"/><file name="button-closed.png" hash="563b78324e0712c0902cb4f77cb9eb86"/><file name="button-open.png" hash="c710849a0d2b61ad1f0fc36c0e59d131"/><file name="button.png" hash="97f3055c5046c851eea2dad7e5227508"/><file name="cd.gif" hash="f41037663522fab5c5c31530c7fa43d8"/><file name="empty.gif" hash="df22aff6e941ff1cc577333d1712b584"/><file name="folder.gif" hash="ea16980ab437fa6ba4aba3d480e83e9e"/><file name="folderopen.gif" hash="18aa3d75315bf95bf080357733437fcc"/><file name="globe.gif" hash="d6b48614cf8dc9553e077c19197637d2"/><file name="imgfolder.gif" hash="1d488d377762e65ab4e8b691ba01e5a4"/><file name="join.gif" hash="4d5d614e0da056df815a4306d6368692"/><file name="joinbottom.gif" hash="4b3daa7f2cc584f1aac0d142275d7cba"/><file name="line.gif" hash="63ab38a6203262f15ca46c631232ea2c"/><file name="list-item-contents.png" hash="00ae24d5bc76df9eedaea597859963e4"/><file name="list-item-last-open.png" hash="615ddd71f81b240e9ed7d4e383b2c01a"/><file name="list-item-last.png" hash="e2bfb790f46855c378e50f3c0a82ea01"/><file name="list-item-open.png" hash="732d1cc59f3a488c89c624eb434eac98"/><file name="list-item-root.png" hash="5529d21e7ec68e9cb750a4895ff0b480"/><file name="list-item.png" hash="e03ec1bf3d9e16bb3005ccf8d26eaa6c"/><file name="minus.gif" hash="d647fbbd0ec410b8f3bb3357b62eedcf"/><file name="minusbottom.gif" hash="b09d684cca7135ef728141aaf2464baa"/><file name="musicfolder.gif" hash="21ece951734f23adb2f75befe1f31fc1"/><file name="nolines_minus.gif" hash="eb2243a354ffcfac93ba0fe948f7167d"/><file name="nolines_plus.gif" hash="ec92b634b63608fb4b0dbf114e3b89e1"/><file name="page.gif" hash="c25b136c1cb3bb145495c25b35d93754"/><file name="plus.gif" hash="5c55d798909c553deca31d610bd18fac"/><file name="plusbottom.gif" hash="1924ce363c38a992f888a4df48c0b274"/><file name="question.gif" hash="ea0ca196ce0ebfd625cc1210abfdec6c"/><file name="trash.gif" hash="6cbfd3ed29531044aed9b4edb3cca9ad"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="de_AT"><file name="MDN_Antidot.csv" hash="c45d0a82747927c46d886f94ab2304be"/></dir><dir name="de_CH"><file name="MDN_Antidot.csv" hash="c45d0a82747927c46d886f94ab2304be"/></dir><dir name="de_DE"><file name="MDN_Antidot.csv" hash="c45d0a82747927c46d886f94ab2304be"/></dir><dir name="es_AR"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_CL"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_CO"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_CR"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_ES"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_MX"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_PA"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_PE"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_VE"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="fr_CA"><file name="MDN_Antidot.csv" hash="c72a1b1173e18386e86c1fc528965a7e"/></dir><dir name="fr_FR"><file name="MDN_Antidot.csv" hash="c72a1b1173e18386e86c1fc528965a7e"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MDN_Antidot.xml" hash="152b50a22cf8a3d25ce33fc79a6edf03"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="antidot"><dir name="catalog"><dir name="layer"><file name="category.phtml" hash="3ec81f7b3e3b947317da8664c8e15927"/><file name="filter.phtml" hash="2304baebff9b798e0ebd977fbc891346"/></dir></dir><dir name="catalogsearch"><file name="result.phtml" hash="12c082ddff0e6c4fef74630b8253face"/></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="antidot.xml" hash="93952350924c21fa3050a9ea9a0637a9"/></dir><dir name="template"><dir name="antidot"><dir name="catalogsearch"><dir name="result"><file name="category.phtml" hash="036c833db90a8ee8b6bdf8ca7f5841de"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
 
 
 
 
 
 
 
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>afs-store</name>
4
+ <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license>LGPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Use AFS STORE search engine seamlessly in Magento</summary>
10
  <description>Use AFS STORE search engine seamlessly in Magento</description>
11
+ <notes>Fix facet with ampersand configuration for search engine &gt; facets&#xD;
12
+ Replace "-" with "&amp;afs:feed" to separate feeds in url (compatibility with AFS 7.7)&#xD;
13
+ Fix empty facet id sent when performing an empty query to afs to get facets list&#xD;
14
+ Add description node for variants&#xD;
15
+ Add cdata for variant name&#xD;
16
+ Prevent to export empty categories node&#xD;
17
+ Add cdata for variant name&#xD;
18
+ Add variant details for grouped products</notes>
19
+ <authors><author><name>Antidot</name><user>antidot</user><email>contact@antidot.net</email></author></authors>
20
+ <date>2014-08-06</date>
21
+ <time>09:46:15</time>
22
+ <contents><target name="magecommunity"><dir name="MDN"><dir name="Antidot"><dir name="Block"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="c8147e06452988877fd23de97e47ba7d"/><file name="Boolean.php" hash="0d301b2ca3c1c1e60a69dbfc043a8520"/><file name="Category.php" hash="695722041376ff47c15c78b233e32f29"/><file name="Decimal.php" hash="a5a605767a6b3322dcab4715f107b71c"/><file name="Price.php" hash="3e8fe52c943c4d7cc21062ebd63ff9a0"/></dir><file name="View.php" hash="95d6226dc5e264422511bc19dcf23358"/></dir></dir><dir name="Catalogsearch"><file name="Category.php" hash="e7fdd211e62b37cddac5649183e49dfe"/><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4b7dd735852366d7d999afaf1c5ad4b9"/></dir></dir><file name="Layer.php" hash="af32668e618033cda4adab8a12ebabcc"/><file name="Result.php" hash="9c3076c2a22ebf198f24f36a6d19f75c"/></dir><dir name="Html"><file name="Select.php" hash="9e12a50fecdc9185fb1f009584368c88"/></dir><dir name="System"><dir name="Config"><dir name="Button"><file name="PushArticles.php" hash="6de266a07e63e47ab9b32903f124608d"/><file name="PushBrands.php" hash="a98dfa0d019fee4fd7327084298361d9"/><file name="PushCategories.php" hash="93948e44a97c0d236bce2d976268794c"/><file name="PushProducts.php" hash="ab6c58cdb5b431fa5418979f16206911"/><file name="RestoreTemplate.php" hash="541d3141c4b1a8202e511a0978ec0de1"/><file name="ShowXml.php" hash="c70714536a6d46ce5d056d41fd62ead6"/></dir><dir name="Form"><dir name="Field"><dir name="Array"><file name="Additional.php" hash="a92ccc94d40b2c05ccf4b6dec8882eff"/><file name="ArticleAdditional.php" hash="506594804d3b624523e04481e8925b35"/><file name="ArticleIdentifier.php" hash="6e85e062f65eeed99dd3274cc689c47f"/><file name="DefaultSort.php" hash="d12eb339e80a7b38c111a63aa003ce6e"/><file name="Facet.php" hash="7ffdd3568f12a9495d39b943402dd861"/><file name="Identifier.php" hash="669eb4a937943dec8a577881f3f20d3c"/><file name="ProductAdditionalFacet.php" hash="3fd8f3957e8c364b39258cf32100b70d"/><file name="ProductAdditionalField.php" hash="9c245ddfb26372a9af712815ace7497b"/><file name="ProductIdentifier.php" hash="14dcf3125eae94145df4c802344cbfcd"/><file name="Sort.php" hash="f1a565e63b90a249fbae162fa2b90e54"/></dir><file name="CategoryAttribute.php" hash="6f20dd2ee95865d458ab37318ea47ad5"/><file name="ProductAttribute.php" hash="9475af9768d2f0bd3e8a1078eb3a03f9"/></dir></dir><dir name="Html"><file name="Export.php" hash="9814c5ed5cacb5792020344bf3f6b863"/><file name="ShowXml.php" hash="4b4012d9973dd397a91734f73d09df17"/><file name="Version.php" hash="7e780d7a124dffb964c63e7136bf161a"/></dir></dir></dir></dir><dir name="Helper"><file name="Antidot.php" hash="2acc8b8ab743de5f0872dd5c983ebd67"/><dir name="CatalogSearch"><file name="Data.php" hash="a76f61fb25cc6632c77c7b168d7bf663"/></dir><file name="Compress.php" hash="8f903a682125dd111b972d3fe998006a"/><file name="Data.php" hash="6a8e63309e99e26b60328c9d11a3305d"/><file name="LogExport.php" hash="9bd67e1c49e7b37fc1c0effd22233f26"/><file name="Url.php" hash="156f1fb9c829919144ebb7fd01588f7e"/><file name="XmlWriter.php" hash="e2fc516875648d230da0cb276369b907"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4a95baa6605e8d47ecf315c3cbd995b1"/><file name="Boolean.php" hash="7151f37fda430c2ceea55db8e39b0dc4"/><file name="Category.php" hash="062b705848d8be4fbba569c7f6bdfbe5"/><file name="Decimal.php" hash="32dc400184631b7913e68224f9aac9a2"/><file name="Item.php" hash="10cb250f8c2e8a763a18cf16f0f1800e"/><file name="Price.php" hash="946b42279612884380b984fef527a212"/></dir></dir><file name="Layer.php" hash="c83e63e6725830e545ab13890f69c5b7"/></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="1b5f705dceb4cc62d1e6375332414872"/></dir></dir><file name="Layer.php" hash="e99d8aee533b6179cf0898c08dcdedca"/><dir name="Resource"><file name="Attribute.php" hash="766e331e27af9d114b946e023522956a"/></dir></dir><dir name="Export"><file name="Abstract.php" hash="509ab599b98466335d73f850ff8ec7d7"/><file name="Article.php" hash="a724568ff3b207b1ce465310ebd585fa"/><file name="Brand.php" hash="84e0ee8e7760a987c615b079f9f0a28d"/><file name="Category.php" hash="174bcf5b902a15b9e4e10b123c423f43"/><file name="Log.php" hash="e5e3ed811f33cf20bbe6682d544070da"/><file name="Product.php" hash="e45bd83333319c514baacbeefcc0a38b"/></dir><dir name="Mysql4"><dir name="Export"><dir name="Log"><file name="Collection.php" hash="0bd33666dd5af14933e4be66d7cf17cb"/></dir><file name="Log.php" hash="c8c2b54ba365a31afddb0417ed9f682d"/></dir></dir><file name="Observer.php" hash="44965838246492b147ef48d083106d17"/><dir name="Resource"><file name="Advanced.php" hash="39a9d8a23da4824b32037b0365669c72"/><dir name="Catalog"><dir name="Product"><file name="Collection.php" hash="f253ebede0e548be73d85c374fd8a331"/></dir></dir><dir name="Engine"><file name="Abstract.php" hash="c1e1d44104e448d4d1df49c53f7147b9"/><file name="Antidot.php" hash="6d9373c83b085e07ca11c2a62bbc05f3"/></dir></dir><dir name="Search"><file name="Abstract.php" hash="0ccd58da349eca4f5f1fce005f441e5f"/><file name="Search.php" hash="ef79db8a7922c911f71c3752a00d2ca1"/><file name="Suggest.php" hash="aa4883d754b8abd7067f7f322f96d899"/></dir><dir name="System"><dir name="Config"><file name="ArticleAttribute.php" hash="1a826cf609a0f0c3c47bf4ef6564de24"/><dir name="Backend"><file name="Engine.php" hash="301dbcfff7ca9034b731443686b85a2e"/></dir><file name="CategoryAttribute.php" hash="7149c1efa8207038d7fd2023c9761c98"/><file name="Dir.php" hash="7df80dbf0ee36504dba95c1d243e88ff"/><file name="DisableEnable.php" hash="903763b2023bb0c8c53ba050a9effc0e"/><file name="Engine.php" hash="8547fb84cbdfb1e61526da1ac79e2d1c"/><file name="Facet.php" hash="0a5274c46a4dde0cbfc803464f35dd28"/><file name="Number.php" hash="addd25d977b6dfdab80e1d010ca3bd12"/><file name="Options.php" hash="341e4677d0a060a63731fb9015d66ae4"/><file name="ProductAttribute.php" hash="f8060f25a70a7e681f5021eedef5dfa8"/><file name="PromoteRedirect.php" hash="9639c16ad74cfc680bd3b727ba2cf331"/><file name="Sort.php" hash="ef8c019fd3ae439e1349d20d229af094"/><dir name="Suggest"><file name="Type.php" hash="f0c083bbaa7fd339832d14937afe1af1"/></dir><file name="WSStatus.php" hash="b469dc276dd3623e51f79ec433791bcc"/></dir></dir><dir name="Transport"><file name="Abstract.php" hash="1c1a1f70c5813872a871f5b558c21360"/><file name="File.php" hash="136190f20ed7f7a340771d3b78f03331"/><file name="Ftp.php" hash="90d68959102cb0cf72785c46a9023754"/><file name="Http.php" hash="667a6f2d07034604b6ec6f2b48b55332"/><file name="Interface.php" hash="82c6c2d1748439a6850e90f6556fec92"/></dir><file name="Transport.php" hash="663e33aaf620ffd4f05292b4e6f27f42"/></dir><dir name="controllers"><dir name="Admin"><file name="PushController.php" hash="0cb3e55625acd83e255dac46704e82f3"/></dir><dir name="Front"><file name="SearchController.php" hash="c1514fc18b5412a9e9072bcca0352607"/></dir></dir><dir name="etc"><file name="config.xml" hash="9aabcddc3206547128c41b60eff9874f"/><file name="system.xml" hash="4fe4fb47a94f6f0875b269e9d04abe9e"/></dir><dir name="sql"><dir name="Antidot_setup"><file name="mysql4-install-0.9.php" hash="62672bc47ea92dbd46966fb76e4251e0"/></dir></dir></dir></dir></target><target name="magelib"><dir name="antidot"><dir name="AFS"><dir name="ACP"><file name="Makefile" hash="0f76232bfabc275a3dac973666fb5dae"/><dir name="TEST"><file name="Makefile" hash="ce56cc786e1df50148e1d3222c05e5f8"/><file name="acpConnectorTest.php" hash="25a8194f3dc8895640df4f4bba895d8e"/><file name="acpQueryTest.php" hash="74ad65a4af639a409ee72a75a2a043d6"/><file name="acpReplysetHelperTest.php" hash="4f0a0d471a06e139cd11c715b67ebe81"/><file name="acpResponseHelperTest.php" hash="6d30f99108db0d9956aef9ba5e1d88df"/><file name="acpTest.php" hash="d6119d150543e7943ba4e9907901ae5d"/></dir><file name="afs_acp.php" hash="78dbfbc92f68469c92898f1da4263e68"/><file name="afs_acp_configuration.php" hash="2d644cc6c5bf2cdaeca5780576c4bf0e"/><file name="afs_acp_connector.php" hash="cf872314b38a86ebe7bb56b19bce9236"/><file name="afs_acp_exception.php" hash="f610d2cc37a15d4b981d7b43939414ad"/><file name="afs_acp_query.php" hash="ced0629355f5d4fc1c219d1adb03297d"/><file name="afs_acp_query_manager.php" hash="b3348972a850c904fc664b4e27671439"/><file name="afs_acp_reply_helper.php" hash="b0259f24f10d2e92ed6e3b8cdaaacc44"/><file name="afs_acp_replyset_helper.php" hash="07e7fdb88a42a399c96261c47ffb0231"/><file name="afs_acp_response_helper.php" hash="33a66106fd3a94194514a0d8d39af1cd"/></dir><file name="Makefile" hash="7bb31592939024f74745d6b6cb7fec0b"/><dir name="SEARCH"><dir name="FILTER"><file name="Makefile" hash="d42338199c6857ded179af2117b9f571"/><dir name="TEST"><file name="Makefile" hash="ab37090c6c5e7af1b260376237737700"/><file name="filterBuilderTest.php" hash="161ff5c8e73914eef884d17456afa133"/><file name="filterCombinationTest.php" hash="2162288d5255d3b24fe94d75b939aa51"/><file name="filterTest.php" hash="1682c0a4d50158a8d2c9369d30e45a18"/><file name="groupFilterTest.php" hash="1ebe8ce7344ed64b93cf94632d3b0184"/></dir><file name="afs_combinable_filter.php" hash="336e6c6bc9ebae3f58602d23ef734182"/><file name="afs_combinator_filter.php" hash="e2fc560b9c0c31f20c73f2057a8b7b69"/><file name="afs_filter.php" hash="1efc032fd2615c82c350f69ba11860fa"/><file name="afs_filter_exception.php" hash="ccce583c63a4a65f7f0a27fc4a487505"/><file name="afs_filter_wrapper.php" hash="30dec104456abc037019ad93922b5afd"/><file name="afs_group_filter.php" hash="b95fa3bc0e26bc39dfc53a6010bce32f"/><file name="afs_operator_filter.php" hash="c7ea43c8d64eedbe33397f61737e0226"/><file name="afs_valued_filter.php" hash="483653071734f77972c9b9771e187d82"/></dir><file name="Makefile" hash="0f76232bfabc275a3dac973666fb5dae"/><dir name="TEST"><file name="Makefile" hash="ce56cc786e1df50148e1d3222c05e5f8"/><file name="clientDataHelperTest.php" hash="523abcf4ab7a42e16c39c2b02bae927c"/><file name="clusterHelperTest.php" hash="e112e7c756f63c8e8ceb554281b418c9"/><file name="conceptHelperTest.php" hash="b44e39b62d0537bf1f7b7feb23f8111f"/><file name="facetDefaultTest.php" hash="382e4ea35e1c7173371b4a84046a38e5"/><file name="facetHelperTest.php" hash="2c6fbec3f1d4dd6e37c089ac835a88b0"/><file name="facetManagerTest.php" hash="bbef8e207c387dbe6a26142fd55264d5"/><file name="facetTest.php" hash="f0264af2550394a4a3d944bc86dac667"/><file name="facetValuesSortOrderTest.php" hash="b650080bf9b2cce2ac42a245cb84c911"/><file name="feedCoderTest.php" hash="f2b5dfdd4fa3c4e5d14c790d15235146"/><file name="filterCoderTest.php" hash="46249fa13edccf1e5d5000daf2573b77"/><file name="headerHelperTest.php" hash="62185c34e1e9015bb12014d719287f06"/><file name="helperConfigurationTest.php" hash="be3f74e53e27744e8214f3c341172796"/><file name="intervalTest.php" hash="912389dad049853f6bf0b4eab2af5034"/><file name="metaHelperTest.php" hash="080f160b54636c4eee743544a6a12bee"/><file name="pagerHelperTest.php" hash="b756d39c29c1d3cfb2733ab13062542e"/><file name="promoteReplyHelperTest.php" hash="7cbb68a7f50c2bd2ef11a085ac94deb2"/><file name="promoteReplysetHelperTest.php" hash="749180b072997539d322c88c97c586d6"/><file name="queryCoderTest.php" hash="064979c30a7e215c486e34abce79b1b5"/><file name="queryTest.php" hash="c48bc5a88a788bbc4a26604b86d60454"/><file name="replyHelperTest.php" hash="5b3cfec02c640282bf4fec92353801d6"/><file name="replysetHelperTest.php" hash="fdb55d9a09f9198fb26b5fab3edc58c3"/><file name="responseHelperTest.php" hash="35969ff7882d97b93aa874fafd4b55c3"/><file name="searchConnectorTest.php" hash="9201de573884b643041b6c32bc535e7e"/><file name="searchQueryManagerTest.php" hash="2334d06f4247abfd69c2b4dc842cc404"/><file name="searchTest.php" hash="eeb7a86bd5b48108434fb93da4e0c0f2"/><file name="spellcheckHelperTest.php" hash="49960fb90055dcf265ef41e491c11325"/><file name="spellcheckTextVisitorTest.php" hash="203f0d08f548a39135517a41f6e9e43a"/><file name="textVisitorTest.php" hash="b722845dd0f5f953574cb51284ad025b"/></dir><file name="afs_base_reply_helper.php" hash="c1c3961f3cc03924fda382adf6e6c419"/><file name="afs_base_replyset_helper.php" hash="096b124a3ebdc6e8d6beb359bd8bb7c5"/><file name="afs_client_data_exception.php" hash="899957af974d04aa7eaca44903a7f86c"/><file name="afs_client_data_helper.php" hash="b2383fc244d6bbcda6de7387ae7b1b0d"/><file name="afs_cluster_exception.php" hash="86d97623db7aebaa28a20857ce2cf17f"/><file name="afs_cluster_helper.php" hash="60b7fbcc869a672929ef9fc6d840d2b2"/><file name="afs_coder_base.php" hash="fb87fbea43d12695154b3b6102e2a019"/><file name="afs_coder_interface.php" hash="3b179b2513e215751ee4edd190b2a719"/><file name="afs_concept_helper.php" hash="982cf3d2063c565cf19cc6136b049066"/><file name="afs_count.php" hash="9f83f3baa3cf4462c0db786f4eea479a"/><file name="afs_facet.php" hash="b5d89249e71741b0558dbb762ad1a077"/><file name="afs_facet_combination.php" hash="005e9742ee032194b86856195dd59f7d"/><file name="afs_facet_default.php" hash="cbcb5d28b7b00815ce5248017065e84b"/><file name="afs_facet_exception.php" hash="f1f0afdbf9a727b53c4731e5a40ac417"/><file name="afs_facet_helper.php" hash="63bf1e4b92cf1e1bdf06b7da54afd5f9"/><file name="afs_facet_helper_retriever.php" hash="5628cc41c50ab25fd3336df302d903f4"/><file name="afs_facet_layout.php" hash="c83f6fef1c13ba3cda667c611841ff87"/><file name="afs_facet_manager.php" hash="3f022435274cbb500699ea054461f4bf"/><file name="afs_facet_mode.php" hash="17f17d277168a017e66364be5ac85394"/><file name="afs_facet_sort.php" hash="0d7ba4059b10da9981b9c801355cb874"/><file name="afs_facet_type.php" hash="6df82cbfa627629f9523437994d1fbb1"/><file name="afs_facet_value_formatter.php" hash="d6580281f9ef5c0820615ac385aae863"/><file name="afs_facet_values_sort_mode.php" hash="17def98365132c810515f8cf3c6fb006"/><file name="afs_facet_values_sort_order.php" hash="f95f77cb5dd7015e4f2e6094ddba49a6"/><file name="afs_feed_coder.php" hash="0df08c2d4e30c9b99d56ce7fdbc1b40b"/><file name="afs_filter_coder.php" hash="6a528ece8d5999aab9eb0fffabea25e3"/><file name="afs_header_helper.php" hash="3b30d839efe9128773c82d47cbd591b8"/><file name="afs_helper_configuration.php" hash="dbd0378574fbc5729babfbddfef0fd67"/><file name="afs_interval.php" hash="dbf9749881be0a2b063f8a33dff214f3"/><file name="afs_interval_exception.php" hash="40f223de231df03aae59596c1a493065"/><file name="afs_meta_helper.php" hash="8403689868c98db725ebd11748508c8b"/><file name="afs_pager_helper.php" hash="8e93f8c060d2fedabbcbad5607a27807"/><file name="afs_producer.php" hash="7c8c515ccb8126523fa0d09a7f759dd5"/><file name="afs_promote_reply_helper.php" hash="b582c3064f0dff62514e28e91d715cf9"/><file name="afs_promote_replyset_helper.php" hash="fdefc6f8a686addb31ea9b6c0a3fa5ad"/><file name="afs_query.php" hash="015bc3e7d007943708f064a34582d6ef"/><file name="afs_query_coder.php" hash="87021c05f45168f11eae4045b999b347"/><file name="afs_query_coder_interface.php" hash="dd16f17b3606a7418c1c714475b19b51"/><file name="afs_query_object_interface.php" hash="a9af13e2c856e4136ccadfff60f72d36"/><file name="afs_raw_text_visitor.php" hash="fd574583c4c9110165c1cadc67b832de"/><file name="afs_reply_helper.php" hash="04a65217b88a53a951d687455986b2a6"/><file name="afs_reply_helper_factory.php" hash="119fba6f39a19ef27fb8c864158cc7a2"/><file name="afs_replyset_helper.php" hash="190b08443559c28a204e8cfb6826d441"/><file name="afs_response_exception.php" hash="0a865bb92fb700ae555dcb5ae675f644"/><file name="afs_response_helper.php" hash="1805fd45c11ef77121867bb84850bedd"/><file name="afs_search.php" hash="11770cf52edd84331988bf61228ab24a"/><file name="afs_search_connector.php" hash="17242fb6536f4596b2c0198a16986310"/><file name="afs_search_query_manager.php" hash="91ee821f87eaeb9f14d5313a19b3f807"/><file name="afs_sort_builtins.php" hash="0cc1617a62f1a834a28d7d2ac249b081"/><file name="afs_sort_coder.php" hash="543015ed1d40caa40317a231476ea06c"/><file name="afs_sort_order.php" hash="7755deb99386650c9974871474168cda"/><file name="afs_spellcheck_helper.php" hash="bb5465848ada7a9df9875f2565fb9686"/><file name="afs_spellcheck_text_helper.php" hash="3ca5c3118660aa600aadb504ceff6c4c"/><file name="afs_spellcheck_text_visitor.php" hash="c44c23ae21f61b065e457911bbc45ed2"/><file name="afs_text_helper.php" hash="59c4ae24560948c3af0f4adbf6bd1803"/><file name="afs_text_visitor.php" hash="867b44a280403cd4567358ec6d59588a"/></dir><file name="afs_configuration_base.php" hash="f26dd9efda4923cc2c71057f21be97d9"/><file name="afs_connector.php" hash="3e000a037ca1d64587a90f53dd6c888b"/><file name="afs_exception.php" hash="c1840fe279f9cb313cec151012ed4513"/><file name="afs_origin.php" hash="a6b7e39a687210572c116afcbea0e7cb"/><file name="afs_query_base.php" hash="63b8fba7bb5c17150e4af0e765deab27"/><file name="afs_response_helper_base.php" hash="b087f7bdad35ed0526566042ef9afc8c"/></dir><dir name="AIF"><file name="Makefile" hash="2d232abf9913fcabb44033d5e5d1ebfd"/><dir name="TEST"><file name="Makefile" hash="24d3030d27e88732028d14fb1d81c203"/><file name="afsMultipartResponseTest.php" hash="70a64d0d599ea01806fac2126fb3680a"/><file name="authenticationTest.php" hash="2e476e9ab15ee221ddd63bb555262a28"/><file name="bowsInformationTest.php" hash="3bbfe71f431a35f0285afdca40906874"/><file name="documentManagerTest.php" hash="ad90a6146f5aeee383355bb05425b3dd"/><file name="documentTest.php" hash="59b204b10b90cd764b259ad4c2bc043a"/><file name="pafConnectorTest.php" hash="ac2928b501d9ea167af43dbf3adafa7d"/><file name="pafLiveTest.php" hash="92862c31d151c34b2caf44bff9d0fb80"/></dir><file name="afs_about_connector.php" hash="8972264a9b7cce237ad1a4b47852b529"/><file name="afs_authentication.php" hash="4285035550c9681a047b85abbca64936"/><file name="afs_bows_connector.php" hash="47a6bcafd5eba2361d2cea409f60d3f7"/><file name="afs_bows_connector_interface.php" hash="8fdf9749f0500a39741d696feb55af14"/><file name="afs_bows_exception.php" hash="1bd8657a37b8b4a9e08bfc4eb6b7e416"/><file name="afs_bows_information.php" hash="1f96a4cd84b2332f1186f9e0cea8542d"/><file name="afs_bows_information_cache.php" hash="1ae9a9243342c4e58a52e70473b68472"/><file name="afs_document.php" hash="6a04f43252f67f6dd90cc23d03fa2b63"/><file name="afs_document_manager.php" hash="8c5c0105d9337b7ae6a9f041f643ea88"/><file name="afs_multipart_response.php" hash="f2077c9eaf121fabdb2fc26c23b2e256"/><file name="afs_paf_connector.php" hash="96111b0536c83874b7c06ada5577106b"/><file name="afs_paf_live_connector.php" hash="9efeb2716f6d95e666f9c37726869fe7"/><file name="afs_paf_upload_reply.php" hash="0cb4905d1c894637d5e6acbd2cffc112"/><file name="afs_token_authentication.php" hash="1f003310f156f0a71db1d273375172d8"/><file name="afs_user_authentication.php" hash="03deeead93ee32753f2f7f80cfc011f4"/></dir><dir name="COMMON"><file name="Makefile" hash="7bb31592939024f74745d6b6cb7fec0b"/><dir name="TEST"><file name="Makefile" hash="d568cfe3683543f363312aa4b6d2bbad"/><file name="languageTest.php" hash="ad0f75b1c2f320c81eba32cade86191c"/><file name="toolsTest.php" hash="9276cb1a275d697f8e8365f2ac340cdf"/><file name="userSessionManagerTest.php" hash="b2b78d6fa156f1a61065f8ee5bfc6e0b"/></dir><file name="afs_connector_base.php" hash="b6b1f091ec71e5b92e4a1e5ca958255f"/><file name="afs_connector_interface.php" hash="68ad5e20a861b85dbf198f79cd2afd4c"/><file name="afs_exception.php" hash="c45bcd565a4124da5d6b23a21d5845a5"/><file name="afs_helper_base.php" hash="839cca78a663c3a22b4a8e35d1460129"/><file name="afs_helper_format.php" hash="30a3f6e945db7412ef95e83e7b0b5898"/><file name="afs_language.php" hash="277acb15b86089b37c812c47f2141d3c"/><file name="afs_service.php" hash="12c00c906e130860120552c40fa9dbc2"/><file name="afs_service_status.php" hash="1dee172850a76b46987534df89013878"/><file name="afs_tools.php" hash="26f6c01c5a61987925385e7a35260399"/><file name="afs_user_session_manager.php" hash="abd625f6b7b5cecf386dac9d82887764"/><file name="afs_versions.php" hash="29dda789ed7b363dc512e3c52a9d80ce"/><dir name="php-SAI"><file name="README.md" hash="63ab581c83fe44918e6d074e20f08f95"/><dir name="lib"><dir name="Curl"><file name="Handle.php" hash="0fc7132737da7cee7df6b974447864ac"/></dir><file name="Curl.php" hash="358e4d3afca2035ee4d3f99f372ed15a"/><file name="CurlInterface.php" hash="714fa045dd4546d0c92cd022efb09422"/><file name="CurlStub.php" hash="fbdc0ece6321c5b5a1e27a65449f4a1f"/><dir name="rb_temp"><file name="HttpClient.php" hash="091b91c98acf9f1cd6c3d6d75cddfb88"/><file name="MultiCurl.php" hash="916e85d73bae6e136f889166ebc6db17"/><file name="SimpleCurl.php" hash="c296966a8bda96e03b464a1d3a9c8e06"/></dir></dir><dir name="tests"><file name="SAI_CurlStubTest.php" hash="bce69cbb17a40bd4eeba6bad1133216e"/></dir><file name=".gitignore" hash="455ed27e3ee2636761d16f833e4d3984"/></dir></dir><file name="COPYING" hash="b234ee4d69f5fce4486a80fdaf4a4263"/><file name="COPYING.LESSER" hash="4fbd65380cdd255951079008b364516c"/><file name="FAQ.md" hash="7d7c886674d70a0047303c5d93de6165"/><file name="Makefile" hash="225475a5a4a0204cecbb77621ff38bb2"/><file name="README.md" hash="c38fa0e7c5aa391c2842affdf89c4795"/><file name="afs_lib.doxygen" hash="4f5839371b1b6ba64f76029bc5865dbf"/><file name="afs_lib.php" hash="4e93523d71e8b083654ac85cb24f8c68"/><file name="afs_version.php" hash="c8db9ed5ee1881b6e31a60a471a81b8a"/><dir name="doc"><file name="afs_filter_documentation.dox" hash="3bf4b96e25d95ce5953b822038c6f135"/><file name="afs_paf_upload.dox" hash="d36893db0234f171e6cfb43f6e13d47c"/><file name="afs_search.dox" hash="b1c5ab8728703822f910852cd17561f4"/><file name="afs_search_coder.dox" hash="77709e1bc691301017f0982e0348a9b9"/><file name="afs_search_query.dox" hash="21dcd1734a165a4cb3b4f62c42a6a0be"/><file name="afs_search_reply.dox" hash="cdb1d42447671f4352927b40b3f8f37d"/><dir name="data"><file name="acp_helper_example.php" hash="2815890e7afbae78e7eb4e6fc5c88f6f"/><file name="full_example.php" hash="e152a964d06e55de460c596070c714d8"/><file name="full_lightweight_example.php" hash="eac3bb2d251052f547a9f737e5cd0461"/><file name="raw_example.php" hash="ed86e971114243f3b28fa39bcaa972b8"/><dir name="templates"><file name="error_template.html" hash="70f44bd0f45470d379a11d0a2fe507e4"/><file name="facet_template.html" hash="6836005a7dae45e9415273f1eb6b78e2"/><file name="facet_values_template.html" hash="9b41f2b55a1cecae5724b4fcd4a46cfb"/><file name="meta_template.html" hash="e664a3bb222d272ce2451fb10bf46de4"/><file name="pager_template.html" hash="2700ab5b60a1f9553b1c39374fda63d4"/><file name="result_template.html" hash="1572a4ef4e8dda0b3db1ea77bbed4a98"/><file name="spellcheck_template.html" hash="8042054a1f5a271b47c77f81436c4791"/></dir></dir><file name="detailled_integration_example_with_template.dox" hash="26ef377a6ef546b636a0e254d11d01f5"/><file name="lightweight_integration_example_with_template.dox" hash="5a388d2dbfad63ad6ec353407b79a6bb"/><file name="logo-antidot-long-200x41.png" hash="1ceac3fff767fb5e395bd767344a3d13"/><file name="main.dox" hash="ca3e97f95deead927fb3298ecafbad5e"/><file name="raw_integration_example.dox" hash="56a7126d008c2e49abdf9bf0b5ec9717"/><file name="template_prerequisites.dox" hash="baa24a943e19ff3654227850bd316abb"/><file name="templates_in_details.dox" hash="5e8db94382f1fbd6c4e0b424a9edc9a3"/></dir><file name="rules.mk" hash="9e3570d254b92d571849718d98492192"/><dir name="scripts"><file name="gen_doc.sh" hash="0f6fc60aca94da563397d3c710bd9d33"/><file name="increment_version.sh" hash="431db9c60d2f94d251be07957787fcb0"/><file name="print_version.sh" hash="a05ddc19cd27ff185721fe2bd0cffc25"/><file name="version_management.sh" hash="3d5ecd39f45ba081144b3033dbd14330"/></dir><file name=".gitignore" hash="14de6527ce1e67cea1543b75a2322165"/></dir></target><target name="mage"><dir name="js"><dir name="mdn"><dir name="antidot"><file name="CollapsibleLists.js" hash="86792ecde0c2759ba85e0d863dd147ce"/></dir></dir></dir><dir name="shell"><file name="abstract.php" hash="91e2b9f922756ffc1b3439c0fe2b10d4"/><file name="antidotExport.php" hash="29ab25956e0a21e28b6e355d0275d4eb"/><file name="compiler.php" hash="810e20754b66351ea9472fcec3751ce6"/><file name="indexer.php" hash="b8ba3faf6220a8da07456c0cbded4602"/><file name="log.php" hash="ed2c3e2db2f847d9c238b9b2d0495e40"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="mdn"><dir name="antidot"><file name="CollapsibleLists.css" hash="c956d83facc41a97bf14726dcb953edb"/></dir></dir></dir><dir name="images"><dir name="mdn"><dir name="antidot"><file name="base.gif" hash="1f71b021e061a4948d69adc4ff10ccad"/><file name="button-closed.png" hash="563b78324e0712c0902cb4f77cb9eb86"/><file name="button-open.png" hash="c710849a0d2b61ad1f0fc36c0e59d131"/><file name="button.png" hash="97f3055c5046c851eea2dad7e5227508"/><file name="cd.gif" hash="f41037663522fab5c5c31530c7fa43d8"/><file name="empty.gif" hash="df22aff6e941ff1cc577333d1712b584"/><file name="folder.gif" hash="ea16980ab437fa6ba4aba3d480e83e9e"/><file name="folderopen.gif" hash="18aa3d75315bf95bf080357733437fcc"/><file name="globe.gif" hash="d6b48614cf8dc9553e077c19197637d2"/><file name="imgfolder.gif" hash="1d488d377762e65ab4e8b691ba01e5a4"/><file name="join.gif" hash="4d5d614e0da056df815a4306d6368692"/><file name="joinbottom.gif" hash="4b3daa7f2cc584f1aac0d142275d7cba"/><file name="line.gif" hash="63ab38a6203262f15ca46c631232ea2c"/><file name="list-item-contents.png" hash="00ae24d5bc76df9eedaea597859963e4"/><file name="list-item-last-open.png" hash="615ddd71f81b240e9ed7d4e383b2c01a"/><file name="list-item-last.png" hash="e2bfb790f46855c378e50f3c0a82ea01"/><file name="list-item-open.png" hash="732d1cc59f3a488c89c624eb434eac98"/><file name="list-item-root.png" hash="5529d21e7ec68e9cb750a4895ff0b480"/><file name="list-item.png" hash="e03ec1bf3d9e16bb3005ccf8d26eaa6c"/><file name="minus.gif" hash="d647fbbd0ec410b8f3bb3357b62eedcf"/><file name="minusbottom.gif" hash="b09d684cca7135ef728141aaf2464baa"/><file name="musicfolder.gif" hash="21ece951734f23adb2f75befe1f31fc1"/><file name="nolines_minus.gif" hash="eb2243a354ffcfac93ba0fe948f7167d"/><file name="nolines_plus.gif" hash="ec92b634b63608fb4b0dbf114e3b89e1"/><file name="page.gif" hash="c25b136c1cb3bb145495c25b35d93754"/><file name="plus.gif" hash="5c55d798909c553deca31d610bd18fac"/><file name="plusbottom.gif" hash="1924ce363c38a992f888a4df48c0b274"/><file name="question.gif" hash="ea0ca196ce0ebfd625cc1210abfdec6c"/><file name="trash.gif" hash="6cbfd3ed29531044aed9b4edb3cca9ad"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="de_AT"><file name="MDN_Antidot.csv" hash="c45d0a82747927c46d886f94ab2304be"/></dir><dir name="de_CH"><file name="MDN_Antidot.csv" hash="c45d0a82747927c46d886f94ab2304be"/></dir><dir name="de_DE"><file name="MDN_Antidot.csv" hash="c45d0a82747927c46d886f94ab2304be"/></dir><dir name="es_AR"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_CL"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_CO"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_CR"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_ES"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_MX"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_PA"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_PE"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="es_VE"><file name="MDN_Antidot.csv" hash="03913d2a662791641b86b02955ef2c51"/></dir><dir name="fr_CA"><file name="MDN_Antidot.csv" hash="c72a1b1173e18386e86c1fc528965a7e"/></dir><dir name="fr_FR"><file name="MDN_Antidot.csv" hash="c72a1b1173e18386e86c1fc528965a7e"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MDN_Antidot.xml" hash="988c6b7e9da4e50f1727956833ab1696"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="antidot"><dir name="catalog"><dir name="layer"><file name="category.phtml" hash="3ec81f7b3e3b947317da8664c8e15927"/><file name="filter.phtml" hash="2304baebff9b798e0ebd977fbc891346"/></dir></dir><dir name="catalogsearch"><file name="result.phtml" hash="12c082ddff0e6c4fef74630b8253face"/></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="antidot.xml" hash="654b0cbb9d7c3f7a0a506e3f6adf164b"/></dir><dir name="template"><dir name="antidot"><dir name="catalogsearch"><dir name="result"><file name="category.phtml" hash="7413580b825508f2cfc08566d62369ae"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
23
  <compatible/>
24
+ <dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php><extension><name>curl</name><min/><max/></extension><extension><name>SimpleXML</name><min/><max/></extension></required></dependencies>
25
  </package>
shell/abstract.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Shell
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Shell scripts abstract class
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Shell
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ abstract class Mage_Shell_Abstract
35
+ {
36
+ /**
37
+ * Is include Mage and initialize application
38
+ *
39
+ * @var bool
40
+ */
41
+ protected $_includeMage = true;
42
+
43
+ /**
44
+ * Magento Root path
45
+ *
46
+ * @var string
47
+ */
48
+ protected $_rootPath;
49
+
50
+ /**
51
+ * Initialize application with code (store, website code)
52
+ *
53
+ * @var string
54
+ */
55
+ protected $_appCode = 'admin';
56
+
57
+ /**
58
+ * Initialize application code type (store, website, store_group)
59
+ *
60
+ * @var string
61
+ */
62
+ protected $_appType = 'store';
63
+
64
+ /**
65
+ * Input arguments
66
+ *
67
+ * @var array
68
+ */
69
+ protected $_args = array();
70
+
71
+ /**
72
+ * Factory instance
73
+ *
74
+ * @var Mage_Core_Model_Factory
75
+ */
76
+ protected $_factory;
77
+
78
+ /**
79
+ * Initialize application and parse input parameters
80
+ *
81
+ */
82
+ public function __construct()
83
+ {
84
+ if ($this->_includeMage) {
85
+ require_once $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
86
+ Mage::app($this->_appCode, $this->_appType);
87
+ }
88
+ $this->_factory = new Mage_Core_Model_Factory();
89
+
90
+ $this->_applyPhpVariables();
91
+ $this->_parseArgs();
92
+ $this->_construct();
93
+ $this->_validate();
94
+ $this->_showHelp();
95
+ }
96
+
97
+ /**
98
+ * Get Magento Root path (with last directory separator)
99
+ *
100
+ * @return string
101
+ */
102
+ protected function _getRootPath()
103
+ {
104
+ if (is_null($this->_rootPath)) {
105
+ $this->_rootPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;
106
+ }
107
+ return $this->_rootPath;
108
+ }
109
+
110
+ /**
111
+ * Parse .htaccess file and apply php settings to shell script
112
+ *
113
+ */
114
+ protected function _applyPhpVariables()
115
+ {
116
+ $htaccess = $this->_getRootPath() . '.htaccess';
117
+ if (file_exists($htaccess)) {
118
+ // parse htaccess file
119
+ $data = file_get_contents($htaccess);
120
+ $matches = array();
121
+ preg_match_all('#^\s+?php_value\s+([a-z_]+)\s+(.+)$#siUm', $data, $matches, PREG_SET_ORDER);
122
+ if ($matches) {
123
+ foreach ($matches as $match) {
124
+ @ini_set($match[1], str_replace("\r", '', $match[2]));
125
+ }
126
+ }
127
+ preg_match_all('#^\s+?php_flag\s+([a-z_]+)\s+(.+)$#siUm', $data, $matches, PREG_SET_ORDER);
128
+ if ($matches) {
129
+ foreach ($matches as $match) {
130
+ @ini_set($match[1], str_replace("\r", '', $match[2]));
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Parse input arguments
138
+ *
139
+ * @return Mage_Shell_Abstract
140
+ */
141
+ protected function _parseArgs()
142
+ {
143
+ $current = null;
144
+ foreach ($_SERVER['argv'] as $arg) {
145
+ $match = array();
146
+ if (preg_match('#^--([\w\d_-]{1,})$#', $arg, $match) || preg_match('#^-([\w\d_]{1,})$#', $arg, $match)) {
147
+ $current = $match[1];
148
+ $this->_args[$current] = true;
149
+ } else {
150
+ if ($current) {
151
+ $this->_args[$current] = $arg;
152
+ } else if (preg_match('#^([\w\d_]{1,})$#', $arg, $match)) {
153
+ $this->_args[$match[1]] = true;
154
+ }
155
+ }
156
+ }
157
+ return $this;
158
+ }
159
+
160
+ /**
161
+ * Additional initialize instruction
162
+ *
163
+ * @return Mage_Shell_Abstract
164
+ */
165
+ protected function _construct()
166
+ {
167
+ return $this;
168
+ }
169
+
170
+ /**
171
+ * Validate arguments
172
+ *
173
+ */
174
+ protected function _validate()
175
+ {
176
+ if (isset($_SERVER['REQUEST_METHOD'])) {
177
+ die('This script cannot be run from Browser. This is the shell script.');
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Run script
183
+ *
184
+ */
185
+ abstract public function run();
186
+
187
+ /**
188
+ * Check is show usage help
189
+ *
190
+ */
191
+ protected function _showHelp()
192
+ {
193
+ if (isset($this->_args['h']) || isset($this->_args['help'])) {
194
+ die($this->usageHelp());
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Retrieve Usage Help Message
200
+ *
201
+ */
202
+ public function usageHelp()
203
+ {
204
+ return <<<USAGE
205
+ Usage: php -f script.php -- [options]
206
+
207
+ -h Short alias for help
208
+ help This help
209
+ USAGE;
210
+ }
211
+
212
+ /**
213
+ * Retrieve argument value by name or false
214
+ *
215
+ * @param string $name the argument name
216
+ * @return mixed
217
+ */
218
+ public function getArg($name)
219
+ {
220
+ if (isset($this->_args[$name])) {
221
+ return $this->_args[$name];
222
+ }
223
+ return false;
224
+ }
225
+ }
shell/antidotExport.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'abstract.php';
4
+
5
+ class MDN_Shell_AntidotExport extends Mage_Shell_Abstract
6
+ {
7
+
8
+ /**
9
+ * Run script
10
+ *
11
+ */
12
+ public function run()
13
+ {
14
+ Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
15
+
16
+ $start = time();
17
+
18
+ echo PHP_EOL.PHP_EOL;
19
+ echo PHP_EOL.date('H:i:s')." : Start antidot AFS@Store push";
20
+ echo PHP_EOL.date('H:i:s')." : Start products";
21
+ Mage::getModel('Antidot/Observer')->catalogFullExport();
22
+ echo PHP_EOL.date('H:i:s')." : Start categories";
23
+ Mage::getModel('Antidot/Observer')->categoriesFullExport();
24
+
25
+ //display last logs from start date
26
+ $logs = Mage::helper('Antidot/LogExport')->getAllLastGeneration(4);
27
+ foreach($logs as $log)
28
+ {
29
+ if (strtotime($log['begin_at']) >= $start)
30
+ {
31
+ echo PHP_EOL." > ".$log['reference']." - ".$log['element'].' - '.$log['status'].' : '.$log['error'];
32
+ }
33
+ }
34
+
35
+ echo PHP_EOL.date('H:i:s')." : COMPLETE";
36
+ echo PHP_EOL.PHP_EOL;
37
+
38
+ return true;
39
+ }
40
+ }
41
+
42
+ $shell = new MDN_Shell_AntidotExport();
43
+ $shell->run();
shell/compiler.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Shell
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ require_once 'abstract.php';
28
+
29
+ /**
30
+ * Magento Compiler Shell Script
31
+ *
32
+ * @category Mage
33
+ * @package Mage_Shell
34
+ * @author Magento Core Team <core@magentocommerce.com>
35
+ */
36
+ class Mage_Shell_Compiler extends Mage_Shell_Abstract
37
+ {
38
+ /**
39
+ * Compiler process object
40
+ *
41
+ * @var Mage_Compiler_Model_Process
42
+ */
43
+ protected $_compiler;
44
+
45
+ /**
46
+ * Get compiler process object
47
+ *
48
+ * @return Mage_Compiler_Model_Process
49
+ */
50
+ protected function _getCompiler()
51
+ {
52
+ if ($this->_compiler === null) {
53
+ $this->_compiler = Mage::getModel('compiler/process');
54
+ }
55
+ return $this->_compiler;
56
+ }
57
+
58
+ /**
59
+ * Run script
60
+ *
61
+ */
62
+ public function run()
63
+ {
64
+ if (isset($this->_args['disable'])) {
65
+ $this->_getCompiler()->registerIncludePath(false);
66
+ echo "Compiler include path disabled\n";
67
+ } else if (isset($this->_args['enable'])) {
68
+ if ($this->_getCompiler()->getCompiledFilesCount() == 0) {
69
+ die("Compilation State: Not Compiled\nPlease run with option compile\n");
70
+ }
71
+
72
+ $this->_getCompiler()->registerIncludePath();
73
+ echo "Compiler include path enabled\n";
74
+ } else if (isset($this->_args['compile'])) {
75
+ try {
76
+ $this->_getCompiler()->run();
77
+ echo "Compilation successfully finished\n";
78
+ } catch (Mage_Core_Exception $e) {
79
+ echo $e->getMessage() . "\n";
80
+ } catch (Exception $e) {
81
+ echo "Compilation unknown error:\n\n";
82
+ echo $e . "\n";
83
+ }
84
+ } else if (isset($this->_args['clear'])) {
85
+ try {
86
+ $this->_getCompiler()->clear();
87
+ echo "Compilation successfully cleared\n";
88
+ } catch (Mage_Core_Exception $e) {
89
+ echo $e->getMessage() . "\n";
90
+ } catch (Exception $e) {
91
+ echo "Compilation unknown error:\n\n";
92
+ echo $e . "\n";
93
+ }
94
+ } else if (isset($this->_args['state']) || isset($this->_args['fullstate'])) {
95
+ $compiler = $this->_getCompiler();
96
+ $compilerConfig = '../includes/config.php';
97
+ if (file_exists($compilerConfig)) {
98
+ include $compilerConfig;
99
+ }
100
+ $status = defined('COMPILER_INCLUDE_PATH') ? 'Enabled' : 'Disabled';
101
+ $state = $compiler->getCollectedFilesCount() > 0 ? 'Compiled' : 'Not Compiled';
102
+ echo "Compiler Status: " . $status . "\n";
103
+ echo "Compilation State: " . $state . "\n";
104
+ echo "Collected Files Count: " . $compiler->getCollectedFilesCount() . "\n";
105
+ echo "Compiled Scopes Count: " . $compiler->getCompiledFilesCount() . "\n";
106
+ } else {
107
+ echo $this->usageHelp();
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Retrieve Usage Help Message
113
+ *
114
+ */
115
+ public function usageHelp()
116
+ {
117
+ return <<<USAGE
118
+ Usage: php -f compiler.php -- [options]
119
+
120
+ state Show Compilation State
121
+ compile Run Compilation Process
122
+ clear Disable Compiler include path and Remove compiled files
123
+ enable Enable Compiler include path
124
+ disable Disable Compiler include path
125
+ help This help
126
+
127
+ USAGE;
128
+ }
129
+ }
130
+
131
+ $shell = new Mage_Shell_Compiler();
132
+ $shell->run();
shell/indexer.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Shell
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ require_once 'abstract.php';
28
+
29
+ /**
30
+ * Magento Compiler Shell Script
31
+ *
32
+ * @category Mage
33
+ * @package Mage_Shell
34
+ * @author Magento Core Team <core@magentocommerce.com>
35
+ */
36
+ class Mage_Shell_Compiler extends Mage_Shell_Abstract
37
+ {
38
+ /**
39
+ * Get Indexer instance
40
+ *
41
+ * @return Mage_Index_Model_Indexer
42
+ */
43
+ protected function _getIndexer()
44
+ {
45
+ return $this->_factory->getSingleton($this->_factory->getIndexClassAlias());
46
+ }
47
+
48
+ /**
49
+ * Parse string with indexers and return array of indexer instances
50
+ *
51
+ * @param string $string
52
+ * @return array
53
+ */
54
+ protected function _parseIndexerString($string)
55
+ {
56
+ $processes = array();
57
+ if ($string == 'all') {
58
+ $collection = $this->_getIndexer()->getProcessesCollection();
59
+ foreach ($collection as $process) {
60
+ if ($process->getIndexer()->isVisible() === false) {
61
+ continue;
62
+ }
63
+ $processes[] = $process;
64
+ }
65
+ } else if (!empty($string)) {
66
+ $codes = explode(',', $string);
67
+ $codes = array_map('trim', $codes);
68
+ $processes = $this->_getIndexer()->getProcessesCollectionByCodes($codes);
69
+ foreach($processes as $key => $process) {
70
+ if ($process->getIndexer()->getVisibility() === false) {
71
+ unset($processes[$key]);
72
+ }
73
+ }
74
+ if ($this->_getIndexer()->hasErrors()) {
75
+ echo implode(PHP_EOL, $this->_getIndexer()->getErrors()), PHP_EOL;
76
+ }
77
+ }
78
+ return $processes;
79
+ }
80
+
81
+ /**
82
+ * Run script
83
+ *
84
+ */
85
+ public function run()
86
+ {
87
+ if ($this->getArg('info')) {
88
+ $processes = $this->_parseIndexerString('all');
89
+ foreach ($processes as $process) {
90
+ /* @var $process Mage_Index_Model_Process */
91
+ echo sprintf('%-30s', $process->getIndexerCode());
92
+ echo $process->getIndexer()->getName() . "\n";
93
+ }
94
+ } else if ($this->getArg('status') || $this->getArg('mode')) {
95
+ if ($this->getArg('status')) {
96
+ $processes = $this->_parseIndexerString($this->getArg('status'));
97
+ } else {
98
+ $processes = $this->_parseIndexerString($this->getArg('mode'));
99
+ }
100
+ foreach ($processes as $process) {
101
+ /* @var $process Mage_Index_Model_Process */
102
+ $status = 'unknown';
103
+ if ($this->getArg('status')) {
104
+ switch ($process->getStatus()) {
105
+ case Mage_Index_Model_Process::STATUS_PENDING:
106
+ $status = 'Pending';
107
+ break;
108
+ case Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX:
109
+ $status = 'Require Reindex';
110
+ break;
111
+ case Mage_Index_Model_Process::STATUS_RUNNING:
112
+ $status = 'Running';
113
+ break;
114
+ default:
115
+ $status = 'Ready';
116
+ break;
117
+ }
118
+ } else {
119
+ switch ($process->getMode()) {
120
+ case Mage_Index_Model_Process::MODE_SCHEDULE:
121
+ $status = 'Update by schedule';
122
+ break;
123
+ case Mage_Index_Model_Process::MODE_REAL_TIME:
124
+ $status = 'Update on Save';
125
+ break;
126
+ case Mage_Index_Model_Process::MODE_MANUAL:
127
+ $status = 'Manual Update';
128
+ break;
129
+ }
130
+ }
131
+ echo sprintf('%-35s ', $process->getIndexer()->getName() . ':') . $status ."\n";
132
+
133
+ }
134
+ } else if ($this->getArg('mode-realtime') || $this->getArg('mode-manual')) {
135
+ if ($this->getArg('mode-realtime')) {
136
+ $mode = Mage_Index_Model_Process::MODE_REAL_TIME;
137
+ $processes = $this->_parseIndexerString($this->getArg('mode-realtime'));
138
+ } else {
139
+ $mode = Mage_Index_Model_Process::MODE_MANUAL;
140
+ $processes = $this->_parseIndexerString($this->getArg('mode-manual'));
141
+ }
142
+ foreach ($processes as $process) {
143
+ /* @var $process Mage_Index_Model_Process */
144
+ try {
145
+ $process->setMode($mode)->save();
146
+ echo $process->getIndexer()->getName() . " index was successfully changed index mode\n";
147
+ } catch (Mage_Core_Exception $e) {
148
+ echo $e->getMessage() . "\n";
149
+ } catch (Exception $e) {
150
+ echo $process->getIndexer()->getName() . " index process unknown error:\n";
151
+ echo $e . "\n";
152
+ }
153
+ }
154
+ } else if ($this->getArg('reindex') || $this->getArg('reindexall')) {
155
+ if ($this->getArg('reindex')) {
156
+ $processes = $this->_parseIndexerString($this->getArg('reindex'));
157
+ } else {
158
+ $processes = $this->_parseIndexerString('all');
159
+ }
160
+
161
+ try {
162
+ Mage::dispatchEvent('shell_reindex_init_process');
163
+ foreach ($processes as $process) {
164
+ /* @var $process Mage_Index_Model_Process */
165
+ try {
166
+ $process->reindexEverything();
167
+ Mage::dispatchEvent($process->getIndexerCode() . '_shell_reindex_after');
168
+ echo $process->getIndexer()->getName() . " index was rebuilt successfully\n";
169
+ } catch (Mage_Core_Exception $e) {
170
+ echo $e->getMessage() . "\n";
171
+ } catch (Exception $e) {
172
+ echo $process->getIndexer()->getName() . " index process unknown error:\n";
173
+ echo $e . "\n";
174
+ }
175
+ }
176
+ Mage::dispatchEvent('shell_reindex_finalize_process');
177
+ } catch (Exception $e) {
178
+ Mage::dispatchEvent('shell_reindex_finalize_process');
179
+ echo $e->getMessage() . "\n";
180
+ }
181
+
182
+ } else {
183
+ echo $this->usageHelp();
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Retrieve Usage Help Message
189
+ *
190
+ */
191
+ public function usageHelp()
192
+ {
193
+ return <<<USAGE
194
+ Usage: php -f indexer.php -- [options]
195
+
196
+ --status <indexer> Show Indexer(s) Status
197
+ --mode <indexer> Show Indexer(s) Index Mode
198
+ --mode-realtime <indexer> Set index mode type "Update on Save"
199
+ --mode-manual <indexer> Set index mode type "Manual Update"
200
+ --reindex <indexer> Reindex Data
201
+ info Show allowed indexers
202
+ reindexall Reindex Data by all indexers
203
+ help This help
204
+
205
+ <indexer> Comma separated indexer codes or value "all" for all indexers
206
+
207
+ USAGE;
208
+ }
209
+ }
210
+
211
+ $shell = new Mage_Shell_Compiler();
212
+ $shell->run();
shell/log.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Shell
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ require_once 'abstract.php';
28
+
29
+ /**
30
+ * Magento Log Shell Script
31
+ *
32
+ * @category Mage
33
+ * @package Mage_Shell
34
+ * @author Magento Core Team <core@magentocommerce.com>
35
+ */
36
+ class Mage_Shell_Log extends Mage_Shell_Abstract
37
+ {
38
+ /**
39
+ * Log instance
40
+ *
41
+ * @var Mage_Log_Model_Log
42
+ */
43
+ protected $_log;
44
+
45
+ /**
46
+ * Retrieve Log instance
47
+ *
48
+ * @return Mage_Log_Model_Log
49
+ */
50
+ protected function _getLog()
51
+ {
52
+ if (is_null($this->_log)) {
53
+ $this->_log = Mage::getModel('log/log');
54
+ }
55
+ return $this->_log;
56
+ }
57
+
58
+ /**
59
+ * Convert count to human view
60
+ *
61
+ * @param int $number
62
+ * @return string
63
+ */
64
+ protected function _humanCount($number)
65
+ {
66
+ if ($number < 1000) {
67
+ return $number;
68
+ } else if ($number >= 1000 && $number < 1000000) {
69
+ return sprintf('%.2fK', $number / 1000);
70
+ } else if ($number >= 1000000 && $number < 1000000000) {
71
+ return sprintf('%.2fM', $number / 1000000);
72
+ } else {
73
+ return sprintf('%.2fB', $number / 1000000000);
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Convert size to human view
79
+ *
80
+ * @param int $number
81
+ * @return string
82
+ */
83
+ protected function _humanSize($number)
84
+ {
85
+ if ($number < 1000) {
86
+ return sprintf('%d b', $number);
87
+ } else if ($number >= 1000 && $number < 1000000) {
88
+ return sprintf('%.2fKb', $number / 1000);
89
+ } else if ($number >= 1000000 && $number < 1000000000) {
90
+ return sprintf('%.2fMb', $number / 1000000);
91
+ } else {
92
+ return sprintf('%.2fGb', $number / 1000000000);
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Run script
98
+ *
99
+ */
100
+ public function run()
101
+ {
102
+ if ($this->getArg('clean')) {
103
+ $days = $this->getArg('days');
104
+ if ($days > 0) {
105
+ Mage::app()->getStore()->setConfig(Mage_Log_Model_Log::XML_LOG_CLEAN_DAYS, $days);
106
+ }
107
+ $this->_getLog()->clean();
108
+ echo "Log cleaned\n";
109
+ } else if ($this->getArg('status')) {
110
+ $resource = $this->_getLog()->getResource();
111
+ $adapter = $resource->getReadConnection();
112
+ // log tables
113
+ $tables = array(
114
+ $resource->getTable('log/customer'),
115
+ $resource->getTable('log/visitor'),
116
+ $resource->getTable('log/visitor_info'),
117
+ $resource->getTable('log/url_table'),
118
+ $resource->getTable('log/url_info_table'),
119
+ $resource->getTable('log/quote_table'),
120
+
121
+ $resource->getTable('reports/viewed_product_index'),
122
+ $resource->getTable('reports/compared_product_index'),
123
+ $resource->getTable('reports/event'),
124
+
125
+ $resource->getTable('catalog/compare_item'),
126
+ );
127
+
128
+ $rows = 0;
129
+ $dataLengh = 0;
130
+ $indexLength = 0;
131
+
132
+ $line = '-----------------------------------+------------+------------+------------+' . "\n";
133
+ echo $line;
134
+ echo sprintf('%-35s|', 'Table Name');
135
+ echo sprintf(' %-11s|', 'Rows');
136
+ echo sprintf(' %-11s|', 'Data Size');
137
+ echo sprintf(' %-11s|', 'Index Size');
138
+ echo "\n";
139
+ echo $line;
140
+
141
+ foreach ($tables as $table) {
142
+ $query = $adapter->quoteInto('SHOW TABLE STATUS LIKE ?', $table);
143
+ $status = $adapter->fetchRow($query);
144
+ if (!$status) {
145
+ continue;
146
+ }
147
+
148
+ $rows += $status['Rows'];
149
+ $dataLengh += $status['Data_length'];
150
+ $indexLength += $status['Index_length'];
151
+
152
+ echo sprintf('%-35s|', $table);
153
+ echo sprintf(' %-11s|', $this->_humanCount($status['Rows']));
154
+ echo sprintf(' %-11s|', $this->_humanSize($status['Data_length']));
155
+ echo sprintf(' %-11s|', $this->_humanSize($status['Index_length']));
156
+ echo "\n";
157
+ }
158
+
159
+ echo $line;
160
+ echo sprintf('%-35s|', 'Total');
161
+ echo sprintf(' %-11s|', $this->_humanCount($rows));
162
+ echo sprintf(' %-11s|', $this->_humanSize($dataLengh));
163
+ echo sprintf(' %-11s|', $this->_humanSize($indexLength));
164
+ echo "\n";
165
+ echo $line;
166
+ } else {
167
+ echo $this->usageHelp();
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Retrieve Usage Help Message
173
+ *
174
+ */
175
+ public function usageHelp()
176
+ {
177
+ return <<<USAGE
178
+ Usage: php -f log.php -- [options]
179
+ php -f log.php -- clean --days 1
180
+
181
+ clean Clean Logs
182
+ --days <days> Save log, days. (Minimum 1 day, if defined - ignoring system value)
183
+ status Display statistics per log tables
184
+ help This help
185
+
186
+ USAGE;
187
+ }
188
+ }
189
+
190
+ $shell = new Mage_Shell_Log();
191
+ $shell->run();