Magmodules_Sooqr - Version 1.2.0

Version Notes

Magmodules_Sooqr

Download this release

Release Info

Developer Magmodules
Extension Magmodules_Sooqr
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.9 to 1.2.0

Files changed (59) hide show
  1. app/code/community/Magmodules/Sooqr/Block/Adminhtml/Config/Form/Field/Extra.php +50 -37
  2. app/code/community/Magmodules/Sooqr/Block/Adminhtml/Config/Form/Field/Filter.php +65 -54
  3. app/code/community/Magmodules/Sooqr/Block/Adminhtml/Config/Form/Renderer/Select.php +94 -84
  4. app/code/community/Magmodules/Sooqr/Block/Adminhtml/System/Config/Form/Field/Feeds.php +113 -39
  5. app/code/community/Magmodules/Sooqr/Block/Adminhtml/System/Config/Form/Field/Heading.php +28 -17
  6. app/code/community/Magmodules/Sooqr/Block/Adminhtml/System/Config/Form/Field/Note.php +28 -17
  7. app/code/community/Magmodules/Sooqr/Block/Adminhtml/System/Config/Form/Field/Version.php +28 -18
  8. app/code/community/Magmodules/Sooqr/Block/Adminhtml/Widget/Info/Info.php +66 -49
  9. app/code/community/Magmodules/Sooqr/Block/Search.php +90 -54
  10. app/code/community/Magmodules/Sooqr/Helper/Data.php +1298 -794
  11. app/code/community/Magmodules/Sooqr/Helper/Write.php +117 -0
  12. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Backend/Design/Extra.php +56 -37
  13. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Backend/Design/Filter.php +62 -42
  14. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Backend/Sooqr/Cron.php +69 -61
  15. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Action.php +0 -28
  16. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Attribute.php +48 -36
  17. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Cacheresize.php +46 -40
  18. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Category.php +55 -45
  19. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Categorytype.php +26 -22
  20. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Cms.php +28 -24
  21. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Cmspages.php +47 -37
  22. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Condition.php +28 -24
  23. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Conditions.php +37 -32
  24. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Configurable.php +33 -28
  25. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Frequency.php +30 -26
  26. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Identifier.php +27 -23
  27. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Image.php +33 -0
  28. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Images.php +46 -29
  29. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Pricemodel.php +28 -24
  30. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Productid.php +72 -61
  31. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Producttype.php +27 -23
  32. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Resize.php +28 -24
  33. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Selectattribute.php +50 -39
  34. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Status.php +27 -23
  35. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Tax.php +28 -24
  36. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Textattribute.php +69 -58
  37. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Varcharattribute.php +69 -58
  38. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Version.php +26 -22
  39. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Visibility.php +28 -24
  40. app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Weight.php +29 -25
  41. app/code/community/Magmodules/Sooqr/Model/Common.php +255 -110
  42. app/code/community/Magmodules/Sooqr/Model/Observer.php +53 -36
  43. app/code/community/Magmodules/Sooqr/Model/Sooqr.php +621 -418
  44. app/code/community/Magmodules/Sooqr/Model/Source/Action.php +32 -0
  45. app/code/community/Magmodules/Sooqr/Model/Source/Attribute.php +50 -0
  46. app/code/community/Magmodules/Sooqr/Model/Source/Countries.php +29 -0
  47. app/code/community/Magmodules/Sooqr/Model/Source/Tax.php +33 -0
  48. app/code/community/Magmodules/Sooqr/Model/System/Config/Backend/Design/Extra.php +61 -0
  49. app/code/community/Magmodules/Sooqr/controllers/Adminhtml/SooqrController.php +143 -72
  50. app/code/community/Magmodules/Sooqr/controllers/InstallationController.php +30 -26
  51. app/code/community/Magmodules/Sooqr/data/magmodules_sooqr_setup/data-install-1.1.9.php +20 -17
  52. app/code/community/Magmodules/Sooqr/data/magmodules_sooqr_setup/data-upgrade-1.1.8-1.1.9.php +20 -17
  53. app/code/community/Magmodules/Sooqr/etc/adminhtml.xml +19 -18
  54. app/code/community/Magmodules/Sooqr/etc/config.xml +89 -86
  55. app/code/community/Magmodules/Sooqr/etc/system.xml +380 -348
  56. app/design/frontend/base/default/layout/magmodules_sooqr.xml +26 -7
  57. app/design/frontend/base/default/template/magmodules/sooqr/form.mini.phtml +28 -25
  58. app/etc/modules/Magmodules_Sooqr.xml +25 -6
  59. package.xml +4 -4
app/code/community/Magmodules/Sooqr/Block/Adminhtml/Config/Form/Field/Extra.php CHANGED
@@ -1,48 +1,61 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
- class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Extra extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
 
 
19
 
20
- protected $_renders = array();
21
-
22
- public function __construct()
23
- {
24
- $layout = Mage::app()->getFrontController()->getAction()->getLayout();
25
- $renderer_attribute = $layout->createBlock('sooqr/adminhtml_config_form_renderer_select', '', array('is_render_to_js_template' => true));
26
- $renderer_attribute->setOptions(Mage::getModel('sooqr/adminhtml_system_config_source_attribute')->toOptionArray());
27
- $this->addColumn('attribute', array(
28
- 'label' => Mage::helper('sooqr')->__('Attribute'),
29
- 'style' => 'width:180px',
30
- 'renderer' => $renderer_attribute
31
- ));
32
- $this->_renders['attribute'] = $renderer_attribute;
 
 
 
 
 
33
  $this->_addAfter = false;
34
  $this->_addButtonLabel = Mage::helper('sooqr')->__('Add Field');
35
  parent::__construct();
36
  }
37
-
38
- protected function _prepareArrayRow(Varien_Object $row)
39
- {
40
- foreach ($this->_renders as $key => $render){
41
- $row->setData(
42
- 'option_extra_attr_' . $render->calcOptionHash($row->getData($key)),
43
- 'selected="selected"'
44
- );
45
- }
46
- }
 
 
 
47
 
48
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Extra
22
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
23
+ {
24
 
25
+ protected $_renders = array();
26
+
27
+ /**
28
+ * Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Extra constructor.
29
+ */
30
+ public function __construct()
31
+ {
32
+ $layout = Mage::app()->getFrontController()->getAction()->getLayout();
33
+ $rendererAttribute = $layout->createBlock('sooqr/adminhtml_config_form_renderer_select', '', array('is_render_to_js_template' => true));
34
+ $rendererAttribute->setOptions(Mage::getModel('sooqr/adminhtml_system_config_source_attribute')->toOptionArray());
35
+ $this->addColumn(
36
+ 'attribute', array(
37
+ 'label' => Mage::helper('sooqr')->__('Attribute'),
38
+ 'style' => 'width:180px',
39
+ 'renderer' => $rendererAttribute
40
+ )
41
+ );
42
+ $this->_renders['attribute'] = $rendererAttribute;
43
  $this->_addAfter = false;
44
  $this->_addButtonLabel = Mage::helper('sooqr')->__('Add Field');
45
  parent::__construct();
46
  }
47
+
48
+ /**
49
+ * @param Varien_Object $row
50
+ */
51
+ public function _prepareArrayRow(Varien_Object $row)
52
+ {
53
+ foreach ($this->_renders as $key => $render) {
54
+ $row->setData(
55
+ 'option_extra_attr_' . $render->calcOptionHash($row->getData($key)),
56
+ 'selected="selected"'
57
+ );
58
+ }
59
+ }
60
 
61
  }
app/code/community/Magmodules/Sooqr/Block/Adminhtml/Config/Form/Field/Filter.php CHANGED
@@ -1,72 +1,83 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
- class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Filter extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
 
 
19
 
20
- protected $_renders = array();
21
 
22
- /**
23
- * Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Shipping constructor.
24
- */
25
- public function __construct()
26
- {
27
  $layout = Mage::app()->getFrontController()->getAction()->getLayout();
28
- $renderer_attributes = $layout->createBlock('sooqr/adminhtml_config_form_renderer_select', '', array('is_render_to_js_template' => true));
29
- $renderer_attributes->setOptions(Mage::getModel('sooqr/adminhtml_system_config_source_attribute')->toOptionArray());
30
-
31
- $renderer_conditions = $layout->createBlock('sooqr/adminhtml_config_form_renderer_select', '', array('is_render_to_js_template' => true));
32
- $renderer_conditions->setOptions(Mage::getModel('sooqr/adminhtml_system_config_source_conditions')->toOptionArray());
33
 
34
- $this->addColumn('attribute', array(
35
- 'label' => Mage::helper('sooqr')->__('Attribute'),
36
- 'style' => 'width:100px',
37
- 'renderer' => $renderer_attributes
38
- ));
39
-
40
- $this->addColumn('condition', array(
41
- 'label' => Mage::helper('sooqr')->__('Condition'),
42
- 'style' => 'width:100px',
43
- 'renderer' => $renderer_conditions
44
- ));
45
 
46
- $this->addColumn('value', array(
47
- 'label' => Mage::helper('sooqr')->__('Value'),
48
- 'style' => 'width:100px',
49
- ));
 
 
 
50
 
51
- $this->_renders['attribute'] = $renderer_attributes;
52
- $this->_renders['condition'] = $renderer_conditions;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  $this->_addAfter = false;
55
  $this->_addButtonLabel = Mage::helper('sooqr')->__('Add Filter');
56
  parent::__construct();
57
  }
58
 
59
- /**
60
- * @param Varien_Object $row
61
- */
62
- protected function _prepareArrayRow(Varien_Object $row)
63
- {
64
- foreach ($this->_renders as $key => $render){
65
- $row->setData(
66
- 'option_extra_attr_' . $render->calcOptionHash($row->getData($key)),
67
- 'selected="selected"'
68
- );
69
- }
70
- }
71
 
72
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Filter
22
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
23
+ {
24
 
25
+ protected $_renders = array();
26
 
27
+ /**
28
+ * Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Shipping constructor.
29
+ */
30
+ public function __construct()
31
+ {
32
  $layout = Mage::app()->getFrontController()->getAction()->getLayout();
33
+ $rendererAttributes = $layout->createBlock('sooqr/adminhtml_config_form_renderer_select', '', array('is_render_to_js_template' => true));
34
+ $rendererAttributes->setOptions(Mage::getModel('sooqr/adminhtml_system_config_source_attribute')->toOptionArray());
 
 
 
35
 
36
+ $rendererConditions = $layout->createBlock('sooqr/adminhtml_config_form_renderer_select', '', array('is_render_to_js_template' => true));
37
+ $rendererConditions->setOptions(Mage::getModel('sooqr/adminhtml_system_config_source_conditions')->toOptionArray());
 
 
 
 
 
 
 
 
 
38
 
39
+ $this->addColumn(
40
+ 'attribute', array(
41
+ 'label' => Mage::helper('sooqr')->__('Attribute'),
42
+ 'style' => 'width:100px',
43
+ 'renderer' => $rendererAttributes
44
+ )
45
+ );
46
 
47
+ $this->addColumn(
48
+ 'condition', array(
49
+ 'label' => Mage::helper('sooqr')->__('Condition'),
50
+ 'style' => 'width:100px',
51
+ 'renderer' => $rendererConditions
52
+ )
53
+ );
54
+
55
+ $this->addColumn(
56
+ 'value', array(
57
+ 'label' => Mage::helper('sooqr')->__('Value'),
58
+ 'style' => 'width:100px',
59
+ )
60
+ );
61
+
62
+ $this->_renders['attribute'] = $rendererAttributes;
63
+ $this->_renders['condition'] = $rendererConditions;
64
 
65
  $this->_addAfter = false;
66
  $this->_addButtonLabel = Mage::helper('sooqr')->__('Add Filter');
67
  parent::__construct();
68
  }
69
 
70
+ /**
71
+ * @param Varien_Object $row
72
+ */
73
+ public function _prepareArrayRow(Varien_Object $row)
74
+ {
75
+ foreach ($this->_renders as $key => $render) {
76
+ $row->setData(
77
+ 'option_extra_attr_' . $render->calcOptionHash($row->getData($key)),
78
+ 'selected="selected"'
79
+ );
80
+ }
81
+ }
82
 
83
  }
app/code/community/Magmodules/Sooqr/Block/Adminhtml/Config/Form/Renderer/Select.php CHANGED
@@ -1,76 +1,80 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
- class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Renderer_Select extends Mage_Core_Block_Html_Select {
19
-
20
- public function setInputName($inputName)
21
- {
22
- $this->setData('inputname', $inputName);
 
23
  return $this;
24
- }
25
-
26
- public function getInputName()
27
- {
28
- return $this->getData('inputname');
29
- }
30
-
31
- public function setColumnName($columnName)
32
- {
33
- $this->setData('columnname', $columnName);
34
  return $this;
35
- }
36
-
37
- public function getColumnName()
38
- {
39
- return $this->getData('columnname');
40
- }
41
-
42
- public function setColumn($column)
43
- {
44
- $this->setData('column', $column);
45
  return $this;
46
- }
47
-
48
- public function getColumn()
49
- {
50
- return $this->getData('column');
51
- }
52
-
53
- public function getExtraParams()
54
- {
55
- $column = $this->getColumn();
56
- if($column && isset($column['style'])){
57
- return ' style="'.$column['style'].'" ';
58
- }else{
59
- return '';
60
- }
61
- }
62
-
63
- protected function _toHtml()
64
  {
65
- if(!$this->_beforeToHtml()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  return '';
67
  }
68
 
69
- $html = '<select name="'.$this->getInputName().'" class="'.$this->getClass().'" '.$this->getExtraParams().'>';
70
-
71
  $values = $this->getValue();
72
 
73
- if (!is_array($values)){
74
  if (!is_null($values)) {
75
  $values = array($values);
76
  } else {
@@ -79,11 +83,11 @@ class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Renderer_Select extends Mage_
79
  }
80
 
81
  $isArrayOption = true;
82
-
83
- foreach($this->getOptions() as $key => $option) {
84
- if($isArrayOption && is_array($option)) {
85
- $value = $option['value'];
86
- $label = $option['label'];
87
  $params = (!empty($option['params'])) ? $option['params'] : array();
88
  } else {
89
  $value = $key;
@@ -92,36 +96,40 @@ class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Renderer_Select extends Mage_
92
  $params = array();
93
  }
94
 
95
- if(is_array($value)) {
96
- $html.= '<optgroup label="'.$label.'">';
97
- foreach($value as $keyGroup => $optionGroup) {
98
- if(!is_array($optionGroup)) {
99
  $optionGroup = array(
100
  'value' => $keyGroup,
101
  'label' => $optionGroup
102
  );
103
  }
104
- $html.= $this->_optionToHtml(
 
105
  $optionGroup,
106
  in_array($optionGroup['value'], $values)
107
  );
108
  }
109
- $html.= '</optgroup>';
 
110
  } else {
111
- $html.= $this->_optionToHtml(array(
112
- 'value' => $value,
113
- 'label' => $label,
 
114
  'params' => $params
115
- ),
116
  in_array($value, $values)
117
  );
118
  }
119
  }
120
- $html.= '</select>';
 
121
  return $html;
122
  }
123
 
124
- protected function _optionToHtml($option, $selected = false)
125
  {
126
  $selectedHtml = $selected ? ' selected="selected"' : '';
127
  if ($this->getIsRenderToJsTemplate() === true) {
@@ -141,21 +149,23 @@ class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Renderer_Select extends Mage_
141
  }
142
  }
143
 
144
- return sprintf('<option value="%s"%s %s>%s</option>',
 
145
  $this->htmlEscape($option['value']),
146
  $selectedHtml,
147
  $params,
148
- $this->htmlEscape($option['label']));
 
149
  }
150
 
151
- public function getHtml()
152
  {
153
  return $this->toHtml();
154
  }
155
-
156
- public function calcOptionHash($optionValue)
157
- {
158
  return sprintf('%u', crc32($this->getColumnName() . $this->getInputName() . $optionValue));
159
  }
160
-
161
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Renderer_Select extends Mage_Core_Block_Html_Select
22
+ {
23
+
24
+ public function setInputName($inputName)
25
+ {
26
+ $this->setData('inputname', $inputName);
27
  return $this;
28
+ }
29
+
30
+ public function getInputName()
31
+ {
32
+ return $this->getData('inputname');
33
+ }
34
+
35
+ public function setColumnName($columnName)
36
+ {
37
+ $this->setData('columnname', $columnName);
38
  return $this;
39
+ }
40
+
41
+ public function getColumnName()
42
+ {
43
+ return $this->getData('columnname');
44
+ }
45
+
46
+ public function setColumn($column)
47
+ {
48
+ $this->setData('column', $column);
49
  return $this;
50
+ }
51
+
52
+ public function getColumn()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  {
54
+ return $this->getData('column');
55
+ }
56
+
57
+ public function getExtraParams()
58
+ {
59
+ $column = $this->getColumn();
60
+ if ($column && isset($column['style'])) {
61
+ return ' style="' . $column['style'] . '" ';
62
+ } else {
63
+ return '';
64
+ }
65
+ }
66
+
67
+ public function _toHtml()
68
+ {
69
+ if (!$this->_beforeToHtml()) {
70
  return '';
71
  }
72
 
73
+ $html = '<select name="' . $this->getInputName() . '" class="' . $this->getClass() . '" ' . $this->getExtraParams() . '>';
74
+
75
  $values = $this->getValue();
76
 
77
+ if (!is_array($values)) {
78
  if (!is_null($values)) {
79
  $values = array($values);
80
  } else {
83
  }
84
 
85
  $isArrayOption = true;
86
+
87
+ foreach ($this->getOptions() as $key => $option) {
88
+ if ($isArrayOption && is_array($option)) {
89
+ $value = $option['value'];
90
+ $label = $option['label'];
91
  $params = (!empty($option['params'])) ? $option['params'] : array();
92
  } else {
93
  $value = $key;
96
  $params = array();
97
  }
98
 
99
+ if (is_array($value)) {
100
+ $html .= '<optgroup label="' . $label . '">';
101
+ foreach ($value as $keyGroup => $optionGroup) {
102
+ if (!is_array($optionGroup)) {
103
  $optionGroup = array(
104
  'value' => $keyGroup,
105
  'label' => $optionGroup
106
  );
107
  }
108
+
109
+ $html .= $this->_optionToHtml(
110
  $optionGroup,
111
  in_array($optionGroup['value'], $values)
112
  );
113
  }
114
+
115
+ $html .= '</optgroup>';
116
  } else {
117
+ $html .= $this->_optionToHtml(
118
+ array(
119
+ 'value' => $value,
120
+ 'label' => $label,
121
  'params' => $params
122
+ ),
123
  in_array($value, $values)
124
  );
125
  }
126
  }
127
+
128
+ $html .= '</select>';
129
  return $html;
130
  }
131
 
132
+ public function _optionToHtml($option, $selected = false)
133
  {
134
  $selectedHtml = $selected ? ' selected="selected"' : '';
135
  if ($this->getIsRenderToJsTemplate() === true) {
149
  }
150
  }
151
 
152
+ return sprintf(
153
+ '<option value="%s"%s %s>%s</option>',
154
  $this->htmlEscape($option['value']),
155
  $selectedHtml,
156
  $params,
157
+ $this->htmlEscape($option['label'])
158
+ );
159
  }
160
 
161
+ public function getHtml()
162
  {
163
  return $this->toHtml();
164
  }
165
+
166
+ public function calcOptionHash($optionValue)
167
+ {
168
  return sprintf('%u', crc32($this->getColumnName() . $this->getInputName() . $optionValue));
169
  }
170
+
171
  }
app/code/community/Magmodules/Sooqr/Block/Adminhtml/System/Config/Form/Field/Feeds.php CHANGED
@@ -1,47 +1,121 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
- class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Feeds extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
 
 
19
 
20
- public function render(Varien_Data_Form_Element_Abstract $element)
 
 
 
 
 
21
  {
22
- $helper = Mage::helper('sooqr');
23
- $store_ids = $helper->getStoreIds('sooqr_connect/generate/enabled');
24
- $html_feedlinks = '';
25
- foreach($store_ids as $storeId) {
26
- $generate_url = $this->getUrl('*/sooqr/generateFeed/store_id/' . $storeId);
27
- $download_url = $this->getUrl('*/sooqr/download/store_id/' . $storeId);
28
- $feed_text = $helper->getUncachedConfigValue('sooqr_connect/generate/feed_result', $storeId);
29
- if(empty($feed_text)) {
30
- $feed_text = Mage::helper('sooqr')->__('No active feed found');
31
- $download_url = '';
32
- }
33
- $store_title = Mage::app()->getStore($storeId)->getName();
34
- $store_code = Mage::app()->getStore($storeId)->getCode();
35
- $html_feedlinks .= '<tr><td valign="top">' . $store_title . '<br/><small>Code: ' . $store_code . '</small></td><td>' . $feed_text . '</td><td><a href="' . $generate_url . '">' . Mage::helper('sooqr')->__('Generate New') . '</a><br/><a href="' . $download_url . '">' . Mage::helper('sooqr')->__('Download Last') . '</a></td></tr>';
36
- }
37
- if(empty($html_feedlinks)) {
38
- $html_feedlinks = Mage::helper('sooqr')->__('No enabled feed(s) found');
39
- } else {
40
- $html_header = '<div class="grid"><table cellpadding="0" cellspacing="0" class="border" style="width: 100%"><tbody><tr class="headings"><th>' . Mage::helper('sooqr')->__('Storeview') . '</th><th>' . Mage::helper('sooqr')->__('Feed') . '</th><th>' . Mage::helper('sooqr')->__('Action') . '</th></tr>';
41
- $html_footer = '</tbody></table></div>';
42
- $html_feedlinks = $html_header . $html_feedlinks . $html_footer;
43
- }
44
- return sprintf('<tr id="row_%s"><td colspan="6" class="label" style="margin-bottom: 10px;">%s</td></tr>', $element->getHtmlId(), $html_feedlinks);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
-
47
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the EULA
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * https://www.magmodules.eu/MM-LICENSE.txt
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license https://www.magmodules.eu/terms.html Single Service License
19
  */
20
 
21
+ class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Feeds
22
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
 
25
+ /**
26
+ * @param Varien_Data_Form_Element_Abstract $element
27
+ *
28
+ * @return string
29
+ */
30
+ public function render(Varien_Data_Form_Element_Abstract $element)
31
  {
32
+ $helper = Mage::helper('sooqr');
33
+ $storeIds = $helper->getStoreIds('sooqr_connect/generate/enabled');
34
+ $htmlFeedlinks = '';
35
+
36
+ foreach ($storeIds as $storeId) {
37
+ $generateUrl = $this->getUrl('*/sooqr/generateFeed/store_id/' . $storeId);
38
+ $downloadUrl = $this->getUrl('*/sooqr/download/store_id/' . $storeId);
39
+ $disableUrl = $this->getUrl('*/sooqr/disableFeed/store_id/' . $storeId);
40
+ $feedText = $helper->getUncachedConfigValue('sooqr_connect/generate/feed_result', $storeId);
41
+
42
+ if (empty($feedText)) {
43
+ $feedText = $helper->__('No active feed found');
44
+ $downloadUrl = '';
45
+ }
46
+
47
+ $htmlFeedlinks .= '<tr>
48
+ <td>
49
+ ' . $helper->__('✓ Enabled') . '
50
+ </td>
51
+ <td valign="top">
52
+ ' . Mage::app()->getStore($storeId)->getName() . '<br/>
53
+ <small>Code: ' . Mage::app()->getStore($storeId)->getCode() . '</small>
54
+ </td>
55
+ <td>
56
+ ' . $feedText . '
57
+ </td>
58
+ <td style="line-height: 25px;">
59
+ <a style="text-decoration: none;padding-left: 4px;" href="' . $generateUrl . '">
60
+ ' . $helper->__('↺ Generate') . '
61
+ </a>
62
+ <br/>
63
+ <a style="text-decoration: none;padding-left: 3px;" href="' . $downloadUrl . '">
64
+ ' . $helper->__('➞ Download') . '
65
+ </a>
66
+ <br/>
67
+ <a style="text-decoration: none; padding: 5px;" href="' . $disableUrl . '">
68
+ ' . $helper->__('✕ Disable') . '</a>
69
+ </td>
70
+ </tr>';
71
+ }
72
+
73
+ $storeIds = $helper->getDisabledStoreIds('sooqr_connect/generate/enabled');
74
+
75
+ foreach ($storeIds as $storeId) {
76
+ $enableUrl = $this->getUrl('*/sooqr/enableFeed/store_id/' . $storeId);
77
+ $feedText = $helper->__('No active feed found');
78
+ $htmlFeedlinks .= '<tr>
79
+ <td>
80
+ ' . $helper->__('✕ Disabled') . '
81
+ </td>
82
+ <td valign="top">
83
+ ' . Mage::app()->getStore($storeId)->getName() . '
84
+ <br/>
85
+ <small>Code: ' . Mage::app()->getStore($storeId)->getCode() . '</small>
86
+ </td>
87
+ <td>
88
+ ' . $feedText . '
89
+ </td>
90
+ <td>
91
+ <a style="text-decoration: none;padding-left: 5px;" href="' . $enableUrl . '">
92
+ ' . $helper->__('✓ Enable') . '
93
+ </a>
94
+ </td>
95
+ </tr>';
96
+ }
97
+
98
+ if (empty($htmlFeedlinks)) {
99
+ $htmlFeedlinks = $helper->__('No enabled feed(s) found');
100
+ } else {
101
+ $htmlHeader = '<div class="grid">
102
+ <table cellpadding="0" cellspacing="0" class="border" style="width: 100%">
103
+ <tbody>
104
+ <tr class="headings">
105
+ <th>' . $helper->__('Status') . '</th>
106
+ <th>' . $helper->__('Storeview') . '</th>
107
+ <th>' . $helper->__('Feed') . '</th>
108
+ <th>' . $helper->__('Action') . '</th>
109
+ </tr>';
110
+ $htmlFooter = '</tbody></table></div>';
111
+ $htmlFeedlinks = $htmlHeader . $htmlFeedlinks . $htmlFooter;
112
+ }
113
+
114
+ return sprintf(
115
+ '<tr id="row_%s"><td colspan="7" class="label" style="margin-bottom: 10px;">%s</td></tr>',
116
+ $element->getHtmlId(),
117
+ $htmlFeedlinks
118
+ );
119
  }
120
+
121
  }
app/code/community/Magmodules/Sooqr/Block/Adminhtml/System/Config/Form/Field/Heading.php CHANGED
@@ -1,28 +1,39 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
- class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Heading extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
 
 
19
 
20
- public function render(Varien_Data_Form_Element_Abstract $element)
 
 
 
 
 
21
  {
22
  $useContainerId = $element->getData('use_container_id');
23
- return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
 
24
  $element->getHtmlId(), $element->getLabel()
25
  );
26
  }
27
-
28
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Heading
22
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
 
25
+ /**
26
+ * @param Varien_Data_Form_Element_Abstract $element
27
+ *
28
+ * @return string
29
+ */
30
+ public function render(Varien_Data_Form_Element_Abstract $element)
31
  {
32
  $useContainerId = $element->getData('use_container_id');
33
+ return sprintf(
34
+ '<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
35
  $element->getHtmlId(), $element->getLabel()
36
  );
37
  }
38
+
39
  }
app/code/community/Magmodules/Sooqr/Block/Adminhtml/System/Config/Form/Field/Note.php CHANGED
@@ -1,28 +1,39 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
- class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Note extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
 
 
19
 
20
- public function render(Varien_Data_Form_Element_Abstract $element)
 
 
 
 
 
21
  {
22
  $useContainerId = $element->getData('use_container_id');
23
- return sprintf('<tr id="row_%s"><td colspan="5" class="label" style="margin-bottom: 10px;">%s</td></tr>',
 
24
  $element->getHtmlId(), $element->getLabel()
25
  );
26
  }
27
-
28
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Note
22
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
 
25
+ /**
26
+ * @param Varien_Data_Form_Element_Abstract $element
27
+ *
28
+ * @return string
29
+ */
30
+ public function render(Varien_Data_Form_Element_Abstract $element)
31
  {
32
  $useContainerId = $element->getData('use_container_id');
33
+ return sprintf(
34
+ '<tr id="row_%s"><td colspan="5" class="label" style="margin-bottom: 10px;">%s</td></tr>',
35
  $element->getHtmlId(), $element->getLabel()
36
  );
37
  }
38
+
39
  }
app/code/community/Magmodules/Sooqr/Block/Adminhtml/System/Config/Form/Field/Version.php CHANGED
@@ -1,25 +1,35 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Version extends Mage_Adminhtml_Block_System_Config_Form_Field {
19
 
20
- public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 
 
 
 
 
 
 
 
 
21
  {
22
- return Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
23
  }
24
-
25
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Version
22
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
23
+ {
24
+
25
+ /**
26
+ * @param Varien_Data_Form_Element_Abstract $element
27
+ *
28
+ * @return mixed
29
+ */
30
+ public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
31
  {
32
+ return Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
33
  }
34
+
35
  }
app/code/community/Magmodules/Sooqr/Block/Adminhtml/Widget/Info/Info.php CHANGED
@@ -1,32 +1,42 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Block_Adminhtml_Widget_Info_Info extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
19
 
20
- public function render(Varien_Data_Form_Element_Abstract $element)
 
 
 
 
 
 
 
 
 
21
  {
22
- $account_id = Mage::getStoreConfig('sooqr_connect/general/account_id');
23
- $api_key = Mage::getStoreConfig('sooqr_connect/general/api_key');
24
- $magento_version = Mage::getVersion();
25
  $module_version = Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
26
- $logo_link = '//www.magmodules.eu/logo/sooqr/' . $module_version . '/' . $magento_version . '/logo.png';
27
- $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
28
 
29
- $html = '<div style="background:url(\'' . $logo_link . '\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
30
  <h4>About Magmodules.eu</h4>
31
  <p>We are a Magento only E-commerce Agency located in the Netherlands and we developed this extension in association with Sooqr.<br>
32
  <br />
@@ -43,22 +53,20 @@ class Magmodules_Sooqr_Block_Adminhtml_Widget_Info_Info extends Mage_Adminhtml_B
43
  <td height="30">Visit our Website:</td>
44
  <td><a href="http://www.magmodules.eu" target="_blank">www.Magmodules.eu</a></td>
45
  </tr>';
46
-
47
-
48
- if(empty($account_id) && empty($api_key)) {
49
- $html .= ' <tr>
50
  <td>Registration on Sooqr (and free trial):</td>
51
- <td><a href="https://my.sooqr.com/magtrial?base=' . $base_url . '" target="_blank">Register here</a></td>
52
  </tr>';
53
-
54
- } else {
55
- $html .= ' <tr>
56
  <td>Sooqr Conversion Suite</td>
57
  <td><a href="https://my.sooqr.com/user/login" target="_blank">Login here</a></td>
58
  </tr>';
59
- }
60
-
61
- $html .= ' <tr>
62
  <td height="30">Sooqr Support</td>
63
  <td><a href="http://support.sooqr.com/support/home" target="_blank">Sooqr Support</a> or <a href="mailto:support@sooqr.com" target="_blank">support@sooqr.com</a></td>
64
  </tr>
@@ -69,22 +77,31 @@ class Magmodules_Sooqr_Block_Adminhtml_Widget_Info_Info extends Mage_Adminhtml_B
69
  </table>
70
  </div>';
71
 
72
- $flat_product = Mage::getStoreConfig('catalog/frontend/flat_catalog_product');
73
- $flat_category = Mage::getStoreConfig('catalog/frontend/flat_catalog_category');
74
- if((!$flat_product) || (!$flat_category)) {
75
- $msg = '<div id="messages"><ul class="messages"><li class="error-msg"><ul><li><span>' . Mage::helper('sooqr')->__('Please enable "Flat Catalog Category" and "Flat Catalog Product" for the extension to work properly. <a href="https://www.magmodules.eu/help/enable-flat-catalog/" target="_blank">More information.</a>') . '</span></li></ul></li></ul></div>';
76
- $html = $html . $msg;
77
- }
78
-
79
- if(Mage::getStoreConfig('catalog/frontend/flat_catalog_product')) {
80
- $store_id = Mage::helper('sooqr')->getStoreIdConfig();
81
- $non_flat_attributes = Mage::helper('sooqr')->checkFlatCatalog(Mage::getModel("sooqr/sooqr")->getFeedAttributes($store_id, 'flatcheck'));
82
- if(count($non_flat_attributes) > 0) {
83
- $html .= '<div id="messages"><ul class="messages"><li class="error-msg"><ul><li><span>';
84
- $html .= $this->__('Warning: The following used attribute(s) were not found in the flat catalog: %s. This can result in empty data or higher resource usage. Click <a href="%s">here</a> to add these to the flat catalog. ', implode($non_flat_attributes, ', '), $this->getUrl('*/sooqr/addToFlat'));
85
- $html .= '</span></ul></li></ul></div>';
86
- }
87
- }
 
 
 
 
 
 
 
 
 
88
  return $html;
89
  }
90
 
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Sooqr_Block_Adminhtml_Widget_Info_Info
22
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
+
25
+ /**
26
+ * @param Varien_Data_Form_Element_Abstract $element
27
+ *
28
+ * @return string
29
+ */
30
+ public function render(Varien_Data_Form_Element_Abstract $element)
31
  {
32
+ $accountId = Mage::getStoreConfig('sooqr_connect/general/account_id');
33
+ $apiKey = Mage::getStoreConfig('sooqr_connect/general/api_key');
34
+ $magentoVersion = Mage::getVersion();
35
  $module_version = Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
36
+ $logoLink = '//www.magmodules.eu/logo/sooqr/' . $module_version . '/' . $magentoVersion . '/logo.png';
37
+ $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
38
 
39
+ $html = '<div style="background:url(\'' . $logoLink . '\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
40
  <h4>About Magmodules.eu</h4>
41
  <p>We are a Magento only E-commerce Agency located in the Netherlands and we developed this extension in association with Sooqr.<br>
42
  <br />
53
  <td height="30">Visit our Website:</td>
54
  <td><a href="http://www.magmodules.eu" target="_blank">www.Magmodules.eu</a></td>
55
  </tr>';
56
+
57
+ if (empty($accountId) && empty($apiKey)) {
58
+ $html .= ' <tr>
 
59
  <td>Registration on Sooqr (and free trial):</td>
60
+ <td><a href="https://my.sooqr.com/magtrial?base=' . $baseUrl . '" target="_blank">Register here</a></td>
61
  </tr>';
62
+ } else {
63
+ $html .= ' <tr>
 
64
  <td>Sooqr Conversion Suite</td>
65
  <td><a href="https://my.sooqr.com/user/login" target="_blank">Login here</a></td>
66
  </tr>';
67
+ }
68
+
69
+ $html .= ' <tr>
70
  <td height="30">Sooqr Support</td>
71
  <td><a href="http://support.sooqr.com/support/home" target="_blank">Sooqr Support</a> or <a href="mailto:support@sooqr.com" target="_blank">support@sooqr.com</a></td>
72
  </tr>
77
  </table>
78
  </div>';
79
 
80
+ $flatProduct = Mage::getStoreConfig('catalog/frontend/flat_catalog_product');
81
+ $flatCategory = Mage::getStoreConfig('catalog/frontend/flat_catalog_category');
82
+ if ((!$flatProduct) || (!$flatCategory)) {
83
+ $msg = '<div id="messages"><ul class="messages"><li class="error-msg"><ul><li><span>' . Mage::helper('sooqr')->__('Please enable "Flat Catalog Category" and "Flat Catalog Product" for the extension to work properly. <a href="https://www.magmodules.eu/help/enable-flat-catalog/" target="_blank">More information.</a>') . '</span></li></ul></li></ul></div>';
84
+ $html = $html . $msg;
85
+ }
86
+
87
+ if (Mage::getStoreConfig('catalog/frontend/flat_catalog_product')) {
88
+ $storeId = Mage::helper('sooqr')->getStoreIdConfig();
89
+ $nonFlatAttributes = Mage::helper('sooqr')->checkFlatCatalog(
90
+ Mage::getModel("sooqr/sooqr")->getFeedAttributes(
91
+ $storeId,
92
+ 'flatcheck'
93
+ )
94
+ );
95
+ if (count($nonFlatAttributes) > 0) {
96
+ $html .= '<div id="messages"><ul class="messages"><li class="error-msg"><ul><li><span>';
97
+ $html .= $this->__(
98
+ 'Warning: The following used attribute(s) were not found in the flat catalog: %s. This can result in empty data or higher resource usage. Click <a href="%s">here</a> to add these to the flat catalog. ',
99
+ implode($nonFlatAttributes, ', '), $this->getUrl('*/sooqr/addToFlat')
100
+ );
101
+ $html .= '</span></ul></li></ul></div>';
102
+ }
103
+ }
104
+
105
  return $html;
106
  }
107
 
app/code/community/Magmodules/Sooqr/Block/Search.php CHANGED
@@ -1,83 +1,119 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Block_Search extends Mage_Core_Block_Template {
19
-
20
- protected function _construct()
21
- {
22
- if($this->isEnabled()) {
23
- $this->setTemplate('magmodules/sooqr/form.mini.phtml');
24
- } else {
25
- $this->setTemplate('catalogsearch/form.mini.phtml');
26
- }
27
- parent::_construct();
 
 
 
 
 
28
  }
29
 
30
- public function isEnabled()
31
- {
32
- $enabled = Mage::getStoreConfig('sooqr_connect/general/enabled', 0);
33
- $frontend_enabled = Mage::getStoreConfig('sooqr_connect/general/frontend_enabled');
34
- $account_id = Mage::getStoreConfig('sooqr_connect/general/account_id');
35
- $api_key = Mage::getStoreConfig('sooqr_connect/general/api_key');
36
- if($enabled && $frontend_enabled && (!empty($account_id)) && (!empty($api_key))) {
37
- return true;
38
- }
39
- }
 
 
 
 
 
40
 
 
 
 
41
  public function getSooqrOptions()
42
  {
43
- $account_id = Mage::getStoreConfig('sooqr_connect/general/account_id');
44
- $options = array('account' => $account_id, 'fieldId' => 'search');
45
- $parent = Mage::getStoreConfig('sooqr_connect/general/parent');
46
- if(!empty($parent)) {
47
  $options['containerParent'] = $parent;
48
- }
49
- $version = Mage::getStoreConfig('sooqr_connect/general/frontend_version');
50
- if(!empty($version)) {
 
51
  $options['version'] = $version;
52
  }
 
53
  return $options;
54
  }
55
-
 
 
 
56
  public function getSooqrLanguage()
57
  {
58
  return Mage::app()->getLocale()->getLocaleCode();
59
- }
60
-
61
- public function getSooqrJavascript() {
62
- $custom_js = Mage::getStoreConfig('sooqr_connect/general/custom_js');
63
- if(!empty($custom_js)) {
64
- return $custom_js;
65
- }
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  public function isTrackingEnabled()
69
  {
70
- if(Mage::getStoreConfig('sooqr_connect/general/statistics')) {
71
- return true;
72
- }
 
 
73
  }
74
 
 
 
 
75
  public function getSooqrScriptUri()
76
  {
77
- if(Mage::getStoreConfig('sooqr_connect/general/staging')) {
78
  return 'static.staging.sooqr.com/sooqr.js';
79
  }
 
80
  return 'static.sooqr.com/sooqr.js';
81
  }
82
-
83
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
+
21
+ class Magmodules_Sooqr_Block_Search extends Mage_Core_Block_Template
22
+ {
23
+
24
+ /**
25
+ *
26
+ */
27
+ public function _construct()
28
+ {
29
+ if ($this->isEnabled()) {
30
+ $this->setTemplate('magmodules/sooqr/form.mini.phtml');
31
+ } else {
32
+ $this->setTemplate('catalogsearch/form.mini.phtml');
33
+ }
34
+
35
+ parent::_construct();
36
  }
37
 
38
+ /**
39
+ * @return bool
40
+ */
41
+ public function isEnabled()
42
+ {
43
+ $enabled = Mage::getStoreConfig('sooqr_connect/general/enabled', 0);
44
+ $frontendEnabled = Mage::getStoreConfig('sooqr_connect/general/frontend_enabled');
45
+ $accountId = Mage::getStoreConfig('sooqr_connect/general/account_id');
46
+ $apiKey = Mage::getStoreConfig('sooqr_connect/general/api_key');
47
+ if ($enabled && $frontendEnabled && (!empty($accountId)) && (!empty($apiKey))) {
48
+ return true;
49
+ }
50
+
51
+ return false;
52
+ }
53
 
54
+ /**
55
+ * @return array
56
+ */
57
  public function getSooqrOptions()
58
  {
59
+ $accountId = Mage::getStoreConfig('sooqr_connect/general/account_id');
60
+ $options = array('account' => $accountId, 'fieldId' => 'search');
61
+ $parent = Mage::getStoreConfig('sooqr_connect/general/parent');
62
+ if (!empty($parent)) {
63
  $options['containerParent'] = $parent;
64
+ }
65
+
66
+ $version = Mage::getStoreConfig('sooqr_connect/general/frontend_version');
67
+ if (!empty($version)) {
68
  $options['version'] = $version;
69
  }
70
+
71
  return $options;
72
  }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
  public function getSooqrLanguage()
78
  {
79
  return Mage::app()->getLocale()->getLocaleCode();
 
 
 
 
 
 
 
80
  }
81
 
82
+ /**
83
+ * @return mixed
84
+ */
85
+ public function getSooqrJavascript()
86
+ {
87
+ $customJs = Mage::getStoreConfig('sooqr_connect/general/custom_js');
88
+ if (!empty($customJs)) {
89
+ return $customJs;
90
+ }
91
+
92
+ return '';
93
+ }
94
+
95
+ /**
96
+ * @return bool
97
+ */
98
  public function isTrackingEnabled()
99
  {
100
+ if (Mage::getStoreConfig('sooqr_connect/general/statistics')) {
101
+ return true;
102
+ }
103
+
104
+ return false;
105
  }
106
 
107
+ /**
108
+ * @return string
109
+ */
110
  public function getSooqrScriptUri()
111
  {
112
+ if (Mage::getStoreConfig('sooqr_connect/general/staging')) {
113
  return 'static.staging.sooqr.com/sooqr.js';
114
  }
115
+
116
  return 'static.sooqr.com/sooqr.js';
117
  }
118
+
119
  }
app/code/community/Magmodules/Sooqr/Helper/Data.php CHANGED
@@ -1,730 +1,1204 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * @version 26-03-2016
16
- * =============================================================
 
 
17
  */
18
-
19
- class Magmodules_Sooqr_Helper_Data extends Mage_Core_Helper_Abstract {
20
-
21
- public function getStoreIds($path)
22
- {
23
- $store_ids = array();
24
- foreach(Mage::app()->getStores() as $store) {
25
- $store_id = Mage::app()->getStore($store)->getId();
26
- if(Mage::getStoreConfig($path, $store_id)) {
27
- $store_ids[] = $store_id;
28
- }
29
- }
30
- return $store_ids;
31
- }
32
-
33
- public function getProductDataRow($product, $config, $parent)
34
- {
35
- $fields = $config['field'];
36
- $data = array();
37
-
38
- if(!$this->validateParent($parent, $config, $product)) { $parent = ''; }
39
- if(!$this->validateProduct($product, $config, $parent)) { return false; }
40
-
41
- foreach($fields as $key => $field) {
42
- $rows = $this->getAttributeValue($key, $product, $config, $field['action'], $parent);
43
- if(is_array($rows)) {
44
- $data = array_merge($data, $rows);
45
- }
46
- }
47
- if(empty($config['skip_validation'])) {
48
- if(!empty($data[$fields['price']['label']])) {
49
- return $data;
50
- }
51
- } else {
52
- return $data;
53
- }
54
- }
55
-
56
- public function getAttributeValue($field, $product, $config, $actions = '', $parent)
57
- {
58
- $data = $config['field'][$field];
59
- $product_data = $product;
60
-
61
- if(!empty($parent)) {
62
- if(!empty($data['parent'])) {
63
- $product_data = $parent;
64
- }
65
- }
66
-
67
- switch($field) {
68
- case 'product_url':
69
- $value = $this->getProductUrl($product, $config, $parent);
70
- break;
71
- case 'image_link':
72
- if(!empty($parent)) {
73
- $value = $this->getProductImage($product, $config);
74
- if(empty($value)) {
75
- $value = $this->getProductImage($parent, $config);
76
- }
77
- } else {
78
- $value = $this->getProductImage($product_data, $config);
79
- }
80
- break;
81
- case 'condition':
82
- $value = $this->getProductCondition($product_data, $config);
83
- break;
84
- case 'availability':
85
- $value = $this->getProductAvailability($product_data, $config);
86
- break;
87
- case 'weight':
88
- $value = $this->getProductWeight($product_data, $config);
89
- break;
90
- case 'price':
91
- $value = $this->getProductPrice($product_data, $config);
92
- break;
93
- case 'bundle':
94
- $value = $this->getProductBundle($product_data, $config);
95
- break;
96
- case 'parent_id':
97
- $value = $this->getProductData($parent, $data);
98
- break;
99
- case 'categories':
100
- $value = $this->getProductCategories($product_data, $config);
101
- break;
102
- default:
103
- if(!empty($data['source'])) {
104
- $value = $this->getProductData($product_data, $data, $config);
105
- } else {
106
- $value = '';
107
- }
108
- break;
109
- }
110
-
111
- if((isset($actions)) && (!empty($value))) {
112
- $value = $this->cleanData($value, $actions);
113
- }
114
-
115
- if((is_array($value) && ($field == 'image_link'))) {
116
- $i = 1;
117
- foreach($value as $key => $val) {
118
- $data_row[$key] = $val;
119
- $i++;
120
- }
121
- return $data_row;
122
- }
123
-
124
- if(!empty($value) || is_numeric($value)) {
125
- $data_row[$data['label']] = $value;
126
- return $data_row;
127
- }
128
- }
129
-
130
- public function cleanData($st, $action = '')
131
- {
132
- if($action) {
133
- $actions = explode('_', $action);
134
- if(in_array('striptags', $actions)) {
135
- $st = $this->stripTags($st);
136
- $st = trim($st);
137
- }
138
- if(in_array('replacetags', $actions)) {
139
- $st = str_replace(array("\r", "\n"), "", $st);
140
- $st = str_replace(array("<br>","<br/>", "<br />"), '\n', $st);
141
- $st = $this->stripTags($st);
142
- $st = rtrim($st);
143
- }
144
- if(in_array('replacetagsn', $actions)) {
145
- $st = str_replace(array("\r", "\n"), "", $st);
146
- $st = str_replace(array("<br>","<br/>", "<br />"), '\\' . '\n', $st);
147
- $st = $this->stripTags($st);
148
- $st = rtrim($st);
149
- }
150
- if(in_array('rn', $actions)) {
151
- $st = str_replace(array("\r", "\n"), "", $st);
152
- }
153
- if(in_array('truncate', $actions)) {
154
- $st = Mage::helper('core/string')->truncate($st, '5000');
155
- }
156
- if(in_array('cdata', $actions)) {
157
- $st = '<![CDATA[' . $st . ']]>';
158
- }
159
- if(in_array('round', $actions)) {
160
- if(!empty($actions[1])) {
161
- if($st > $actions[1]) {
162
- $st = $actions[1];
163
- }
164
- }
165
- $st = round($st);
166
- }
167
- if(in_array('boolean', $actions)) {
168
- ($st > 0 ? $st = 1 : $st = 0);
169
- }
170
- }
171
- return $st;
172
- }
173
-
174
- public function getProductUrl($product, $config, $parent)
175
- {
176
- $url = '';
177
- if(!empty($parent)) {
178
- if($parent->getRequestPath()) {
179
- $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getRequestPath()));
180
- }
181
- if(empty($url)) {
182
- if($parent->getUrlKey()) {
183
- $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getUrlKey()));
184
- }
185
- }
186
- } else {
187
- if($product->getRequestPath()) {
188
- $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getRequestPath()));
189
- }
190
- if(empty($url)) {
191
- if($product->getUrlKey()) {
192
- $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getUrlKey()));
193
- }
194
- }
195
- }
196
- if(!empty($config['product_url_suffix'])) {
197
- if(strpos($url, $config['product_url_suffix']) === false) {
198
- $url = $url . $config['product_url_suffix'];
199
- }
200
- }
201
- if(!empty($parent) && !empty($config['conf_switch_urls'])) {
202
- if($parent->getTypeId() == 'configurable') {
203
- $productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
204
- $url_extra = '';
205
- foreach ($productAttributeOptions as $productAttribute) {
206
- if($id = Mage::getResourceModel('catalog/product')->getAttributeRawValue($product->getId(), $productAttribute['attribute_code'], $config['store_id'])) {
207
- $url_extra .= $productAttribute['attribute_id'] . '=' . $id . '&';
208
- }
209
- }
210
- if(!empty($url_extra)) {
211
- $url = $url . '#' . rtrim($url_extra, '&');
212
- }
213
- }
214
- }
215
- return $url;
216
- }
217
-
218
- public function getProductImage($product, $config)
219
- {
220
- $image_data = array();
221
- if(!empty($config['image_resize']) && !empty($config['image_size'])) {
222
- $image_file = $product->getData($config['image_source']);
223
- if($image_file != 'no_selection') {
224
- $imageModel = Mage::getModel('catalog/product_image')->setSize($config['image_size'])->setDestinationSubdir($config['image_source'])->setBaseFile($image_file);
225
- if(!$imageModel->isCached()) {
226
- $imageModel->resize()->saveFile();
227
- }
228
- $productImage = $imageModel->getUrl();
229
- return (string)$productImage;
230
- }
231
- } else {
232
- $image = '';
233
- if(!empty($config['media_attributes'])) {
234
- foreach($config['media_attributes'] as $media_att) {
235
- if($media_att == 'base') { $media_att = 'image'; }
236
- $media_data = $product->getData($media_att);
237
- if(!empty($media_data)) {
238
- if($media_data != 'no_selection') {
239
- $image = $config['media_image_url'] . $media_data;
240
- $image_data['image'][$media_att] = $image;
241
- }
242
- }
243
- }
244
- } else {
245
- if($product->getThumbnail()) {
246
- if($product->getThumbnail() != 'no_selection') {
247
- $image = $config['media_image_url'] . $product->getThumbnail();
248
- $image_data['image']['thumbnail'] = $image;
249
- }
250
- }
251
- if($product->getSmallImage()) {
252
- if($product->getSmallImage() != 'no_selection') {
253
- $image = $config['media_image_url'] . $product->getSmallImage();
254
- $image_data['image']['small_image'] = $image;
255
- }
256
- }
257
- if($product->getImage()) {
258
- if($product->getImage() != 'no_selection') {
259
- $image = $config['media_image_url'] . $product->getImage();
260
- $image_data['image']['image'] = $image;
261
- }
262
- }
263
- }
264
- if(!empty($config['images'])) {
265
- $image_data['image_link'] = $image;
266
- $container = new Varien_Object(array('attribute' => new Varien_Object(array('id' => $config['media_gallery_id']))));
267
- $img_product = new Varien_Object(array('id' => $product->getId(),'store_id' => $config['store_id']));
268
- $gallery = Mage::getResourceModel('catalog/product_attribute_backend_media')->loadGallery($img_product, $container);
269
- $images = array(); $i = 1;
270
- usort($gallery, function($a, $b) { return $a['position_default'] > $b['position_default']; });
271
- foreach($gallery as $gal_image) {
272
- if($gal_image['disabled'] == 0) {
273
- $image_data['image']['all']['image_' . $i] = $config['media_image_url'] . $gal_image['file'];
274
- $image_data['image']['last'] = $config['media_image_url'] . $gal_image['file'];
275
- if($i == 1) { $image_data['image']['first'] = $config['media_image_url'] . $gal_image['file']; }
276
- $i++;
277
- }
278
- }
279
- return $image_data;
280
- } else {
281
- if(!empty($image_data['image'][$config['image_source']])) {
282
- return $image_data['image'][$config['image_source']];
283
- } else {
284
- return $image;
285
- }
286
- }
287
- }
288
- }
289
-
290
- public function getProductCondition($product, $config)
291
- {
292
- if(isset($config['condition_attribute'])) {
293
- if($condition = $product->getAttributeText($config['condition_attribute'])) {
294
- return $condition;
295
- } else{
296
- return false;
297
- }
298
- }
299
- return $config['condition_default'];
300
- }
301
-
302
- public function getProductBundle($product, $config)
303
- {
304
- if($product->getTypeId() == 'bundle') {
305
- return 'true';
306
- }
307
- }
308
-
309
- public function getProductAvailability($product, $config)
310
- {
311
- if(!empty($config['stock_instock'])) {
312
- if($product->getUseConfigManageStock()) {
313
- $manage_stock = $config['stock_manage'];
314
- } else {
315
- $manage_stock = $product->getManageStock();
316
- }
317
- if($manage_stock) {
318
- if($product['stock_status']) {
319
- $availability = $config['stock_instock'];
320
- } else {
321
- $availability = $config['stock_outofstock'];
322
- }
323
- } else {
324
- $availability = $config['stock_instock'];
325
- }
326
- return $availability;
327
- }
328
- }
329
-
330
- public function getProductWeight($product, $config)
331
- {
332
- if(!empty($config['weight'])) {
333
- $weight = number_format($product->getWeight(), 2, '.', '');
334
- if(isset($config['weight_units'])) {
335
- $weight = $weight . ' ' . $config['weight_units'];
336
- }
337
- return $weight;
338
- }
339
- }
340
-
341
- public function getProductCategories($product, $config)
342
- {
343
- if(isset($config['category_data'])) {
344
- $category_data = $config['category_data'];
345
- $products_cat = array();
346
- $category_ids = $product->getCategoryIds();
347
- $level = 0;
348
- if(!empty($config['category_full'])) {
349
- $path = array();
350
- foreach($category_ids as $category_id) {
351
- if(isset($category_data[$category_id])) {
352
- $path[] = $category_data[$category_id]['name'];
353
- }
354
- }
355
- $products_cat = array('path' => $path);
356
- } else {
357
- foreach($category_ids as $category_id) {
358
- if(isset($category_data[$category_id])) {
359
- $products_cat[] = $category_data[$category_id];
360
- $level = $category_data[$category_id]['level'];
361
- }
362
- }
363
- }
364
- return $products_cat;
365
- }
366
- }
367
-
368
- public function getProductData($product, $data, $config = '')
369
- {
370
- $type = $data['type'];
371
- $source = $data['source'];
372
- $value = '';
373
- switch($type) {
374
- case 'price':
375
- if(!empty($product[$source])) {
376
- $value = number_format($product[$source], 2, '.', '');
377
- if(!empty($config['currency'])) {
378
- $value .= ' ' . $config['currency'];
379
- }
380
- }
381
- break;
382
- case 'select':
383
- $value = $product->getAttributeText($source);
384
- break;
385
- case 'multiselect':
386
- if(count($product->getAttributeText($source))) {
387
- if(count($product->getAttributeText($source)) > 1) {
388
- $value = implode(',', $product->getAttributeText($source));
389
- } else {
390
- $value = $product->getAttributeText($source);
391
- }
392
- }
393
- break;
394
- default:
395
- if(isset($product[$source])) {
396
- $value = $product[$source];
397
- }
398
- break;
399
- }
400
- return $value;
401
- }
402
-
403
- public function getProductPrice($product, $config)
404
- {
405
- $price_data = array();
406
- $price_markup = $this->getPriceMarkup($config);
407
- $tax_param = $config['use_tax'];
408
-
409
- if(!empty($config['hide_currency'])) {
410
- $currency = '';
411
- } else {
412
- $currency = ' ' . $config['currency'];
413
- }
414
-
415
- if(!empty($config['price_scope'])) {
416
- $price = Mage::getResourceModel('catalog/product')->getAttributeRawValue($product->getId(), 'price', $config['store_id']);
417
- } else {
418
- $price = $product->getPrice();
419
- }
420
-
421
- $price = Mage::helper('tax')->getPrice($product, $price, $tax_param);
422
- $price_data['regular_price'] = number_format(($price * $price_markup), 2, '.', '') . $currency;
423
- $pricerule_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), $tax_param);
424
-
425
- $special_price = ''; $special_date = '';
426
- if(($pricerule_price > 0) && ($pricerule_price < $price)) {
427
- $sales_price = $pricerule_price;
428
- $specialPriceFromDate = $product->getSpecialFromDate();
429
- $specialPriceToDate = $product->getSpecialToDate();
430
- $today = time();
431
- if($today >= strtotime($specialPriceFromDate)) {
432
- if($today <= strtotime($specialPriceToDate) || is_null($specialPriceToDate)) {
433
- $price_data['sales_date_start'] = $specialPriceFromDate;
434
- $price_data['sales_date_end'] = $specialPriceToDate;
435
- }
436
- }
437
- }
438
-
439
- if(($product->getTypeId() == 'bundle') && ($price < 0.01)) {
440
- $price = $this->getPriceBundle($product, $config['store_id']);
441
- }
442
-
443
- if($product->getTypeId() == 'grouped') {
444
- if(!empty($config['price_grouped'])) {
445
- $price = $this->getPriceGrouped($product, $config['price_grouped']);
446
- } else {
447
- if($price < 0.01) {
448
- $price = $this->getPriceGrouped($product);
449
- }
450
- }
451
- }
452
-
453
- $price_data['final_price_clean'] = $price;
454
- $price_data['price'] = number_format(($price * $price_markup), 2, '.', '') . $currency;
455
-
456
- if(isset($sales_price)) {
457
- $price_data['sales_price'] = number_format(($sales_price * $price_markup), 2, '.', '') . $currency;
458
- }
459
-
460
- return $price_data;
461
- }
462
-
463
- public function getPriceMarkup($config)
464
- {
465
- $markup = 1;
466
- if(!empty($config['price_add_tax']) && !empty($config['price_add_tax_perc'])) {
467
- $markup = 1 + ($config['price_add_tax_perc'] / 100);
468
- }
469
- if($config['base_currency_code'] != $config['currency']) {
470
- $exchange_rate = Mage::helper('directory')->currencyConvert(1, $config['base_currency_code'], $config['currency']);
471
- $markup = ($markup * $exchange_rate);
472
- }
473
- return $markup;
474
- }
475
-
476
- public function getTaxUsage($config)
477
- {
478
- if(!empty($config['force_tax'])) {
479
- if($config['force_tax'] == 'incl') {
480
- return 'true';
481
- } else {
482
- return '';
483
- }
484
- } else {
485
- return 'true';
486
- }
487
- }
488
-
489
- public function addAttributeData($attributes, $config = '')
490
- {
491
- foreach($attributes as $key => $attribute) {
492
- $type = (!empty($attribute['type']) ? $attribute['type'] : '');
493
- $action = (!empty($attribute['action']) ? $attribute['action'] : '');
494
- $parent = (!empty($attribute['parent']) ? $attribute['parent'] : '');
495
- if(isset($attribute['source'])) {
496
- $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $attribute['source']);
497
- $type = $attributeModel->getFrontendInput();
498
- }
499
- if(!empty($config['conf_fields'])) {
500
- $conf_attributes = explode(',', $config['conf_fields']);
501
- if(in_array($key, $conf_attributes)) {
502
- $parent = '1';
503
- }
504
- }
505
- $attributes[$key] = array('label' => $attribute['label'], 'source' => $attribute['source'], 'type' => $type, 'action' => $action, 'parent' => $parent);
506
- }
507
- return $attributes;
508
- }
509
-
510
- public function getCategoryData($config, $storeId)
511
- {
512
- $eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
513
- $attributes = array('entity_id','path','name','level');
514
-
515
- if(!empty($config['category_custom'])) {
516
- $attributes[] = $config['category_custom'];
517
- }
518
- if(!empty($config['category_replace'])) {
519
- $attributes[] = $config['category_replace'];
520
- }
521
-
522
- if(!empty($config['filter_enabled'])) {
523
- $type = $config['filter_type'];
524
- $f_categories = explode(',', $config['filter_cat']);
525
- if($type && $f_categories) {
526
- if($type == 'include') {
527
- $categories = Mage::getModel('catalog/category')->setStoreId($storeId)->getCollection()->addAttributeToSelect($attributes)->addFieldToFilter('is_active', array('eq' => 1))->addAttributeToFilter('entity_id', array('in' => $f_categories));
528
- } else {
529
- $categories = Mage::getModel('catalog/category')->setStoreId($storeId)->getCollection()->addAttributeToSelect($attributes)->addFieldToFilter('is_active', array('eq' => 1))->addAttributeToFilter('entity_id', array('nin' => $f_categories));
530
- }
531
- }
532
- } else {
533
- $categories = Mage::getModel('catalog/category')->setStoreId($storeId)->getCollection()->addAttributeToSelect($attributes)->addFieldToFilter('is_active', array('eq' => 1));
534
- }
535
- $_categories = array();
536
-
537
- foreach($categories as $cat) {
538
- $custom = ''; $name = '';
539
- if(!empty($config['category_replace'])) {
540
- if(!empty($cat[$config['category_replace']])) {
541
- $name = $cat[$config['category_replace']];
542
- }
543
- }
544
- if(isset($config['category_custom'])) {
545
- if(!empty($cat[$config['category_custom']])) {
546
- $custom = $cat[$config['category_custom']];
547
- }
548
- }
549
- if(empty($name)) { $name = $cat['name']; }
550
- $_categories[$cat->getId()] = array('path' => $cat['path'], 'custom' => $custom, 'name' => $name, 'level' => $cat['level']);
551
- }
552
-
553
- foreach($_categories as $key => $cat) {
554
- $path = array();
555
- $custom_path = array();
556
- $paths = explode('/', $cat['path']);
557
- foreach($paths as $p) {
558
- if(!empty($_categories[$p]['name'])) {
559
- if($_categories[$p]['level'] > 1) {
560
- $path[] = $_categories[$p]['name'];
561
- if(!empty($_categories[$p]['custom'])) {
562
- $custom_path[] = $_categories[$p]['custom'];
563
- }
564
- }
565
- }
566
- }
567
- $_categories[$key] = array('path' => $this->cleanData($path, 'stiptags'), 'custom_path' => $this->cleanData($custom_path, 'stiptags'), 'custom' => $this->cleanData(end($custom_path), 'striptags'), 'name' => $this->cleanData($cat['name'], 'striptags'), 'level' => $cat['level']);
568
- }
569
- return $_categories;
570
- }
571
-
572
- public function getParentData($product, $config)
573
- {
574
- if(!empty($config['conf_enabled'])) {
575
- if(($product['type_id'] == 'simple')) {
576
- $config_ids = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
577
- $group_ids = Mage::getResourceSingleton('catalog/product_link')->getParentIdsByChild($product->getId(), Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED);
578
- if($config_ids) {
579
- return $config_ids[0];
580
- }
581
- if($group_ids) {
582
- return $group_ids[0];
583
- }
584
- }
585
- }
586
- }
587
-
588
- public function validateProduct($product, $config, $parent)
589
- {
590
- if(empty($config['skip_validation'])) {
591
- if($product['visibility'] == 1) {
592
- if(empty($parent)) {
593
- return false;
594
- }
595
- if($parent['status'] != 1) {
596
- return false;
597
- }
598
- }
599
- if(!empty($config['filter_exclude'])) {
600
- if($product[$config['filter_exclude']] == 1) {
601
- return false;
602
- }
603
- }
604
- if(!empty($config['hide_no_stock'])) {
605
- if($product->getUseConfigManageStock()) {
606
- $manage_stock = $config['stock_manage'];
607
- } else {
608
- $manage_stock = $product->getManageStock();
609
- }
610
- if($manage_stock) {
611
- if(!$product['stock_status']) {
612
- return false;
613
- }
614
- }
615
- }
616
- if(!empty($config['conf_exclude_parent'])) {
617
- if($product->getTypeId() == 'configurable') {
618
- return false;
619
- }
620
- }
621
- }
622
- return true;
623
- }
624
-
625
- public function validateParent($parent, $config, $product)
626
- {
627
- return $this->validateProduct($product, $config, $parent);
628
- }
629
-
630
- public function getPriceBundle($product, $storeId)
631
- {
632
- if(($product->getPriceType() == '1') && ($product->getFinalPrice() > 0)) {
633
- $price = $product->getFinalPrice();
634
- } else {
635
- $priceModel = $product->getPriceModel();
636
- $block = Mage::getSingleton('core/layout')->createBlock('bundle/catalog_product_view_type_bundle');
637
- $options = $block->setProduct($product)->getOptions();
638
- $price = 0;
639
-
640
- foreach ($options as $option) {
641
- $selection = $option->getDefaultSelection();
642
- if($selection === null) { continue; }
643
- $selection_product_id = $selection->getProductId();
644
- $_resource = Mage::getSingleton('catalog/product')->getResource();
645
- $final_price = $_resource->getAttributeRawValue($selection_product_id, 'final_price', $storeId);
646
- $selection_qty = $_resource->getAttributeRawValue($selection_product_id, 'selection_qty', $storeId);
647
- $price += ($final_price * $selection_qty);
648
- }
649
- }
650
- if($price < 0.01) {
651
- $price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
652
- }
653
- return $price;
654
- }
655
-
656
- public function getPriceGrouped($product, $pricemodel = '')
657
- {
658
- if(!$pricemodel) { $pricemodel = 'min'; }
659
- $prices = array();
660
- $_associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
661
- foreach($_associatedProducts as $_item) {
662
- $price_associated = Mage::helper('tax')->getPrice($_item, $_item->getFinalPrice(), true);
663
- if($price_associated > 0) {
664
- $prices[] = $price_associated;
665
- }
666
- }
667
- if(!empty($prices)) {
668
- if($pricemodel == 'min') { return min($prices); }
669
- if($pricemodel == 'max') { return max($prices); }
670
- if($pricemodel == 'total') { return array_sum($prices); }
671
- }
672
- }
673
-
674
- public function getTypePrices($config, $products)
675
- {
676
- $type_prices = array();
677
- if(!empty($config['conf_enabled'])) {
678
- if(!empty($config['hide_currency'])) {
679
- $currency = '';
680
- } else {
681
- $currency = ' ' . $config['currency'];
682
- }
683
- foreach($products as $product) {
684
- if($product->getTypeId() == 'configurable') {
685
- $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
686
- $att_prices = array();
687
- $base_price = $product->getFinalPrice();
688
- $base_price_reg = $product->getPrice();
689
- foreach ($attributes as $attribute){
690
- $optionPrices = array();
691
- $prices = $attribute->getPrices();
692
- foreach ($prices as $value) {
693
- $product->setConfigurablePrice(
694
- $this->_preparePrice($value['pricing_value'], $value['is_percent'], $product)
695
- );
696
- $product->setParentId(true);
697
- Mage::dispatchEvent(
698
- 'catalog_product_type_configurable_price',
699
- array('product' => $product)
700
- );
701
- $configurablePrice = $product->getConfigurablePrice();
702
- $optionPrices[$value['value_index']] = $configurablePrice;
703
- $optionPrices[$value['value_index'] .'_reg'] = $this->_prepareOldPrice($value['pricing_value'], $value['is_percent'], $product);
704
- }
705
- }
706
- $simple = $product->getTypeInstance()->getUsedProducts();
707
- $simple_prices = array();
708
- foreach($simple as $sProduct) {
709
- $total_price = $base_price;
710
- $total_price_reg = $base_price_reg;
711
- foreach($attributes as $attribute) {
712
- $value = $sProduct->getData($attribute->getProductAttribute()->getAttributeCode());
713
- if(isset($optionPrices[$value])) {
714
- $total_price += $optionPrices[$value];
715
- $total_price_reg += $optionPrices[$value . '_reg'];
716
- }
717
- }
718
- $type_prices[$sProduct->getEntityId()] = number_format(($total_price * $config['markup']), 2, '.', '');
719
- $type_prices[$sProduct->getEntityId() . '_reg'] = number_format(($total_price_reg * $config['markup']), 2, '.', '');
720
- }
721
- }
722
- }
723
- }
724
- return $type_prices;
725
- }
726
-
727
- protected function _preparePrice($price, $isPercent = false, $product)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
  {
729
  if ($isPercent && !empty($price)) {
730
  $price = $product->getFinalPrice() * $price / 100;
@@ -732,8 +1206,15 @@ class Magmodules_Sooqr_Helper_Data extends Mage_Core_Helper_Abstract {
732
 
733
  return $price;
734
  }
735
-
736
- protected function _prepareOldPrice($price, $isPercent = false, $product)
 
 
 
 
 
 
 
737
  {
738
  if ($isPercent && !empty($price)) {
739
  $price = $product->getPrice() * $price / 100;
@@ -741,71 +1222,94 @@ class Magmodules_Sooqr_Helper_Data extends Mage_Core_Helper_Abstract {
741
 
742
  return $price;
743
  }
744
-
745
- public function checkOldVersion($dir)
746
- {
747
- if($dir) {
748
- $dir = Mage::getBaseDir('app') . DS . 'code' . DS . 'local' . DS . 'Magmodules' . DS . $dir;
749
- return file_exists($dir);
750
- }
751
- }
752
-
753
- public function checkFlatCatalog($attributes)
754
- {
755
- $non_flat_attributes = array();
756
- foreach($attributes as $key => $attribute) {
757
- if(!empty($attribute['source'])) {
758
- if(($attribute['source'] != 'entity_id') && ($attribute['source'] != 'sku')) {
759
- $_attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $attribute['source']);
760
- if($_attribute->getUsedInProductListing() == 0) {
761
- if($_attribute->getId()) {
762
- $non_flat_attributes[$_attribute->getId()] = $_attribute->getFrontendLabel();
763
- }
764
- }
765
- }
766
- }
767
- }
768
- return $non_flat_attributes;
769
- }
770
-
771
- public function getMediaAttributes()
772
- {
773
- $media_types = array();
774
- $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->addFieldToFilter('frontend_input', 'media_image');
775
- foreach($attributes as $attribute) {
776
- $media_types[] = $attribute->getData('attribute_code');
777
- }
778
- return $media_types;
779
- }
780
-
781
- public function getStoreIdConfig()
782
- {
783
- $store_id = 0;
784
- if(strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) {
785
- $store_id = Mage::getModel('core/store')->load($code)->getId();
786
- }
787
- return $store_id;
788
- }
789
-
790
- public function getProductUrlSuffix($storeId)
791
- {
792
- $suffix = Mage::getStoreConfig('catalog/seo/product_url_suffix', $storeId);
793
- if(!empty($suffix)) {
794
- if(($suffix[0] != '.') && ($suffix != '/')) {
795
- $suffix = '.' . $suffix;
796
- }
797
- }
798
- return $suffix;
799
- }
800
-
801
- public function getUncachedConfigValue($path, $storeId = 0)
802
- {
803
- $collection = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path', $path);
804
- if($storeId == 0) {
805
- $collection = $collection->addFieldToFilter('scope_id', 0)->addFieldToFilter('scope', 'default');
806
- } else {
807
- $collection = $collection->addFieldToFilter('scope_id', $storeId)->addFieldToFilter('scope', 'stores');
808
- }
809
- return $collection->getFirstItem()->getValue();
810
- }
811
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the EULA
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * https://www.magmodules.eu/MM-LICENSE.txt
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Beslist
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license https://www.magmodules.eu/terms.html Single Service License
19
  */
20
+
21
+ class Magmodules_Sooqr_Helper_Data extends Magmodules_Sooqr_Helper_Write
22
+ {
23
+
24
+ /**
25
+ * @param $path
26
+ *
27
+ * @return array
28
+ */
29
+ public function getStoreIds($path)
30
+ {
31
+ $storeIds = array();
32
+ foreach (Mage::app()->getStores() as $store) {
33
+ $storeId = Mage::app()->getStore($store)->getId();
34
+ if ($this->getUncachedConfigValue($path, $storeId)) {
35
+ $storeIds[] = $storeId;
36
+ }
37
+ }
38
+
39
+ return $storeIds;
40
+ }
41
+
42
+ /**
43
+ * @param $path
44
+ * @param int $storeId
45
+ *
46
+ * @return mixed
47
+ */
48
+ public function getUncachedConfigValue($path, $storeId = 0)
49
+ {
50
+ $collection = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path', $path);
51
+ if ($storeId == 0) {
52
+ $collection = $collection->addFieldToFilter('scope_id', 0)->addFieldToFilter('scope', 'default');
53
+ } else {
54
+ $collection = $collection->addFieldToFilter('scope_id', $storeId)->addFieldToFilter('scope', 'stores');
55
+ }
56
+
57
+ return $collection->getFirstItem()->getValue();
58
+ }
59
+
60
+ public function getDisabledStoreIds($path)
61
+ {
62
+ $storeIds = array();
63
+ foreach (Mage::app()->getStores() as $store) {
64
+ $storeId = Mage::app()->getStore($store)->getId();
65
+ if (!$this->getUncachedConfigValue($path, $storeId)) {
66
+ $storeIds[] = $storeId;
67
+ }
68
+ }
69
+
70
+ return $storeIds;
71
+ }
72
+
73
+ /**
74
+ * @param $product
75
+ * @param $config
76
+ * @param $parent
77
+ * @param $parentAttributes
78
+ *
79
+ * @return array|bool
80
+ */
81
+ public function getProductDataRow($product, $config, $parent, $parentAttributes)
82
+ {
83
+ $fields = $config['field'];
84
+ $data = array();
85
+
86
+ if (!$this->validateParent($parent, $config, $product)) {
87
+ $parent = '';
88
+ }
89
+
90
+ if (!$this->validateProduct($product, $config, $parent)) {
91
+ return false;
92
+ }
93
+
94
+ foreach ($fields as $key => $field) {
95
+ $rows = $this->getAttributeValue($key, $product, $config, $field['action'], $parent, $parentAttributes);
96
+ if (is_array($rows)) {
97
+ $data = array_merge($data, $rows);
98
+ }
99
+ }
100
+
101
+ if (empty($config['skip_validation'])) {
102
+ if (!empty($data[$fields['price']['label']])) {
103
+ return $data;
104
+ }
105
+ } else {
106
+ return $data;
107
+ }
108
+
109
+ return false;
110
+ }
111
+
112
+ /**
113
+ * @param $parent
114
+ * @param $config
115
+ * @param $product
116
+ *
117
+ * @return bool
118
+ */
119
+ public function validateParent($parent, $config, $product)
120
+ {
121
+ return $this->validateProduct($product, $config, $parent);
122
+ }
123
+
124
+ /**
125
+ * @param $product
126
+ * @param $config
127
+ * @param $parent
128
+ *
129
+ * @return bool
130
+ */
131
+ public function validateProduct($product, $config, $parent)
132
+ {
133
+ if (empty($config['skip_validation'])) {
134
+ if ($product['visibility'] == 1) {
135
+ if (empty($parent)) {
136
+ return false;
137
+ }
138
+
139
+ if ($parent['status'] != 1) {
140
+ return false;
141
+ }
142
+ }
143
+
144
+ if (!empty($config['filter_exclude'])) {
145
+ if ($product[$config['filter_exclude']] == 1) {
146
+ return false;
147
+ }
148
+ }
149
+
150
+ if (!empty($config['hide_no_stock'])) {
151
+ if ($product->getUseConfigManageStock()) {
152
+ $manageStock = $config['stock_manage'];
153
+ } else {
154
+ $manageStock = $product->getManageStock();
155
+ }
156
+
157
+ if ($manageStock) {
158
+ if (!$product['is_in_stock']) {
159
+ return false;
160
+ }
161
+ }
162
+ }
163
+
164
+ if (!empty($config['conf_exclude_parent'])) {
165
+ if ($product->getTypeId() == 'configurable') {
166
+ return false;
167
+ }
168
+ }
169
+ }
170
+
171
+ return true;
172
+ }
173
+
174
+ /**
175
+ * @param $field
176
+ * @param $product
177
+ * @param $config
178
+ * @param string $actions
179
+ * @param $parent
180
+ *
181
+ * @return bool
182
+ */
183
+ public function getAttributeValue($field, $product, $config, $actions = '', $parent, $parentAttributes)
184
+ {
185
+
186
+ $data = $config['field'][$field];
187
+ $productData = $product;
188
+
189
+ if (!empty($parent)) {
190
+ if (!empty($data['parent'])) {
191
+ $productData = $parent;
192
+ }
193
+ }
194
+
195
+ if (!empty($data['static'])) {
196
+ $dataRow[$data['label']] = $data['static'];
197
+ return $dataRow;
198
+ }
199
+
200
+ switch ($field) {
201
+ case 'product_url':
202
+ $value = $this->getProductUrl($product, $config, $parent, $parentAttributes);
203
+ break;
204
+ case 'image_link':
205
+ $value = $this->getProductImage($productData, $config);
206
+ break;
207
+ case 'condition':
208
+ $value = $this->getProductCondition($productData, $config);
209
+ break;
210
+ case 'availability':
211
+ $value = $this->getProductAvailability($productData, $config);
212
+ break;
213
+ case 'weight':
214
+ $value = $this->getProductWeight($productData, $config);
215
+ break;
216
+ case 'price':
217
+ $value = $this->getProductPrice($productData, $config);
218
+ break;
219
+ case 'bundle':
220
+ $value = $this->getProductBundle($productData);
221
+ break;
222
+ case 'is_in_stock':
223
+ $value = $this->getIsInStock($productData, $config);
224
+ break;
225
+ case 'parent_id':
226
+ $value = $this->getProductData($parent, $data);
227
+ break;
228
+ case 'attribute_set_id':
229
+ $value = $this->getAttributeSetName($productData);
230
+ break;
231
+ case 'categories':
232
+ $value = $this->getProductCategories($productData, $config);
233
+ break;
234
+ default:
235
+ if (!empty($data['source'])) {
236
+ $value = $this->getProductData($productData, $data, $config);
237
+ } else {
238
+ $value = '';
239
+ }
240
+ break;
241
+ }
242
+
243
+ if ($config['field'][$field]['type'] == 'media_image') {
244
+ if ($field != 'image_link') {
245
+ if (!empty($value)) {
246
+ if ($value != 'no_selection') {
247
+ $value = $config['media_url'] . 'catalog/product' . $value;
248
+ } else {
249
+ $value = '';
250
+ }
251
+ }
252
+ }
253
+ }
254
+
255
+ if ((isset($actions)) && (!empty($value))) {
256
+ $value = $this->cleanData($value, $actions);
257
+ }
258
+
259
+ if ((is_array($value) && ($field == 'image_link'))) {
260
+ $i = 1;
261
+ foreach ($value as $key => $val) {
262
+ $dataRow[$key] = $val;
263
+ $i++;
264
+ }
265
+
266
+ return $dataRow;
267
+ }
268
+
269
+ if (!empty($value) || is_numeric($value)) {
270
+ $dataRow[$data['label']] = $value;
271
+
272
+ return $dataRow;
273
+ }
274
+
275
+ return false;
276
+ }
277
+
278
+ /**
279
+ * @param $product
280
+ * @param $config
281
+ * @param $parent
282
+ *
283
+ * @return string
284
+ */
285
+ public function getProductUrl($product, $config, $parent, $parentAttributes)
286
+ {
287
+ $url = '';
288
+ if (!empty($parent)) {
289
+ if ($parent->getRequestPath()) {
290
+ $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getRequestPath()));
291
+ }
292
+
293
+ if (empty($url)) {
294
+ if ($parent->getUrlKey()) {
295
+ $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getUrlKey()));
296
+ }
297
+ }
298
+ } else {
299
+ if ($product->getRequestPath()) {
300
+ $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getRequestPath()));
301
+ }
302
+
303
+ if (empty($url)) {
304
+ if ($product->getUrlKey()) {
305
+ $url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getUrlKey()));
306
+ }
307
+ }
308
+ }
309
+
310
+ if (!empty($config['product_url_suffix'])) {
311
+ if (strpos($url, $config['product_url_suffix']) === false) {
312
+ $url = $url . $config['product_url_suffix'];
313
+ }
314
+ }
315
+
316
+ if (!empty($parent) && !empty($url)) {
317
+ if (!empty($parentAttributes[$parent->getEntityId()])) {
318
+ $storeId = $config['store_id'];
319
+ $pId = $product->getId();
320
+ $productAttributeOptions = $parentAttributes[$parent->getEntityId()];
321
+ $urlExtra = '';
322
+ foreach ($productAttributeOptions as $productAttribute) {
323
+ $attCode = $productAttribute['attribute_code'];
324
+ $id = Mage::getResourceModel('catalog/product')->getAttributeRawValue($pId, $attCode, $storeId);
325
+ if ($id > 0) {
326
+ $urlExtra .= $productAttribute['attribute_id'] . '=' . $id . '&';
327
+ }
328
+ }
329
+
330
+ if (!empty($urlExtra)) {
331
+ $url = $url . '#' . rtrim($urlExtra, '&');
332
+ }
333
+ }
334
+ }
335
+
336
+ return $url;
337
+ }
338
+
339
+ /**
340
+ * @param $product
341
+ * @param $config
342
+ *
343
+ * @return array|string
344
+ */
345
+ public function getProductImage($product, $config)
346
+ {
347
+ $imageData = array();
348
+ if (!empty($config['image_resize']) && !empty($config['image_size'])) {
349
+ $imageFile = $product->getData($config['image_source']);
350
+ $imageModel = Mage::getModel('catalog/product_image')
351
+ ->setSize($config['image_size'])
352
+ ->setDestinationSubdir($config['image_source'])
353
+ ->setBaseFile($imageFile);
354
+ if (!$imageModel->isCached()) {
355
+ $imageModel->resize()->saveFile();
356
+ }
357
+
358
+ $productImage = $imageModel->getUrl();
359
+
360
+ return (string)$productImage;
361
+ } else {
362
+ $image = '';
363
+ if (!empty($config['media_attributes'])) {
364
+ foreach ($config['media_attributes'] as $mediaAtt) {
365
+ if ($mediaAtt == 'base') {
366
+ $mediaAtt = 'image';
367
+ }
368
+
369
+ $mediaData = $product->getData($mediaAtt);
370
+ if (!empty($mediaData)) {
371
+ if ($mediaData != 'no_selection') {
372
+ $image = $config['media_image_url'] . $mediaData;
373
+ $imageData['image'][$mediaAtt] = $image;
374
+ }
375
+ }
376
+ }
377
+ } else {
378
+ if ($product->getThumbnail()) {
379
+ if ($product->getThumbnail() != 'no_selection') {
380
+ $image = $config['media_image_url'] . $product->getThumbnail();
381
+ $imageData['image']['thumbnail'] = $image;
382
+ }
383
+ }
384
+
385
+ if ($product->getSmallImage()) {
386
+ if ($product->getSmallImage() != 'no_selection') {
387
+ $image = $config['media_image_url'] . $product->getSmallImage();
388
+ $imageData['image']['small_image'] = $image;
389
+ }
390
+ }
391
+
392
+ if ($product->getImage()) {
393
+ if ($product->getImage() != 'no_selection') {
394
+ $image = $config['media_image_url'] . $product->getImage();
395
+ $imageData['image']['image'] = $image;
396
+ }
397
+ }
398
+ }
399
+
400
+ if (!empty($config['images'])) {
401
+ $imageData['image_link'] = $image;
402
+ $container = new Varien_Object(
403
+ array(
404
+ 'attribute' => new Varien_Object(array('id' => $config['media_gallery_id']))
405
+ )
406
+ );
407
+ $imgProduct = new Varien_Object(array('id' => $product->getId(), 'store_id' => $config['store_id']));
408
+ $gallery = Mage::getResourceModel('catalog/product_attribute_backend_media')->loadGallery(
409
+ $imgProduct,
410
+ $container
411
+ );
412
+
413
+ $i = 1;
414
+ usort(
415
+ $gallery, function ($a, $b) {
416
+ return $a['position_default'] > $b['position_default'];
417
+ }
418
+ );
419
+ foreach ($gallery as $galleryImage) {
420
+ if ($galleryImage['disabled'] == 0) {
421
+ $imageData['image']['all']['image_' . $i] = $config['media_image_url'] . $galleryImage['file'];
422
+ $imageData['image']['last'] = $config['media_image_url'] . $galleryImage['file'];
423
+ if ($i == 1) {
424
+ $imageData['image']['first'] = $config['media_image_url'] . $galleryImage['file'];
425
+ }
426
+
427
+ $i++;
428
+ }
429
+ }
430
+
431
+ return $imageData;
432
+ } else {
433
+ if (!empty($imageData['image']['image'])) {
434
+ return $imageData['image']['image'];
435
+ } else {
436
+ return $image;
437
+ }
438
+ }
439
+ }
440
+ }
441
+
442
+ /**
443
+ * @param $product
444
+ * @param $config
445
+ *
446
+ * @return bool
447
+ */
448
+ public function getProductCondition($product, $config)
449
+ {
450
+ if (isset($config['condition_attribute'])) {
451
+ if ($condition = $product->getAttributeText($config['condition_attribute'])) {
452
+ return $condition;
453
+ } else {
454
+ return false;
455
+ }
456
+ }
457
+
458
+ if (!empty($config['condition_default'])) {
459
+ return $config['condition_default'];
460
+ }
461
+
462
+ return false;
463
+ }
464
+
465
+ /**
466
+ * @param $product
467
+ * @param $config
468
+ *
469
+ * @return bool
470
+ */
471
+ public function getProductAvailability($product, $config)
472
+ {
473
+ if (!empty($config['stock_instock'])) {
474
+ if ($product->getUseConfigManageStock()) {
475
+ $manageStock = $config['stock_manage'];
476
+ } else {
477
+ $manageStock = $product->getManageStock();
478
+ }
479
+
480
+ if ($manageStock) {
481
+ if ($product['is_in_stock']) {
482
+ $availability = $config['stock_instock'];
483
+ } else {
484
+ $availability = $config['stock_outofstock'];
485
+ }
486
+ } else {
487
+ $availability = $config['stock_instock'];
488
+ }
489
+
490
+ return $availability;
491
+ }
492
+
493
+ return false;
494
+ }
495
+
496
+ /**
497
+ * @param $product
498
+ * @param $config
499
+ *
500
+ * @return bool|string
501
+ */
502
+ public function getProductWeight($product, $config)
503
+ {
504
+ if (!empty($config['weight'])) {
505
+ $weight = number_format($product->getWeight(), 2, '.', '');
506
+ if (isset($config['weight_units'])) {
507
+ $weight = $weight . ' ' . $config['weight_units'];
508
+ }
509
+
510
+ return $weight;
511
+ }
512
+
513
+ return false;
514
+ }
515
+
516
+ /**
517
+ * @param $product
518
+ * @param $config
519
+ *
520
+ * @return array
521
+ */
522
+ public function getProductPrice($product, $config)
523
+ {
524
+ $priceData = array();
525
+ $priceMarkup = $this->getPriceMarkup($config);
526
+ $taxParam = $config['use_tax'];
527
+
528
+ if (!empty($config['hide_currency'])) {
529
+ $currency = '';
530
+ } else {
531
+ $currency = ' ' . $config['currency'];
532
+ }
533
+
534
+ if (!empty($config['price_scope'])) {
535
+ $price = Mage::getResourceModel('catalog/product')->getAttributeRawValue(
536
+ $product->getId(), 'price',
537
+ $config['store_id']
538
+ );
539
+ } else {
540
+ $price = $product->getPrice();
541
+ }
542
+
543
+ $price = Mage::helper('tax')->getPrice($product, $price, $taxParam);
544
+ $priceData['regular_price'] = number_format(($price * $priceMarkup), 2, '.', '') . $currency;
545
+ $pricerulePrice = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), $taxParam);
546
+
547
+ if (($pricerulePrice > 0) && ($pricerulePrice < $price)) {
548
+ $salesPrice = $pricerulePrice;
549
+ $specialPriceFromDate = $product->getSpecialFromDate();
550
+ $specialPriceToDate = $product->getSpecialToDate();
551
+ $today = time();
552
+ if ($today >= strtotime($specialPriceFromDate)) {
553
+ if ($today <= strtotime($specialPriceToDate) || empty($specialPriceToDate)) {
554
+ $priceData['sales_date_start'] = $specialPriceFromDate;
555
+ $priceData['sales_date_end'] = $specialPriceToDate;
556
+ }
557
+ }
558
+ }
559
+
560
+ if (($product->getTypeId() == 'bundle') && ($price < 0.01)) {
561
+ $price = $this->getPriceBundle($product, $config['store_id']);
562
+ }
563
+
564
+ if ($product->getTypeId() == 'grouped') {
565
+ if (!empty($config['price_grouped'])) {
566
+ $price = $this->getPriceGrouped($product, $config['price_grouped']);
567
+ } else {
568
+ if ($price < 0.01) {
569
+ $price = $this->getPriceGrouped($product);
570
+ }
571
+ }
572
+ }
573
+
574
+ if ($price == 0) {
575
+ $price = $product->getMinPrice();
576
+ }
577
+
578
+ $priceData['final_price_clean'] = $price;
579
+ $priceData['price'] = number_format(($price * $priceMarkup), 2, '.', '') . $currency;
580
+
581
+ if (isset($salesPrice)) {
582
+ $priceData['sales_price'] = number_format(($salesPrice * $priceMarkup), 2, '.', '') . $currency;
583
+ }
584
+
585
+ return $priceData;
586
+ }
587
+
588
+ /**
589
+ * @param $config
590
+ *
591
+ * @return int
592
+ */
593
+ public function getPriceMarkup($config)
594
+ {
595
+ $markup = 1;
596
+ if (!empty($config['price_add_tax']) && !empty($config['price_add_tax_perc'])) {
597
+ $markup = 1 + ($config['price_add_tax_perc'] / 100);
598
+ }
599
+
600
+ if ($config['base_currency_code'] != $config['currency']) {
601
+ $exchangeRate = Mage::helper('directory')->currencyConvert(
602
+ 1,
603
+ $config['base_currency_code'],
604
+ $config['currency']
605
+ );
606
+ $markup = ($markup * $exchangeRate);
607
+ }
608
+
609
+ return $markup;
610
+ }
611
+
612
+ /**
613
+ * @param $product
614
+ * @param $storeId
615
+ *
616
+ * @return int
617
+ */
618
+ public function getPriceBundle($product, $storeId)
619
+ {
620
+ if (($product->getPriceType() == '1') && ($product->getFinalPrice() > 0)) {
621
+ $price = $product->getFinalPrice();
622
+ } else {
623
+ $block = Mage::getSingleton('core/layout')->createBlock('bundle/catalog_product_view_type_bundle');
624
+ $options = $block->setProduct($product)->getOptions();
625
+ $price = 0;
626
+
627
+ foreach ($options as $option) {
628
+ $selection = $option->getDefaultSelection();
629
+ if ($selection === null) {
630
+ continue;
631
+ }
632
+
633
+ $selectionProductId = $selection->getProductId();
634
+ $_resource = Mage::getSingleton('catalog/product')->getResource();
635
+ $finalPrice = $_resource->getAttributeRawValue($selectionProductId, 'final_price', $storeId);
636
+ $selectionQty = $_resource->getAttributeRawValue($selectionProductId, 'selection_qty', $storeId);
637
+ $price += ($finalPrice * $selectionQty);
638
+ }
639
+ }
640
+
641
+ if ($price < 0.01) {
642
+ $price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
643
+ }
644
+
645
+ return $price;
646
+ }
647
+
648
+ /**
649
+ * @param $product
650
+ * @param string $pricemodel
651
+ *
652
+ * @return bool|mixed|number
653
+ */
654
+ public function getPriceGrouped($product, $pricemodel = '')
655
+ {
656
+ if (!$pricemodel) {
657
+ $pricemodel = 'min';
658
+ }
659
+
660
+ if ($pricemodel == 'min') {
661
+ return $product->getMinPrice();
662
+ }
663
+
664
+ if ($pricemodel == 'max') {
665
+ return $product->getMaxPrice();
666
+ }
667
+
668
+ if ($pricemodel == 'total') {
669
+ $prices = array();
670
+ $_associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
671
+ foreach ($_associatedProducts as $_item) {
672
+ $priceAssociated = Mage::helper('tax')->getPrice($_item, $_item->getFinalPrice(), true);
673
+ if ($priceAssociated > 0) {
674
+ $prices[] = $priceAssociated;
675
+ }
676
+ }
677
+
678
+ return array_sum($prices);
679
+ }
680
+
681
+ return false;
682
+ }
683
+
684
+ /**
685
+ * @param $product
686
+ *
687
+ * @return bool|string
688
+ */
689
+ public function getProductBundle($product)
690
+ {
691
+ if ($product->getTypeId() == 'bundle') {
692
+ return 'true';
693
+ }
694
+
695
+ return false;
696
+ }
697
+
698
+ /**
699
+ * @param $product
700
+ * @param $config
701
+ *
702
+ * @return string
703
+ */
704
+ public function getIsInStock($product, $config)
705
+ {
706
+ if ($product->getUseConfigManageStock()) {
707
+ $manageStock = $config['stock_manage'];
708
+ } else {
709
+ $manageStock = $product->getManageStock();
710
+ }
711
+
712
+ if ($manageStock) {
713
+ return $product->getIsInStock();
714
+ } else {
715
+ return "1";
716
+ }
717
+ }
718
+
719
+ /**
720
+ * @param $product
721
+ * @param $data
722
+ * @param string $config
723
+ *
724
+ * @return string
725
+ */
726
+ public function getProductData($product, $data, $config = '')
727
+ {
728
+ $type = $data['type'];
729
+ $source = $data['source'];
730
+ $value = '';
731
+ switch ($type) {
732
+ case 'price':
733
+ if (!empty($product[$source])) {
734
+ $value = number_format($product[$source], 2, '.', '');
735
+ if (!empty($config['currency'])) {
736
+ $value .= ' ' . $config['currency'];
737
+ }
738
+ }
739
+ break;
740
+ case 'select':
741
+ $value = $product->getAttributeText($source);
742
+ break;
743
+ case 'multiselect':
744
+ if (is_array($product->getAttributeText($source))) {
745
+ $value = implode(',', $product->getAttributeText($source));
746
+ } else {
747
+ $value = $product->getAttributeText($source);
748
+ }
749
+ break;
750
+ default:
751
+ if (isset($product[$source])) {
752
+ $value = $product[$source];
753
+ }
754
+ break;
755
+ }
756
+
757
+ return $value;
758
+ }
759
+
760
+ /**
761
+ * @param $product
762
+ *
763
+ * @return mixed
764
+ */
765
+ public function getAttributeSetName($product)
766
+ {
767
+ return Mage::getModel('eav/entity_attribute_set')->load($product->getAttributeSetId())->getAttributeSetName();
768
+ }
769
+
770
+ /**
771
+ * @param $product
772
+ * @param $config
773
+ *
774
+ * @return array
775
+ */
776
+ public function getProductCategories($product, $config)
777
+ {
778
+ if (isset($config['category_data'])) {
779
+ $categoryData = $config['category_data'];
780
+ $productsCat = array();
781
+ $categoryIds = $product->getCategoryIds();
782
+ if (!empty($config['category_full'])) {
783
+ $path = array();
784
+ foreach ($categoryIds as $categoryId) {
785
+ if (isset($categoryData[$categoryId])) {
786
+ $path[] = $categoryData[$categoryId]['name'];
787
+ }
788
+ }
789
+
790
+ $productsCat = array('path' => $path);
791
+ } else {
792
+ foreach ($categoryIds as $categoryId) {
793
+ if (isset($categoryData[$categoryId])) {
794
+ $productsCat[] = $categoryData[$categoryId];
795
+ }
796
+ }
797
+ }
798
+
799
+ return $this->getSortedArray($productsCat, 'level');
800
+ }
801
+ }
802
+
803
+ /**
804
+ * @param $data
805
+ * @param $sort
806
+ *
807
+ * @return array
808
+ */
809
+ function getSortedArray($data, $sort)
810
+ {
811
+ $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
812
+ usort($data, create_function('$a,$b', $code));
813
+
814
+ return array_reverse($data);
815
+ }
816
+
817
+ /**
818
+ * @param $st
819
+ * @param string $action
820
+ *
821
+ * @return mixed|string
822
+ */
823
+ public function cleanData($st, $action = '')
824
+ {
825
+ if ($action) {
826
+ $actions = explode('_', $action);
827
+ if (in_array('striptags', $actions)) {
828
+ $st = $this->stripTags($st);
829
+ $st = trim($st);
830
+ }
831
+
832
+ if (in_array('replacetags', $actions)) {
833
+ $st = str_replace(array("\r", "\n"), "", $st);
834
+ $st = str_replace(array("<br>", "<br/>", "<br />"), '\n', $st);
835
+ $st = $this->stripTags($st);
836
+ $st = rtrim($st);
837
+ }
838
+
839
+ if (in_array('replacetagsn', $actions)) {
840
+ $st = str_replace(array("\r", "\n"), "", $st);
841
+ $st = str_replace(array("<br>", "<br/>", "<br />"), '\\' . '\n', $st);
842
+ $st = $this->stripTags($st);
843
+ $st = rtrim($st);
844
+ }
845
+
846
+ if (in_array('rn', $actions)) {
847
+ $st = str_replace(array("\r", "\n"), "", $st);
848
+ }
849
+
850
+ if (in_array('truncate', $actions)) {
851
+ $st = Mage::helper('core/string')->truncate($st, '5000');
852
+ }
853
+
854
+ if (in_array('truncate150', $actions)) {
855
+ $st = Mage::helper('core/string')->truncate($st, '150');
856
+ }
857
+
858
+ if (in_array('uppercheck', $actions)) {
859
+ if (strtoupper($st) == $st) {
860
+ $st = ucfirst(strtolower($st));
861
+ }
862
+ }
863
+
864
+ if (in_array('cdata', $actions)) {
865
+ $st = '<![CDATA[' . $st . ']]>';
866
+ }
867
+
868
+ if (in_array('round', $actions)) {
869
+ if (!empty($actions[1])) {
870
+ if ($st > $actions[1]) {
871
+ $st = $actions[1];
872
+ }
873
+ }
874
+
875
+ $st = round($st);
876
+ }
877
+
878
+ if (in_array('boolean', $actions)) {
879
+ ($st > 0 ? $st = 1 : $st = 0);
880
+ }
881
+ }
882
+
883
+ return $st;
884
+ }
885
+
886
+ public function backorderCheck($config, $product)
887
+ {
888
+ if ($product->getUseConfigManageStock()) {
889
+ $manageStock = $config['stock_manage'];
890
+ } else {
891
+ $manageStock = $product->getManageStock();
892
+ }
893
+
894
+ if ($manageStock) {
895
+ if ($product->getUseConfigBackorders()) {
896
+ if ($config['backorders_default'] > 0) {
897
+ return 1;
898
+ }
899
+ } else {
900
+ if ($product->getBackorders() > 0) {
901
+ return 1;
902
+ }
903
+ }
904
+ }
905
+
906
+ return 0;
907
+ }
908
+
909
+ public function getConfigurableAttributesAsArray($parents, $config)
910
+ {
911
+ $configurableAttributes = array();
912
+ if (!empty($config['conf_switch_urls'])) {
913
+ foreach ($parents as $parent) {
914
+ if ($parent->getTypeId() == 'configurable') {
915
+ $configurableAttributes[$parent->getEntityId()] = $parent->getTypeInstance(true)
916
+ ->getConfigurableAttributesAsArray($parent);
917
+ }
918
+ }
919
+ }
920
+
921
+ return $configurableAttributes;
922
+ }
923
+
924
+ /**
925
+ * @param $config
926
+ *
927
+ * @return string
928
+ */
929
+ public function getTaxUsage($config)
930
+ {
931
+ if (!empty($config['force_tax'])) {
932
+ if ($config['force_tax'] == 'incl') {
933
+ return 'true';
934
+ } else {
935
+ return '';
936
+ }
937
+ } else {
938
+ return 'true';
939
+ }
940
+ }
941
+
942
+ /**
943
+ * @param $attributes
944
+ * @param string $config
945
+ *
946
+ * @return mixed
947
+ */
948
+ public function addAttributeData($attributes, $config = '')
949
+ {
950
+ foreach ($attributes as $key => $attribute) {
951
+ $type = (!empty($attribute['type']) ? $attribute['type'] : '');
952
+ $action = (!empty($attribute['action']) ? $attribute['action'] : '');
953
+ $parent = (!empty($attribute['parent']) ? $attribute['parent'] : '');
954
+ if (isset($attribute['source'])) {
955
+ $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode(
956
+ 'catalog_product',
957
+ $attribute['source']
958
+ );
959
+ $type = $attributeModel->getFrontendInput();
960
+ }
961
+
962
+ if (!empty($config['conf_fields'])) {
963
+ $confAttributes = explode(',', $config['conf_fields']);
964
+ if (in_array($key, $confAttributes)) {
965
+ $parent = '1';
966
+ }
967
+ }
968
+
969
+ $attributes[$key] = array(
970
+ 'label' => $attribute['label'],
971
+ 'source' => isset($attribute['source']) ? $attribute['source'] : '',
972
+ 'static' => isset($attribute['static']) ? $attribute['static'] : '',
973
+ 'type' => $type,
974
+ 'action' => $action,
975
+ 'parent' => $parent
976
+ );
977
+ }
978
+
979
+ return $attributes;
980
+ }
981
+
982
+ /**
983
+ * @param $config
984
+ * @param $storeId
985
+ *
986
+ * @return array
987
+ */
988
+ public function getCategoryData($config, $storeId)
989
+ {
990
+ $defaultAttributes = array('entity_id', 'path', 'name', 'level');
991
+
992
+ $attributes = $defaultAttributes;
993
+
994
+ if (!empty($config['category_custom'])) {
995
+ $attributes[] = $config['category_custom'];
996
+ }
997
+
998
+ if (!empty($config['category_replace'])) {
999
+ $attributes[] = $config['category_replace'];
1000
+ }
1001
+
1002
+ if (!empty($config['category_exclude'])) {
1003
+ $attributes[] = $config['category_exclude'];
1004
+ }
1005
+
1006
+ // CHECK IF NEW ATTRIBUTES ARE AVAILABLE
1007
+ try {
1008
+ Mage::getModel('catalog/category')
1009
+ ->setStoreId($storeId)
1010
+ ->getCollection()
1011
+ ->addAttributeToSelect($attributes)
1012
+ ->setCurPage(1)
1013
+ ->setPageSize(1)
1014
+ ->getFirstItem();
1015
+ } catch (Exception $e) {
1016
+ Mage::log($e->getMessage());
1017
+ }
1018
+
1019
+ if (empty($e)) {
1020
+ $categories = Mage::getModel('catalog/category')
1021
+ ->setStoreId($storeId)
1022
+ ->getCollection()
1023
+ ->addAttributeToSelect($attributes)
1024
+ ->addFieldToFilter('is_active', array('eq' => 1));
1025
+ } else {
1026
+ $categories = Mage::getModel('catalog/category')
1027
+ ->setStoreId($storeId)
1028
+ ->getCollection()
1029
+ ->addAttributeToSelect($defaultAttributes)
1030
+ ->addFieldToFilter('is_active', array('eq' => 1));
1031
+ }
1032
+
1033
+ $_categories = array();
1034
+
1035
+ foreach ($categories as $cat) {
1036
+ $custom = '';
1037
+ $name = '';
1038
+ $exclude = 0;
1039
+ if (!empty($config['category_replace'])) {
1040
+ if (!empty($cat[$config['category_replace']])) {
1041
+ $name = $cat[$config['category_replace']];
1042
+ }
1043
+ }
1044
+
1045
+ if (isset($config['category_custom'])) {
1046
+ if (!empty($cat[$config['category_custom']])) {
1047
+ $custom = $cat[$config['category_custom']];
1048
+ }
1049
+ }
1050
+
1051
+ if (isset($config['category_exclude'])) {
1052
+ if (!empty($cat[$config['category_exclude']])) {
1053
+ $exclude = $cat[$config['category_exclude']];
1054
+ }
1055
+ }
1056
+
1057
+ if (empty($name)) {
1058
+ $name = $cat['name'];
1059
+ }
1060
+
1061
+ if ($exclude != 1) {
1062
+ $_categories[$cat->getId()] = array(
1063
+ 'path' => $cat['path'],
1064
+ 'custom' => $custom,
1065
+ 'name' => $name,
1066
+ 'level' => $cat['level'],
1067
+ 'exclude' => $exclude
1068
+ );
1069
+ }
1070
+ }
1071
+
1072
+ foreach ($_categories as $key => $cat) {
1073
+ $path = array();
1074
+ $customPath = array();
1075
+ $paths = explode('/', $cat['path']);
1076
+ foreach ($paths as $p) {
1077
+ if (!empty($_categories[$p]['name'])) {
1078
+ if ($_categories[$p]['level'] > 1) {
1079
+ $path[] = $_categories[$p]['name'];
1080
+ if (!empty($_categories[$p]['custom'])) {
1081
+ $customPath[] = $_categories[$p]['custom'];
1082
+ }
1083
+ }
1084
+ }
1085
+ }
1086
+
1087
+ $_categories[$key] = array(
1088
+ 'path' => $this->cleanData($path, 'stiptags'),
1089
+ 'custom_path' => $this->cleanData($customPath, 'stiptags'),
1090
+ 'custom' => $this->cleanData(end($customPath), 'striptags'),
1091
+ 'name' => $this->cleanData($cat['name'], 'striptags'),
1092
+ 'level' => $cat['level']
1093
+ );
1094
+ }
1095
+
1096
+ return $_categories;
1097
+ }
1098
+
1099
+ /**
1100
+ * @param $product
1101
+ * @param $config
1102
+ *
1103
+ * @return bool
1104
+ */
1105
+ public function getParentData($product, $config)
1106
+ {
1107
+ if (!empty($config['conf_enabled'])) {
1108
+ if (($product['type_id'] == 'simple')) {
1109
+ $configIds = Mage::getModel('catalog/product_type_configurable')
1110
+ ->getParentIdsByChild($product->getId());
1111
+ $groupIds = Mage::getResourceSingleton('catalog/product_link')->getParentIdsByChild(
1112
+ $product->getId(),
1113
+ Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED
1114
+ );
1115
+ if ($configIds) {
1116
+ return $configIds[0];
1117
+ }
1118
+
1119
+ if ($groupIds) {
1120
+ return $groupIds[0];
1121
+ }
1122
+ }
1123
+ }
1124
+
1125
+ return false;
1126
+ }
1127
+
1128
+ /**
1129
+ * @param $config
1130
+ * @param $products
1131
+ *
1132
+ * @return array
1133
+ */
1134
+ public function getTypePrices($config, $products)
1135
+ {
1136
+ $typePrices = array();
1137
+ $confEnabled = $config['conf_enabled'];
1138
+ $simplePrice = $config['simple_price'];
1139
+
1140
+ if (!empty($confEnabled) && empty($simplePrice)) {
1141
+ foreach ($products as $product) {
1142
+ if ($product->getTypeId() == 'configurable') {
1143
+ $parentId = $product->getEntityId();
1144
+ $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
1145
+ $basePrice = $product->getFinalPrice();
1146
+ $basePriceReg = $product->getPrice();
1147
+ $optionPrices = array();
1148
+
1149
+ foreach ($attributes as $attribute) {
1150
+ $prices = $attribute->getPrices();
1151
+ foreach ($prices as $value) {
1152
+ $product->setConfigurablePrice(
1153
+ $this->preparePrice(
1154
+ $value['pricing_value'],
1155
+ $value['is_percent'], $product
1156
+ )
1157
+ );
1158
+ $product->setParentId(true);
1159
+ Mage::dispatchEvent(
1160
+ 'catalog_product_type_configurable_price', array('product' => $product)
1161
+ );
1162
+ $configurablePrice = $product->getConfigurablePrice();
1163
+ $optionPrices[$value['value_index']] = $configurablePrice;
1164
+ $optionPrices[$value['value_index'] . '_reg'] =
1165
+ $this->prepareOldPrice($value['pricing_value'], $value['is_percent'], $product);
1166
+ }
1167
+ }
1168
+
1169
+ $simple = $product->getTypeInstance()->getUsedProducts();
1170
+ foreach ($simple as $sProduct) {
1171
+ $totalPrice = $basePrice;
1172
+ $totalPriceReg = $basePriceReg;
1173
+ foreach ($attributes as $attribute) {
1174
+ $value = $sProduct->getData($attribute->getProductAttribute()->getAttributeCode());
1175
+ if (isset($optionPrices[$value])) {
1176
+ $totalPrice += $optionPrices[$value];
1177
+ $totalPriceReg += $optionPrices[$value . '_reg'];
1178
+ }
1179
+ }
1180
+
1181
+ $typePrices[$parentId . '_' . $sProduct->getEntityId()] =
1182
+ number_format(($totalPrice * $config['markup']), 2, '.', '');
1183
+
1184
+ $typePrices[$parentId . '_' . $sProduct->getEntityId() . '_reg'] =
1185
+ number_format(($totalPriceReg * $config['markup']), 2, '.', '');
1186
+ }
1187
+ }
1188
+ }
1189
+ }
1190
+
1191
+ return $typePrices;
1192
+ }
1193
+
1194
+ /**
1195
+ * @param $price
1196
+ * @param bool $isPercent
1197
+ * @param $product
1198
+ *
1199
+ * @return float|int
1200
+ */
1201
+ public function preparePrice($price, $isPercent = false, $product)
1202
  {
1203
  if ($isPercent && !empty($price)) {
1204
  $price = $product->getFinalPrice() * $price / 100;
1206
 
1207
  return $price;
1208
  }
1209
+
1210
+ /**
1211
+ * @param $price
1212
+ * @param bool $isPercent
1213
+ * @param $product
1214
+ *
1215
+ * @return float|int
1216
+ */
1217
+ public function prepareOldPrice($price, $isPercent = false, $product)
1218
  {
1219
  if ($isPercent && !empty($price)) {
1220
  $price = $product->getPrice() * $price / 100;
1222
 
1223
  return $price;
1224
  }
1225
+
1226
+ /**
1227
+ * @param $dir
1228
+ *
1229
+ * @return bool
1230
+ */
1231
+ public function checkOldVersion($dir)
1232
+ {
1233
+ if ($dir) {
1234
+ $dir = Mage::getBaseDir('app') . DS . 'code' . DS . 'local' . DS . 'Magmodules' . DS . $dir;
1235
+
1236
+ return file_exists($dir);
1237
+ }
1238
+
1239
+ return false;
1240
+ }
1241
+
1242
+ /**
1243
+ * @param $attributes
1244
+ *
1245
+ * @return array
1246
+ */
1247
+ public function checkFlatCatalog($attributes)
1248
+ {
1249
+ $nonFlatAttributes = array();
1250
+ foreach ($attributes as $key => $attribute) {
1251
+ if (!empty($attribute['source'])) {
1252
+ if (($attribute['source'] != 'entity_id') && ($attribute['source'] != 'sku')) {
1253
+ $_attribute = Mage::getModel('eav/entity_attribute')->loadByCode(
1254
+ 'catalog_product',
1255
+ $attribute['source']
1256
+ );
1257
+ if ($_attribute->getUsedInProductListing() == 0) {
1258
+ if ($_attribute->getId()) {
1259
+ $nonFlatAttributes[$_attribute->getId()] = $_attribute->getFrontendLabel();
1260
+ }
1261
+ }
1262
+ }
1263
+ }
1264
+ }
1265
+
1266
+ return $nonFlatAttributes;
1267
+ }
1268
+
1269
+ /**
1270
+ * @return array
1271
+ */
1272
+ public function getMediaAttributes()
1273
+ {
1274
+ $mediaTypes = array();
1275
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
1276
+ ->addFieldToFilter('frontend_input', 'media_image');
1277
+ foreach ($attributes as $attribute) {
1278
+ $mediaTypes[] = $attribute->getData('attribute_code');
1279
+ }
1280
+
1281
+ return $mediaTypes;
1282
+ }
1283
+
1284
+ /**
1285
+ * @return int
1286
+ */
1287
+ public function getStoreIdConfig()
1288
+ {
1289
+ $storeId = 0;
1290
+ $code = Mage::getSingleton('adminhtml/config_data')->getStore();
1291
+ if (!empty($code)) {
1292
+ $storeId = Mage::getModel('core/store')->load($code)->getId();
1293
+ }
1294
+
1295
+ return $storeId;
1296
+ }
1297
+
1298
+ /**
1299
+ * @param $storeId
1300
+ *
1301
+ * @return string
1302
+ */
1303
+ public function getProductUrlSuffix($storeId)
1304
+ {
1305
+ $suffix = Mage::getStoreConfig('catalog/seo/product_url_suffix', $storeId);
1306
+ if (!empty($suffix)) {
1307
+ if (($suffix[0] != '.') && ($suffix != '/')) {
1308
+ $suffix = '.' . $suffix;
1309
+ }
1310
+ }
1311
+
1312
+ return $suffix;
1313
+ }
1314
+
1315
+ }
app/code/community/Magmodules/Sooqr/Helper/Write.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Magmodules_Sooqr_Helper_Write extends Mage_Core_Helper_Abstract
22
+ {
23
+
24
+ /**
25
+ * @param $config
26
+ *
27
+ * @return Varien_Io_File
28
+ */
29
+ public function createFeed($config)
30
+ {
31
+ $header = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL;
32
+ $header .= '<rss xmlns:sqr="http://base.sooqr.com/ns/1.0" version="2.0" encoding="utf-8">' . PHP_EOL;
33
+ $header .= ' <products>' . PHP_EOL;
34
+
35
+ $io = new Varien_Io_File();
36
+ $io->setAllowCreateFolders(true);
37
+ $io->open(array('path' => Mage::getBaseDir('tmp')));
38
+ $io->streamOpen($config['file_name']);
39
+ $io->streamWrite($header);
40
+
41
+ return $io;
42
+ }
43
+
44
+ /**
45
+ * @param $row
46
+ * @param Varien_Io_File $io
47
+ * @param string $item
48
+ */
49
+ public function writeRow($row, Varien_Io_File $io, $item = 'product')
50
+ {
51
+ $io->streamWrite($this->getXmlFromArray($row, $item));
52
+ }
53
+
54
+ /**
55
+ * @param $data
56
+ * @param $type
57
+ *
58
+ * @return string
59
+ */
60
+ public function getXmlFromArray($data, $type)
61
+ {
62
+ $outputEmpty = array();
63
+ $xml = ' <' . $type . '>' . PHP_EOL;
64
+ foreach ($data as $key => $value) {
65
+ if (is_array($value)) {
66
+ $xml .= ' <sqr:' . $key . '>' . PHP_EOL;
67
+ foreach ($value as $ks => $vs) {
68
+ if (!empty($vs)) {
69
+ $xml .= ' <node>' . $this->cleanValue($vs) . '</node>' . PHP_EOL;
70
+ }
71
+ }
72
+
73
+ $xml .= ' </sqr:' . $key . '>' . PHP_EOL;
74
+ } else {
75
+ if (!empty($value) || in_array($key, $outputEmpty)) {
76
+ $xml .= ' <sqr:' . $key . '>' . $this->cleanValue($value) . '</sqr:' . $key . '>' . PHP_EOL;
77
+ }
78
+ }
79
+ }
80
+
81
+ $xml .= ' </' . $type . '>' . PHP_EOL;
82
+
83
+ return $xml;
84
+ }
85
+
86
+ /**
87
+ * @param $value
88
+ *
89
+ * @return string
90
+ */
91
+ public function cleanValue($value)
92
+ {
93
+ return htmlspecialchars($value, ENT_XML1);
94
+ }
95
+
96
+ /**
97
+ * @param $io
98
+ * @param $config
99
+ */
100
+ public function closeFeed(Varien_Io_File $io, $config)
101
+ {
102
+ $footer = ' </products>' . PHP_EOL;
103
+ $footer .= '</rss>';
104
+ $io->streamWrite($footer);
105
+ $io->streamClose();
106
+
107
+ $tmp = Mage::getBaseDir('tmp') . DS . $config['file_name'];
108
+ $new = $config['file_path'] . DS . $config['file_name'];
109
+
110
+ if (!file_exists($config['file_path'])) {
111
+ mkdir($config['file_path']);
112
+ }
113
+
114
+ rename($tmp, $new);
115
+ }
116
+
117
+ }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Backend/Design/Extra.php CHANGED
@@ -1,51 +1,70 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Backend_Design_Extra extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array {
 
 
19
 
20
- protected function _beforeSave()
21
- {
 
 
 
22
  $value = $this->getValue();
23
- if(is_array($value)) {
24
  unset($value['__empty']);
25
- if(count($value)) {
26
- $value = $this->orderData($value, 'attribute');
27
- $keys = array();
28
- for($i=0; $i < count($value); $i++){
29
- $keys[] = 'fields_' . uniqid();
30
- }
31
-
32
- foreach($value as $key => $field){
33
- $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $field['attribute']);
34
- $value[$key]['attribute'] = $field['attribute'];
35
- $value[$key]['type'] = $attribute->getFrontendInput();
36
- }
37
- $value = array_combine($keys, array_values($value));
 
 
 
 
38
  }
39
  }
 
40
  $this->setValue($value);
41
  parent::_beforeSave();
42
  }
43
 
44
- function orderData($data, $sort)
45
- {
46
- $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
47
- usort($data, create_function('$a,$b', $code));
48
- return $data;
49
- }
50
-
 
 
 
 
 
 
51
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Backend_Design_Extra
22
+ extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array
23
+ {
24
 
25
+ /**
26
+ *
27
+ */
28
+ public function _beforeSave()
29
+ {
30
  $value = $this->getValue();
31
+ if (is_array($value)) {
32
  unset($value['__empty']);
33
+ if (count($value)) {
34
+ $value = $this->orderData($value, 'attribute');
35
+ $keys = array();
36
+ for ($i = 0; $i < count($value); $i++) {
37
+ $keys[] = 'fields_' . uniqid();
38
+ }
39
+
40
+ foreach ($value as $key => $field) {
41
+ $attribute = Mage::getModel('eav/entity_attribute')->loadByCode(
42
+ 'catalog_product',
43
+ $field['attribute']
44
+ );
45
+ $value[$key]['attribute'] = $field['attribute'];
46
+ $value[$key]['type'] = $attribute->getFrontendInput();
47
+ }
48
+
49
+ $value = array_combine($keys, array_values($value));
50
  }
51
  }
52
+
53
  $this->setValue($value);
54
  parent::_beforeSave();
55
  }
56
 
57
+ /**
58
+ * @param $data
59
+ * @param $sort
60
+ *
61
+ * @return mixed
62
+ */
63
+ public function orderData($data, $sort)
64
+ {
65
+ $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
66
+ usort($data, create_function('$a,$b', $code));
67
+ return $data;
68
+ }
69
+
70
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Backend/Design/Filter.php CHANGED
@@ -1,56 +1,76 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Backend_Design_Filter extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array {
 
 
19
 
20
- protected function _beforeSave()
21
- {
 
 
 
22
  $value = $this->getValue();
23
- if(is_array($value)) {
24
  unset($value['__empty']);
25
- if(count($value)) {
26
- $value = $this->orderData($value, 'attribute');
27
- foreach($value as $key => $field){
28
- if(!empty($field['attribute']) && !empty($field['condition']) && !empty($field['value'])) {
29
- $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $field['attribute']);
30
- $value[$key]['attribute'] = $field['attribute'];
31
- $value[$key]['condition'] = $field['condition'];
32
- $value[$key]['value'] = $field['value'];
33
- $value[$key]['type'] = $attribute->getFrontendInput();
34
- } else {
35
- unset($value[$key]);
36
- }
37
- }
38
- $keys = array();
39
- for($i=0; $i < count($value); $i++){
40
- $keys[] = 'filter_' . uniqid();
41
- }
42
- $value = array_combine($keys, array_values($value));
 
 
 
 
 
43
  }
44
  }
 
45
  $this->setValue($value);
46
  parent::_beforeSave();
47
  }
48
 
49
- function orderData($data, $sort)
50
- {
51
- $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
52
- usort($data, create_function('$a,$b', $code));
53
- return $data;
54
- }
55
-
 
 
 
 
 
 
56
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Backend_Design_Filter
22
+ extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array
23
+ {
24
 
25
+ /**
26
+ *
27
+ */
28
+ public function _beforeSave()
29
+ {
30
  $value = $this->getValue();
31
+ if (is_array($value)) {
32
  unset($value['__empty']);
33
+ if (count($value)) {
34
+ $value = $this->orderData($value, 'attribute');
35
+ foreach ($value as $key => $field) {
36
+ if (!empty($field['attribute']) && !empty($field['condition']) && !empty($field['value'])) {
37
+ $attribute = Mage::getModel('eav/entity_attribute')->loadByCode(
38
+ 'catalog_product',
39
+ $field['attribute']
40
+ );
41
+ $value[$key]['attribute'] = $field['attribute'];
42
+ $value[$key]['condition'] = $field['condition'];
43
+ $value[$key]['value'] = $field['value'];
44
+ $value[$key]['type'] = $attribute->getFrontendInput();
45
+ } else {
46
+ unset($value[$key]);
47
+ }
48
+ }
49
+
50
+ $keys = array();
51
+ for ($i = 0; $i < count($value); $i++) {
52
+ $keys[] = 'filter_' . uniqid();
53
+ }
54
+
55
+ $value = array_combine($keys, array_values($value));
56
  }
57
  }
58
+
59
  $this->setValue($value);
60
  parent::_beforeSave();
61
  }
62
 
63
+ /**
64
+ * @param $data
65
+ * @param $sort
66
+ *
67
+ * @return mixed
68
+ */
69
+ function orderData($data, $sort)
70
+ {
71
+ $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
72
+ usort($data, create_function('$a,$b', $code));
73
+ return $data;
74
+ }
75
+
76
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Backend/Sooqr/Cron.php CHANGED
@@ -1,76 +1,84 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Backend_Sooqr_Cron extends Mage_Core_Model_Config_Data {
 
19
 
20
  const CRON_MODEL_PATH = 'sooqr_connect/generate/cron_schedule';
21
  const CRON_STRING_PATH = 'crontab/jobs/sooqr_generate/schedule/cron_expr';
22
  const CRON_RUNMODEL_PATH = 'crontab/jobs/sooqr_generate/run/model';
23
 
24
- protected function _afterSave()
 
 
 
25
  {
26
  $time = $this->getData('groups/generate/fields/time/value');
27
  $frequency = $this->getData('groups/generate/fields/frequency/value');
28
- $count = count(Mage::helper('sooqr')->getStoreIds('sooqr_connect/generate/enabled'));
29
  $cronExprString = '';
30
-
31
- if($count > 0) {
32
- switch($frequency) {
33
- case 'custom_expr':
34
- $cronExprString = $this->getData('groups/generate/fields/custom_cron/value');
35
- break;
36
- case 0:
37
- $hours = array();
38
- for($i = 0; $i < $count; $i++) {
39
- $hours[] = $i;
40
- }
41
- $cronExprArray = array('40', implode(',', $hours), '*', '*', '*');
42
- break;
43
- case 6:
44
- $cronExprArray = array('40', '*/6', '*', '*', '*');
45
- break;
46
- case 4:
47
- $cronExprArray = array('40', '*/4', '*', '*', '*');
48
- break;
49
- case 2:
50
- $cronExprArray = array('40', '*/2', '*', '*', '*');
51
- break;
52
- case 1:
53
- $cronExprArray = array('40', '*', '*', '*', '*');
54
- break;
55
- case 30:
56
- $cronExprArray = array('10,40', '*', '*', '*', '*');
57
- break;
58
- case 15:
59
- $cronExprArray = array('0,15,30,45', '*', '*', '*', '*');
60
- break;
61
- }
62
- }
63
-
64
- if(!empty($cronExprArray)) {
65
- $cronExprString = join(' ', $cronExprArray);
66
- }
67
-
 
68
  try {
69
  Mage::getModel('core/config_data')
70
- ->load(self::CRON_MODEL_PATH, 'path')
71
- ->setValue($cronExprString)
72
- ->setPath(self::CRON_MODEL_PATH)
73
- ->save();
74
  Mage::getModel('core/config_data')
75
  ->load(self::CRON_STRING_PATH, 'path')
76
  ->setValue($cronExprString)
@@ -78,9 +86,9 @@ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Backend_Sooqr_Cron extends
78
  ->save();
79
  Mage::getModel('core/config_data')
80
  ->load(self::CRON_RUNMODEL_PATH, 'path')
81
- ->setValue((string) Mage::getConfig()->getNode(self::CRON_RUNMODEL_PATH))
82
  ->setPath(self::CRON_RUNMODEL_PATH)
83
- ->save();
84
  } catch (Exception $e) {
85
  throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));
86
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
+
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Backend_Sooqr_Cron extends Mage_Core_Model_Config_Data
22
+ {
23
 
24
  const CRON_MODEL_PATH = 'sooqr_connect/generate/cron_schedule';
25
  const CRON_STRING_PATH = 'crontab/jobs/sooqr_generate/schedule/cron_expr';
26
  const CRON_RUNMODEL_PATH = 'crontab/jobs/sooqr_generate/run/model';
27
 
28
+ /**
29
+ * @throws Exception
30
+ */
31
+ public function _afterSave()
32
  {
33
  $time = $this->getData('groups/generate/fields/time/value');
34
  $frequency = $this->getData('groups/generate/fields/frequency/value');
35
+ $count = count(Mage::helper('sooqr')->getStoreIds('sooqr_connect/generate/enabled'));
36
  $cronExprString = '';
37
+
38
+ if ($count > 0) {
39
+ switch ($frequency) {
40
+ case 'custom_expr':
41
+ $cronExprString = $this->getData('groups/generate/fields/custom_cron/value');
42
+ break;
43
+ case 0:
44
+ $hours = array();
45
+ for ($i = 0; $i < $count; $i++) {
46
+ $hours[] = $i;
47
+ }
48
+
49
+ $cronExprArray = array('40', implode(',', $hours), '*', '*', '*');
50
+ break;
51
+ case 6:
52
+ $cronExprArray = array('40', '*/6', '*', '*', '*');
53
+ break;
54
+ case 4:
55
+ $cronExprArray = array('40', '*/4', '*', '*', '*');
56
+ break;
57
+ case 2:
58
+ $cronExprArray = array('40', '*/2', '*', '*', '*');
59
+ break;
60
+ case 1:
61
+ $cronExprArray = array('40', '*', '*', '*', '*');
62
+ break;
63
+ case 30:
64
+ $cronExprArray = array('10,40', '*', '*', '*', '*');
65
+ break;
66
+ case 15:
67
+ $cronExprArray = array('0,15,30,45', '*', '*', '*', '*');
68
+ break;
69
+ }
70
+ }
71
+
72
+ if (!empty($cronExprArray)) {
73
+ $cronExprString = join(' ', $cronExprArray);
74
+ }
75
+
76
  try {
77
  Mage::getModel('core/config_data')
78
+ ->load(self::CRON_MODEL_PATH, 'path')
79
+ ->setValue($cronExprString)
80
+ ->setPath(self::CRON_MODEL_PATH)
81
+ ->save();
82
  Mage::getModel('core/config_data')
83
  ->load(self::CRON_STRING_PATH, 'path')
84
  ->setValue($cronExprString)
86
  ->save();
87
  Mage::getModel('core/config_data')
88
  ->load(self::CRON_RUNMODEL_PATH, 'path')
89
+ ->setValue((string)Mage::getConfig()->getNode(self::CRON_RUNMODEL_PATH))
90
  ->setPath(self::CRON_RUNMODEL_PATH)
91
+ ->save();
92
  } catch (Exception $e) {
93
  throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));
94
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Action.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
16
- */
17
-
18
- class Magmodules_Sooqr_Model_Source_Action {
19
-
20
- public function toOptionArray()
21
- {
22
- $position = array();
23
- $position[] = array('value'=> '', 'label'=> Mage::helper('sooqr')->__('-- None'));
24
- $position[] = array('value'=> 'strip_tags', 'label'=> Mage::helper('sooqr')->__('Strip Tags'));
25
- return $position;
26
- }
27
-
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Attribute.php CHANGED
@@ -1,43 +1,55 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Attribute {
19
 
20
- public function toOptionArray()
21
- {
22
- $optionArray = array();
23
- $optionArray[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- none'));
24
- $optionArray[] = array('label' => Mage::helper('sooqr')->__('- Product ID'), 'value' => 'entity_id');
25
- $optionArray[] = array('label' => Mage::helper('sooqr')->__('- Final Price'), 'value' => 'final_price');
26
- $optionArray[] = array('label' => Mage::helper('sooqr')->__('- Product Type'), 'value' => 'type_id');
27
- $backend_types = array('text', 'select', 'textarea', 'date', 'int', 'boolean', 'static', 'varchar', 'decimal');
28
- $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->setOrder('frontend_label','ASC')->addFieldToFilter('backend_type', $backend_types);
29
- foreach($attributes as $attribute) {
30
- if($attribute->getData('frontend_label')) {
31
- $label = str_replace("'", "", $attribute->getData('frontend_label'));
32
- } else {
33
- $label = str_replace("'", "", $attribute->getData('attribute_code'));
34
- }
35
- $optionArray[] = array(
36
- 'value' => $attribute->getData('attribute_code'),
37
- 'label' => $label,
38
- );
 
 
 
 
 
 
 
 
 
 
39
  }
 
40
  return $optionArray;
41
- }
42
-
43
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Attribute
22
+ {
23
+
24
+ /**
25
+ * @return array
26
+ */
27
+ public function toOptionArray()
28
+ {
29
+ $optionArray = array();
30
+ $optionArray[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- none'));
31
+ $optionArray[] = array('label' => Mage::helper('sooqr')->__('- Product ID'), 'value' => 'entity_id');
32
+ $optionArray[] = array('label' => Mage::helper('sooqr')->__('- Final Price'), 'value' => 'final_price');
33
+ $optionArray[] = array('label' => Mage::helper('sooqr')->__('- Product Type'), 'value' => 'type_id');
34
+ $backendTypes = array('text', 'select', 'textarea', 'date', 'int', 'boolean', 'static', 'varchar', 'decimal');
35
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->setOrder(
36
+ 'frontend_label',
37
+ 'ASC'
38
+ )->addFieldToFilter('backend_type', $backendTypes);
39
+ foreach ($attributes as $attribute) {
40
+ if ($attribute->getData('frontend_label')) {
41
+ $label = str_replace("'", "", $attribute->getData('frontend_label'));
42
+ } else {
43
+ $label = str_replace("'", "", $attribute->getData('attribute_code'));
44
+ }
45
+
46
+ $optionArray[] = array(
47
+ 'value' => $attribute->getData('attribute_code'),
48
+ 'label' => $label,
49
+ );
50
  }
51
+
52
  return $optionArray;
53
+ }
54
+
55
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Cacheresize.php CHANGED
@@ -1,45 +1,51 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Cacheresize {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $store_id = Mage::helper('sooqr')->getStoreIdConfig();
23
- $source = Mage::getStoreConfig('sooqr_connect/products/image_source', $store_id);
24
- $options = array();
25
- if($source) {
26
- $dir = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . DS . 'cache' . DS . $store_id . DS . $source . DS;
27
- if(file_exists($dir)) {
28
- $dirs = array_filter(glob($dir . '*'), 'is_dir');
29
- if(count($dirs)) {
30
- foreach($dirs as $img_option) {
31
- $img_option = str_replace($dir, '', $img_option);
32
- if(strlen($img_option) < 8) {
33
- $options[] = array('value'=> $img_option, 'label'=> $img_option);
34
- }
35
- }
36
- }
37
- }
38
- }
39
- if(empty($options)) {
40
- $options[] = array('value'=> '', 'label'=> Mage::helper('adminhtml')->__('No cached sizes found'));
41
- }
42
- return $options;
43
- }
44
-
45
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Cacheresize
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $storeId = Mage::helper('sooqr')->getStoreIdConfig();
27
+ $source = Mage::getStoreConfig('sooqr_connect/products/image_source', $storeId);
28
+ $options = array();
29
+ if ($source) {
30
+ $dir = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . DS . 'cache' . DS . $storeId . DS . $source . DS;
31
+ if (file_exists($dir)) {
32
+ $dirs = array_filter(glob($dir . '*'), 'is_dir');
33
+ if (count($dirs)) {
34
+ foreach ($dirs as $imgOption) {
35
+ $imgOption = str_replace($dir, '', $imgOption);
36
+ if (strlen($imgOption) < 8) {
37
+ $options[] = array('value' => $imgOption, 'label' => $imgOption);
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ if (empty($options)) {
45
+ $options[] = array('value' => '', 'label' => Mage::helper('adminhtml')->__('No cached sizes found'));
46
+ }
47
+
48
+ return $options;
49
+ }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Category.php CHANGED
@@ -1,62 +1,72 @@
1
- <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Category {
19
 
20
- public function toOptionArray($addEmpty = true)
21
- {
22
  $options = array();
23
  $collection = Mage::getResourceModel('catalog/category_collection');
24
  $collection->addAttributeToSelect('name')->addPathFilter('^1/[0-9/]+')->load();
25
  $cats = array();
26
  foreach ($collection as $category) {
27
- $cat = new stdClass();
28
- $cat->label = $category->getName();
29
- $cat->value = $category->getId();
30
- $cat->level = $category->getLevel();
31
- $cat->parentid = $category->getParentId();
32
  $cats[$cat->value] = $cat;
33
  }
34
 
35
- foreach($cats as $id => $cat){
36
- if(isset($cats[$cat->parentid])){
37
- if(!isset($cats[$cat->parentid]->child)) {
38
- $cats[$cat->parentid]->child = array();
39
- }
40
- $cats[$cat->parentid]->child[] =& $cats[$id];
41
- }
 
42
  }
43
- foreach($cats as $id => $cat) {
44
- if(!isset($cats[$cat->parentid])){
45
- $stack = array($cats[$id]);
46
- while(count($stack)>0 ){
47
- $opt = array_pop($stack);
48
- $option = array('label' => ($opt->level>1 ? str_repeat('- ', $opt->level-1) : '') . $opt->label, 'value' => $opt->value);
49
- array_push($options, $option);
50
- if(isset($opt->child) && count($opt->child)) {
51
- foreach(array_reverse($opt->child) as $child) {
52
- array_push($stack, $child);
53
- }
54
- }
55
- }
56
- }
 
 
 
 
57
  }
 
58
  unset($cats);
59
  return $options;
60
  }
61
-
62
  }
1
+ <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Category
22
+ {
23
 
24
+ public function toOptionArray($addEmpty = true)
25
+ {
26
  $options = array();
27
  $collection = Mage::getResourceModel('catalog/category_collection');
28
  $collection->addAttributeToSelect('name')->addPathFilter('^1/[0-9/]+')->load();
29
  $cats = array();
30
  foreach ($collection as $category) {
31
+ $cat = new stdClass();
32
+ $cat->label = $category->getName();
33
+ $cat->value = $category->getId();
34
+ $cat->level = $category->getLevel();
35
+ $cat->parentid = $category->getParentId();
36
  $cats[$cat->value] = $cat;
37
  }
38
 
39
+ foreach ($cats as $id => $cat) {
40
+ if (isset($cats[$cat->parentid])) {
41
+ if (!isset($cats[$cat->parentid]->child)) {
42
+ $cats[$cat->parentid]->child = array();
43
+ }
44
+
45
+ $cats[$cat->parentid]->child[] =& $cats[$id];
46
+ }
47
  }
48
+
49
+ foreach ($cats as $id => $cat) {
50
+ if (!isset($cats[$cat->parentid])) {
51
+ $stack = array($cats[$id]);
52
+ while (count($stack) > 0) {
53
+ $opt = array_pop($stack);
54
+ $option = array(
55
+ 'label' => ($opt->level > 1 ? str_repeat('- ', $opt->level - 1) : '') . $opt->label,
56
+ 'value' => $opt->value
57
+ );
58
+ array_push($options, $option);
59
+ if (isset($opt->child) && count($opt->child)) {
60
+ foreach (array_reverse($opt->child) as $child) {
61
+ array_push($stack, $child);
62
+ }
63
+ }
64
+ }
65
+ }
66
  }
67
+
68
  unset($cats);
69
  return $options;
70
  }
71
+
72
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Categorytype.php CHANGED
@@ -1,28 +1,32 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Categorytype {
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'include', 'label'=> Mage::helper('sooqr')->__('Include by Category'));
24
- $type[] = array('value'=>'exclude', 'label'=> Mage::helper('sooqr')->__('Exclude by Category'));
25
- return $type;
26
- }
27
 
28
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Categorytype
22
+ {
23
 
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => 'include', 'label' => Mage::helper('sooqr')->__('Include by Category'));
28
+ $type[] = array('value' => 'exclude', 'label' => Mage::helper('sooqr')->__('Exclude by Category'));
29
+ return $type;
30
+ }
31
 
32
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Cms.php CHANGED
@@ -1,29 +1,33 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Cms {
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $cms = array();
23
- $cms[] = array('value'=> '0', 'label'=> Mage::helper('sooqr')->__('No'));
24
- $cms[] = array('value'=> '1', 'label'=> Mage::helper('sooqr')->__('Yes, all'));
25
- $cms[] = array('value'=> '2', 'label'=> Mage::helper('sooqr')->__('Yes, selection'));
26
- return $cms;
27
- }
28
-
29
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Cms
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $cms = array();
27
+ $cms[] = array('value' => '0', 'label' => Mage::helper('sooqr')->__('No'));
28
+ $cms[] = array('value' => '1', 'label' => Mage::helper('sooqr')->__('Yes, all'));
29
+ $cms[] = array('value' => '2', 'label' => Mage::helper('sooqr')->__('Yes, selection'));
30
+ return $cms;
31
+ }
32
 
 
 
 
 
 
 
 
 
 
33
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Cmspages.php CHANGED
@@ -1,45 +1,55 @@
1
- <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Cmspages {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $store_id = '';
23
- $cms = array();
24
- $code = Mage::app()->getRequest()->getParam('store');
25
- if(!empty($code)) {
26
- $store_id = Mage::getModel('core/store')->load($code)->getId();
27
  } else {
28
- $code = Mage::app()->getRequest()->getParam('website');
29
- if(!empty($code)) {
30
- $website_id = Mage::getModel('core/website')->load($code)->getId();
31
- $store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
32
- }
33
  }
34
- if($store_id) {
35
- $cmspages = Mage::getModel('cms/page')->getCollection()->addStoreFilter($store_id);
36
- } else {
37
- $cmspages = Mage::getModel('cms/page')->getCollection();
38
- }
39
- foreach($cmspages as $page) {
40
- $cms[] = array('value' => $page->getId(), 'label' => $page->getTitle() . ' (' . $page->getIdentifier() . ')');
41
- }
42
  return $cms;
43
  }
44
-
45
  }
1
+ <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Cmspages
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $storeId = '';
27
+ $cms = array();
28
+ $code = Mage::app()->getRequest()->getParam('store');
29
+ if (!empty($code)) {
30
+ $storeId = Mage::getModel('core/store')->load($code)->getId();
31
+ } else {
32
+ $code = Mage::app()->getRequest()->getParam('website');
33
+ if (!empty($code)) {
34
+ $websiteId = Mage::getModel('core/website')->load($code)->getId();
35
+ $storeId = Mage::app()->getWebsite($websiteId)->getDefaultStore()->getId();
36
+ }
37
+ }
38
 
39
+ if ($storeId) {
40
+ $cmspages = Mage::getModel('cms/page')->getCollection()->addStoreFilter($storeId);
 
 
 
 
 
41
  } else {
42
+ $cmspages = Mage::getModel('cms/page')->getCollection();
 
 
 
 
43
  }
44
+
45
+ foreach ($cmspages as $page) {
46
+ $cms[] = array(
47
+ 'value' => $page->getId(),
48
+ 'label' => $page->getTitle() . ' (' . $page->getIdentifier() . ')'
49
+ );
50
+ }
51
+
52
  return $cms;
53
  }
54
+
55
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Condition.php CHANGED
@@ -1,29 +1,33 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Condition {
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'new', 'label'=> Mage::helper('sooqr')->__('New'));
24
- $type[] = array('value'=>'refurbished', 'label'=> Mage::helper('sooqr')->__('Refurbished'));
25
- $type[] = array('value'=>'used', 'label'=> Mage::helper('sooqr')->__('Used'));
26
- return $type;
27
- }
28
-
29
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Condition
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => 'new', 'label' => Mage::helper('sooqr')->__('New'));
28
+ $type[] = array('value' => 'refurbished', 'label' => Mage::helper('sooqr')->__('Refurbished'));
29
+ $type[] = array('value' => 'used', 'label' => Mage::helper('sooqr')->__('Used'));
30
+ return $type;
31
+ }
32
 
 
 
 
 
 
 
 
 
 
33
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Conditions.php CHANGED
@@ -1,37 +1,42 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2015 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Conditions {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray() {
21
- $type = array();
22
- $type[] = array('value'=> '', 'label'=> Mage::helper('sooqr')->__(''));
23
- $type[] = array('value'=> 'eq', 'label'=> Mage::helper('sooqr')->__('Equal'));
24
- $type[] = array('value'=> 'neq', 'label'=> Mage::helper('sooqr')->__('Not equal'));
25
- $type[] = array('value'=> 'gt', 'label'=> Mage::helper('sooqr')->__('Greater than'));
26
- $type[] = array('value'=> 'gteq', 'label'=> Mage::helper('sooqr')->__('Greater than or equal to'));
27
- $type[] = array('value'=> 'lt', 'label'=> Mage::helper('sooqr')->__('Less than'));
28
- $type[] = array('value'=> 'lteg', 'label'=> Mage::helper('sooqr')->__('Less than or equal to'));
29
- $type[] = array('value'=> 'in', 'label'=> Mage::helper('sooqr')->__('In'));
30
- $type[] = array('value'=> 'nin', 'label'=> Mage::helper('sooqr')->__('Not in'));
31
- $type[] = array('value'=> 'like', 'label'=> Mage::helper('sooqr')->__('Like'));
32
- $type[] = array('value'=> 'empty', 'label'=> Mage::helper('sooqr')->__('Empty'));
33
- $type[] = array('value'=> 'not-empty', 'label'=> Mage::helper('sooqr')->__('Not Empty'));
34
- return $type;
35
- }
36
-
37
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Conditions
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => '', 'label' => Mage::helper('sooqr')->__(''));
28
+ $type[] = array('value' => 'eq', 'label' => Mage::helper('sooqr')->__('Equal'));
29
+ $type[] = array('value' => 'neq', 'label' => Mage::helper('sooqr')->__('Not equal'));
30
+ $type[] = array('value' => 'gt', 'label' => Mage::helper('sooqr')->__('Greater than'));
31
+ $type[] = array('value' => 'gteq', 'label' => Mage::helper('sooqr')->__('Greater than or equal to'));
32
+ $type[] = array('value' => 'lt', 'label' => Mage::helper('sooqr')->__('Less than'));
33
+ $type[] = array('value' => 'lteg', 'label' => Mage::helper('sooqr')->__('Less than or equal to'));
34
+ $type[] = array('value' => 'in', 'label' => Mage::helper('sooqr')->__('In'));
35
+ $type[] = array('value' => 'nin', 'label' => Mage::helper('sooqr')->__('Not in'));
36
+ $type[] = array('value' => 'like', 'label' => Mage::helper('sooqr')->__('Like'));
37
+ $type[] = array('value' => 'empty', 'label' => Mage::helper('sooqr')->__('Empty'));
38
+ $type[] = array('value' => 'not-empty', 'label' => Mage::helper('sooqr')->__('Not Empty'));
39
+ return $type;
40
+ }
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Configurable.php CHANGED
@@ -1,33 +1,38 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Configurable {
19
 
20
- public function toOptionArray()
21
- {
22
- $attributes = Mage::getModel("sooqr/sooqr")->getFeedAttributes();
23
- $attributes_skip = array('id','parent_id','price');
24
- $att = array();
25
- foreach ($attributes as $key => $attribute) {
26
- if(!in_array($key,$attributes_skip)) {
27
- $att[] = array('value'=> $key, 'label'=> $key);
28
- }
29
- }
30
- return $att;
31
- }
32
-
 
 
 
 
33
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Configurable
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $attributes = Mage::getModel("sooqr/sooqr")->getFeedAttributes();
27
+ $attributesSkip = array('id', 'parent_id', 'price', 'content_type', 'type', 'qty', 'visibility', 'status', 'stock_status');
28
+ $att = array();
29
+ foreach ($attributes as $key => $attribute) {
30
+ if (!in_array($key, $attributesSkip)) {
31
+ $att[] = array('value' => $key, 'label' => $key);
32
+ }
33
+ }
34
+
35
+ return $att;
36
+ }
37
+
38
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Frequency.php CHANGED
@@ -1,34 +1,38 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
 
 
17
 
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Frequency {
19
-
20
- public function toOptionArray()
21
  {
22
- $frequency = array();
23
- $frequency[] = array('label' => Mage::helper('adminhtml')->__('Daily'), 'value' => '0');
24
- $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 6 hours'), 'value' => '6');
25
- $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 4 hours'), 'value' => '4');
26
- $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 2 hours'), 'value' => '2');
27
- $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every hour'), 'value' => '1');
28
- $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 30 minutes'), 'value' => '30');
29
- $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 15 minutes'), 'value' => '15');
30
- $frequency[] = array('label' => Mage::helper('adminhtml')->__('Custom'), 'value' => 'custom_expr');
31
- return $frequency;
32
  }
33
 
34
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Frequency
22
+ {
23
 
24
+ public function toOptionArray()
 
 
25
  {
26
+ $frequency = array();
27
+ $frequency[] = array('label' => Mage::helper('adminhtml')->__('Daily'), 'value' => '0');
28
+ $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 6 hours'), 'value' => '6');
29
+ $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 4 hours'), 'value' => '4');
30
+ $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 2 hours'), 'value' => '2');
31
+ $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every hour'), 'value' => '1');
32
+ $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 30 minutes'), 'value' => '30');
33
+ $frequency[] = array('label' => Mage::helper('adminhtml')->__('Every 15 minutes'), 'value' => '15');
34
+ $frequency[] = array('label' => Mage::helper('adminhtml')->__('Custom'), 'value' => 'custom_expr');
35
+ return $frequency;
36
  }
37
 
38
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Identifier.php CHANGED
@@ -1,29 +1,33 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Identifier {
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('No'));
24
- $type[] = array('value'=>'1', 'label'=> Mage::helper('adminhtml')->__('Only when less than two.. '));
25
- $type[] = array('value'=>'2', 'label'=> Mage::helper('adminhtml')->__('Every product'));
26
- return $type;
27
- }
28
 
29
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Identifier
22
+ {
23
 
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => '', 'label' => Mage::helper('adminhtml')->__('No'));
28
+ $type[] = array('value' => '1', 'label' => Mage::helper('adminhtml')->__('Only when less than two.. '));
29
+ $type[] = array('value' => '2', 'label' => Mage::helper('adminhtml')->__('Every product'));
30
+ return $type;
31
+ }
32
 
33
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Image.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Image
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $position = array();
27
+ $position[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('No'));
28
+ $position[] = array('value' => 'incl', 'label' => Mage::helper('sooqr')->__('Force including Tax'));
29
+ $position[] = array('value' => 'excl', 'label' => Mage::helper('sooqr')->__('Force excluding Tax'));
30
+ return $position;
31
+ }
32
+
33
+ }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Images.php CHANGED
@@ -1,34 +1,51 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Images {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->addFieldToFilter('frontend_input', 'media_image');
23
- $type = array();
24
- foreach($attributes as $attribute) {
25
- if($attribute->getData('attribute_code') == 'small_image') {
26
- $type[] = array('value' => $attribute->getData('attribute_code'), 'label'=> str_replace("'", "", $attribute->getData('frontend_label') . ' ' . Mage::helper('sooqr')->__('(recommended)')));
27
- } else {
28
- $type[] = array('value' => $attribute->getData('attribute_code'), 'label'=> str_replace("'", "", $attribute->getData('frontend_label')));
29
- }
30
- }
31
- return $type;
32
- }
33
-
34
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Images
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->addFieldToFilter(
27
+ 'frontend_input',
28
+ 'media_image'
29
+ );
30
+ $type = array();
31
+ foreach ($attributes as $attribute) {
32
+ if ($attribute->getData('attribute_code') == 'small_image') {
33
+ $type[] = array(
34
+ 'value' => $attribute->getData('attribute_code'),
35
+ 'label' => str_replace(
36
+ "'", "",
37
+ $attribute->getData('frontend_label') . ' ' . Mage::helper('sooqr')->__('(recommended)')
38
+ )
39
+ );
40
+ } else {
41
+ $type[] = array(
42
+ 'value' => $attribute->getData('attribute_code'),
43
+ 'label' => str_replace("'", "", $attribute->getData('frontend_label'))
44
+ );
45
+ }
46
+ }
47
+
48
+ return $type;
49
+ }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Pricemodel.php CHANGED
@@ -1,30 +1,34 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Pricemodel {
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('Use default price'));
24
- $type[] = array('value'=>'min', 'label'=> Mage::helper('adminhtml')->__('Use minimum price'));
25
- $type[] = array('value'=>'max', 'label'=> Mage::helper('adminhtml')->__('Use maximum price'));
26
- $type[] = array('value'=>'total', 'label'=> Mage::helper('adminhtml')->__('Use total price'));
27
- return $type;
28
- }
29
 
30
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Pricemodel
22
+ {
23
 
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => '', 'label' => Mage::helper('adminhtml')->__('Use default price'));
28
+ $type[] = array('value' => 'min', 'label' => Mage::helper('adminhtml')->__('Use minimum price'));
29
+ $type[] = array('value' => 'max', 'label' => Mage::helper('adminhtml')->__('Use maximum price'));
30
+ $type[] = array('value' => 'total', 'label' => Mage::helper('adminhtml')->__('Use total price'));
31
+ return $type;
32
+ }
33
 
34
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Productid.php CHANGED
@@ -1,73 +1,84 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Productid {
19
 
20
- protected $_ignore = array(
21
- 'compatibility',
22
- 'gallery',
23
- 'installation',
24
- 'language_support',
25
- 'country_of_manufacture',
26
- 'links_title',
27
- 'current_version',
28
- 'custom_design',
29
- 'custom_layout_update',
30
- 'gift_message_available',
31
- 'image',
32
- 'image_label',
33
- 'media_gallery',
34
- 'msrp_display_actual_price_type',
35
- 'msrp_enabled',
36
- 'options_container',
37
- 'price_view',
38
- 'page_layout',
39
- 'samples_title',
40
- 'sku_type',
41
- 'tier_price',
42
- 'url_key',
43
- 'small_image',
44
- 'small_image_label',
45
- 'thumbnail',
46
- 'thumbnail_label',
47
- 'recurring_profile',
48
- 'version_info',
49
- 'meta_title',
50
- 'meta_keyword',
51
- 'name',
52
- 'brand',
53
- 'created_at'
54
- );
55
 
56
  public function toOptionArray()
57
  {
58
  $options = array();
59
- $options[] = array('value' => 'entity_id', 'label' => Mage::helper('sooqr')->__('Product ID'));
60
  $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
61
- $attributes = Mage::getModel('eav/entity_attribute')->getCollection()->addFilter('entity_type_id', $entityTypeId)->setOrder('attribute_code', 'ASC');
62
- foreach ($attributes as $attribute){
63
- if(($attribute->getBackendType() == 'varchar') || ($attribute->getBackendType() == 'static') || ($attribute->getBackendType() == 'text')) {
64
- if($attribute->getFrontendLabel()) {
65
- if(!in_array($attribute->getAttributeCode(), $this->_ignore)) {
66
- $options[] = array('value'=> $attribute->getAttributeCode(), 'label'=> $attribute->getFrontendLabel());
67
- }
68
- }
69
- }
70
- }
 
 
 
 
 
 
 
71
  return $options;
72
  }
73
 
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Productid
22
+ {
23
 
24
+ protected $_ignore = array(
25
+ 'compatibility',
26
+ 'gallery',
27
+ 'installation',
28
+ 'language_support',
29
+ 'country_of_manufacture',
30
+ 'links_title',
31
+ 'current_version',
32
+ 'custom_design',
33
+ 'custom_layout_update',
34
+ 'gift_message_available',
35
+ 'image',
36
+ 'image_label',
37
+ 'media_gallery',
38
+ 'msrp_display_actual_price_type',
39
+ 'msrp_enabled',
40
+ 'options_container',
41
+ 'price_view',
42
+ 'page_layout',
43
+ 'samples_title',
44
+ 'sku_type',
45
+ 'tier_price',
46
+ 'url_key',
47
+ 'small_image',
48
+ 'small_image_label',
49
+ 'thumbnail',
50
+ 'thumbnail_label',
51
+ 'recurring_profile',
52
+ 'version_info',
53
+ 'meta_title',
54
+ 'meta_keyword',
55
+ 'name',
56
+ 'brand',
57
+ 'created_at'
58
+ );
59
 
60
  public function toOptionArray()
61
  {
62
  $options = array();
63
+ $options[] = array('value' => 'entity_id', 'label' => Mage::helper('sooqr')->__('Product ID'));
64
  $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
65
+ $attributes = Mage::getModel('eav/entity_attribute')->getCollection()->addFilter(
66
+ 'entity_type_id',
67
+ $entityTypeId
68
+ )->setOrder('attribute_code', 'ASC');
69
+ foreach ($attributes as $attribute) {
70
+ if (($attribute->getBackendType() == 'varchar') || ($attribute->getBackendType() == 'static') || ($attribute->getBackendType() == 'text')) {
71
+ if ($attribute->getFrontendLabel()) {
72
+ if (!in_array($attribute->getAttributeCode(), $this->_ignore)) {
73
+ $options[] = array(
74
+ 'value' => $attribute->getAttributeCode(),
75
+ 'label' => $attribute->getFrontendLabel()
76
+ );
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
  return $options;
83
  }
84
 
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Producttype.php CHANGED
@@ -1,29 +1,33 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Producttype {
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('No'));
24
- $type[] = array('value'=>'full', 'label'=> Mage::helper('adminhtml')->__('Full Category Path'));
25
- $type[] = array('value'=>'last', 'label'=> Mage::helper('adminhtml')->__('Only Deepest Categoy'));
26
- return $type;
27
- }
28
 
29
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Producttype
22
+ {
23
 
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => '', 'label' => Mage::helper('adminhtml')->__('No'));
28
+ $type[] = array('value' => 'full', 'label' => Mage::helper('adminhtml')->__('Full Category Path'));
29
+ $type[] = array('value' => 'last', 'label' => Mage::helper('adminhtml')->__('Only Deepest Categoy'));
30
+ return $type;
31
+ }
32
 
33
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Resize.php CHANGED
@@ -1,29 +1,33 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Resize {
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'','label'=> Mage::helper('adminhtml')->__('No'));
24
- $type[] = array('value'=>'fixed','label'=> Mage::helper('adminhtml')->__('Yes, fixed value'));
25
- $type[] = array('value'=>'custom','label'=> Mage::helper('adminhtml')->__('Yes, custom value'));
26
- return $type;
27
- }
28
-
29
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Resize
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => '', 'label' => Mage::helper('adminhtml')->__('No'));
28
+ $type[] = array('value' => 'fixed', 'label' => Mage::helper('adminhtml')->__('Yes, fixed value'));
29
+ $type[] = array('value' => 'custom', 'label' => Mage::helper('adminhtml')->__('Yes, custom value'));
30
+ return $type;
31
+ }
32
 
 
 
 
 
 
 
 
 
 
33
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Selectattribute.php CHANGED
@@ -1,50 +1,61 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Selectattribute {
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
- protected $_ignore = array(
21
- 'ebizmarts_mark_visited',
22
- 'is_recurring',
23
- 'links_purchased_separately',
24
- 'price_view',
25
- 'status',
26
- 'tax_class_id',
27
- 'visibility',
28
- 'sooqr_condition',
29
- 'sooqr_exclude',
30
- 'shipment_type',
31
- );
32
-
33
  public function toOptionArray()
34
  {
35
  $options = array();
36
- $options[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- none'));
37
  $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
38
- $attributes = Mage::getModel('eav/entity_attribute')->getCollection()->addFilter('entity_type_id', $entityTypeId)->setOrder('attribute_code', 'ASC');
39
- foreach ($attributes as $attribute){
40
- if($attribute->getBackendType() == 'int') {
41
- if($attribute->getFrontendLabel()) {
42
- if(!in_array($attribute->getAttributeCode(), $this->_ignore)) {
43
- $options[] = array('value'=> $attribute->getAttributeCode(), 'label'=> $attribute->getFrontendLabel());
44
- }
45
- }
46
- }
47
- }
 
 
 
 
 
 
 
48
  return $options;
49
  }
50
 
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Selectattribute
22
+ {
23
+
24
+ protected $_ignore = array(
25
+ 'ebizmarts_mark_visited',
26
+ 'is_recurring',
27
+ 'links_purchased_separately',
28
+ 'price_view',
29
+ 'status',
30
+ 'tax_class_id',
31
+ 'visibility',
32
+ 'sooqr_condition',
33
+ 'sooqr_exclude',
34
+ 'shipment_type',
35
+ );
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  public function toOptionArray()
38
  {
39
  $options = array();
40
+ $options[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- none'));
41
  $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
42
+ $attributes = Mage::getModel('eav/entity_attribute')->getCollection()->addFilter(
43
+ 'entity_type_id',
44
+ $entityTypeId
45
+ )->setOrder('attribute_code', 'ASC');
46
+ foreach ($attributes as $attribute) {
47
+ if ($attribute->getBackendType() == 'int') {
48
+ if ($attribute->getFrontendLabel()) {
49
+ if (!in_array($attribute->getAttributeCode(), $this->_ignore)) {
50
+ $options[] = array(
51
+ 'value' => $attribute->getAttributeCode(),
52
+ 'label' => $attribute->getFrontendLabel()
53
+ );
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
  return $options;
60
  }
61
 
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Status.php CHANGED
@@ -1,28 +1,32 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Status {
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'1', 'label'=> Mage::helper('adminhtml')->__('Enabled'));
24
- $type[] = array('value'=>'2', 'label'=> Mage::helper('adminhtml')->__('Disabled'));
25
- return $type;
26
- }
27
-
28
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Status
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => '1', 'label' => Mage::helper('adminhtml')->__('Enabled'));
28
+ $type[] = array('value' => '2', 'label' => Mage::helper('adminhtml')->__('Disabled'));
29
+ return $type;
30
+ }
31
 
 
 
 
 
 
 
 
 
32
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Tax.php CHANGED
@@ -1,29 +1,33 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Tax {
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $position = array();
23
- $position[] = array('value'=> '', 'label'=> Mage::helper('sooqr')->__('No'));
24
- $position[] = array('value'=> 'incl', 'label'=> Mage::helper('sooqr')->__('Force including Tax'));
25
- $position[] = array('value'=> 'excl', 'label'=> Mage::helper('sooqr')->__('Force excluding Tax'));
26
- return $position;
27
- }
28
-
29
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Tax
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $position = array();
27
+ $position[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('No'));
28
+ $position[] = array('value' => 'incl', 'label' => Mage::helper('sooqr')->__('Force including Tax'));
29
+ $position[] = array('value' => 'excl', 'label' => Mage::helper('sooqr')->__('Force excluding Tax'));
30
+ return $position;
31
+ }
32
 
 
 
 
 
 
 
 
 
 
33
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Textattribute.php CHANGED
@@ -1,70 +1,81 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Textattribute {
19
 
20
- protected $_ignore = array(
21
- 'compatibility',
22
- 'gallery',
23
- 'installation',
24
- 'language_support',
25
- 'country_of_manufacture',
26
- 'links_title',
27
- 'current_version',
28
- 'custom_design',
29
- 'custom_layout_update',
30
- 'gift_message_available',
31
- 'image',
32
- 'image_label',
33
- 'media_gallery',
34
- 'msrp_display_actual_price_type',
35
- 'msrp_enabled',
36
- 'options_container',
37
- 'price_view',
38
- 'page_layout',
39
- 'samples_title',
40
- 'sku_type',
41
- 'tier_price',
42
- 'url_key',
43
- 'small_image',
44
- 'small_image_label',
45
- 'thumbnail',
46
- 'thumbnail_label',
47
- 'recurring_profile',
48
- 'version_info',
49
- 'meta_title',
50
- 'meta_keyword',
51
- );
52
 
53
  public function toOptionArray()
54
  {
55
  $options = array();
56
- $options[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- none'));
57
  $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
58
- $attributes = Mage::getModel('eav/entity_attribute')->getCollection()->addFilter('entity_type_id', $entityTypeId)->setOrder('attribute_code', 'ASC');
59
- foreach ($attributes as $attribute){
60
- if(($attribute->getBackendType() == 'text') || ($attribute->getBackendType() == 'varchar') || ($attribute->getBackendType() == 'static')) {
61
- if($attribute->getFrontendLabel()) {
62
- if(!in_array($attribute->getAttributeCode(), $this->_ignore)) {
63
- $options[] = array('value'=> $attribute->getAttributeCode(), 'label'=> $attribute->getFrontendLabel());
64
- }
65
- }
66
- }
67
- }
 
 
 
 
 
 
 
68
  return $options;
69
  }
70
 
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Textattribute
22
+ {
23
 
24
+ protected $_ignore = array(
25
+ 'compatibility',
26
+ 'gallery',
27
+ 'installation',
28
+ 'language_support',
29
+ 'country_of_manufacture',
30
+ 'links_title',
31
+ 'current_version',
32
+ 'custom_design',
33
+ 'custom_layout_update',
34
+ 'gift_message_available',
35
+ 'image',
36
+ 'image_label',
37
+ 'media_gallery',
38
+ 'msrp_display_actual_price_type',
39
+ 'msrp_enabled',
40
+ 'options_container',
41
+ 'price_view',
42
+ 'page_layout',
43
+ 'samples_title',
44
+ 'sku_type',
45
+ 'tier_price',
46
+ 'url_key',
47
+ 'small_image',
48
+ 'small_image_label',
49
+ 'thumbnail',
50
+ 'thumbnail_label',
51
+ 'recurring_profile',
52
+ 'version_info',
53
+ 'meta_title',
54
+ 'meta_keyword',
55
+ );
56
 
57
  public function toOptionArray()
58
  {
59
  $options = array();
60
+ $options[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- none'));
61
  $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
62
+ $attributes = Mage::getModel('eav/entity_attribute')->getCollection()->addFilter(
63
+ 'entity_type_id',
64
+ $entityTypeId
65
+ )->setOrder('attribute_code', 'ASC');
66
+ foreach ($attributes as $attribute) {
67
+ if (($attribute->getBackendType() == 'text') || ($attribute->getBackendType() == 'varchar') || ($attribute->getBackendType() == 'static')) {
68
+ if ($attribute->getFrontendLabel()) {
69
+ if (!in_array($attribute->getAttributeCode(), $this->_ignore)) {
70
+ $options[] = array(
71
+ 'value' => $attribute->getAttributeCode(),
72
+ 'label' => $attribute->getFrontendLabel()
73
+ );
74
+ }
75
+ }
76
+ }
77
+ }
78
+
79
  return $options;
80
  }
81
 
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Varcharattribute.php CHANGED
@@ -1,70 +1,81 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Varcharattribute {
19
 
20
- protected $_ignore = array(
21
- 'compatibility',
22
- 'gallery',
23
- 'installation',
24
- 'language_support',
25
- 'country_of_manufacture',
26
- 'links_title',
27
- 'current_version',
28
- 'custom_design',
29
- 'custom_layout_update',
30
- 'gift_message_available',
31
- 'image',
32
- 'image_label',
33
- 'media_gallery',
34
- 'msrp_display_actual_price_type',
35
- 'msrp_enabled',
36
- 'options_container',
37
- 'price_view',
38
- 'page_layout',
39
- 'samples_title',
40
- 'sku_type',
41
- 'tier_price',
42
- 'url_key',
43
- 'small_image',
44
- 'small_image_label',
45
- 'thumbnail',
46
- 'thumbnail_label',
47
- 'recurring_profile',
48
- 'version_info',
49
- 'meta_keyword',
50
- 'meta_description',
51
- );
52
 
53
  public function toOptionArray()
54
  {
55
  $options = array();
56
- $options[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- none'));
57
  $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
58
- $attributes = Mage::getModel('eav/entity_attribute')->getCollection()->addFilter('entity_type_id', $entityTypeId)->setOrder('attribute_code', 'ASC');
59
- foreach ($attributes as $attribute){
60
- if($attribute->getBackendType() == 'varchar') {
61
- if($attribute->getFrontendLabel()) {
62
- if(!in_array($attribute->getAttributeCode(), $this->_ignore)) {
63
- $options[] = array('value'=> $attribute->getAttributeCode(), 'label'=> $attribute->getFrontendLabel());
64
- }
65
- }
66
- }
67
- }
 
 
 
 
 
 
 
68
  return $options;
69
  }
70
 
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Varcharattribute
22
+ {
23
 
24
+ protected $_ignore = array(
25
+ 'compatibility',
26
+ 'gallery',
27
+ 'installation',
28
+ 'language_support',
29
+ 'country_of_manufacture',
30
+ 'links_title',
31
+ 'current_version',
32
+ 'custom_design',
33
+ 'custom_layout_update',
34
+ 'gift_message_available',
35
+ 'image',
36
+ 'image_label',
37
+ 'media_gallery',
38
+ 'msrp_display_actual_price_type',
39
+ 'msrp_enabled',
40
+ 'options_container',
41
+ 'price_view',
42
+ 'page_layout',
43
+ 'samples_title',
44
+ 'sku_type',
45
+ 'tier_price',
46
+ 'url_key',
47
+ 'small_image',
48
+ 'small_image_label',
49
+ 'thumbnail',
50
+ 'thumbnail_label',
51
+ 'recurring_profile',
52
+ 'version_info',
53
+ 'meta_keyword',
54
+ 'meta_description',
55
+ );
56
 
57
  public function toOptionArray()
58
  {
59
  $options = array();
60
+ $options[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- none'));
61
  $entityTypeId = Mage::getModel('eav/entity_type')->loadByCode('catalog_product')->getEntityTypeId();
62
+ $attributes = Mage::getModel('eav/entity_attribute')->getCollection()->addFilter(
63
+ 'entity_type_id',
64
+ $entityTypeId
65
+ )->setOrder('attribute_code', 'ASC');
66
+ foreach ($attributes as $attribute) {
67
+ if ($attribute->getBackendType() == 'varchar') {
68
+ if ($attribute->getFrontendLabel()) {
69
+ if (!in_array($attribute->getAttributeCode(), $this->_ignore)) {
70
+ $options[] = array(
71
+ 'value' => $attribute->getAttributeCode(),
72
+ 'label' => $attribute->getFrontendLabel()
73
+ );
74
+ }
75
+ }
76
+ }
77
+ }
78
+
79
  return $options;
80
  }
81
 
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Version.php CHANGED
@@ -1,28 +1,32 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Version {
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'4', 'label'=> Mage::helper('sooqr')->__('Version 4 (Responsive)'));
24
- $type[] = array('value'=>'3', 'label'=> Mage::helper('sooqr')->__('Version 3 (Original)'));
25
- return $type;
26
- }
27
 
28
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Version
22
+ {
23
 
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => '4', 'label' => Mage::helper('sooqr')->__('Version 4 (Responsive)'));
28
+ $type[] = array('value' => '3', 'label' => Mage::helper('sooqr')->__('Version 3 (Original)'));
29
+ return $type;
30
+ }
31
 
32
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Visibility.php CHANGED
@@ -1,30 +1,34 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Visibility {
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'1', 'label'=> Mage::helper('adminhtml')->__('Not Visible Individually'));
24
- $type[] = array('value'=>'2', 'label'=> Mage::helper('adminhtml')->__('Catalog'));
25
- $type[] = array('value'=>'3', 'label'=> Mage::helper('adminhtml')->__('Search'));
26
- $type[] = array('value'=>'4', 'label'=> Mage::helper('adminhtml')->__('Catalog, Search'));
27
- return $type;
28
- }
29
 
30
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Visibility
22
+ {
23
 
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => '1', 'label' => Mage::helper('adminhtml')->__('Not Visible Individually'));
28
+ $type[] = array('value' => '2', 'label' => Mage::helper('adminhtml')->__('Catalog'));
29
+ $type[] = array('value' => '3', 'label' => Mage::helper('adminhtml')->__('Search'));
30
+ $type[] = array('value' => '4', 'label' => Mage::helper('adminhtml')->__('Catalog, Search'));
31
+ return $type;
32
+ }
33
 
34
  }
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Weight.php CHANGED
@@ -1,30 +1,34 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Weight {
 
 
 
 
 
 
 
 
 
 
19
 
20
- public function toOptionArray()
21
- {
22
- $type = array();
23
- $type[] = array('value'=>'lb', 'label'=> Mage::helper('adminhtml')->__('Pounds (lb)'));
24
- $type[] = array('value'=>'oz', 'label'=> Mage::helper('adminhtml')->__('Ounces (oz)'));
25
- $type[] = array('value'=>'g', 'label'=> Mage::helper('adminhtml')->__('Grams (g)'));
26
- $type[] = array('value'=>'kg', 'label'=> Mage::helper('adminhtml')->__('Kilograms (kg)'));
27
- return $type;
28
- }
29
-
30
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Weight
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $type = array();
27
+ $type[] = array('value' => 'lb', 'label' => Mage::helper('adminhtml')->__('Pounds (lb)'));
28
+ $type[] = array('value' => 'oz', 'label' => Mage::helper('adminhtml')->__('Ounces (oz)'));
29
+ $type[] = array('value' => 'g', 'label' => Mage::helper('adminhtml')->__('Grams (g)'));
30
+ $type[] = array('value' => 'kg', 'label' => Mage::helper('adminhtml')->__('Kilograms (kg)'));
31
+ return $type;
32
+ }
33
 
 
 
 
 
 
 
 
 
 
 
34
  }
app/code/community/Magmodules/Sooqr/Model/Common.php CHANGED
@@ -1,126 +1,271 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Common extends Mage_Core_Helper_Abstract {
19
-
20
- public function getProducts($config, $limit = '')
 
 
 
 
 
 
 
21
  {
22
- $store_id = $config['store_id'];
23
- $collection = Mage::getResourceModel('catalog/product_collection');
24
- $collection->setStore($store_id);
25
- $collection->addStoreFilter($store_id);
26
- $collection->addFinalPrice();
27
- $collection->addUrlRewrite();
28
-
29
- if(!empty($config['filter_enabled'])) {
30
- $type = $config['filter_type'];
31
- $categories = $config['filter_cat'];
32
- if($type && $categories) {
33
- $table = Mage::getSingleton('core/resource')->getTableName('catalog_category_product');
34
- if($type == 'include') {
35
- $collection->getSelect()->join(array('cats' => $table), 'cats.product_id = e.entity_id');
36
- $collection->getSelect()->where('cats.category_id in (' . $categories . ')');
37
- } else {
38
- $collection->getSelect()->join(array('cats' => $table), 'cats.product_id = e.entity_id');
39
- $collection->getSelect()->where('cats.category_id not in (' . $categories . ')');
40
- }
41
- }
42
- }
43
-
44
- $collection->addAttributeToFilter('status', 1);
45
-
46
- if($limit) {
47
- $collection->setPage(1, $limit)->getCurPage();
48
- }
49
-
50
- if(!empty($config['conf_enabled'])) {
51
- $collection->addAttributeToFilter('visibility', array('in' => array('1','3','4')));
52
- } else {
53
- $collection->addAttributeToFilter('visibility', array('in' => array('3','4')));
54
- }
55
-
56
- // All attributes
57
- $attributes = array();
58
- $attributes[] = 'url_key';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  $attributes[] = 'price';
60
  $attributes[] = 'final_price';
61
  $attributes[] = 'price_model';
62
  $attributes[] = 'price_type';
63
  $attributes[] = 'special_price';
64
  $attributes[] = 'special_from_date';
65
- $attributes[] = 'special_to_date';
66
- $attributes[] = 'type_id';
67
  $attributes[] = 'tax_class_id';
68
  $attributes[] = 'tax_percent';
69
  $attributes[] = 'weight';
70
  $attributes[] = 'visibility';
71
  $attributes[] = 'type_id';
72
- $attributes[] = 'image';
73
- $attributes[] = 'small_image';
74
- $attributes[] = 'thumbnail';
75
-
76
- if(!empty($config['filter_exclude'])) {
77
- $attributes[] = $config['filter_exclude'];
78
- }
79
-
80
- foreach($config['field'] as $field) {
81
- if(isset($field['source'])) {
82
- $attributes[] = $field['source'];
83
- }
84
- }
85
-
86
- $collection->addAttributeToSelect($attributes);
87
-
88
- if(!empty($config['filters'])) {
89
- foreach($config['filters'] as $filter) {
90
- $attribute = $filter['attribute'];
91
- if($filter['type'] == 'select') {
92
- $attribute = $filter['attribute'] . '_value';
93
- }
94
- $condition = $filter['condition'];
95
- $value = $filter['value'];
96
- switch ($condition) {
97
- case 'nin':
98
- if(strpos($value, ',') !== FALSE) { $value = explode(',', $value); }
99
- $collection->addAttributeToFilter(array(array('attribute' => $attribute, $condition => $value), array('attribute' => $attribute, 'null' => true)));
100
- break;
101
- case 'in';
102
- if(strpos($value, ',') !== FALSE) { $value = explode(',', $value); }
103
- $collection->addAttributeToFilter($attribute, array($condition => $value));
104
- break;
105
- case 'neq':
106
- $collection->addAttributeToFilter(array(array('attribute' => $attribute, $condition => $value), array('attribute' => $attribute, 'null' => true)));
107
- break;
108
- case 'empty':
109
- $collection->addAttributeToFilter($attribute, array('null' => true));
110
- break;
111
- case 'not-empty':
112
- $collection->addAttributeToFilter($attribute, array('notnull' => true));
113
- break;
114
- default:
115
- $collection->addAttributeToFilter($attribute, array($condition => $value));
116
- break;
117
- }
118
- }
119
- }
120
-
121
- $collection->joinTable('cataloginventory/stock_item', 'product_id=entity_id', array("qty" => "qty", "stock_status" => "is_in_stock", "manage_stock" => "manage_stock", "use_config_manage_stock" => "use_config_manage_stock", "use_config_backorders" => "use_config_backorders", "backorders" => "backorders"))->addAttributeToSelect(array('qty', 'stock_status', 'manage_stock', 'use_config_manage_stock', 'use_config_backorders', 'backorders'));
122
- $collection->getSelect()->group('e.entity_id');
123
- return $collection->load();
124
- }
125
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the EULA
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * https://www.magmodules.eu/MM-LICENSE.txt
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license https://www.magmodules.eu/terms.html Single Service License
19
  */
20
+
21
+ class Magmodules_Sooqr_Model_Common extends Mage_Core_Helper_Abstract
22
+ {
23
+
24
+ /**
25
+ * @param $config
26
+ * @param string $limit
27
+ *
28
+ * @return mixed
29
+ */
30
+ public function getProducts($config, $limit = '')
31
  {
32
+ $storeId = $config['store_id'];
33
+
34
+ $collection = Mage::getResourceModel('catalog/product_collection')
35
+ ->setStore($storeId)
36
+ ->addStoreFilter($storeId)
37
+ ->addFinalPrice()
38
+ ->addUrlRewrite()
39
+ ->addAttributeToFilter('status', 1);
40
+
41
+ if ($limit) {
42
+ $collection->setPage(1, $limit)->getCurPage();
43
+ }
44
+
45
+ if (empty($config['conf_enabled'])) {
46
+ $collection->addAttributeToFilter('visibility', array('in' => array(2, 3, 4)));
47
+ }
48
+
49
+ if (!empty($config['filter_enabled'])) {
50
+ $type = $config['filter_type'];
51
+ $categories = $config['filter_cat'];
52
+ if ($type && $categories) {
53
+ $table = Mage::getSingleton('core/resource')->getTableName('catalog_category_product');
54
+ if ($type == 'include') {
55
+ $collection->getSelect()->join(array('cats' => $table), 'cats.product_id = e.entity_id');
56
+ $collection->getSelect()->where('cats.category_id in (' . $categories . ')');
57
+ } else {
58
+ $collection->getSelect()->join(array('cats' => $table), 'cats.product_id = e.entity_id');
59
+ $collection->getSelect()->where('cats.category_id not in (' . $categories . ')');
60
+ }
61
+ }
62
+ }
63
+
64
+ $attributes = $this->getDefaultAttributes();
65
+
66
+ if (!empty($config['filter_exclude'])) {
67
+ $attributes[] = $config['filter_exclude'];
68
+ }
69
+
70
+ foreach ($config['field'] as $field) {
71
+ if (!empty($field['source'])) {
72
+ $attributes[] = $field['source'];
73
+ }
74
+ }
75
+
76
+ if (!empty($config['delivery_att'])) {
77
+ $attributes[] = $config['delivery_att'];
78
+ }
79
+
80
+ if (!empty($config['delivery_att_be'])) {
81
+ $attributes[] = $config['delivery_att_be'];
82
+ }
83
+
84
+ $customValues = '';
85
+ if (isset($config['custom_name'])) {
86
+ $customValues .= $config['custom_name'] . ' ';
87
+ }
88
+
89
+ if (isset($config['custom_description'])) {
90
+ $customValues .= $config['custom_description'] . ' ';
91
+ }
92
+
93
+ preg_match_all("/{{([^}]*)}}/", $customValues, $foundAtts);
94
+ if (!empty($foundAtts)) {
95
+ foreach ($foundAtts[1] as $att) {
96
+ $attributes[] = $att;
97
+ }
98
+ }
99
+
100
+ if (!empty($config['extra_attributes'])) {
101
+ foreach ($config['extra_attributes'] as $att) {
102
+ if (!empty($att['source'])) {
103
+ $attributes[] = $att['source'];
104
+ }
105
+ }
106
+ }
107
+
108
+ if (!empty($config['size_multiple'])) {
109
+ $sizeMultiple = explode(',', $config['size_multiple']);
110
+ foreach ($sizeMultiple as $att) {
111
+ if (!empty($att)) {
112
+ $attributes[] = $att;
113
+ }
114
+ }
115
+ }
116
+
117
+ if (!empty($config['size_na_multiple'])) {
118
+ $sizeMultiple = explode(',', $config['size_na_multiple']);
119
+ foreach ($sizeMultiple as $att) {
120
+ if (!empty($att)) {
121
+ $attributes[] = $att;
122
+ }
123
+ }
124
+ }
125
+
126
+ $collection->addAttributeToSelect(array_unique($attributes));
127
+
128
+ $collection->joinTable(
129
+ 'cataloginventory/stock_item', 'product_id=entity_id', array(
130
+ 'qty' => 'qty',
131
+ 'is_in_stock' => 'is_in_stock',
132
+ 'manage_stock' => 'manage_stock',
133
+ 'use_config_manage_stock' => 'use_config_manage_stock',
134
+ 'min_sale_qty' => 'min_sale_qty',
135
+ 'qty_increments' => 'qty_increments',
136
+ 'enable_qty_increments' => 'enable_qty_increments',
137
+ 'use_config_qty_increments' => 'use_config_qty_increments',
138
+ 'backorders' => 'backorders',
139
+ 'use_config_backorders' => 'use_config_backorders',
140
+ )
141
+ )->addAttributeToSelect(
142
+ array(
143
+ 'qty',
144
+ 'is_in_stock',
145
+ 'manage_stock',
146
+ 'use_config_manage_stock',
147
+ 'min_sale_qty',
148
+ 'qty_increments',
149
+ 'enable_qty_increments',
150
+ 'use_config_qty_increments',
151
+ 'backorders',
152
+ 'use_config_backorders'
153
+ )
154
+ );
155
+
156
+ $collection->getSelect()->group('e.entity_id');
157
+
158
+ if (!empty($config['filters'])) {
159
+ $this->addFilters($config['filters'], $collection);
160
+ }
161
+
162
+ return $collection->load();
163
+ }
164
+
165
+ public function getDefaultAttributes()
166
+ {
167
+ $attributes = array();
168
+ $attributes[] = 'url_key';
169
+ $attributes[] = 'url_path';
170
+ $attributes[] = 'sku';
171
  $attributes[] = 'price';
172
  $attributes[] = 'final_price';
173
  $attributes[] = 'price_model';
174
  $attributes[] = 'price_type';
175
  $attributes[] = 'special_price';
176
  $attributes[] = 'special_from_date';
177
+ $attributes[] = 'special_to_date';
178
+ $attributes[] = 'type_id';
179
  $attributes[] = 'tax_class_id';
180
  $attributes[] = 'tax_percent';
181
  $attributes[] = 'weight';
182
  $attributes[] = 'visibility';
183
  $attributes[] = 'type_id';
184
+ $attributes[] = 'image';
185
+ $attributes[] = 'small_image';
186
+ $attributes[] = 'thumbnail';
187
+ $attributes[] = 'status';
188
+
189
+ return $attributes;
190
+ }
191
+
192
+ public function addFilters($filters, $collection)
193
+ {
194
+ $cType = array(
195
+ 'eq' => '=',
196
+ 'neq' => '!=',
197
+ 'gt' => '>',
198
+ 'gteq' => '>=',
199
+ 'lt' => '<',
200
+ 'lteg' => '<='
201
+ );
202
+
203
+ foreach ($filters as $filter) {
204
+ $attribute = $filter['attribute'];
205
+ if ($filter['type'] == 'select') {
206
+ $attribute = $filter['attribute'] . '_value';
207
+ }
208
+
209
+ $condition = $filter['condition'];
210
+ $value = $filter['value'];
211
+
212
+ if ($attribute == 'final_price') {
213
+ if (isset($cType[$condition])) {
214
+ $collection->getSelect()->where('price_index.final_price ' . $cType[$condition] . ' ' . $value);
215
+ }
216
+
217
+ continue;
218
+ }
219
+
220
+ if ($attribute == 'min_sale_qty') {
221
+ if (isset($cType[$condition])) {
222
+ $collection->getSelect()->where('cataloginventory_stock_item.min_sale_qty ' . $cType[$condition] . ' ' . $value);
223
+ }
224
+
225
+ continue;
226
+ }
227
+
228
+ switch ($condition) {
229
+ case 'nin':
230
+ if (strpos($value, ',') !== false) {
231
+ $value = explode(',', $value);
232
+ }
233
+
234
+ $collection->addAttributeToFilter(
235
+ array(
236
+ array(
237
+ 'attribute' => $attribute,
238
+ $condition => $value
239
+ ),
240
+ array('attribute' => $attribute, 'null' => true)
241
+ )
242
+ );
243
+ break;
244
+ case 'in';
245
+ if (strpos($value, ',') !== false) {
246
+ $value = explode(',', $value);
247
+ }
248
+
249
+ $collection->addAttributeToFilter($attribute, array($condition => $value));
250
+ break;
251
+ case 'neq':
252
+ $collection->addAttributeToFilter(
253
+ array(
254
+ array('attribute' => $attribute, $condition => $value),
255
+ array('attribute' => $attribute, 'null' => true)
256
+ )
257
+ );
258
+ break;
259
+ case 'empty':
260
+ $collection->addAttributeToFilter($attribute, array('null' => true));
261
+ break;
262
+ case 'not-empty':
263
+ $collection->addAttributeToFilter($attribute, array('notnull' => true));
264
+ break;
265
+ default:
266
+ $collection->addAttributeToFilter($attribute, array($condition => $value));
267
+ break;
268
+ }
269
+ }
270
+ }
271
  }
app/code/community/Magmodules/Sooqr/Model/Observer.php CHANGED
@@ -1,44 +1,61 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Observer {
19
 
20
- public function scheduledGenerateSooqr($schedule)
 
 
 
 
 
 
21
  {
22
  $enabled = Mage::getStoreConfig('sooqr_connect/general/enabled');
23
- $cron = Mage::getStoreConfig('sooqr_connect/generate/cron');
24
- $next_store = Mage::helper('sooqr')->getUncachedConfigValue('sooqr_connect/generate/cron_next');
25
- $storeIds = Mage::helper('sooqr')->getStoreIds('sooqr_connect/generate/enabled');
26
- if($enabled && $cron && (count($storeIds) > 0)) {
27
- if(empty($next_store) || ($next_store >= count($storeIds))) {
28
- $next_store = 0;
29
- }
30
- $store_id = $storeIds[$next_store];
31
- $time_start = microtime(true);
32
- $appEmulation = Mage::getSingleton('core/app_emulation');
33
- $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($store_id);
34
- if($result = Mage::getModel('sooqr/sooqr')->generateFeed($store_id, '', $time_start)) {
35
- $html = '<a href="' . $result['url'] . '" target="_blank">' . $result['url'] .'</a><br/><small>Date: ' . $result['date'] . ' (cron) - Products: ' . $result['qty'] . ' - Time: ' . number_format((microtime(true) - $time_start), 4) . '</small>';
36
- $config = new Mage_Core_Model_Config();
37
- $config->saveConfig('sooqr_connect/generate/feed_result', $html, 'stores', $store_id);
38
- }
39
- $config->saveConfig('sooqr_connect/generate/cron_next', ($next_store + 1), 'default', 0);
40
- $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
41
- }
 
 
 
 
 
 
 
 
 
 
42
  }
43
-
44
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Sooqr_Model_Observer
22
+ {
23
+
24
+ /**
25
+ * @param $schedule
26
+ */
27
+ public function scheduledGenerateSooqr($schedule)
28
  {
29
  $enabled = Mage::getStoreConfig('sooqr_connect/general/enabled');
30
+ $cron = Mage::getStoreConfig('sooqr_connect/generate/cron');
31
+ $nextStore = Mage::helper('sooqr')->getUncachedConfigValue('sooqr_connect/generate/cron_next');
32
+ $storeIds = Mage::helper('sooqr')->getStoreIds('sooqr_connect/generate/enabled');
33
+ $nrStores = count($storeIds);
34
+
35
+ if ($enabled && $cron && ($nrStores > 0)) {
36
+ if (empty($nextStore) || ($nextStore >= $nrStores)) {
37
+ $nextStore = 0;
38
+ }
39
+
40
+ $storeId = $storeIds[$nextStore];
41
+ $timeStart = microtime(true);
42
+ $appEmulation = Mage::getSingleton('core/app_emulation');
43
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
44
+ $config = Mage::getModel('core/config');
45
+ if ($result = Mage::getModel('sooqr/sooqr')->generateFeed($storeId, $timeStart)) {
46
+ $html = '<a href="' . $result['url'] . '" target="_blank">' . $result['url'] . '</a>
47
+ <br/>
48
+ <small>
49
+ Date: ' . $result['date'] . ' (cron) -
50
+ Products: ' . $result['qty'] . ' -
51
+ Time: ' . number_format((microtime(true) - $timeStart), 4) . '
52
+ </small>';
53
+ $config->saveConfig('sooqr_connect/generate/feed_result', $html, 'stores', $storeId);
54
+ }
55
+
56
+ $config->saveConfig('sooqr_connect/generate/cron_next', ($nextStore + 1), 'default', 0);
57
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
58
+ }
59
  }
60
+
61
  }
app/code/community/Magmodules/Sooqr/Model/Sooqr.php CHANGED
@@ -1,427 +1,630 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Model_Sooqr extends Magmodules_Sooqr_Model_Common {
19
-
20
- public function generateFeed($store_id, $limit = '', $time_start)
21
- {
22
- $limit = $this->setMemoryLimit($store_id);
23
- $config = $this->getFeedConfig($store_id);
24
- $products = $this->getProducts($config, $config['limit']);
25
- $prices = Mage::helper('sooqr')->getTypePrices($config, $products);
26
- if($feed = $this->getFeedData($products, $config, $time_start, $prices)) {
27
- return $this->saveFeed($feed, $config, 'sooqr', count($feed['products']));
28
- }
29
- }
30
-
31
- public function getFeedData($products, $config, $time_start, $prices)
32
- {
33
- foreach($products as $product) {
34
- $parent_id = Mage::helper('sooqr')->getParentData($product, $config);
35
- if($parent_id > 0) { $parent = $products->getItemById($parent_id); } else { $parent = ''; }
36
- if($product_data = Mage::helper('sooqr')->getProductDataRow($product, $config, $parent)) {
37
- $product_row['content_type'] = 'product';
38
- foreach($product_data as $key => $value) {
39
- if((!is_array($value)) && (!empty($value) || is_numeric($value))) { $product_row[$key] = $value; }
40
- }
41
- if($extra_data = $this->getExtraDataFields($product_data, $config, $product, $prices)) {
42
- $product_row = array_merge($product_row, $extra_data);
43
- }
44
- $feed['products'][] = $product_row;
45
- unset($product_row);
46
- }
47
- }
48
- if(!empty($feed)) {
49
- $return_feed = array();
50
- $return_feed['config'] = $this->getFeedHeader($config, count($feed['products']), $time_start);
51
- if($config['cms_pages']) {
52
- $return_feed['products'] = array_merge($feed['products'], $this->getCmspages($config));
53
- } else {
54
- $return_feed['products'] = $feed['products'];
55
- }
56
- return $return_feed;
57
- }
58
- }
59
-
60
- public function getFeedConfig($storeId, $type = 'xml')
61
- {
62
-
63
- $config = array();
64
- $feed = Mage::helper('sooqr');
65
- $filename = $this->getFileName('sooqr', $storeId);
66
- $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
67
-
68
- // DEFAULTS
69
- $config['store_id'] = $storeId;
70
- $config['website_name'] = $feed->cleanData(Mage::getModel('core/website')->load($websiteId)->getName(), 'striptags');
71
- $config['website_url'] = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
72
- $config['media_url'] = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
73
- $config['media_image_url'] = $config['media_url'] . 'catalog' . DS . 'product';
74
- $config['media_gallery_id'] = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', 'media_gallery');
75
- $config['image_source'] = Mage::getStoreConfig('sooqr_connect/products/image_source', $storeId);
76
- $config['image_resize'] = Mage::getStoreConfig('sooqr_connect/products/image_resize', $storeId);
77
- $config['file_name'] = $filename;
78
- $config['limit'] = Mage::getStoreConfig('sooqr_connect/generate/limit', $storeId);
79
- $config['version'] = (string)Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
80
- $config['filter_enabled'] = Mage::getStoreConfig('sooqr_connect/products/category_enabled', $storeId);
81
- $config['filter_cat'] = Mage::getStoreConfig('sooqr_connect/products/categories', $storeId);
82
- $config['filter_type'] = Mage::getStoreConfig('sooqr_connect/products/category_type', $storeId);
83
- $config['cms_pages'] = Mage::getStoreConfig('sooqr_connect/products/cms_pages', $storeId);
84
- $config['cms_include'] = Mage::getStoreConfig('sooqr_connect/products/cms_include', $storeId);
85
- $config['filters'] = @unserialize(Mage::getStoreConfig('sooqr_connect/products/advanced', $storeId));
86
- $config['product_url_suffix'] = $feed->getProductUrlSuffix($storeId);
87
- $config['stock_manage'] = Mage::getStoreConfig('cataloginventory/item_options/manage_stock');
88
- $config['backorders'] = Mage::getStoreConfig('cataloginventory/item_options/backorders');
89
- $config['token'] = Mage::getStoreConfig('sooqr_connect/generate/token');
90
-
91
- // PRICE
92
- $config['price_scope'] = Mage::getStoreConfig('catalog/price/scope');
93
- $config['price_add_tax'] = Mage::getStoreConfig('sooqr_connect/products/add_tax', $storeId);
94
- $config['price_add_tax_perc'] = Mage::getStoreConfig('sooqr_connect/products/tax_percentage', $storeId);
95
- $config['price_grouped'] = Mage::getStoreConfig('sooqr_connect/products/grouped_price', $storeId);
96
- $config['force_tax'] = Mage::getStoreConfig('sooqr_connect/products/force_tax', $storeId);
97
- $config['price_rules'] = true;
98
- $config['currency'] = Mage::app()->getStore($storeId)->getCurrentCurrencyCode();
99
- $config['currency_allow'] = Mage::getStoreConfig('currency/options/allow', $storeId);
100
- $config['hide_currency'] = true;
101
- $config['base_currency_code'] = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
102
- $config['currency_data'] = $this->getCurrencies($storeId, $config['base_currency_code']);
103
- $config['conf_enabled'] = Mage::getStoreConfig('sooqr_connect/products/conf_enabled', $storeId);
104
- $config['markup'] = $feed->getPriceMarkup($config);
105
- $config['use_tax'] = $feed->getTaxUsage($config);
106
-
107
- // FIELD & CATEGORY DATA
108
- $config['field'] = $this->getFeedAttributes($storeId, $type, $config);
109
- $config['category_data'] = $feed->getCategoryData($config, $storeId);
110
-
111
- if($config['image_resize'] == 'fixed') {
112
- $config['image_size'] = Mage::getStoreConfig('sooqr_connect/products/image_size_fixed', $storeId);
113
- } else {
114
- $config['image_size'] = Mage::getStoreConfig('sooqr_connect/products/image_size_custom', $storeId);
115
- }
116
-
117
- return $config;
118
- }
119
-
120
- public function getFeedAttributes($storeId = 0, $type = 'xml', $config = '')
121
- {
122
- $attributes = array();
123
- $attributes['id'] = array('label' => 'id', 'source' => Mage::getStoreConfig('sooqr_connect/products/id_attribute', $storeId));
124
- $attributes['name'] = array('label' => 'title', 'source' => Mage::getStoreConfig('sooqr_connect/products/name_attribute', $storeId));
125
- $attributes['sku'] = array('label' => 'sku', 'source' => Mage::getStoreConfig('sooqr_connect/products/sku_attribute', $storeId));
126
- $attributes['description'] = array('label' => 'description', 'source' => Mage::getStoreConfig('sooqr_connect/products/description_attribute', $storeId), 'action' => 'striptags');
127
- $attributes['brand'] = array('label' => 'brand', 'source' => Mage::getStoreConfig('sooqr_connect/products/brand_attribute', $storeId));
128
- $attributes['product_url'] = array('label' => 'url', 'source' => '');
129
- $attributes['image_link'] = array('label' => 'image_link', 'source' => Mage::getStoreConfig('sooqr_connect/products/image_source', $storeId));
130
- $attributes['price'] = array('label' => 'price', 'source' => '');
131
- $attributes['parent_id'] = array('label' => 'assoc_id', 'source' =>'entity_id', 'parent' => 1);
132
- $attributes['qty'] = array('label' => 'stock', 'source' => 'qty', 'action' => 'round');
133
- $attributes['stock_status'] = array('label' => 'stock_status', 'source' => 'stock_status');
134
- $attributes['type'] = array('label' => 'product_object_type', 'source' => 'type_id');
135
- $attributes['visibility'] = array('label' => 'visibility', 'source' => 'visibility');
136
- $attributes['status'] = array('label' => 'status', 'source' => 'status');
137
- $attributes['categories'] = array('label' => 'categories', 'source' => '', 'parent' => 1);
138
- if($extra_fields = @unserialize(Mage::getStoreConfig('sooqr_connect/products/extra', $storeId))) {
139
- foreach($extra_fields as $extra_field) {
140
- $attributes[$extra_field['attribute']] = array('label' => $extra_field['attribute'], 'source' => $extra_field['attribute'], 'action' => 'striptags');
141
- }
142
- }
143
- if($type == 'flatcheck') {
144
- if($filters = @unserialize(Mage::getStoreConfig('sooqr_connect/products/advanced', $storeId))) {
145
- foreach($filters as $filter) {
146
- $attributes[$filter['attribute']] = array('label' => $filter['attribute'], 'source' => $filter['attribute']);
147
- }
148
- }
149
- }
150
- return Mage::helper('sooqr')->addAttributeData($attributes, $config);
151
- }
152
-
153
- public function getFileName($type, $storeId, $refresh = 1)
154
- {
155
- if(!$fileName = Mage::getStoreConfig('sooqr_connect/generate/filename', $storeId)) {
156
- $fileName = $type . '.xml';
157
- }
158
-
159
- if(substr($fileName, -3) != 'xml') {
160
- $fileName = $fileName . '-' . $storeId. '.xml';
161
- } else {
162
- $fileName = substr($fileName, 0, -4) . '-' . $storeId. '.xml';
163
- }
164
-
165
- if(!file_exists(Mage::getBaseDir('media') . DS . $type)) {
166
- mkdir(Mage::getBaseDir('media') . DS . $type);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
-
169
- return Mage::getBaseDir() . DS . 'media' . DS . $type . DS . $fileName;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
 
172
- public function saveFeed($feed, $config, $type, $count)
173
- {
174
- $encoding = Mage::getStoreConfig('design/head/default_charset');
175
- $xml_data = new SimpleXMLElement("<rss xmlns:sqr=\"http://base.sooqr.com/ns/1.0\" version=\"2.0\" encoding=\"" . $encoding . "\"></rss>");
176
- $this->getArray2Xml($feed, $xml_data);
177
- $dom = dom_import_simplexml($xml_data)->ownerDocument;
178
- $dom->encoding = $encoding;
179
- $dom->formatOutput = true;
180
- $xml_feed = $dom->saveXML();
181
- if (!file_put_contents($config['file_name'], $xml_feed)) {
182
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper($type)->__('File writing not succeeded'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  } else {
184
- $filename = $config['file_name'];
185
- $store_id = $config['store_id'];
186
- $local_path = Mage::getBaseDir() . DS . 'media' . DS . $type . DS;
187
- $filename = str_replace($local_path, '', $filename);
188
- $websiteUrl = Mage::app()->getStore($store_id)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
189
- $feed_url = $websiteUrl . $type . DS . $filename;
190
- $result = array();
191
- $result['url'] = $feed_url;
192
- $result['shop'] = Mage::app()->getStore($store_id)->getCode();
193
- $result['date'] = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
194
- $result['qty'] = $count;
195
- return $result;
 
 
 
196
  }
197
- }
198
-
199
- protected function getPrices($data, $currency, $config, $conf_prices, $product)
200
- {
201
- $prices = array();
202
- $id = $product->getEntityId();
203
- $prices['currency'] = $currency;
204
- if(!empty($conf_prices[$id])) {
205
- $conf_price = Mage::helper('tax')->getPrice($product, $conf_prices[$id], true);
206
- $conf_price_reg = Mage::helper('tax')->getPrice($product, $conf_prices[$id . '_reg'], true);
207
- if($conf_price_reg > $conf_price) {
208
- $prices['price'] = $conf_price;
209
- $prices['normal_price'] = $conf_price_reg;
210
- } else {
211
- $prices['price'] = $conf_price;
212
- }
213
- } else {
214
- if(!empty($config['currency_data'])) {
215
- foreach($config['currency_data'] as $key => $value) {
216
- if($currency == $key) {
217
- if(isset($data['sales_price'])) {
218
- $prices['normal_price'] = $data['regular_price'];
219
- $prices['price'] = $data['sales_price'];
220
- } else {
221
- $prices['price'] = $data['price'];
222
- }
223
- } else {
224
- if(isset($data['sales_price'])) {
225
- $prices['normal_price_' . strtolower($key)] = round(($data['regular_price'] * $value), 2);
226
- $prices['price_' . strtolower($key)] = round(($data['sales_price'] * $value), 2);
227
- } else {
228
- $prices['price_' . strtolower($key)] = round(($data['price'] * $value), 2);
229
- }
230
- }
231
- }
232
- } else {
233
- if(isset($data['sales_price'])) {
234
- $prices['normal_price'] = $data['regular_price'];
235
- $prices['price'] = $data['sales_price'];
236
- } else {
237
- $prices['price'] = $data['price'];
238
- }
239
- }
240
- }
241
- return $prices;
242
- }
243
-
244
- protected function getAssocId($data)
245
- {
246
- $assoc_id = array();
247
- if(empty($data['assoc_id'])) {
248
- $assoc_id['assoc_id'] = $data['id'];
249
- }
250
- if($data['product_object_type'] != 'simple') {
251
- $assoc_id['is_parent'] = '1';
252
- } else {
253
- $assoc_id['is_parent'] = '0';
254
- }
255
- return $assoc_id;
256
- }
257
-
258
- protected function getStockData($product_data, $config, $product)
259
- {
260
- $stock_data = array();
261
- if($product->getUseConfigManageStock()) {
262
- $stock_data['manage_stock'] = (string)$config['stock_manage'];
263
- } else {
264
- $stock_data['manage_stock'] = (string)$product->getManageStock();
265
- }
266
-
267
- if($product->getUseConfigBackorders()) {
268
- $stock_data['backorders'] = (string)$config['backorders'];
269
- } else {
270
- $stock_data['backorders'] = (string)$product->getBackorders();
271
- }
272
- return $stock_data;
273
- }
274
-
275
-
276
- protected function getCategoryData($product_data, $config)
277
- {
278
- $category = array();
279
- if(!empty($product_data['categories'])) {
280
- foreach($product_data['categories'] as $cat) {
281
- if(!empty($cat['path'])) {
282
- $i = 0;
283
- foreach($cat['path'] as $catpath) {
284
- $category[$i][] = $catpath;
285
- $i++;
286
- }
287
- }
288
- }
289
- }
290
- $category_array = array(); $i = 0;
291
- if(!empty($category)) {
292
- foreach($category as $cat) {
293
- $category_array['category' . $i] = array_unique($cat);
294
- $i++;
295
- }
296
- }
297
- return $category_array;
298
- }
299
-
300
- protected function getExtraDataFields($product_data, $config, $product, $prices)
301
- {
302
- $_extra = array();
303
- if($_category_data = $this->getCategoryData($product_data, $config)) {
304
- $_extra = array_merge($_extra, $_category_data);
305
- }
306
- if($_prices = $this->getPrices($product_data['price'], $config['currency'], $config, $prices, $product)) {
307
- $_extra = array_merge($_extra, $_prices);
308
- }
309
- if($_assoc_id = $this->getAssocId($product_data)) {
310
- $_extra = array_merge($_extra, $_assoc_id);
311
- }
312
- if($_stock_data = $this->getStockData($product_data, $config, $product)) {
313
- $_extra = array_merge($_extra, $_stock_data);
314
- }
315
-
316
- return $_extra;
317
- }
318
-
319
- protected function getFeedHeader($config, $count, $time_start)
320
- {
321
- $header = array();
322
- $header['system'] = 'Magento';
323
- $header['extension'] = 'Magmodules_Sooqr';
324
- $header['extension_version'] = $config['version'];
325
- $header['store'] = $config['website_name'];
326
- $header['url'] = $config['website_url'];
327
- $header['token'] = $config['token'];
328
- $header['products_total'] = $count;
329
- $header['products_limit'] = $config['limit'];
330
- $header['date_created'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
331
- $header['processing_time'] = number_format((microtime(true) - $time_start), 4);
332
- return $header;
333
- }
334
-
335
- public function getInstallation()
336
- {
337
- $json = array();
338
- $json['search']['enabled'] = '0';
339
- $store_ids = Mage::helper('sooqr')->getStoreIds('sooqr_connect/generate/enabled');
340
- foreach($store_ids as $store_id) {
341
- $media_url = Mage::app()->getStore($store_id)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
342
- if(!$file_name = Mage::getStoreConfig('sooqr_connect/generate/filename', $store_id)) {
343
- $file_name = 'soorq.xml';
344
- }
345
- if(substr($file_name, -3) != 'xml') {
346
- $file_name = $file_name . '-' . $store_id. '.xml';
347
- } else {
348
- $file_name = substr($file_name, 0, -4) . '-' . $store_id. '.xml';
349
- }
350
- $name = Mage::app()->getStore($store_id)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
351
- $name = str_replace(array('https://','http://','www'), '', $name);
352
-
353
- $json['feeds'][$store_id]['name'] = $name;
354
- $json['feeds'][$store_id]['feed_url'] = $media_url . DS . 'sooqr' . DS . $file_name;
355
- $json['feeds'][$store_id]['currency'] = Mage::app()->getStore($store_id)->getBaseCurrencyCode();
356
- $json['feeds'][$store_id]['locale'] = Mage::getStoreConfig('general/locale/code', $store_id) ;
357
- $json['feeds'][$store_id]['country'] = Mage::getStoreConfig('general/country/default', $store_id);
358
- $json['feeds'][$store_id]['timezone'] = Mage::getStoreConfig('general/locale/timezone', $store_id);
359
- $json['feeds'][$store_id]['system'] = Mage::getStoreConfig('general/locale/timezone', $store_id);
360
- $json['feeds'][$store_id]['extension'] = 'Magmodules_Sooqr';
361
- $json['feeds'][$store_id]['extension_version'] = (string)Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
362
- }
363
- return $json;
364
- }
365
-
366
- public function getCmspages($config)
367
- {
368
- $cmspages = array();
369
- if($config['cms_pages'] == 1) {
370
- $pages = Mage::getModel('cms/page')->getCollection()->addStoreFilter($config['store_id'])->addFieldToFilter('is_active', 1)->addFieldToFilter('identifier', array(array('nin' => array('no-route','enable-cookies'))));
371
- } else {
372
- $cms_include = explode(',', $config['cms_include']);
373
- $pages = Mage::getModel('cms/page')->getCollection()->addStoreFilter($config['store_id'])->addFieldToFilter('is_active', 1)->addFieldToFilter('page_id', array('in' => $cms_include));
374
- }
375
- foreach($pages as $page) {
376
- $cmspages[] = array('content_type' => 'cms', 'id' => 'CMS-' . $page->getId(), 'title' => $page->getTitle(), 'content' => Mage::helper('sooqr')->cleanData($page->getContent(), 'striptags'), 'url' => $config['website_url'] . $page->getIdentifier());
377
- }
378
- return $cmspages;
379
- }
380
-
381
- function getArray2Xml($array, &$xml_user_info)
382
- {
383
- foreach($array as $key => $value) {
384
- if(is_array($value)) {
385
- if(!is_numeric($key)) {
386
- if(substr($key,0,8) == 'category') {
387
- $key = 'sqr:' . $key;
388
- $subnode = $xml_user_info->addChild("$key", "", "http://base.sooqr.com/ns/1.0");
389
- $this->getArray2Xml($value, $subnode);
390
- } else {
391
- $subnode = $xml_user_info->addChild("$key");
392
- $this->getArray2Xml($value, $subnode);
393
- }
394
- } else{
395
- $subnode = $xml_user_info->addChild("item");
396
- $this->getArray2Xml($value, $subnode);
397
- }
398
- } else {
399
- if(is_numeric($key)) {
400
- $xml_user_info->addChild("node", htmlspecialchars("$value"), "http://base.sooqr.com/ns/1.0");
401
- } else {
402
- $xml_user_info->addChild("$key", htmlspecialchars("$value"), "http://base.sooqr.com/ns/1.0");
403
- }
404
- }
405
- }
406
- }
407
-
408
- function getCurrencies($storeId, $base_currency)
409
- {
410
- $allow = explode(',', Mage::getStoreConfig('currency/options/allow', $storeId));
411
- $rates = Mage::getModel('directory/currency')->getCurrencyRates($base_currency, array_values($allow));
412
- return $rates;
413
- }
414
-
415
- protected function setMemoryLimit($storeId)
416
- {
417
- if(Mage::getStoreConfig('sooqr_connect/generate/overwrite', $storeId)) {
418
- if($memory_limit = Mage::getStoreConfig('sooqr_connect/generate/memory_limit', $storeId)) {
419
- ini_set('memory_limit', $memory_limit);
420
- }
421
- if($max_execution_time = Mage::getStoreConfig('sooqr_connect/generate/max_execution_time', $storeId)) {
422
- ini_set('max_execution_time', $max_execution_time);
423
- }
424
- }
425
- }
426
-
427
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
+
21
+ class Magmodules_Sooqr_Model_Sooqr extends Magmodules_Sooqr_Model_Common
22
+ {
23
+
24
+ /**
25
+ * @param $storeId
26
+ * @param $timeStart
27
+ *
28
+ * @return array
29
+ */
30
+ public function generateFeed($storeId, $timeStart)
31
+ {
32
+ $this->setMemoryLimit($storeId);
33
+ $helper = Mage::helper('sooqr');
34
+ $config = $this->getFeedConfig($storeId);
35
+ $products = $this->getProducts($config, $config['limit']);
36
+ $prices = $helper->getTypePrices($config, $products);
37
+ $parentAttributes = $helper->getConfigurableAttributesAsArray($products, $config);
38
+
39
+ $io = $helper->createFeed($config);
40
+ $summary = $this->getFeedHeader($config);
41
+ $helper->writeRow($summary, $io, 'config');
42
+ $feedStats = $this->getFeedData($products, $config, $parentAttributes, $prices, $io, $timeStart);
43
+ $helper->closeFeed($io, $config);
44
+
45
+ return $feedStats;
46
+ }
47
+
48
+ /**
49
+ * @param $storeId
50
+ * @param string $type
51
+ *
52
+ * @return array
53
+ */
54
+ public function getFeedConfig($storeId, $type = 'xml')
55
+ {
56
+
57
+ $config = array();
58
+ $feed = Mage::helper('sooqr');
59
+ $filename = $this->getFileName('sooqr', $storeId);
60
+ $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
61
+
62
+ // DEFAULTS
63
+ $config['store_id'] = $storeId;
64
+ $config['website_name'] = $feed->cleanData(Mage::getModel('core/website')->load($websiteId)->getName(), 'striptags');
65
+ $config['website_url'] = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
66
+ $config['media_url'] = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
67
+ $config['media_image_url'] = $config['media_url'] . 'catalog' . DS . 'product';
68
+ $config['media_gallery_id'] = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', 'media_gallery');
69
+ $config['image_source'] = Mage::getStoreConfig('sooqr_connect/products/image_source', $storeId);
70
+ $config['image_resize'] = Mage::getStoreConfig('sooqr_connect/products/image_resize', $storeId);
71
+ $config['file_name'] = $filename;
72
+ $config['limit'] = Mage::getStoreConfig('sooqr_connect/generate/limit', $storeId);
73
+ $config['version'] = (string)Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
74
+ $config['filter_enabled'] = Mage::getStoreConfig('sooqr_connect/products/category_enabled', $storeId);
75
+ $config['filter_cat'] = Mage::getStoreConfig('sooqr_connect/products/categories', $storeId);
76
+ $config['filter_type'] = Mage::getStoreConfig('sooqr_connect/products/category_type', $storeId);
77
+ $config['cms_pages'] = Mage::getStoreConfig('sooqr_connect/products/cms_pages', $storeId);
78
+ $config['cms_include'] = Mage::getStoreConfig('sooqr_connect/products/cms_include', $storeId);
79
+ $config['filters'] = @unserialize(Mage::getStoreConfig('sooqr_connect/products/advanced', $storeId));
80
+ $config['product_url_suffix'] = $feed->getProductUrlSuffix($storeId);
81
+ $config['stock_manage'] = Mage::getStoreConfig('cataloginventory/item_options/manage_stock');
82
+ $config['backorders'] = Mage::getStoreConfig('cataloginventory/item_options/backorders');
83
+ $config['token'] = Mage::getStoreConfig('sooqr_connect/generate/token');
84
+
85
+ // PRICE
86
+ $config['price_scope'] = Mage::getStoreConfig('catalog/price/scope');
87
+ $config['price_add_tax'] = Mage::getStoreConfig('sooqr_connect/products/add_tax', $storeId);
88
+ $config['price_add_tax_perc'] = Mage::getStoreConfig('sooqr_connect/products/tax_percentage', $storeId);
89
+ $config['price_grouped'] = Mage::getStoreConfig('sooqr_connect/products/grouped_price', $storeId);
90
+ $config['simple_price'] = Mage::getStoreConfig('sooqr_connect/products/simple_price', $storeId);
91
+ $config['force_tax'] = Mage::getStoreConfig('sooqr_connect/products/force_tax', $storeId);
92
+ $config['price_rules'] = true;
93
+ $config['currency'] = Mage::app()->getStore($storeId)->getCurrentCurrencyCode();
94
+ $config['currency_allow'] = Mage::getStoreConfig('currency/options/allow', $storeId);
95
+ $config['hide_currency'] = true;
96
+ $config['base_currency_code'] = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
97
+ $config['currency_data'] = $this->getCurrencies($storeId, $config['base_currency_code'], $config['currency']);
98
+ $config['conf_enabled'] = Mage::getStoreConfig('sooqr_connect/products/conf_enabled', $storeId);
99
+ $config['conf_fields'] = Mage::getStoreConfig('sooqr_connect/products/conf_fields', $storeId);
100
+
101
+ $config['markup'] = $feed->getPriceMarkup($config);
102
+ $config['use_tax'] = $feed->getTaxUsage($config);
103
+
104
+ // FIELD & CATEGORY DATA
105
+ $config['field'] = $this->getFeedAttributes($storeId, $type, $config);
106
+ $config['category_data'] = $feed->getCategoryData($config, $storeId);
107
+
108
+ if ($config['image_resize'] == 'fixed') {
109
+ $config['image_size'] = Mage::getStoreConfig('sooqr_connect/products/image_size_fixed', $storeId);
110
+ } else {
111
+ $config['image_size'] = Mage::getStoreConfig('sooqr_connect/products/image_size_custom', $storeId);
112
+ }
113
+
114
+ $websiteUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
115
+ $config['file_name'] = $this->getFileName('sooqr', $storeId);
116
+ $config['file_path'] = Mage::getBaseDir() . DS . 'media' . DS . 'sooqr';
117
+ $config['file_url'] = $websiteUrl . 'sooqr' . DS . $config['file_name'];
118
+
119
+ return $config;
120
+ }
121
+
122
+ /**
123
+ * @param $type
124
+ * @param $storeId
125
+ *
126
+ * @return mixed|string
127
+ */
128
+ public function getFileName($type, $storeId)
129
+ {
130
+ if (!$fileName = Mage::getStoreConfig($type . '/generate/filename', $storeId)) {
131
+ $fileName = $type . '.xml';
132
+ }
133
+
134
+ if (substr($fileName, -3) != 'xml') {
135
+ $fileName = $fileName . '-' . $storeId . '.xml';
136
+ } else {
137
+ $fileName = substr($fileName, 0, -4) . '-' . $storeId . '.xml';
138
+ }
139
+
140
+ return $fileName;
141
+ }
142
+
143
+ /**
144
+ * @param $storeId
145
+ * @param $baseCurrency
146
+ * @param $storeCurrency
147
+ *
148
+ * @return array
149
+ */
150
+ public function getCurrencies($storeId, $baseCurrency, $storeCurrency)
151
+ {
152
+ $allow = explode(',', Mage::getStoreConfig('currency/options/allow', $storeId));
153
+ $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrency, array_values($allow));
154
+
155
+ if ($baseCurrency == $storeCurrency) {
156
+ return $rates;
157
+ }
158
+
159
+ $baseRates = array();
160
+ foreach ($rates as $key => $rate) {
161
+ $baseRates[$key] = $rate * ($rates[$baseCurrency] / $rates[$storeCurrency]);
162
+ }
163
+
164
+ return $baseRates;
165
+ }
166
+
167
+ /**
168
+ * @param int $storeId
169
+ * @param string $type
170
+ * @param string $config
171
+ *
172
+ * @return mixed
173
+ */
174
+ public function getFeedAttributes($storeId = 0, $type = 'xml', $config = '')
175
+ {
176
+ $attributes = array();
177
+ $attributes['content_type'] = array(
178
+ 'label' => 'content_type',
179
+ 'static' => 'product'
180
+ );
181
+ $attributes['id'] = array(
182
+ 'label' => 'id',
183
+ 'source' => Mage::getStoreConfig('sooqr_connect/products/id_attribute', $storeId)
184
+ );
185
+ $attributes['name'] = array(
186
+ 'label' => 'title',
187
+ 'source' => Mage::getStoreConfig('sooqr_connect/products/name_attribute', $storeId)
188
+ );
189
+ $attributes['sku'] = array(
190
+ 'label' => 'sku',
191
+ 'source' => Mage::getStoreConfig('sooqr_connect/products/sku_attribute', $storeId)
192
+ );
193
+ $attributes['description'] = array(
194
+ 'label' => 'description',
195
+ 'source' => Mage::getStoreConfig('sooqr_connect/products/description_attribute', $storeId),
196
+ 'action' => 'striptags'
197
+ );
198
+ $attributes['brand'] = array(
199
+ 'label' => 'brand',
200
+ 'source' => Mage::getStoreConfig('sooqr_connect/products/brand_attribute', $storeId)
201
+ );
202
+ $attributes['product_url'] = array(
203
+ 'label' => 'url',
204
+ 'source' => ''
205
+ );
206
+ $attributes['image_link'] = array(
207
+ 'label' => 'image_link',
208
+ 'source' => Mage::getStoreConfig('sooqr_connect/products/image_source', $storeId)
209
+ );
210
+ $attributes['price'] = array(
211
+ 'label' => 'price',
212
+ 'source' => ''
213
+ );
214
+ $attributes['parent_id'] = array(
215
+ 'label' => 'assoc_id',
216
+ 'source' => 'entity_id',
217
+ 'parent' => 1
218
+ );
219
+ $attributes['qty'] = array(
220
+ 'label' => 'stock',
221
+ 'source' => 'qty',
222
+ 'action' => 'round'
223
+ );
224
+ $attributes['stock_status'] = array(
225
+ 'label' => 'stock_status',
226
+ 'source' => 'stock_status'
227
+ );
228
+ $attributes['type'] = array(
229
+ 'label' => 'product_object_type',
230
+ 'source' => 'type_id'
231
+ );
232
+ $attributes['visibility'] = array(
233
+ 'label' => 'visibility',
234
+ 'source' => 'visibility'
235
+ );
236
+ $attributes['status'] = array(
237
+ 'label' => 'status',
238
+ 'source' => 'status'
239
+ );
240
+ $attributes['categories'] = array(
241
+ 'label' => 'categories',
242
+ 'source' => '',
243
+ 'parent' => 1
244
+ );
245
+ if ($extraFields = @unserialize(Mage::getStoreConfig('sooqr_connect/products/extra', $storeId))) {
246
+ foreach ($extraFields as $extraField) {
247
+ $attributes[$extraField['attribute']] = array(
248
+ 'label' => $extraField['attribute'],
249
+ 'source' => $extraField['attribute'],
250
+ 'action' => 'striptags'
251
+ );
252
+ }
253
+ }
254
+
255
+ if ($type == 'flatcheck') {
256
+ if ($filters = @unserialize(Mage::getStoreConfig('sooqr_connect/products/advanced', $storeId))) {
257
+ foreach ($filters as $filter) {
258
+ $attributes[$filter['attribute']] = array(
259
+ 'label' => $filter['attribute'],
260
+ 'source' => $filter['attribute']
261
+ );
262
+ }
263
+ }
264
+ }
265
+
266
+ return Mage::helper('sooqr')->addAttributeData($attributes, $config);
267
+ }
268
+
269
+ /**
270
+ * @param $products
271
+ * @param $parents
272
+ * @param $config
273
+ * @param $parentAttributes
274
+ * @param $prices
275
+ * @param $io
276
+ *
277
+ * @return array
278
+ */
279
+ public function getFeedData($products, $config, $parentAttributes, $prices, $io, $timeStart)
280
+ {
281
+ $feedStats = array();
282
+ $helper = Mage::helper('sooqr');
283
+ $qty = 0;
284
+
285
+ foreach ($products as $product) {
286
+ if ($parentId = $helper->getParentData($product, $config)) {
287
+ $parent = $products->getItemById($parentId);
288
+ } else {
289
+ $parent = '';
290
+ }
291
+
292
+ $productData = $helper->getProductDataRow($product, $config, $parent, $parentAttributes);
293
+
294
+ if ($productData) {
295
+ foreach ($productData as $key => $value) {
296
+ if (!is_array($value)) {
297
+ $productRow[$key] = $value;
298
+ }
299
+ }
300
+
301
+ if (!empty($parent)) {
302
+ $sAtts = $this->getSuperAtts($parent);
303
+ } else {
304
+ $sAtts = '';
305
+ }
306
+
307
+ if ($extraData = $this->getExtraDataFields($productData, $config, $product, $sAtts, $parent, $prices)) {
308
+ $productRow = array_merge($productRow, $extraData);
309
+ }
310
+
311
+ $helper->writeRow($productRow, $io, 'product');
312
+ unset($productRow);
313
+ $qty++;
314
+ }
315
+ }
316
+
317
+ if ($cmsPages = $this->getCmspages($config)) {
318
+ foreach ($cmsPages as $item) {
319
+ $helper->writeRow($item, $io, 'product');
320
+ }
321
+ }
322
+
323
+ $summary = $this->getFeedResults($timeStart, $qty, $config['limit']);
324
+ $helper->writeRow($summary, $io, 'results');
325
+
326
+ $feedStats['qty'] = $qty;
327
+ $feedStats['date'] = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
328
+ $feedStats['url'] = $config['file_url'];
329
+ $feedStats['shop'] = Mage::app()->getStore($config['store_id'])->getCode();
330
+
331
+ return $feedStats;
332
+ }
333
+
334
+ /**
335
+ * @param $parent
336
+ *
337
+ * @return mixed
338
+ */
339
+ public function getSuperAtts($parent)
340
+ {
341
+ if ($parent->getTypeId() == 'configurable') {
342
+ return $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
343
+ }
344
+
345
+ return false;
346
+ }
347
+
348
+ /**
349
+ * @param $productData
350
+ * @param $config
351
+ * @param $product
352
+ * @param $prices
353
+ *
354
+ * @return array
355
+ */
356
+ public function getExtraDataFields($productData, $config, $product, $prices)
357
+ {
358
+ $extraDataFields = array();
359
+ if ($categoryData = $this->getCategoryData($productData)) {
360
+ $extraDataFields = array_merge($extraDataFields, $categoryData);
361
+ }
362
+
363
+ if ($pricesData = $this->getPrices($productData['price'], $config['currency'], $config, $prices, $product)) {
364
+ $extraDataFields = array_merge($extraDataFields, $pricesData);
365
+ }
366
+
367
+ if ($assocId = $this->getAssocId($productData)) {
368
+ $extraDataFields = array_merge($extraDataFields, $assocId);
369
+ }
370
+
371
+ if ($stockData = $this->getStockData($config, $product)) {
372
+ $extraDataFields = array_merge($extraDataFields, $stockData);
373
+ }
374
+
375
+ return $extraDataFields;
376
+ }
377
+
378
+ /**
379
+ * @param $productData
380
+ *
381
+ * @return array
382
+ */
383
+ public function getCategoryData($productData)
384
+ {
385
+ $category = array();
386
+ if (!empty($productData['categories'])) {
387
+ foreach ($productData['categories'] as $cat) {
388
+ if (!empty($cat['path'])) {
389
+ $i = 0;
390
+ foreach ($cat['path'] as $catpath) {
391
+ $category[$i][] = $catpath;
392
+ $i++;
393
+ }
394
+ }
395
+ }
396
+ }
397
+
398
+ $categoryArray = array();
399
+ $i = 0;
400
+ if (!empty($category)) {
401
+ foreach ($category as $cat) {
402
+ $categoryArray['category' . $i] = array_unique($cat);
403
+ $i++;
404
+ }
405
+ }
406
+
407
+ return $categoryArray;
408
+ }
409
+
410
+ /**
411
+ * @param $data
412
+ * @param $currency
413
+ * @param $config
414
+ * @param $confPrices
415
+ * @param $product
416
+ *
417
+ * @return array
418
+ */
419
+ public function getPrices($data, $currency, $config, $confPrices, $product)
420
+ {
421
+ $prices = array();
422
+ $id = $product->getEntityId();
423
+ $prices['currency'] = $currency;
424
+ if (!empty($confPrices[$id])) {
425
+ $confPrice = Mage::helper('tax')->getPrice($product, $confPrices[$id], true);
426
+ $confPriceReg = Mage::helper('tax')->getPrice($product, $confPrices[$id . '_reg'], true);
427
+ if ($confPriceReg > $confPrice) {
428
+ $prices['price'] = $confPrice;
429
+ $prices['normal_price'] = $confPriceReg;
430
+ } else {
431
+ $prices['price'] = $confPrice;
432
+ }
433
+ } else {
434
+ if (!empty($config['currency_data'])) {
435
+ foreach ($config['currency_data'] as $key => $value) {
436
+ if ($currency == $key) {
437
+ if (isset($data['sales_price'])) {
438
+ $prices['normal_price'] = $data['regular_price'];
439
+ $prices['price'] = $data['sales_price'];
440
+ } else {
441
+ $prices['price'] = $data['price'];
442
+ }
443
+ } else {
444
+ if (isset($data['sales_price'])) {
445
+ $prices['normal_price_' . strtolower($key)] = round(($data['regular_price'] * $value), 2);
446
+ $prices['price_' . strtolower($key)] = round(($data['sales_price'] * $value), 2);
447
+ } else {
448
+ $prices['price_' . strtolower($key)] = round(($data['price'] * $value), 2);
449
+ }
450
+ }
451
+ }
452
+ } else {
453
+ if (isset($data['sales_price'])) {
454
+ $prices['normal_price'] = $data['regular_price'];
455
+ $prices['price'] = $data['sales_price'];
456
+ } else {
457
+ $prices['price'] = $data['price'];
458
+ }
459
+ }
460
+ }
461
+
462
+ return $prices;
463
+ }
464
+
465
+ /**
466
+ * @param $data
467
+ *
468
+ * @return array
469
+ */
470
+ public function getAssocId($data)
471
+ {
472
+ $assocId = array();
473
+ if (empty($data['assoc_id'])) {
474
+ $assocId['assoc_id'] = $data['id'];
475
+ }
476
+
477
+ if ($data['product_object_type'] != 'simple') {
478
+ $assocId['is_parent'] = '1';
479
+ } else {
480
+ $assocId['is_parent'] = '0';
481
+ }
482
+
483
+ return $assocId;
484
+ }
485
+
486
+ /**
487
+ * @param $config
488
+ * @param $product
489
+ *
490
+ * @return array
491
+ */
492
+ public function getStockData($config, $product)
493
+ {
494
+ $stockData = array();
495
+ if ($product->getUseConfigManageStock()) {
496
+ $stockData['manage_stock'] = (string)$config['stock_manage'];
497
+ } else {
498
+ $stockData['manage_stock'] = (string)$product->getManageStock();
499
+ }
500
+
501
+ if ($product->getUseConfigBackorders()) {
502
+ $stockData['backorders'] = (string)$config['backorders'];
503
+ } else {
504
+ $stockData['backorders'] = (string)$product->getBackorders();
505
  }
506
+
507
+ return $stockData;
508
+ }
509
+
510
+ /**
511
+ * @param $config
512
+ *
513
+ * @return array
514
+ */
515
+ public function getFeedHeader($config)
516
+ {
517
+ $header = array();
518
+ $header['system'] = 'Magento';
519
+ $header['extension'] = 'Magmodules_Sooqr';
520
+ $header['extension_version'] = $config['version'];
521
+ $header['store'] = $config['website_name'];
522
+ $header['url'] = $config['website_url'];
523
+ $header['token'] = $config['token'];
524
+ return $header;
525
  }
526
 
527
+ /**
528
+ * @param $timeStart
529
+ * @param $count
530
+ * @param $limit
531
+ *
532
+ * @return array
533
+ */
534
+ public function getFeedResults($timeStart, $count, $limit)
535
+ {
536
+ $summary = array();
537
+ $summary['products_total'] = $count;
538
+ $summary['products_limit'] = $limit;
539
+ $summary['processing_time'] = number_format((microtime(true) - $timeStart), 4);
540
+ $summary['date_created'] = Mage::getModel('core/date')->date('Y-m-d H:i:s');
541
+ return $summary;
542
+ }
543
+
544
+ /**
545
+ * @return array
546
+ */
547
+ public function getInstallation()
548
+ {
549
+ $json = array();
550
+ $json['search']['enabled'] = '0';
551
+ $storeIds = Mage::helper('sooqr')->getStoreIds('sooqr_connect/generate/enabled');
552
+ foreach ($storeIds as $storeId) {
553
+ $mediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
554
+ if (!$fileName = Mage::getStoreConfig('sooqr_connect/generate/filename', $storeId)) {
555
+ $fileName = 'soorq.xml';
556
+ }
557
+
558
+ if (substr($fileName, -3) != 'xml') {
559
+ $fileName = $fileName . '-' . $storeId . '.xml';
560
+ } else {
561
+ $fileName = substr($fileName, 0, -4) . '-' . $storeId . '.xml';
562
+ }
563
+
564
+ $name = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
565
+ $name = str_replace(array('https://', 'http://', 'www'), '', $name);
566
+
567
+ $json['feeds'][$storeId]['name'] = $name;
568
+ $json['feeds'][$storeId]['feed_url'] = $mediaUrl . DS . 'sooqr' . DS . $fileName;
569
+ $json['feeds'][$storeId]['currency'] = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
570
+ $json['feeds'][$storeId]['locale'] = Mage::getStoreConfig('general/locale/code', $storeId);
571
+ $json['feeds'][$storeId]['country'] = Mage::getStoreConfig('general/country/default', $storeId);
572
+ $json['feeds'][$storeId]['timezone'] = Mage::getStoreConfig('general/locale/timezone', $storeId);
573
+ $json['feeds'][$storeId]['system'] = Mage::getStoreConfig('general/locale/timezone', $storeId);
574
+ $json['feeds'][$storeId]['extension'] = 'Magmodules_Sooqr';
575
+ $json['feeds'][$storeId]['extension_version'] = (string)Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
576
+ }
577
+
578
+ return $json;
579
+ }
580
+
581
+ /**
582
+ * @param $config
583
+ *
584
+ * @return array
585
+ */
586
+ public function getCmspages($config)
587
+ {
588
+ $cmspages = array();
589
+ if ($config['cms_pages'] == 1) {
590
+ $pages = Mage::getModel('cms/page')->getCollection()->addStoreFilter($config['store_id'])->addFieldToFilter(
591
+ 'is_active',
592
+ 1
593
+ )->addFieldToFilter('identifier', array(array('nin' => array('no-route', 'enable-cookies'))));
594
  } else {
595
+ $cmsInclude = explode(',', $config['cms_include']);
596
+ $pages = Mage::getModel('cms/page')->getCollection()
597
+ ->addStoreFilter($config['store_id'])
598
+ ->addFieldToFilter('is_active', 1)
599
+ ->addFieldToFilter('page_id', array('in' => $cmsInclude));
600
+ }
601
+
602
+ foreach ($pages as $page) {
603
+ $cmspages[] = array(
604
+ 'content_type' => 'cms',
605
+ 'id' => 'CMS-' . $page->getId(),
606
+ 'title' => $page->getTitle(),
607
+ 'content' => Mage::helper('sooqr')->cleanData($page->getContent(), 'striptags'),
608
+ 'url' => $config['website_url'] . $page->getIdentifier()
609
+ );
610
  }
611
+
612
+ return $cmspages;
613
+ }
614
+
615
+ /**
616
+ * @param $storeId
617
+ */
618
+ public function setMemoryLimit($storeId)
619
+ {
620
+ if (Mage::getStoreConfig('sooqr_connect/generate/overwrite', $storeId)) {
621
+ if ($memoryLimit = Mage::getStoreConfig('sooqr_connect/generate/memory_limit', $storeId)) {
622
+ ini_set('memory_limit', $memoryLimit);
623
+ }
624
+
625
+ if ($maxExecutionTime = Mage::getStoreConfig('sooqr_connect/generate/max_execution_time', $storeId)) {
626
+ ini_set('max_execution_time', $maxExecutionTime);
627
+ }
628
+ }
629
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
  }
app/code/community/Magmodules/Sooqr/Model/Source/Action.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class Magmodules_Sooqr_Model_Source_Action
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $position = array();
27
+ $position[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('-- None'));
28
+ $position[] = array('value' => 'strip_tags', 'label' => Mage::helper('sooqr')->__('Strip Tags'));
29
+ return $position;
30
+ }
31
+
32
+ }
app/code/community/Magmodules/Sooqr/Model/Source/Attribute.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class Magmodules_Sooqr_Model_Source_Attribute
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+
27
+ $optionArray = array();
28
+
29
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
30
+ ->addVisibleFilter()
31
+ ->addFieldToFilter(
32
+ 'backend_type',
33
+ array('text', 'select', 'textarea', 'date', 'int', 'boolean', 'static', 'varchar')
34
+ );
35
+
36
+ // Some Default Attributes
37
+ $optionArray[] = array('label' => Mage::helper('sooqr')->__('- Product ID'), 'value' => 'entity_id');
38
+ $optionArray[] = array('label' => Mage::helper('sooqr')->__('- Final Price'), 'value' => 'final_price');
39
+
40
+ foreach ($attributes as $attribute) {
41
+ $optionArray[] = array(
42
+ 'label' => str_replace("'", "", $attribute->getData('frontend_label')),
43
+ 'value' => $attribute->getData('attribute_code')
44
+ );
45
+ }
46
+
47
+ return $optionArray;
48
+ }
49
+
50
+ }
app/code/community/Magmodules/Sooqr/Model/Source/Countries.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class Magmodules_Sooqr_Model_Source_Countries
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ return Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(true);
27
+ }
28
+
29
+ }
app/code/community/Magmodules/Sooqr/Model/Source/Tax.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class Magmodules_Sooqr_Model_Source_Tax
22
+ {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $position = array();
27
+ $position[] = array('value' => '', 'label' => Mage::helper('sooqr')->__('No'));
28
+ $position[] = array('value' => 'incl', 'label' => Mage::helper('sooqr')->__('Force including Tax'));
29
+ $position[] = array('value' => 'excl', 'label' => Mage::helper('sooqr')->__('Force excluding Tax'));
30
+ return $position;
31
+ }
32
+
33
+ }
app/code/community/Magmodules/Sooqr/Model/System/Config/Backend/Design/Extra.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Magmodules_Sooqr_Model_System_Config_Backend_Design_Extra
22
+ extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array
23
+ {
24
+
25
+ public function _beforeSave()
26
+ {
27
+ $value = $this->getValue();
28
+ if (is_array($value)) {
29
+ unset($value['__empty']);
30
+ if (count($value)) {
31
+ $value = $this->orderData($value, 'attribute');
32
+ $keys = array();
33
+ for ($i = 0; $i < count($value); $i++) {
34
+ $keys[] = 'fields_' . uniqid();
35
+ }
36
+
37
+ foreach ($value as $key => $field) {
38
+ $attribute = Mage::getModel('eav/entity_attribute')->loadByCode(
39
+ 'catalog_product',
40
+ $field['attribute']
41
+ );
42
+ $value[$key]['attribute'] = $field['attribute'];
43
+ $value[$key]['type'] = $attribute->getFrontendInput();
44
+ }
45
+
46
+ $value = array_combine($keys, array_values($value));
47
+ }
48
+ }
49
+
50
+ $this->setValue($value);
51
+ parent::_beforeSave();
52
+ }
53
+
54
+ function orderData($data, $sort)
55
+ {
56
+ $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
57
+ usort($data, create_function('$a,$b', $code));
58
+ return $data;
59
+ }
60
+
61
+ }
app/code/community/Magmodules/Sooqr/controllers/Adminhtml/SooqrController.php CHANGED
@@ -1,82 +1,153 @@
1
  <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2015 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_Adminhtml_SooqrController extends Mage_Adminhtml_Controller_Action {
19
 
20
- public function generateFeedAction($store_id = '')
21
- {
22
- $store_id = $this->getRequest()->getParam('store_id');
23
- if(!empty($store_id)) {
24
- $time_start = microtime(true);
25
- $appEmulation = Mage::getSingleton('core/app_emulation');
26
- $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($store_id);
27
- if($result = Mage::getModel('sooqr/sooqr')->generateFeed($store_id, '', $time_start)) {
28
- $html = '<a href="' . $result['url'] . '" target="_blank">' . $result['url'] .'</a><br/><small>Date: ' . $result['date'] . ' (manual) - Products: ' . $result['qty'] . ' - Time: ' . number_format((microtime(true) - $time_start), 4) . '</small>';
29
- $config = new Mage_Core_Model_Config();
30
- $config->saveConfig('sooqr_connect/generate/feed_result', $html, 'stores', $store_id);
31
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sooqr')->__('Generated feed with %s products. %s', $result['qty'], '<a style="float:right;" href="' . $this->getUrl('*/sooqr/download/store_id/' . $store_id) . '">Download XML</a>'));
32
- $limit = Mage::getStoreConfig('sooqr_connect/generate/limit', $store_id);
33
- if($limit > 0) {
34
- Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('sooqr')->__('Note, in the feed generate configuration tab you have enabled the product limit of %s.', $limit));
35
- }
36
- } else {
37
- $config = new Mage_Core_Model_Config();
38
- $config->saveConfig('sooqr_connect/generate/feed_result', '', 'stores', $store_id);
39
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sooqr')->__('No products found, make sure your filters are configured with existing values.'));
40
- }
41
- $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  $this->_redirect('adminhtml/system_config/edit/section/sooqr_connect');
44
- }
 
 
 
 
 
 
 
 
 
 
 
45
 
46
- public function downloadAction()
47
- {
48
- $store_id = $this->getRequest()->getParam('store_id');
49
- $filepath = Mage::getModel('sooqr/sooqr')->getFileName('sooqr', $store_id, 0);
50
- if(file_exists($filepath)) {
51
- $this->getResponse()
52
- ->setHttpResponseCode(200)
53
- ->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', true)
54
- ->setHeader('Pragma','no-cache',1)
55
- ->setHeader('Content-type', 'application/force-download')
56
- ->setHeader('Content-Length', filesize($filepath) )
57
- ->setHeader('Content-Disposition', 'attachment' . '; filename=' . basename($filepath) );
58
- $this->getResponse()->clearBody();
59
- $this->getResponse()->sendHeaders();
60
- readfile($filepath);
61
- }
62
- }
63
-
64
- public function addToFlatAction()
65
- {
66
- $store_ids = Mage::helper('sooqr')->getStoreIds('sooqr_connect/generate/enabled');
67
- foreach($store_ids as $store_id) {
68
- $non_flat_attributes = Mage::helper('sooqr')->checkFlatCatalog(Mage::getModel("sooqr/sooqr")->getFeedAttributes($store_id, 'flatcheck'));
69
- foreach($non_flat_attributes as $key => $value) {
70
- $_attribute = Mage::getModel('catalog/resource_eav_attribute')->load($key)->setUsedInProductListing(1)->save();
71
- }
72
- }
73
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sooqr')->__('Attributes added to Flat Catalog, please reindex Product Flat Data.'));
74
  $this->_redirect('adminhtml/system_config/edit/section/sooqr_connect');
75
- }
 
 
 
 
 
 
 
 
 
 
 
76
 
77
- protected function _isAllowed()
78
- {
 
 
 
 
 
 
79
  return Mage::getSingleton('admin/session')->isAllowed('admin/system/config/sooqr_connect');
80
- }
81
-
82
  }
1
  <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Sooqr_Adminhtml_SooqrController extends Mage_Adminhtml_Controller_Action
22
+ {
23
+
24
+ public function generateFeedAction()
25
+ {
26
+ $storeId = $this->getRequest()->getParam('store_id');
27
+ $config = Mage::getModel('core/config');
28
+
29
+ if (!empty($storeId)) {
30
+ $timeStart = microtime(true);
31
+ $appEmulation = Mage::getSingleton('core/app_emulation');
32
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
33
+ if ($result = Mage::getModel('sooqr/sooqr')->generateFeed($storeId, $timeStart)) {
34
+ $html = '<a href="' . $result['url'] . '" target="_blank">' . $result['url'] . '</a>
35
+ <br/>
36
+ <small>
37
+ Date: ' . $result['date'] . ' (manual) -
38
+ Products: ' . $result['qty'] . ' -
39
+ Time: ' . number_format((microtime(true) - $timeStart), 4) . '
40
+ </small>';
41
+ $config->saveConfig('sooqr_connect/generate/feed_result', $html, 'stores', $storeId);
42
+ $url = $this->getUrl('*/sooqr/download/store_id/' . $storeId);
43
+ Mage::getSingleton('adminhtml/session')->addSuccess(
44
+ Mage::helper('sooqr')->__(
45
+ 'Generated feed with %s products. %s',
46
+ $result['qty'],
47
+ '<a style="float:right;" href="' . $url . '">Download XML</a>'
48
+ )
49
+ );
50
+ $limit = Mage::getStoreConfig('sooqr_connect/generate/limit', $storeId);
51
+ if ($limit > 0) {
52
+ Mage::getSingleton('adminhtml/session')->addNotice(
53
+ Mage::helper('sooqr')->__(
54
+ 'Note, in the feed generate configuration tab you have enabled the product limit of %s.',
55
+ $limit
56
+ )
57
+ );
58
+ }
59
+ } else {
60
+ $config->saveConfig('sooqr_connect/generate/feed_result', '', 'stores', $storeId);
61
+ $msg = $this->__('No products found, make sure your filters are configured with existing values.');
62
+ Mage::getSingleton('adminhtml/session')->addError($msg);
63
+ }
64
+
65
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
66
+ }
67
+
68
+ $this->_redirect('adminhtml/system_config/edit/section/sooqr_connect');
69
+ }
70
+
71
+ public function downloadAction()
72
+ {
73
+ $storeId = $this->getRequest()->getParam('store_id');
74
+ if ($fileName = Mage::getModel('sooqr/sooqr')->getFileName('sooqr', $storeId, 0)) {
75
+ $filePath = Mage::getBaseDir() . DS . 'media' . DS . 'sooqr' . DS . $fileName;
76
+ }
77
+
78
+ if (file_exists($filePath)) {
79
+ $this->getResponse()
80
+ ->setHttpResponseCode(200)
81
+ ->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', true)
82
+ ->setHeader('Pragma', 'no-cache', 1)
83
+ ->setHeader('Content-type', 'application/force-download')
84
+ ->setHeader('Content-Length', filesize($filePath))
85
+ ->setHeader('Content-Disposition', 'attachment' . '; filename=' . basename($filePath));
86
+ $this->getResponse()->clearBody();
87
+ $this->getResponse()->sendHeaders();
88
+ readfile($filePath);
89
+ }
90
+ }
91
+
92
+ /**
93
+ *
94
+ */
95
+ public function addToFlatAction()
96
+ {
97
+ $storeIds = Mage::helper('sooqr')->getStoreIds('sooqr_connect/generate/enabled');
98
+ foreach ($storeIds as $storeId) {
99
+ $nonFlatAttributes = Mage::helper('sooqr')->checkFlatCatalog(
100
+ Mage::getModel("sooqr/sooqr")->getFeedAttributes(
101
+ $storeId,
102
+ 'flatcheck'
103
+ )
104
+ );
105
+ foreach ($nonFlatAttributes as $key => $value) {
106
+ Mage::getModel('catalog/resource_eav_attribute')->load($key)
107
+ ->setUsedInProductListing(1)
108
+ ->save();
109
+ }
110
+ }
111
+
112
+ $msg = $this->__('Attributes added to Flat Catalog, please reindex Product Flat Data.');
113
+ Mage::getSingleton('adminhtml/session')->addSuccess($msg);
114
  $this->_redirect('adminhtml/system_config/edit/section/sooqr_connect');
115
+ }
116
+
117
+ /**
118
+ *
119
+ */
120
+ public function disableFeedAction()
121
+ {
122
+ $storeId = $this->getRequest()->getParam('store_id');
123
+ if ($storeId > 0) {
124
+ $config = Mage::getModel('core/config');
125
+ $config->saveConfig('sooqr_connect/generate/enabled', '', 'stores', $storeId);
126
+ }
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  $this->_redirect('adminhtml/system_config/edit/section/sooqr_connect');
129
+ }
130
+
131
+ /**
132
+ *
133
+ */
134
+ public function enableFeedAction()
135
+ {
136
+ $storeId = $this->getRequest()->getParam('store_id');
137
+ if ($storeId > 0) {
138
+ $config = Mage::getModel('core/config');
139
+ $config->saveConfig('sooqr_connect/generate/enabled', 1, 'stores', $storeId);
140
+ }
141
 
142
+ $this->_redirect('adminhtml/system_config/edit/section/sooqr_connect');
143
+ }
144
+
145
+ /**
146
+ * @return mixed
147
+ */
148
+ public function _isAllowed()
149
+ {
150
  return Mage::getSingleton('admin/session')->isAllowed('admin/system/config/sooqr_connect');
151
+ }
152
+
153
  }
app/code/community/Magmodules/Sooqr/controllers/InstallationController.php CHANGED
@@ -1,30 +1,34 @@
1
  <?php
 
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
-
18
- class Magmodules_Sooqr_InstallationController extends Mage_Core_Controller_Front_Action {
19
-
20
- public function indexAction()
21
- {
22
- if(Mage::getStoreConfig('sooqr_connect/general/enabled')) {
23
- if($feed = Mage::getModel('sooqr/sooqr')->getInstallation()) {
24
- $this->getResponse()->clearHeaders()->setHeader('Content-type','application/json',true);
25
- $this->getResponse()->setBody(json_encode($feed));
26
- }
27
- }
28
- }
29
-
30
  }
1
  <?php
2
+
3
  /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Sooqr
17
+ * @author Magmodules <info@magmodules.eu>
18
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
+ class Magmodules_Sooqr_InstallationController extends Mage_Core_Controller_Front_Action
22
+ {
23
+
24
+ public function indexAction()
25
+ {
26
+ if (Mage::getStoreConfig('sooqr_connect/general/enabled')) {
27
+ if ($feed = Mage::getModel('sooqr/sooqr')->getInstallation()) {
28
+ $this->getResponse()->clearHeaders()->setHeader('Content-type', 'application/json', true);
29
+ $this->getResponse()->setBody(json_encode($feed));
30
+ }
31
+ }
32
+ }
33
+
34
  }
app/code/community/Magmodules/Sooqr/data/magmodules_sooqr_setup/data-install-1.1.9.php CHANGED
@@ -1,25 +1,28 @@
1
- <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
  $token = '';
19
  $chars = str_split("abcdefghijklmnopqrstuvwxyz0123456789");
20
- for($i = 0; $i < 16; $i++) {
21
- $token .= $chars[array_rand($chars)];
22
  }
23
 
24
- $config = new Mage_Core_Model_Config();
25
  $config->saveConfig('sooqr_connect/generate/token', $token, 'default', 0);
1
+ <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
  $token = '';
22
  $chars = str_split("abcdefghijklmnopqrstuvwxyz0123456789");
23
+ for ($i = 0; $i < 16; $i++) {
24
+ $token .= $chars[array_rand($chars)];
25
  }
26
 
27
+ $config = Mage::getModel('core/config');
28
  $config->saveConfig('sooqr_connect/generate/token', $token, 'default', 0);
app/code/community/Magmodules/Sooqr/data/magmodules_sooqr_setup/data-upgrade-1.1.8-1.1.9.php CHANGED
@@ -1,25 +1,28 @@
1
- <?php
2
  /**
3
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
4
- * =============================================================
5
- * NOTICE OF LICENSE [Single domain license]
6
- * This source file is subject to the EULA that is
7
- * available through the world-wide-web at:
8
- * http://www.magmodules.eu/license-agreement/
9
- * =============================================================
10
- * @category Magmodules
11
- * @package Magmodules_Sooqr
12
- * @author Magmodules <info@magmodules.eu>
13
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
14
- * @license http://www.magmodules.eu/license-agreement/
15
- * =============================================================
 
 
 
16
  */
17
 
18
  $token = '';
19
  $chars = str_split("abcdefghijklmnopqrstuvwxyz0123456789");
20
- for($i = 0; $i < 16; $i++) {
21
- $token .= $chars[array_rand($chars)];
22
  }
23
 
24
- $config = new Mage_Core_Model_Config();
25
  $config->saveConfig('sooqr_connect/generate/token', $token, 'default', 0);
1
+ <?php
2
  /**
3
+ * Magmodules.eu - http://www.magmodules.eu
4
+ *
5
+ * NOTICE OF LICENSE
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to info@magmodules.eu so we can send you a copy immediately.
13
+ *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
  $token = '';
22
  $chars = str_split("abcdefghijklmnopqrstuvwxyz0123456789");
23
+ for ($i = 0; $i < 16; $i++) {
24
+ $token .= $chars[array_rand($chars)];
25
  }
26
 
27
+ $config = Mage::getModel('core/config');
28
  $config->saveConfig('sooqr_connect/generate/token', $token, 'default', 0);
app/code/community/Magmodules/Sooqr/etc/adminhtml.xml CHANGED
@@ -1,21 +1,22 @@
1
  <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
5
- * =============================================================
6
- * NOTICE OF LICENSE [Single domain license]
7
- * This source file is subject to the EULA that is
8
- * available through the world-wide-web at:
9
- * http://www.magmodules.eu/license-agreement/
10
- * =============================================================
11
- * @category Magmodules
12
- * @package Magmodules_Sooqr
13
- * @author Magmodules <info@magmodules.eu>
14
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
15
- * @license http://www.magmodules.eu/license-agreement/
16
- * =============================================================
17
- */
18
- -->
 
19
  <config>
20
  <acl>
21
  <resources>
@@ -31,7 +32,7 @@
31
  </children>
32
  </config>
33
  </children>
34
- </system>
35
  </children>
36
  </admin>
37
  </resources>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Sooqr
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
20
  <config>
21
  <acl>
22
  <resources>
32
  </children>
33
  </config>
34
  </children>
35
+ </system>
36
  </children>
37
  </admin>
38
  </resources>
app/code/community/Magmodules/Sooqr/etc/config.xml CHANGED
@@ -1,43 +1,44 @@
1
  <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
5
- * =============================================================
6
- * NOTICE OF LICENSE [Single domain license]
7
- * This source file is subject to the EULA that is
8
- * available through the world-wide-web at:
9
- * http://www.magmodules.eu/license-agreement/
10
- * =============================================================
11
- * @category Magmodules
12
- * @package Magmodules_Sooqr
13
- * @author Magmodules <info@magmodules.eu>
14
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
15
- * @license http://www.magmodules.eu/license-agreement/
16
- * =============================================================
17
- */
18
- -->
 
19
  <config>
20
- <modules>
21
- <Magmodules_Sooqr>
22
- <version>1.1.9</version>
23
- </Magmodules_Sooqr>
24
- </modules>
25
- <global>
26
- <helpers>
27
- <sooqr>
28
- <class>Magmodules_Sooqr_Helper</class>
29
- </sooqr>
30
- </helpers>
31
- <blocks>
32
- <sooqr>
33
- <class>Magmodules_Sooqr_Block</class>
34
- </sooqr>
35
- </blocks>
36
- <models>
37
- <sooqr>
38
- <class>Magmodules_Sooqr_Model</class>
39
- </sooqr>
40
- </models>
41
  <resources>
42
  <magmodules_sooqr_setup>
43
  <setup>
@@ -47,18 +48,18 @@
47
  <use>core_setup</use>
48
  </connection>
49
  </magmodules_sooqr_setup>
50
- </resources>
51
- </global>
52
- <frontend>
53
- <routers>
54
- <sooqr>
55
- <use>standard</use>
56
- <args>
57
- <module>Magmodules_Sooqr</module>
58
- <frontName>sooqr</frontName>
59
- </args>
60
- </sooqr>
61
- </routers>
62
  <layout>
63
  <updates>
64
  <sooqr>
@@ -78,11 +79,11 @@
78
  <product>
79
  <collection>
80
  <attributes>
81
- <image />
82
- </attributes>
83
  </collection>
84
  </product>
85
- </frontend>
86
  <admin>
87
  <routers>
88
  <adminhtml>
@@ -94,7 +95,7 @@
94
  </adminhtml>
95
  </routers>
96
  </admin>
97
- <adminhtml>
98
  <translate>
99
  <modules>
100
  <magmodules_sooqr>
@@ -103,39 +104,41 @@
103
  </files>
104
  </magmodules_sooqr>
105
  </modules>
106
- </translate>
107
  </adminhtml>
108
- <default>
109
- <sooqr_connect>
110
- <general>
111
- <enabled>0</enabled>
112
- <frontend_version>4</frontend_version>
113
- </general>
114
- <products>
115
- <id_attribute>id</id_attribute>
116
- <name_attribute>name</name_attribute>
117
- <sku_attribute>sku</sku_attribute>
118
- <description_attribute>description</description_attribute>
119
- <brand_attribute>manufacturer</brand_attribute>
120
- <image_source>small_image</image_source>
121
- </products>
122
- <generate>
123
- <enabled>1</enabled>
124
- <filename>sooqr-datafeed.xml</filename>
125
- <cron>0</cron>
126
- <limit>10</limit>
127
- <cron_schedule>0 0 * * *</cron_schedule>
128
- <memory_limit>1024M</memory_limit>
129
- <max_execution_time>300</max_execution_time>
130
- <overwrite>0</overwrite>
131
- </generate>
132
- </sooqr_connect>
133
- </default>
134
- <crontab>
135
  <jobs>
136
- <sooqr_generate>
137
- <run><model>sooqr/observer::scheduledGenerateSooqr</model></run>
138
- </sooqr_generate>
 
 
139
  </jobs>
140
- </crontab>
141
  </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Sooqr
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
20
  <config>
21
+ <modules>
22
+ <Magmodules_Sooqr>
23
+ <version>1.2.0</version>
24
+ </Magmodules_Sooqr>
25
+ </modules>
26
+ <global>
27
+ <helpers>
28
+ <sooqr>
29
+ <class>Magmodules_Sooqr_Helper</class>
30
+ </sooqr>
31
+ </helpers>
32
+ <blocks>
33
+ <sooqr>
34
+ <class>Magmodules_Sooqr_Block</class>
35
+ </sooqr>
36
+ </blocks>
37
+ <models>
38
+ <sooqr>
39
+ <class>Magmodules_Sooqr_Model</class>
40
+ </sooqr>
41
+ </models>
42
  <resources>
43
  <magmodules_sooqr_setup>
44
  <setup>
48
  <use>core_setup</use>
49
  </connection>
50
  </magmodules_sooqr_setup>
51
+ </resources>
52
+ </global>
53
+ <frontend>
54
+ <routers>
55
+ <sooqr>
56
+ <use>standard</use>
57
+ <args>
58
+ <module>Magmodules_Sooqr</module>
59
+ <frontName>sooqr</frontName>
60
+ </args>
61
+ </sooqr>
62
+ </routers>
63
  <layout>
64
  <updates>
65
  <sooqr>
79
  <product>
80
  <collection>
81
  <attributes>
82
+ <image/>
83
+ </attributes>
84
  </collection>
85
  </product>
86
+ </frontend>
87
  <admin>
88
  <routers>
89
  <adminhtml>
95
  </adminhtml>
96
  </routers>
97
  </admin>
98
+ <adminhtml>
99
  <translate>
100
  <modules>
101
  <magmodules_sooqr>
104
  </files>
105
  </magmodules_sooqr>
106
  </modules>
107
+ </translate>
108
  </adminhtml>
109
+ <default>
110
+ <sooqr_connect>
111
+ <general>
112
+ <enabled>0</enabled>
113
+ <frontend_version>4</frontend_version>
114
+ </general>
115
+ <products>
116
+ <id_attribute>id</id_attribute>
117
+ <name_attribute>name</name_attribute>
118
+ <sku_attribute>sku</sku_attribute>
119
+ <description_attribute>description</description_attribute>
120
+ <brand_attribute>manufacturer</brand_attribute>
121
+ <image_source>small_image</image_source>
122
+ </products>
123
+ <generate>
124
+ <enabled>1</enabled>
125
+ <filename>sooqr-datafeed.xml</filename>
126
+ <cron>0</cron>
127
+ <limit>10</limit>
128
+ <cron_schedule>0 0 * * *</cron_schedule>
129
+ <memory_limit>1024M</memory_limit>
130
+ <max_execution_time>300</max_execution_time>
131
+ <overwrite>0</overwrite>
132
+ </generate>
133
+ </sooqr_connect>
134
+ </default>
135
+ <crontab>
136
  <jobs>
137
+ <sooqr_generate>
138
+ <run>
139
+ <model>sooqr/observer::scheduledGenerateSooqr</model>
140
+ </run>
141
+ </sooqr_generate>
142
  </jobs>
143
+ </crontab>
144
  </config>
app/code/community/Magmodules/Sooqr/etc/system.xml CHANGED
@@ -1,62 +1,63 @@
1
  <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
5
- * =============================================================
6
- * NOTICE OF LICENSE [Single domain license]
7
- * This source file is subject to the EULA that is
8
- * available through the world-wide-web at:
9
- * http://www.magmodules.eu/license-agreement/
10
- * =============================================================
11
- * @category Magmodules
12
- * @package Magmodules_Sooqr
13
- * @author Magmodules <info@magmodules.eu>
14
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
15
- * @license http://www.magmodules.eu/license-agreement/
16
- * =============================================================
17
- */
18
- -->
 
19
  <config>
20
- <tabs>
21
- <magmodules translate="label" module="sooqr">
22
- <label>Magmodules</label>
23
- <sort_order>200</sort_order>
24
- </magmodules>
25
- </tabs>
26
- <sections>
27
- <sooqr_connect translate="label" module="sooqr">
28
- <label>Sooqr Connect</label>
29
- <tab>magmodules</tab>
30
- <frontend_type>text</frontend_type>
31
- <sort_order>119</sort_order>
32
- <show_in_default>1</show_in_default>
33
- <show_in_website>1</show_in_website>
34
- <show_in_store>1</show_in_store>
35
- <groups>
36
- <info>
37
- <frontend_model>sooqr/adminhtml_widget_info_info</frontend_model>
38
- <sort_order>1</sort_order>
39
- <show_in_default>1</show_in_default>
40
- <show_in_website>1</show_in_website>
41
- <show_in_store>1</show_in_store>
42
- </info>
43
- <general translate="label" module="sooqr">
44
- <label>General</label>
45
- <frontend_type>text</frontend_type>
46
- <sort_order>2</sort_order>
47
- <show_in_default>1</show_in_default>
48
- <show_in_website>1</show_in_website>
49
- <show_in_store>1</show_in_store>
50
- <expanded>1</expanded>
51
- <fields>
52
- <note translate="label">
53
  <label><![CDATA[Set the general settings to connect your store with the Sooqr API.]]></label>
54
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
55
  <sort_order>1</sort_order>
56
  <show_in_default>1</show_in_default>
57
  <show_in_website>1</show_in_website>
58
- <show_in_store>1</show_in_store>
59
- </note>
60
  <version translate="label">
61
  <label>Extension Version</label>
62
  <frontend_type>text</frontend_type>
@@ -65,7 +66,7 @@
65
  <show_in_default>1</show_in_default>
66
  <show_in_website>0</show_in_website>
67
  <show_in_store>0</show_in_store>
68
- </version>
69
  <enabled translate="label">
70
  <label>Enabled</label>
71
  <frontend_type>select</frontend_type>
@@ -74,42 +75,42 @@
74
  <show_in_default>1</show_in_default>
75
  <show_in_website>0</show_in_website>
76
  <show_in_store>0</show_in_store>
77
- </enabled>
78
- <api_heading translate="label">
79
  <label>API Details</label>
80
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
81
  <sort_order>10</sort_order>
82
  <show_in_default>1</show_in_default>
83
  <show_in_website>1</show_in_website>
84
  <show_in_store>1</show_in_store>
85
- </api_heading>
86
- <account_id translate="label">
87
- <label>Sooqr Account ID</label>
88
- <frontend_type>text</frontend_type>
89
- <sort_order>11</sort_order>
90
- <show_in_default>1</show_in_default>
91
- <show_in_website>1</show_in_website>
92
- <show_in_store>1</show_in_store>
93
- <tooltip>You can find your Sooqr Account ID in your Sooqr account, you can find the link in the information box at the top of this page.</tooltip>
94
- <comment>It should look like SQ-12345-1.</comment>
95
- </account_id>
96
- <api_key translate="label">
97
- <label>Sooqr API Key</label>
98
- <frontend_type>text</frontend_type>
99
- <sort_order>12</sort_order>
100
- <show_in_default>1</show_in_default>
101
- <show_in_website>1</show_in_website>
102
- <show_in_store>1</show_in_store>
103
- <tooltip>You can find your Sooqr API Key in your Sooqr account, you can find the link in the information box at the top of this page.</tooltip>
104
- </api_key>
105
- <frontend_heading translate="label">
106
  <label>Frontend Settings</label>
107
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
108
  <sort_order>20</sort_order>
109
  <show_in_default>1</show_in_default>
110
  <show_in_website>1</show_in_website>
111
  <show_in_store>1</show_in_store>
112
- </frontend_heading>
113
  <frontend_enabled translate="label">
114
  <label>Enable</label>
115
  <frontend_type>select</frontend_type>
@@ -127,15 +128,15 @@
127
  <show_in_default>1</show_in_default>
128
  <show_in_website>1</show_in_website>
129
  <show_in_store>1</show_in_store>
130
- </statistics>
131
- <advanced_heading translate="label">
132
  <label>Advanced Settings</label>
133
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
134
  <sort_order>30</sort_order>
135
  <show_in_default>1</show_in_default>
136
  <show_in_website>1</show_in_website>
137
  <show_in_store>1</show_in_store>
138
- </advanced_heading>
139
  <parent translate="label">
140
  <label>Parent HTML node</label>
141
  <frontend_type>text</frontend_type>
@@ -143,7 +144,7 @@
143
  <show_in_default>1</show_in_default>
144
  <show_in_website>1</show_in_website>
145
  <show_in_store>1</show_in_store>
146
- </parent>
147
  <staging translate="label">
148
  <label>Staging Environment</label>
149
  <frontend_type>select</frontend_type>
@@ -178,176 +179,180 @@
178
  <show_in_default>1</show_in_default>
179
  <show_in_website>1</show_in_website>
180
  <show_in_store>1</show_in_store>
181
- </custom_js>
182
- </fields>
183
- </general>
184
- <products translate="label" module="sooqr">
185
- <label>Product &amp; CMS Data</label>
186
- <frontend_type>text</frontend_type>
187
- <sort_order>3</sort_order>
188
- <show_in_default>1</show_in_default>
189
- <show_in_website>1</show_in_website>
190
- <show_in_store>1</show_in_store>
191
- <expanded>1</expanded>
192
- <fields>
193
- <note translate="label">
194
  <label><![CDATA[This section lists all the available attributes for the Sooqr Product Feed. Some attributes are required for all products and some are required for certain product types such as apparel, others are recommended. To get the best results with Sooqr lease make sure that you provide most of the attributes.]]></label>
195
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
196
  <sort_order>1</sort_order>
197
  <show_in_default>1</show_in_default>
198
  <show_in_website>1</show_in_website>
199
- <show_in_store>1</show_in_store>
200
  </note>
201
- <data_heading translate="label">
202
  <label>Product Fields</label>
203
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
204
  <sort_order>10</sort_order>
205
  <show_in_default>1</show_in_default>
206
  <show_in_website>1</show_in_website>
207
  <show_in_store>1</show_in_store>
208
- </data_heading>
209
- <id_attribute translate="label">
210
- <label>ID</label>
211
- <frontend_type>select</frontend_type>
212
- <source_model>sooqr/adminhtml_system_config_source_productid</source_model>
213
- <sort_order>11</sort_order>
214
- <show_in_default>1</show_in_default>
215
- <show_in_website>1</show_in_website>
216
- <show_in_store>1</show_in_store>
217
- </id_attribute>
218
- <name_attribute translate="label">
219
- <label>Name</label>
220
- <frontend_type>select</frontend_type>
221
- <source_model>sooqr/adminhtml_system_config_source_attribute</source_model>
222
- <sort_order>12</sort_order>
223
- <show_in_default>1</show_in_default>
224
- <show_in_website>1</show_in_website>
225
- <show_in_store>1</show_in_store>
226
- </name_attribute>
227
- <sku_attribute translate="label">
228
- <label>Sku</label>
229
- <frontend_type>select</frontend_type>
230
- <source_model>sooqr/adminhtml_system_config_source_attribute</source_model>
231
- <sort_order>13</sort_order>
232
- <show_in_default>1</show_in_default>
233
- <show_in_website>1</show_in_website>
234
- <show_in_store>1</show_in_store>
235
- </sku_attribute>
236
- <description_attribute translate="label">
237
- <label>Description</label>
238
- <frontend_type>select</frontend_type>
239
- <source_model>sooqr/adminhtml_system_config_source_attribute</source_model>
240
- <sort_order>14</sort_order>
241
- <show_in_default>1</show_in_default>
242
- <show_in_website>1</show_in_website>
243
- <show_in_store>1</show_in_store>
244
- </description_attribute>
245
- <brand_attribute translate="label">
246
- <label>Brand</label>
247
- <frontend_type>select</frontend_type>
248
- <source_model>sooqr/adminhtml_system_config_source_attribute</source_model>
249
- <sort_order>15</sort_order>
250
- <show_in_default>1</show_in_default>
251
- <show_in_website>1</show_in_website>
252
- <show_in_store>1</show_in_store>
253
- </brand_attribute>
254
- <images_heading translate="label">
255
  <label>Images</label>
256
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
257
  <sort_order>20</sort_order>
258
  <show_in_default>1</show_in_default>
259
  <show_in_website>0</show_in_website>
260
  <show_in_store>1</show_in_store>
261
- </images_heading>
262
- <note_resize translate="label">
263
  <label><![CDATA[Image resize options are only available on store level which can be selected from the scope dropdown on the left top of this page.<br>]]></label>
264
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
265
  <sort_order>21</sort_order>
266
  <show_in_default>1</show_in_default>
267
  <show_in_website>0</show_in_website>
268
- <show_in_store>0</show_in_store>
269
- </note_resize>
270
- <image_source translate="label">
271
- <label>Source</label>
272
- <frontend_type>select</frontend_type>
273
- <source_model>sooqr/adminhtml_system_config_source_images</source_model>
274
- <sort_order>22</sort_order>
275
- <show_in_default>1</show_in_default>
276
- <show_in_website>0</show_in_website>
277
- <show_in_store>1</show_in_store>
278
- </image_source>
279
- <image_resize translate="label">
280
  <label>Resize Image</label>
281
  <frontend_type>select</frontend_type>
282
- <source_model>sooqr/adminhtml_system_config_source_resize</source_model>
283
  <sort_order>23</sort_order>
284
  <show_in_default>0</show_in_default>
285
  <show_in_website>0</show_in_website>
286
  <show_in_store>1</show_in_store>
287
- </image_resize>
288
- <image_size_fixed translate="label">
289
- <label>Image Size</label>
290
  <frontend_type>select</frontend_type>
291
- <source_model>sooqr/adminhtml_system_config_source_cacheresize</source_model>
292
- <sort_order>24</sort_order>
293
- <show_in_default>0</show_in_default>
294
- <show_in_website>0</show_in_website>
295
- <show_in_store>1</show_in_store>
296
- <depends><image_resize>fixed</image_resize></depends>
297
- <comment>List of available sizes in cache directory.</comment>
298
- </image_size_fixed>
299
- <image_size_custom translate="label">
300
- <label>Image Size</label>
301
- <frontend_type>text</frontend_type>
302
- <sort_order>24</sort_order>
303
- <show_in_default>0</show_in_default>
304
- <show_in_website>0</show_in_website>
305
- <show_in_store>1</show_in_store>
306
- <depends><image_resize>custom</image_resize></depends>
307
- <comment>Example format: 200x300</comment>
308
- </image_size_custom>
309
- <extra_heading translate="label">
 
 
 
 
310
  <label>Extra Fields</label>
311
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
312
  <sort_order>30</sort_order>
313
  <show_in_default>1</show_in_default>
314
  <show_in_website>1</show_in_website>
315
  <show_in_store>1</show_in_store>
316
- </extra_heading>
317
- <extra_note translate="label">
318
  <label><![CDATA[Add your custom attributes as Sooqr fields. The maximum number of allowed fields is restricted by your Sooqr subscription.]]></label>
319
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
320
  <sort_order>31</sort_order>
321
  <show_in_default>1</show_in_default>
322
  <show_in_website>1</show_in_website>
323
- <show_in_store>1</show_in_store>
324
- </extra_note>
325
- <extra>
326
- <label>Extra Fields</label>
327
  <frontend_model>sooqr/adminhtml_config_form_field_extra</frontend_model>
328
- <backend_model>sooqr/adminhtml_system_config_backend_design_extra</backend_model>
329
  <sort_order>32</sort_order>
330
  <show_in_default>1</show_in_default>
331
  <show_in_website>1</show_in_website>
332
  <show_in_store>1</show_in_store>
333
- </extra>
334
- <tax_heading translate="label">
335
  <label>Prices and Tax</label>
336
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
337
  <sort_order>40</sort_order>
338
  <show_in_default>1</show_in_default>
339
  <show_in_website>1</show_in_website>
340
  <show_in_store>1</show_in_store>
341
- </tax_heading>
342
- <tax_note translate="label">
343
  <label><![CDATA[By default prices are shown incl. Tax so only change this option if necessary.<br>If the feed export is without tax it's possible to add it with this option.<br>]]></label>
344
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
345
  <sort_order>41</sort_order>
346
  <show_in_default>1</show_in_default>
347
  <show_in_website>1</show_in_website>
348
- <show_in_store>1</show_in_store>
349
- </tax_note>
350
- <force_tax translate="label">
351
  <label>Force Tax Usage</label>
352
  <frontend_type>select</frontend_type>
353
  <source_model>sooqr/adminhtml_system_config_source_tax</source_model>
@@ -356,7 +361,7 @@
356
  <show_in_website>1</show_in_website>
357
  <show_in_store>1</show_in_store>
358
  </force_tax>
359
- <add_tax translate="label">
360
  <label>Manually Add Tax</label>
361
  <frontend_type>select</frontend_type>
362
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -365,17 +370,19 @@
365
  <show_in_website>1</show_in_website>
366
  <show_in_store>1</show_in_store>
367
  </add_tax>
368
- <tax_percentage translate="label">
369
- <label>Percentage</label>
370
- <frontend_type>text</frontend_type>
371
- <sort_order>44</sort_order>
372
- <show_in_default>1</show_in_default>
373
- <show_in_website>1</show_in_website>
374
- <show_in_store>1</show_in_store>
375
- <comment><![CDATA[When the tax percentage is 21% use 21.]]></comment>
376
- <depends><add_tax>1</add_tax></depends>
377
- </tax_percentage>
378
- <configurable_heading translate="label">
 
 
379
  <label>Configurable &amp; Grouped</label>
380
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
381
  <sort_order>50</sort_order>
@@ -383,15 +390,15 @@
383
  <show_in_website>1</show_in_website>
384
  <show_in_store>1</show_in_store>
385
  </configurable_heading>
386
- <configurable_note translate="label">
387
  <label><![CDATA[Export non visible simple products of configurable and grouped products.]]></label>
388
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
389
  <sort_order>51</sort_order>
390
  <show_in_default>1</show_in_default>
391
  <show_in_website>1</show_in_website>
392
- <show_in_store>1</show_in_store>
393
- </configurable_note>
394
- <conf_enabled translate="label">
395
  <label>Enable</label>
396
  <frontend_type>select</frontend_type>
397
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -399,24 +406,37 @@
399
  <show_in_default>1</show_in_default>
400
  <show_in_website>1</show_in_website>
401
  <show_in_store>1</show_in_store>
402
- </conf_enabled>
403
- <grouped_price translate="label">
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  <label>Grouped Price</label>
405
  <frontend_type>select</frontend_type>
406
- <source_model>sooqr/adminhtml_system_config_source_pricemodel</source_model>
407
- <sort_order>53</sort_order>
408
  <show_in_default>1</show_in_default>
409
  <show_in_website>1</show_in_website>
410
  <show_in_store>1</show_in_store>
411
  </grouped_price>
412
- <category_heading translate="label">
413
  <label>Filter by Category</label>
414
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
415
  <sort_order>60</sort_order>
416
  <show_in_default>1</show_in_default>
417
  <show_in_website>1</show_in_website>
418
  <show_in_store>1</show_in_store>
419
- </category_heading>
420
  <category_enabled translate="label">
421
  <label>Enabled</label>
422
  <frontend_type>select</frontend_type>
@@ -425,53 +445,57 @@
425
  <show_in_default>1</show_in_default>
426
  <show_in_website>1</show_in_website>
427
  <show_in_store>1</show_in_store>
428
- </category_enabled>
429
- <category_type translate="label">
430
- <label>Type of filter</label>
431
- <frontend_type>select</frontend_type>
432
- <source_model>sooqr/adminhtml_system_config_source_categorytype</source_model>
433
- <sort_order>62</sort_order>
434
- <show_in_default>1</show_in_default>
435
- <show_in_website>1</show_in_website>
436
- <show_in_store>1</show_in_store>
437
- <depends><category_enabled>1</category_enabled></depends>
438
- </category_type>
439
- <categories translate="label">
440
- <label>Category</label>
441
- <frontend_type>multiselect</frontend_type>
442
- <source_model>sooqr/adminhtml_system_config_source_category</source_model>
443
- <sort_order>63</sort_order>
444
- <show_in_default>1</show_in_default>
445
- <show_in_website>1</show_in_website>
446
- <show_in_store>1</show_in_store>
447
- <depends><category_enabled>1</category_enabled></depends>
448
- </categories>
449
- <advanced_heading translate="label">
 
 
 
 
450
  <label>Advanced</label>
451
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
452
  <sort_order>70</sort_order>
453
  <show_in_default>1</show_in_default>
454
  <show_in_website>1</show_in_website>
455
  <show_in_store>1</show_in_store>
456
- </advanced_heading>
457
- <advanced>
458
- <label>Advanced Filter</label>
459
- <frontend_model>sooqr/adminhtml_config_form_field_filter</frontend_model>
460
- <backend_model>sooqr/adminhtml_system_config_backend_design_filter</backend_model>
461
- <sort_order>71</sort_order>
462
- <show_in_default>1</show_in_default>
463
- <show_in_website>1</show_in_website>
464
- <show_in_store>1</show_in_store>
465
- </advanced>
466
- <cms_heading translate="label">
467
  <label>Export CMS Pages</label>
468
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
469
  <sort_order>80</sort_order>
470
  <show_in_default>1</show_in_default>
471
  <show_in_website>1</show_in_website>
472
  <show_in_store>1</show_in_store>
473
- </cms_heading>
474
- <cms_pages translate="label">
475
  <label>Enable</label>
476
  <frontend_type>select</frontend_type>
477
  <source_model>sooqr/adminhtml_system_config_source_cms</source_model>
@@ -480,44 +504,46 @@
480
  <show_in_website>1</show_in_website>
481
  <show_in_store>1</show_in_store>
482
  </cms_pages>
483
- <cms_include translate="label">
484
- <label>Only include</label>
485
- <frontend_type>multiselect</frontend_type>
486
- <source_model>sooqr/adminhtml_system_config_source_cmspages</source_model>
487
- <sort_order>82</sort_order>
488
- <show_in_default>1</show_in_default>
489
- <show_in_website>1</show_in_website>
490
- <show_in_store>1</show_in_store>
491
- <depends><cms_pages>2</cms_pages></depends>
492
- </cms_include>
493
- </fields>
494
- </products>
495
- <generate translate="label" module="sooqr">
496
- <label>Feed Generation Settings</label>
497
- <frontend_type>text</frontend_type>
498
- <sort_order>8</sort_order>
499
- <show_in_default>1</show_in_default>
500
- <show_in_website>1</show_in_website>
501
- <show_in_store>1</show_in_store>
502
- <expanded>1</expanded>
503
- <fields>
504
- <note translate="label">
 
 
505
  <label><![CDATA[Each store view will have their own Sooqr feed, you can easily activate or de-activate the Sooqr feed generation on store level or automatically generate the Sooqr feed. In case your not using the cron job functionality it's possible to generate the Sooqr feed manually.]]></label>
506
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
507
  <sort_order>1</sort_order>
508
  <show_in_default>1</show_in_default>
509
  <show_in_website>1</show_in_website>
510
- <show_in_store>1</show_in_store>
511
- </note>
512
- <exclude_heading translate="label">
513
  <label>Feed Generation</label>
514
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
515
  <sort_order>10</sort_order>
516
  <show_in_default>1</show_in_default>
517
  <show_in_website>1</show_in_website>
518
  <show_in_store>1</show_in_store>
519
- </exclude_heading>
520
- <enabled translate="label">
521
  <label>Enabled</label>
522
  <frontend_type>select</frontend_type>
523
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -526,33 +552,33 @@
526
  <show_in_website>1</show_in_website>
527
  <show_in_store>1</show_in_store>
528
  </enabled>
529
- <filename translate="label">
530
- <label>Filename</label>
531
- <frontend_type>text</frontend_type>
532
- <sort_order>12</sort_order>
533
- <show_in_default>1</show_in_default>
534
- <show_in_website>1</show_in_website>
535
- <show_in_store>1</show_in_store>
536
- <comment><![CDATA[sqoor-datatfeed.xml]]></comment>
537
- </filename>
538
- <limit translate="label">
539
- <label>Limit Products</label>
540
- <frontend_type>text</frontend_type>
541
- <sort_order>13</sort_order>
542
- <show_in_default>1</show_in_default>
543
- <show_in_website>1</show_in_website>
544
- <show_in_store>1</show_in_store>
545
- <comment><![CDATA[Set limit for testing, use 0 for all products]]></comment>
546
- </limit>
547
- <server_heading translate="label">
548
  <label>Overwrite server settings</label>
549
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
550
  <sort_order>20</sort_order>
551
  <show_in_default>1</show_in_default>
552
  <show_in_website>0</show_in_website>
553
  <show_in_store>0</show_in_store>
554
- </server_heading>
555
- <overwrite translate="label">
556
  <label>Enabled</label>
557
  <frontend_type>select</frontend_type>
558
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -561,36 +587,40 @@
561
  <show_in_website>0</show_in_website>
562
  <show_in_store>0</show_in_store>
563
  <tooltip>Only use this option if it's necessary to overwrite this setting because of your server memory limit or execution time.</tooltip>
564
- </overwrite>
565
- <memory_limit translate="label">
566
- <label>Memory Limit</label>
567
- <frontend_type>text</frontend_type>
568
- <sort_order>22</sort_order>
569
- <show_in_default>1</show_in_default>
570
- <show_in_website>0</show_in_website>
571
- <show_in_store>0</show_in_store>
572
- <depends><overwrite>1</overwrite></depends>
573
- <comment><![CDATA[This overwrites the maximum amount of memory in bytes that a script is allowed to allocate, eg: 1024M.]]></comment>
574
- </memory_limit>
575
- <max_execution_time translate="label">
576
- <label>Max Execution Time</label>
577
- <frontend_type>text</frontend_type>
578
- <sort_order>23</sort_order>
579
- <show_in_default>1</show_in_default>
580
- <show_in_website>0</show_in_website>
581
- <show_in_store>0</show_in_store>
582
- <depends><overwrite>1</overwrite></depends>
583
- <comment><![CDATA[This overwrites the maximum time in seconds a script is allowed to run before it is terminated by the parser, eg: 300 (for 5 minutes).]]></comment>
584
- </max_execution_time>
585
- <cron_heading translate="label">
 
 
 
 
586
  <label>Cron</label>
587
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
588
  <sort_order>30</sort_order>
589
  <show_in_default>1</show_in_default>
590
  <show_in_website>1</show_in_website>
591
  <show_in_store>1</show_in_store>
592
- </cron_heading>
593
- <cron translate="label">
594
  <label>Enabled</label>
595
  <frontend_type>select</frontend_type>
596
  <source_model>adminhtml/system_config_source_yesno</source_model>
@@ -598,7 +628,7 @@
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
- </cron>
602
  <frequency translate="label">
603
  <label>Frequency</label>
604
  <frontend_type>select</frontend_type>
@@ -609,35 +639,37 @@
609
  <show_in_website>1</show_in_website>
610
  <show_in_store>1</show_in_store>
611
  </frequency>
612
- <custom_cron translate="label">
613
- <label>Custom Cron Expression</label>
614
- <frontend_type>text</frontend_type>
615
- <sort_order>33</sort_order>
616
- <show_in_default>1</show_in_default>
617
- <show_in_website>0</show_in_website>
618
- <show_in_store>0</show_in_store>
619
- <depends><frequency>custom_expr</frequency></depends>
620
- <comment><![CDATA[e.g. 15 */2 * * *]]></comment>
621
- </custom_cron>
622
- <feeds_heading translate="label">
 
 
623
  <label>Generated Feeds</label>
624
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
625
  <sort_order>40</sort_order>
626
  <show_in_default>1</show_in_default>
627
  <show_in_website>1</show_in_website>
628
  <show_in_store>1</show_in_store>
629
- </feeds_heading>
630
- <feeds_text translate="label">
631
- <label>Text</label>
632
  <frontend_model>sooqr/adminhtml_system_config_form_field_feeds</frontend_model>
633
- <sort_order>41</sort_order>
634
- <show_in_default>1</show_in_default>
635
- <show_in_website>1</show_in_website>
636
- <show_in_store>1</show_in_store>
637
- </feeds_text>
638
- </fields>
639
- </generate>
640
- </groups>
641
- </sooqr_connect>
642
- </sections>
643
  </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Sooqr
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
20
  <config>
21
+ <tabs>
22
+ <magmodules translate="label" module="sooqr">
23
+ <label>Magmodules</label>
24
+ <sort_order>200</sort_order>
25
+ </magmodules>
26
+ </tabs>
27
+ <sections>
28
+ <sooqr_connect translate="label" module="sooqr">
29
+ <label>Sooqr Connect</label>
30
+ <tab>magmodules</tab>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>119</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ <groups>
37
+ <info>
38
+ <frontend_model>sooqr/adminhtml_widget_info_info</frontend_model>
39
+ <sort_order>1</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </info>
44
+ <general translate="label" module="sooqr">
45
+ <label>General</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>2</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ <expanded>1</expanded>
52
+ <fields>
53
+ <note translate="label">
54
  <label><![CDATA[Set the general settings to connect your store with the Sooqr API.]]></label>
55
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
56
  <sort_order>1</sort_order>
57
  <show_in_default>1</show_in_default>
58
  <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </note>
61
  <version translate="label">
62
  <label>Extension Version</label>
63
  <frontend_type>text</frontend_type>
66
  <show_in_default>1</show_in_default>
67
  <show_in_website>0</show_in_website>
68
  <show_in_store>0</show_in_store>
69
+ </version>
70
  <enabled translate="label">
71
  <label>Enabled</label>
72
  <frontend_type>select</frontend_type>
75
  <show_in_default>1</show_in_default>
76
  <show_in_website>0</show_in_website>
77
  <show_in_store>0</show_in_store>
78
+ </enabled>
79
+ <api_heading translate="label">
80
  <label>API Details</label>
81
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
82
  <sort_order>10</sort_order>
83
  <show_in_default>1</show_in_default>
84
  <show_in_website>1</show_in_website>
85
  <show_in_store>1</show_in_store>
86
+ </api_heading>
87
+ <account_id translate="label">
88
+ <label>Sooqr Account ID</label>
89
+ <frontend_type>text</frontend_type>
90
+ <sort_order>11</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <tooltip>You can find your Sooqr Account ID in your Sooqr account, you can find the link in the information box at the top of this page.</tooltip>
95
+ <comment>It should look like SQ-12345-1.</comment>
96
+ </account_id>
97
+ <api_key translate="label">
98
+ <label>Sooqr API Key</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>12</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ <tooltip>You can find your Sooqr API Key in your Sooqr account, you can find the link in the information box at the top of this page.</tooltip>
105
+ </api_key>
106
+ <frontend_heading translate="label">
107
  <label>Frontend Settings</label>
108
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
109
  <sort_order>20</sort_order>
110
  <show_in_default>1</show_in_default>
111
  <show_in_website>1</show_in_website>
112
  <show_in_store>1</show_in_store>
113
+ </frontend_heading>
114
  <frontend_enabled translate="label">
115
  <label>Enable</label>
116
  <frontend_type>select</frontend_type>
128
  <show_in_default>1</show_in_default>
129
  <show_in_website>1</show_in_website>
130
  <show_in_store>1</show_in_store>
131
+ </statistics>
132
+ <advanced_heading translate="label">
133
  <label>Advanced Settings</label>
134
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
135
  <sort_order>30</sort_order>
136
  <show_in_default>1</show_in_default>
137
  <show_in_website>1</show_in_website>
138
  <show_in_store>1</show_in_store>
139
+ </advanced_heading>
140
  <parent translate="label">
141
  <label>Parent HTML node</label>
142
  <frontend_type>text</frontend_type>
144
  <show_in_default>1</show_in_default>
145
  <show_in_website>1</show_in_website>
146
  <show_in_store>1</show_in_store>
147
+ </parent>
148
  <staging translate="label">
149
  <label>Staging Environment</label>
150
  <frontend_type>select</frontend_type>
179
  <show_in_default>1</show_in_default>
180
  <show_in_website>1</show_in_website>
181
  <show_in_store>1</show_in_store>
182
+ </custom_js>
183
+ </fields>
184
+ </general>
185
+ <products translate="label" module="sooqr">
186
+ <label>Product &amp; CMS Data</label>
187
+ <frontend_type>text</frontend_type>
188
+ <sort_order>3</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>1</show_in_website>
191
+ <show_in_store>1</show_in_store>
192
+ <expanded>1</expanded>
193
+ <fields>
194
+ <note translate="label">
195
  <label><![CDATA[This section lists all the available attributes for the Sooqr Product Feed. Some attributes are required for all products and some are required for certain product types such as apparel, others are recommended. To get the best results with Sooqr lease make sure that you provide most of the attributes.]]></label>
196
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
197
  <sort_order>1</sort_order>
198
  <show_in_default>1</show_in_default>
199
  <show_in_website>1</show_in_website>
200
+ <show_in_store>1</show_in_store>
201
  </note>
202
+ <data_heading translate="label">
203
  <label>Product Fields</label>
204
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
205
  <sort_order>10</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
+ </data_heading>
210
+ <id_attribute translate="label">
211
+ <label>ID</label>
212
+ <frontend_type>select</frontend_type>
213
+ <source_model>sooqr/adminhtml_system_config_source_productid</source_model>
214
+ <sort_order>11</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ </id_attribute>
219
+ <name_attribute translate="label">
220
+ <label>Name</label>
221
+ <frontend_type>select</frontend_type>
222
+ <source_model>sooqr/adminhtml_system_config_source_attribute</source_model>
223
+ <sort_order>12</sort_order>
224
+ <show_in_default>1</show_in_default>
225
+ <show_in_website>1</show_in_website>
226
+ <show_in_store>1</show_in_store>
227
+ </name_attribute>
228
+ <sku_attribute translate="label">
229
+ <label>Sku</label>
230
+ <frontend_type>select</frontend_type>
231
+ <source_model>sooqr/adminhtml_system_config_source_attribute</source_model>
232
+ <sort_order>13</sort_order>
233
+ <show_in_default>1</show_in_default>
234
+ <show_in_website>1</show_in_website>
235
+ <show_in_store>1</show_in_store>
236
+ </sku_attribute>
237
+ <description_attribute translate="label">
238
+ <label>Description</label>
239
+ <frontend_type>select</frontend_type>
240
+ <source_model>sooqr/adminhtml_system_config_source_attribute</source_model>
241
+ <sort_order>14</sort_order>
242
+ <show_in_default>1</show_in_default>
243
+ <show_in_website>1</show_in_website>
244
+ <show_in_store>1</show_in_store>
245
+ </description_attribute>
246
+ <brand_attribute translate="label">
247
+ <label>Brand</label>
248
+ <frontend_type>select</frontend_type>
249
+ <source_model>sooqr/adminhtml_system_config_source_attribute</source_model>
250
+ <sort_order>15</sort_order>
251
+ <show_in_default>1</show_in_default>
252
+ <show_in_website>1</show_in_website>
253
+ <show_in_store>1</show_in_store>
254
+ </brand_attribute>
255
+ <images_heading translate="label">
256
  <label>Images</label>
257
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
258
  <sort_order>20</sort_order>
259
  <show_in_default>1</show_in_default>
260
  <show_in_website>0</show_in_website>
261
  <show_in_store>1</show_in_store>
262
+ </images_heading>
263
+ <note_resize translate="label">
264
  <label><![CDATA[Image resize options are only available on store level which can be selected from the scope dropdown on the left top of this page.<br>]]></label>
265
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
266
  <sort_order>21</sort_order>
267
  <show_in_default>1</show_in_default>
268
  <show_in_website>0</show_in_website>
269
+ <show_in_store>0</show_in_store>
270
+ </note_resize>
271
+ <image_source translate="label">
272
+ <label>Source</label>
273
+ <frontend_type>select</frontend_type>
274
+ <source_model>sooqr/adminhtml_system_config_source_images</source_model>
275
+ <sort_order>22</sort_order>
276
+ <show_in_default>1</show_in_default>
277
+ <show_in_website>0</show_in_website>
278
+ <show_in_store>1</show_in_store>
279
+ </image_source>
280
+ <image_resize translate="label">
281
  <label>Resize Image</label>
282
  <frontend_type>select</frontend_type>
283
+ <source_model>sooqr/adminhtml_system_config_source_resize</source_model>
284
  <sort_order>23</sort_order>
285
  <show_in_default>0</show_in_default>
286
  <show_in_website>0</show_in_website>
287
  <show_in_store>1</show_in_store>
288
+ </image_resize>
289
+ <image_size_fixed translate="label">
290
+ <label>Image Size</label>
291
  <frontend_type>select</frontend_type>
292
+ <source_model>sooqr/adminhtml_system_config_source_cacheresize</source_model>
293
+ <sort_order>24</sort_order>
294
+ <show_in_default>0</show_in_default>
295
+ <show_in_website>0</show_in_website>
296
+ <show_in_store>1</show_in_store>
297
+ <depends>
298
+ <image_resize>fixed</image_resize>
299
+ </depends>
300
+ <comment>List of available sizes in cache directory.</comment>
301
+ </image_size_fixed>
302
+ <image_size_custom translate="label">
303
+ <label>Image Size</label>
304
+ <frontend_type>text</frontend_type>
305
+ <sort_order>24</sort_order>
306
+ <show_in_default>0</show_in_default>
307
+ <show_in_website>0</show_in_website>
308
+ <show_in_store>1</show_in_store>
309
+ <depends>
310
+ <image_resize>custom</image_resize>
311
+ </depends>
312
+ <comment>Example format: 200x300</comment>
313
+ </image_size_custom>
314
+ <extra_heading translate="label">
315
  <label>Extra Fields</label>
316
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
317
  <sort_order>30</sort_order>
318
  <show_in_default>1</show_in_default>
319
  <show_in_website>1</show_in_website>
320
  <show_in_store>1</show_in_store>
321
+ </extra_heading>
322
+ <extra_note translate="label">
323
  <label><![CDATA[Add your custom attributes as Sooqr fields. The maximum number of allowed fields is restricted by your Sooqr subscription.]]></label>
324
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
325
  <sort_order>31</sort_order>
326
  <show_in_default>1</show_in_default>
327
  <show_in_website>1</show_in_website>
328
+ <show_in_store>1</show_in_store>
329
+ </extra_note>
330
+ <extra>
331
+ <label>Extra Fields</label>
332
  <frontend_model>sooqr/adminhtml_config_form_field_extra</frontend_model>
333
+ <backend_model>sooqr/adminhtml_system_config_backend_design_extra</backend_model>
334
  <sort_order>32</sort_order>
335
  <show_in_default>1</show_in_default>
336
  <show_in_website>1</show_in_website>
337
  <show_in_store>1</show_in_store>
338
+ </extra>
339
+ <tax_heading translate="label">
340
  <label>Prices and Tax</label>
341
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
342
  <sort_order>40</sort_order>
343
  <show_in_default>1</show_in_default>
344
  <show_in_website>1</show_in_website>
345
  <show_in_store>1</show_in_store>
346
+ </tax_heading>
347
+ <tax_note translate="label">
348
  <label><![CDATA[By default prices are shown incl. Tax so only change this option if necessary.<br>If the feed export is without tax it's possible to add it with this option.<br>]]></label>
349
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
350
  <sort_order>41</sort_order>
351
  <show_in_default>1</show_in_default>
352
  <show_in_website>1</show_in_website>
353
+ <show_in_store>1</show_in_store>
354
+ </tax_note>
355
+ <force_tax translate="label">
356
  <label>Force Tax Usage</label>
357
  <frontend_type>select</frontend_type>
358
  <source_model>sooqr/adminhtml_system_config_source_tax</source_model>
361
  <show_in_website>1</show_in_website>
362
  <show_in_store>1</show_in_store>
363
  </force_tax>
364
+ <add_tax translate="label">
365
  <label>Manually Add Tax</label>
366
  <frontend_type>select</frontend_type>
367
  <source_model>adminhtml/system_config_source_yesno</source_model>
370
  <show_in_website>1</show_in_website>
371
  <show_in_store>1</show_in_store>
372
  </add_tax>
373
+ <tax_percentage translate="label">
374
+ <label>Percentage</label>
375
+ <frontend_type>text</frontend_type>
376
+ <sort_order>44</sort_order>
377
+ <show_in_default>1</show_in_default>
378
+ <show_in_website>1</show_in_website>
379
+ <show_in_store>1</show_in_store>
380
+ <comment><![CDATA[When the tax percentage is 21% use 21.]]></comment>
381
+ <depends>
382
+ <add_tax>1</add_tax>
383
+ </depends>
384
+ </tax_percentage>
385
+ <configurable_heading translate="label">
386
  <label>Configurable &amp; Grouped</label>
387
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
388
  <sort_order>50</sort_order>
390
  <show_in_website>1</show_in_website>
391
  <show_in_store>1</show_in_store>
392
  </configurable_heading>
393
+ <configurable_note translate="label">
394
  <label><![CDATA[Export non visible simple products of configurable and grouped products.]]></label>
395
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
396
  <sort_order>51</sort_order>
397
  <show_in_default>1</show_in_default>
398
  <show_in_website>1</show_in_website>
399
+ <show_in_store>1</show_in_store>
400
+ </configurable_note>
401
+ <conf_enabled translate="label">
402
  <label>Enable</label>
403
  <frontend_type>select</frontend_type>
404
  <source_model>adminhtml/system_config_source_yesno</source_model>
406
  <show_in_default>1</show_in_default>
407
  <show_in_website>1</show_in_website>
408
  <show_in_store>1</show_in_store>
409
+ </conf_enabled>
410
+ <conf_fields translate="label">
411
+ <label>Use the Parent Data for Simple</label>
412
+ <frontend_type>multiselect</frontend_type>
413
+ <source_model>sooqr/adminhtml_system_config_source_configurable</source_model>
414
+ <sort_order>53</sort_order>
415
+ <show_in_default>1</show_in_default>
416
+ <show_in_website>0</show_in_website>
417
+ <show_in_store>0</show_in_store>
418
+ <depends>
419
+ <conf_enabled>1</conf_enabled>
420
+ </depends>
421
+ <comment>Use the parent data</comment>
422
+ </conf_fields>
423
+ <grouped_price translate="label">
424
  <label>Grouped Price</label>
425
  <frontend_type>select</frontend_type>
426
+ <source_model>sooqr/adminhtml_system_config_source_pricemodel</source_model>
427
+ <sort_order>54</sort_order>
428
  <show_in_default>1</show_in_default>
429
  <show_in_website>1</show_in_website>
430
  <show_in_store>1</show_in_store>
431
  </grouped_price>
432
+ <category_heading translate="label">
433
  <label>Filter by Category</label>
434
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
435
  <sort_order>60</sort_order>
436
  <show_in_default>1</show_in_default>
437
  <show_in_website>1</show_in_website>
438
  <show_in_store>1</show_in_store>
439
+ </category_heading>
440
  <category_enabled translate="label">
441
  <label>Enabled</label>
442
  <frontend_type>select</frontend_type>
445
  <show_in_default>1</show_in_default>
446
  <show_in_website>1</show_in_website>
447
  <show_in_store>1</show_in_store>
448
+ </category_enabled>
449
+ <category_type translate="label">
450
+ <label>Type of filter</label>
451
+ <frontend_type>select</frontend_type>
452
+ <source_model>sooqr/adminhtml_system_config_source_categorytype</source_model>
453
+ <sort_order>62</sort_order>
454
+ <show_in_default>1</show_in_default>
455
+ <show_in_website>1</show_in_website>
456
+ <show_in_store>1</show_in_store>
457
+ <depends>
458
+ <category_enabled>1</category_enabled>
459
+ </depends>
460
+ </category_type>
461
+ <categories translate="label">
462
+ <label>Category</label>
463
+ <frontend_type>multiselect</frontend_type>
464
+ <source_model>sooqr/adminhtml_system_config_source_category</source_model>
465
+ <sort_order>63</sort_order>
466
+ <show_in_default>1</show_in_default>
467
+ <show_in_website>1</show_in_website>
468
+ <show_in_store>1</show_in_store>
469
+ <depends>
470
+ <category_enabled>1</category_enabled>
471
+ </depends>
472
+ </categories>
473
+ <advanced_heading translate="label">
474
  <label>Advanced</label>
475
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
476
  <sort_order>70</sort_order>
477
  <show_in_default>1</show_in_default>
478
  <show_in_website>1</show_in_website>
479
  <show_in_store>1</show_in_store>
480
+ </advanced_heading>
481
+ <advanced>
482
+ <label>Advanced Filter</label>
483
+ <frontend_model>sooqr/adminhtml_config_form_field_filter</frontend_model>
484
+ <backend_model>sooqr/adminhtml_system_config_backend_design_filter</backend_model>
485
+ <sort_order>71</sort_order>
486
+ <show_in_default>1</show_in_default>
487
+ <show_in_website>1</show_in_website>
488
+ <show_in_store>1</show_in_store>
489
+ </advanced>
490
+ <cms_heading translate="label">
491
  <label>Export CMS Pages</label>
492
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
493
  <sort_order>80</sort_order>
494
  <show_in_default>1</show_in_default>
495
  <show_in_website>1</show_in_website>
496
  <show_in_store>1</show_in_store>
497
+ </cms_heading>
498
+ <cms_pages translate="label">
499
  <label>Enable</label>
500
  <frontend_type>select</frontend_type>
501
  <source_model>sooqr/adminhtml_system_config_source_cms</source_model>
504
  <show_in_website>1</show_in_website>
505
  <show_in_store>1</show_in_store>
506
  </cms_pages>
507
+ <cms_include translate="label">
508
+ <label>Only include</label>
509
+ <frontend_type>multiselect</frontend_type>
510
+ <source_model>sooqr/adminhtml_system_config_source_cmspages</source_model>
511
+ <sort_order>82</sort_order>
512
+ <show_in_default>1</show_in_default>
513
+ <show_in_website>1</show_in_website>
514
+ <show_in_store>1</show_in_store>
515
+ <depends>
516
+ <cms_pages>2</cms_pages>
517
+ </depends>
518
+ </cms_include>
519
+ </fields>
520
+ </products>
521
+ <generate translate="label" module="sooqr">
522
+ <label>Feed Generation Settings</label>
523
+ <frontend_type>text</frontend_type>
524
+ <sort_order>8</sort_order>
525
+ <show_in_default>1</show_in_default>
526
+ <show_in_website>1</show_in_website>
527
+ <show_in_store>1</show_in_store>
528
+ <expanded>1</expanded>
529
+ <fields>
530
+ <note translate="label">
531
  <label><![CDATA[Each store view will have their own Sooqr feed, you can easily activate or de-activate the Sooqr feed generation on store level or automatically generate the Sooqr feed. In case your not using the cron job functionality it's possible to generate the Sooqr feed manually.]]></label>
532
  <frontend_model>sooqr/adminhtml_system_config_form_field_note</frontend_model>
533
  <sort_order>1</sort_order>
534
  <show_in_default>1</show_in_default>
535
  <show_in_website>1</show_in_website>
536
+ <show_in_store>1</show_in_store>
537
+ </note>
538
+ <exclude_heading translate="label">
539
  <label>Feed Generation</label>
540
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
541
  <sort_order>10</sort_order>
542
  <show_in_default>1</show_in_default>
543
  <show_in_website>1</show_in_website>
544
  <show_in_store>1</show_in_store>
545
+ </exclude_heading>
546
+ <enabled translate="label">
547
  <label>Enabled</label>
548
  <frontend_type>select</frontend_type>
549
  <source_model>adminhtml/system_config_source_yesno</source_model>
552
  <show_in_website>1</show_in_website>
553
  <show_in_store>1</show_in_store>
554
  </enabled>
555
+ <filename translate="label">
556
+ <label>Filename</label>
557
+ <frontend_type>text</frontend_type>
558
+ <sort_order>12</sort_order>
559
+ <show_in_default>1</show_in_default>
560
+ <show_in_website>1</show_in_website>
561
+ <show_in_store>1</show_in_store>
562
+ <comment><![CDATA[sqoor-datatfeed.xml]]></comment>
563
+ </filename>
564
+ <limit translate="label">
565
+ <label>Limit Products</label>
566
+ <frontend_type>text</frontend_type>
567
+ <sort_order>13</sort_order>
568
+ <show_in_default>1</show_in_default>
569
+ <show_in_website>1</show_in_website>
570
+ <show_in_store>1</show_in_store>
571
+ <comment><![CDATA[Set limit for testing, use 0 for all products]]></comment>
572
+ </limit>
573
+ <server_heading translate="label">
574
  <label>Overwrite server settings</label>
575
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
576
  <sort_order>20</sort_order>
577
  <show_in_default>1</show_in_default>
578
  <show_in_website>0</show_in_website>
579
  <show_in_store>0</show_in_store>
580
+ </server_heading>
581
+ <overwrite translate="label">
582
  <label>Enabled</label>
583
  <frontend_type>select</frontend_type>
584
  <source_model>adminhtml/system_config_source_yesno</source_model>
587
  <show_in_website>0</show_in_website>
588
  <show_in_store>0</show_in_store>
589
  <tooltip>Only use this option if it's necessary to overwrite this setting because of your server memory limit or execution time.</tooltip>
590
+ </overwrite>
591
+ <memory_limit translate="label">
592
+ <label>Memory Limit</label>
593
+ <frontend_type>text</frontend_type>
594
+ <sort_order>22</sort_order>
595
+ <show_in_default>1</show_in_default>
596
+ <show_in_website>0</show_in_website>
597
+ <show_in_store>0</show_in_store>
598
+ <depends>
599
+ <overwrite>1</overwrite>
600
+ </depends>
601
+ <comment><![CDATA[This overwrites the maximum amount of memory in bytes that a script is allowed to allocate, eg: 1024M.]]></comment>
602
+ </memory_limit>
603
+ <max_execution_time translate="label">
604
+ <label>Max Execution Time</label>
605
+ <frontend_type>text</frontend_type>
606
+ <sort_order>23</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
+ <depends>
611
+ <overwrite>1</overwrite>
612
+ </depends>
613
+ <comment><![CDATA[This overwrites the maximum time in seconds a script is allowed to run before it is terminated by the parser, eg: 300 (for 5 minutes).]]></comment>
614
+ </max_execution_time>
615
+ <cron_heading translate="label">
616
  <label>Cron</label>
617
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
618
  <sort_order>30</sort_order>
619
  <show_in_default>1</show_in_default>
620
  <show_in_website>1</show_in_website>
621
  <show_in_store>1</show_in_store>
622
+ </cron_heading>
623
+ <cron translate="label">
624
  <label>Enabled</label>
625
  <frontend_type>select</frontend_type>
626
  <source_model>adminhtml/system_config_source_yesno</source_model>
628
  <show_in_default>1</show_in_default>
629
  <show_in_website>0</show_in_website>
630
  <show_in_store>0</show_in_store>
631
+ </cron>
632
  <frequency translate="label">
633
  <label>Frequency</label>
634
  <frontend_type>select</frontend_type>
639
  <show_in_website>1</show_in_website>
640
  <show_in_store>1</show_in_store>
641
  </frequency>
642
+ <custom_cron translate="label">
643
+ <label>Custom Cron Expression</label>
644
+ <frontend_type>text</frontend_type>
645
+ <sort_order>33</sort_order>
646
+ <show_in_default>1</show_in_default>
647
+ <show_in_website>0</show_in_website>
648
+ <show_in_store>0</show_in_store>
649
+ <depends>
650
+ <frequency>custom_expr</frequency>
651
+ </depends>
652
+ <comment><![CDATA[e.g. 15 */2 * * *]]></comment>
653
+ </custom_cron>
654
+ <feeds_heading translate="label">
655
  <label>Generated Feeds</label>
656
  <frontend_model>sooqr/adminhtml_system_config_form_field_heading</frontend_model>
657
  <sort_order>40</sort_order>
658
  <show_in_default>1</show_in_default>
659
  <show_in_website>1</show_in_website>
660
  <show_in_store>1</show_in_store>
661
+ </feeds_heading>
662
+ <feeds_text translate="label">
663
+ <label>Text</label>
664
  <frontend_model>sooqr/adminhtml_system_config_form_field_feeds</frontend_model>
665
+ <sort_order>41</sort_order>
666
+ <show_in_default>1</show_in_default>
667
+ <show_in_website>1</show_in_website>
668
+ <show_in_store>1</show_in_store>
669
+ </feeds_text>
670
+ </fields>
671
+ </generate>
672
+ </groups>
673
+ </sooqr_connect>
674
+ </sections>
675
  </config>
app/design/frontend/base/default/layout/magmodules_sooqr.xml CHANGED
@@ -1,8 +1,27 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <default>
4
- <reference name="header">
5
- <block type="sooqr/search" name="top.search" as="topSearch" />
6
- </reference>
7
- </default>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  </layout>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Sooqr
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
20
+
21
+ <layout version="0.1.0">
22
+ <default>
23
+ <reference name="header">
24
+ <block type="sooqr/search" name="top.search" as="topSearch"/>
25
+ </reference>
26
+ </default>
27
  </layout>
app/design/frontend/base/default/template/magmodules/sooqr/form.mini.phtml CHANGED
@@ -3,7 +3,6 @@
3
  * Magmodules.eu - http://www.magmodules.eu
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:
@@ -12,34 +11,38 @@
12
  * obtain it through the world-wide-web, please send an email
13
  * to info@magmodules.eu so we can send you a copy immediately.
14
  *
15
- * @category Magmodules
16
- * @package Magmodules_Sooqr
17
- * @author Magmodules <info@magmodules.eu)
18
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
  */
21
- $catalogSearchHelper = $this->helper('catalogsearch');
22
  ?>
23
  <form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
24
  <div class="input-box">
25
  <label for="search"><?php echo $this->__('Search:') ?></label>
26
- <input id="search" type="search" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="input-text required-entry" placeholder="<?php echo $this->quoteEscape($this->__('Search entire store here...')) ?>" />
27
- <button type="submit" title="<?php echo $this->quoteEscape($this->__('Search')) ?>" class="button search-button"><span><span><?php echo $this->__('Search') ?></span></span></button>
 
28
  </div>
29
- <script type="text/javascript">
30
- var _wssq = _wssq || [];
31
- _wssq.push(['_load', { 'suggest' : <?php echo json_encode($this->getSooqrOptions()) ?>}]);
32
- _wssq.push(['suggest._setPosition', 'screen-middle']);
33
- _wssq.push(['suggest._setLocale', '<?php echo $this->getSooqrLanguage() ?>']);
34
- _wssq.push(['suggest._setFixedFilters', { 'magento_store' : '<?php echo Mage::app()->getStore()->getCode(); ?>' }]);
35
- <?php if (!$this->isTrackingEnabled()) { ?>
36
- _wssq.push(['suggest._disableTracking']);
37
- <?php } ?>
38
- <?php echo $this->getSooqrJavascript() ?>
39
- (function() {
40
- var ws = document.createElement('script'); ws.type = 'text/javascript'; ws.async = true;
41
- ws.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + '<?php echo $this->getSooqrScriptUri() ?>';
42
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ws, s);
43
- })();
44
- </script>
 
 
 
45
  </form>
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Sooqr
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
+ $catalogSearchHelper = $this->helper('catalogsearch');
21
  ?>
22
  <form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
23
  <div class="input-box">
24
  <label for="search"><?php echo $this->__('Search:') ?></label>
25
+ <input id="search" type="search" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="input-text required-entry" placeholder="<?php echo $this->quoteEscape($this->__('Search entire store here...')) ?>"/>
26
+ <button type="submit" title="<?php echo $this->quoteEscape($this->__('Search')) ?>" class="button search-button">
27
+ <span><span><?php echo $this->__('Search') ?></span></span></button>
28
  </div>
29
+ <script type="text/javascript">
30
+ var _wssq = _wssq || [];
31
+ _wssq.push(['_load', {'suggest': <?php echo json_encode($this->getSooqrOptions()) ?>}]);
32
+ _wssq.push(['suggest._setPosition', 'screen-middle']);
33
+ _wssq.push(['suggest._setLocale', '<?php echo $this->getSooqrLanguage() ?>']);
34
+ _wssq.push(['suggest._setFixedFilters', {'magento_store': '<?php echo Mage::app()->getStore()->getCode(); ?>'}]);
35
+ <?php if (!$this->isTrackingEnabled()) { ?>
36
+ _wssq.push(['suggest._disableTracking']);
37
+ <?php } ?>
38
+ <?php echo $this->getSooqrJavascript() ?>
39
+ (function () {
40
+ var ws = document.createElement('script');
41
+ ws.type = 'text/javascript';
42
+ ws.async = true;
43
+ ws.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + '<?php echo $this->getSooqrScriptUri() ?>';
44
+ var s = document.getElementsByTagName('script')[0];
45
+ s.parentNode.insertBefore(ws, s);
46
+ })();
47
+ </script>
48
  </form>
app/etc/modules/Magmodules_Sooqr.xml CHANGED
@@ -1,9 +1,28 @@
1
  <?xml version="1.0"?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <config>
3
- <modules>
4
- <Magmodules_Sooqr>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Magmodules_Sooqr>
8
- </modules>
9
  </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Sooqr
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
20
+
21
  <config>
22
+ <modules>
23
+ <Magmodules_Sooqr>
24
+ <active>true</active>
25
+ <codePool>community</codePool>
26
+ </Magmodules_Sooqr>
27
+ </modules>
28
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magmodules_Sooqr</name>
4
- <version>1.1.9</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Magmodules_Sooqr</description>
11
  <notes>Magmodules_Sooqr</notes>
12
  <authors><author><name>Magmodules</name><user>magmodules</user><email>info@magmodules.nl</email></author></authors>
13
- <date>2016-11-29</date>
14
- <time>18:33:20</time>
15
- <contents><target name="magecommunity"><dir name="Magmodules"><dir name="Sooqr"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Extra.php" hash="e583284820c631015ed78c131bf3cfa8"/><file name="Filter.php" hash="e21c1f53da21d4f3afbfe7691efce06e"/></dir><dir name="Renderer"><file name="Select.php" hash="69d71d66aaf7b842ef482affd484ec48"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Feeds.php" hash="2106ad07090060ed232ef4f77bc0e309"/><file name="Heading.php" hash="a89db4f294f9c9e6785745163b1aed5f"/><file name="Note.php" hash="f131e40d8a0f4ed2e444d9e692a91ed5"/><file name="Version.php" hash="5832a42f30122977420d722683211f66"/></dir></dir></dir></dir><dir name="Widget"><dir name="Info"><file name="Info.php" hash="ee3ef0f3d785a28e73d313ecbb5da325"/></dir></dir></dir><file name="Search.php" hash="2acb516fec2f419e260240e8647c5999"/></dir><dir name="Helper"><file name="Data.php" hash="8a2fe0a8cb53c868bbe49e9fdb7341b6"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Design"><file name="Extra.php" hash="3e262b80ccc673e415bf51bf172c72d4"/><file name="Filter.php" hash="e6fac56290f6d0d7be78553e75cb18a3"/></dir><dir name="Sooqr"><file name="Cron.php" hash="113b2d8de9349fd393c54ff7b59ff91d"/></dir></dir><dir name="Source"><file name="Action.php" hash="ef9830d9c1a98c94991626c4cc4909c9"/><file name="Attribute.php" hash="6f3736cd2f7de23b9d74356d7c1c557f"/><file name="Cacheresize.php" hash="86a916189abef3a670e58f3a8298f894"/><file name="Category.php" hash="92b245d0758fbe075b79c397a96d8567"/><file name="Categorytype.php" hash="8bc5f054db86f543019a6762a6a98562"/><file name="Cms.php" hash="34197c03a013a67112fa4f2c8415ed2b"/><file name="Cmspages.php" hash="d9cc6034c3d777cc896ff28f1a29f88d"/><file name="Condition.php" hash="bd66be4fe74f549d5fa6c213bd9b64f6"/><file name="Conditions.php" hash="502fe20b60e397240b8d552fd5ea4d81"/><file name="Configurable.php" hash="34a165474618953e44fd1de305371907"/><file name="Frequency.php" hash="b7518824f5cb60d13e9d6564a383dcc9"/><file name="Identifier.php" hash="cdf5bd32696cb92a6f3be396ce5b3a6d"/><file name="Images.php" hash="08658a5e913e334959ec476a61e2891f"/><file name="Pricemodel.php" hash="dbbeabc2853a7caecab3fc42a557766b"/><file name="Productid.php" hash="e4b431e0183d91bdd4f186f001119e77"/><file name="Producttype.php" hash="88d0e8386f59d7c0ea62a19cbf800fa4"/><file name="Resize.php" hash="1a0824757d8c87f85225f063de3a025b"/><file name="Selectattribute.php" hash="bcae6eff0788821f7d3dbf7d224b59e4"/><file name="Status.php" hash="2f474fe7188e3b1cf1d1714ffebcd9e8"/><file name="Tax.php" hash="c6e19d702751bc0c616768fceaf53855"/><file name="Textattribute.php" hash="9645d5652679a972a280cf337ab8662b"/><file name="Varcharattribute.php" hash="37a9253e8ea806f3402052a0b0744707"/><file name="Version.php" hash="906736f8f04f03421ab56a0c042639aa"/><file name="Visibility.php" hash="67f20c3b4581144b11ca8696c885b97d"/><file name="Weight.php" hash="fbc88d0b6bd073d00dc6e4a05ce1b4df"/></dir></dir></dir></dir><file name="Common.php" hash="f9c26c5efa9dafe962c48654db7120c1"/><file name="Observer.php" hash="7df2ecf06c93f5a2c0a00981ff8db76f"/><file name="Sooqr.php" hash="92247eda9ba119ac35a761953be768e9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SooqrController.php" hash="0fbb61bf89e06ee0c2a07b4859104c49"/></dir><file name="InstallationController.php" hash="a96e58cbab2c7b6a3a4c9b42de62a59f"/></dir><dir name="data"><dir name="magmodules_sooqr_setup"><file name="data-install-1.1.9.php" hash="448fcd59b4bd3492006bd26083188888"/><file name="data-upgrade-1.1.8-1.1.9.php" hash="448fcd59b4bd3492006bd26083188888"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="cf4313a4daa72837c48e137b51b11eba"/><file name="config.xml" hash="68abc08e76442bd8f6d8593669df5bf2"/><file name="system.xml" hash="eeeed98810a90bc96a2144a9b6481f38"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Magmodules_Sooqr.csv" hash="38992a5f4cf87eeee3d06ab38ead900b"/></dir><dir name="nl_NL"><file name="Magmodules_Sooqr.csv" hash="7f45989fad8c6e6ad552a827757d5161"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magmodules_Sooqr.xml" hash="eeec89a005c4ccb1ed86bf90c446e3ef"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="magmodules"><dir name="sooqr"><file name="form.mini.phtml" hash="dfb86fc52128baeef3c81f1f1eb6cc1c"/></dir></dir></dir><dir name="layout"><file name="magmodules_sooqr.xml" hash="62a14cd61d3d74653b8d883d4d6b9d8d"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>7.9.9</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magmodules_Sooqr</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
7
  <channel>community</channel>
10
  <description>Magmodules_Sooqr</description>
11
  <notes>Magmodules_Sooqr</notes>
12
  <authors><author><name>Magmodules</name><user>magmodules</user><email>info@magmodules.nl</email></author></authors>
13
+ <date>2017-04-18</date>
14
+ <time>16:22:11</time>
15
+ <contents><target name="magecommunity"><dir name="Magmodules"><dir name="Sooqr"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Extra.php" hash="a9cacbcf68c855ed73bd52abe01ccd44"/><file name="Filter.php" hash="d54ac6275773626d0a01e40a8d4f81b7"/></dir><dir name="Renderer"><file name="Select.php" hash="01676a7570e75c7f410937c5107d1646"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Feeds.php" hash="3ce142675c3d9fdc71c3d99b630924e8"/><file name="Heading.php" hash="fbbd8cc60539cfeac6668e6f0912b633"/><file name="Note.php" hash="03a258aa59b2fc1e3ba6d86ef6320e70"/><file name="Version.php" hash="ef6f8aad0b0b593c9505529b6b882d39"/></dir></dir></dir></dir><dir name="Widget"><dir name="Info"><file name="Info.php" hash="918d1ff4a453b31b2f191d2cd63e3ae8"/></dir></dir></dir><file name="Search.php" hash="fa678f00d6e21d2f0f7ef20275f8f9b6"/></dir><dir name="Helper"><file name="Data.php" hash="211d888b9eb21076af7dc3bf083aa85b"/><file name="Write.php" hash="4f73b9e63aa18fec44d1f232fdd286e4"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Design"><file name="Extra.php" hash="67ff611e3438690bf575690da0044253"/><file name="Filter.php" hash="4552008a9ff9c6ef51b086ff29372f6f"/></dir><dir name="Sooqr"><file name="Cron.php" hash="366e632dba5cae766ec0c0f6db168ad2"/></dir></dir><dir name="Source"><file name="Attribute.php" hash="294e8bfa1bc7580b54c6e1df43edca9b"/><file name="Cacheresize.php" hash="ecc3b2646dc6afb0d951e53134d70b0c"/><file name="Category.php" hash="cf08766f169b8fe3ad0f986aff80c517"/><file name="Categorytype.php" hash="99169b9645fa831caeedd436dc312895"/><file name="Cms.php" hash="ecfad3770b5423e922b1df5c1a192ef1"/><file name="Cmspages.php" hash="da555afe48d9034e967b91e5e99f0361"/><file name="Condition.php" hash="051a5e28f3956a500e1cd56b4ca36341"/><file name="Conditions.php" hash="b8d29a2f87de5e009abf71be9f48ef9a"/><file name="Configurable.php" hash="66cc2413209b7885172c06f6b60bb169"/><file name="Frequency.php" hash="fec9d7b52daf7d4a10c2f32005dd0de0"/><file name="Identifier.php" hash="7543ccef4d2b1f01016ef6b296273161"/><file name="Image.php" hash="660152ec0e3b368fc073205d58a3c841"/><file name="Images.php" hash="c375db01f9d2adc725004bb1d5e92bf7"/><file name="Pricemodel.php" hash="28fa3ef72d5c75c0b864d95f9b697e11"/><file name="Productid.php" hash="88934c982131f40ac5cd76bd15e6651e"/><file name="Producttype.php" hash="6869621d2d3b0ac43314e013c707bbe5"/><file name="Resize.php" hash="e9202a2f6ce1f7ce83f6294b88667fce"/><file name="Selectattribute.php" hash="b2c79a4404bfc72d3d4502345c983c3a"/><file name="Status.php" hash="2dcdf99ff9c355a4c301f3b30ede271c"/><file name="Tax.php" hash="91121e6a651e50a0545bf36ee1724f60"/><file name="Textattribute.php" hash="216cd8dc3afdf0f265507211d09215f3"/><file name="Varcharattribute.php" hash="15ee6aa1a072994f8d1a83f5b560ce84"/><file name="Version.php" hash="2a75fc0457233c46b41325f2f7dbdfc7"/><file name="Visibility.php" hash="aae5f050ddf2d4ae356ebcf297224a41"/><file name="Weight.php" hash="4ba66c962d02bce1a2bc7d9f4ae042bc"/></dir></dir></dir></dir><file name="Common.php" hash="60720323e6bfdc4551445821f0234c42"/><file name="Observer.php" hash="734f4a718bbfbd82626bf0465ca8cea8"/><file name="Sooqr.php" hash="175127011919a859e036e9cd466581ae"/><dir name="Source"><file name="Action.php" hash="9320bd8732a64b37cd71b18f309ef005"/><file name="Attribute.php" hash="429d628800620e3b87e9995db8353c3f"/><file name="Countries.php" hash="97406369fbcdc5f8ca631bb644c87fb8"/><file name="Tax.php" hash="2cf50edd9d8f6c8ce725666045893d13"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Design"><file name="Extra.php" hash="c847cb6d7b946589901ee65269b318c2"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="SooqrController.php" hash="b81d39dedf1c0e36e52b22dd5185b729"/></dir><file name="InstallationController.php" hash="3b50e232b11fbe2a7adfabecec7769bc"/></dir><dir name="data"><dir name="magmodules_sooqr_setup"><file name="data-install-1.1.9.php" hash="413b3091428cf6defd29a1b1b56beb58"/><file name="data-upgrade-1.1.8-1.1.9.php" hash="413b3091428cf6defd29a1b1b56beb58"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="0bc3e3e7ad5a44c4c9f503bb98af0f8d"/><file name="config.xml" hash="17a0e1e6079f8b25e4a6098c7d76104f"/><file name="system.xml" hash="219f48ff5d353c9dd3a96ccd0f80324f"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Magmodules_Sooqr.csv" hash="38992a5f4cf87eeee3d06ab38ead900b"/></dir><dir name="nl_NL"><file name="Magmodules_Sooqr.csv" hash="7f45989fad8c6e6ad552a827757d5161"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magmodules_Sooqr.xml" hash="8cb4a8ad48328949173b882736a3bb0f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="magmodules"><dir name="sooqr"><file name="form.mini.phtml" hash="29110af56cb75c02e48fb99525a22edb"/></dir></dir></dir><dir name="layout"><file name="magmodules_sooqr.xml" hash="4e1e3c0204fb943cf6a77585cac61247"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>7.9.9</max></php></required></dependencies>
18
  </package>