idealoConnect - Version 1.2.3

Version Notes


  • fix for price calculation of configurable products

Download this release

Release Info

Developer idealo
Extension idealoConnect
Version 1.2.3
Comparing to
See all releases


Code changes from version 1.2.2 to 1.2.3

Files changed (62) hide show
  1. app/code/community/NRApps/Idealo/Block/Adminhtml/Attributes.php +100 -100
  2. app/code/community/NRApps/Idealo/Block/Adminhtml/Notifications.php +45 -45
  3. app/code/community/NRApps/Idealo/Block/Config/Adminhtml/Form/Field/Attributes.php +46 -46
  4. app/code/community/NRApps/Idealo/Block/Config/Adminhtml/Form/Field/Dummy.php +46 -46
  5. app/code/community/NRApps/Idealo/Block/Config/Adminhtml/Form/Field/Listings.php +46 -46
  6. app/code/community/NRApps/Idealo/Block/Config/Adminhtml/Form/Field/PaymentMethods.php +46 -46
  7. app/code/community/NRApps/Idealo/Block/Config/Attributes.php +46 -46
  8. app/code/community/NRApps/Idealo/Block/Config/AttributesNoSortOrder.php +41 -41
  9. app/code/community/NRApps/Idealo/Block/Config/DeliveryTimeMapping.php +82 -82
  10. app/code/community/NRApps/Idealo/Block/Config/DeliveryTimeUpdateButton.php +32 -32
  11. app/code/community/NRApps/Idealo/Block/Config/Description.php +32 -32
  12. app/code/community/NRApps/Idealo/Block/Config/PaymentMethods.php +51 -51
  13. app/code/community/NRApps/Idealo/Block/Config/ShippingComments.php +46 -46
  14. app/code/community/NRApps/Idealo/Block/Config/ShippingCosts.php +46 -46
  15. app/code/community/NRApps/Idealo/Block/Config/ShippingCostsWeight.php +46 -46
  16. app/code/community/NRApps/Idealo/Helper/Data.php +135 -135
  17. app/code/community/NRApps/Idealo/Model/Api.php +356 -356
  18. app/code/community/NRApps/Idealo/Model/Attribute.php +67 -67
  19. app/code/community/NRApps/Idealo/Model/Backend/Serialized/Array.php +17 -17
  20. app/code/community/NRApps/Idealo/Model/Csv/Feed.php +64 -64
  21. app/code/community/NRApps/Idealo/Model/Csv/Generator.php +18 -18
  22. app/code/community/NRApps/Idealo/Model/DeliveryTime.php +145 -145
  23. app/code/community/NRApps/Idealo/Model/Feed.php +86 -86
  24. app/code/community/NRApps/Idealo/Model/Filter.php +90 -90
  25. app/code/community/NRApps/Idealo/Model/Generator.php +1387 -1387
  26. app/code/community/NRApps/Idealo/Model/Indexer.php +599 -599
  27. app/code/community/NRApps/Idealo/Model/Observer.php +230 -230
  28. app/code/community/NRApps/Idealo/Model/Resource/Indexer.php +166 -166
  29. app/code/community/NRApps/Idealo/Model/Source/AttributeSets.php +44 -44
  30. app/code/community/NRApps/Idealo/Model/Source/ConfigurableChildProductsPriceType.php +59 -59
  31. app/code/community/NRApps/Idealo/Model/Source/ConfigurableTypes.php +27 -27
  32. app/code/community/NRApps/Idealo/Model/Source/FeedAttributes.php +105 -105
  33. app/code/community/NRApps/Idealo/Model/Source/ListingCountries.php +78 -78
  34. app/code/community/NRApps/Idealo/Model/Source/PaymentMethods.php +58 -58
  35. app/code/community/NRApps/Idealo/Model/Source/PercentalSurchargeCalculationMethod.php +54 -54
  36. app/code/community/NRApps/Idealo/Model/Source/ProductAttributes.php +37 -37
  37. app/code/community/NRApps/Idealo/Model/Source/ProductTypes.php +58 -58
  38. app/code/community/NRApps/Idealo/Model/Source/ShippingCostsMethod.php +54 -54
  39. app/code/community/NRApps/Idealo/Model/Source/Store.php +49 -49
  40. app/code/community/NRApps/Idealo/Model/Source/YesNoDefault.php +29 -29
  41. app/code/community/NRApps/Idealo/controllers/Adminhtml/Idealo/AttributesController.php +104 -104
  42. app/code/community/NRApps/Idealo/controllers/Adminhtml/Idealo/SettingsController.php +27 -27
  43. app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-install-1.2.0.php +23 -23
  44. app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-install-1.2.2.php +23 -23
  45. app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-upgrade-1.0.0-1.1.0.php +23 -23
  46. app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-upgrade-1.1.0-1.2.0.php +10 -10
  47. app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-upgrade-1.2.1-1.2.2.php +11 -11
  48. app/code/community/NRApps/Idealo/etc/adminhtml.xml +59 -59
  49. app/code/community/NRApps/Idealo/etc/config.xml +228 -228
  50. app/code/community/NRApps/Idealo/etc/system.xml +840 -840
  51. app/code/community/NRApps/Idealo/sql/nrapps_idealo_setup/install-1.0.0.php +86 -86
  52. app/design/adminhtml/default/default/layout/nrapps/idealo.xml +7 -7
  53. app/design/adminhtml/default/default/template/nrapps/idealo/attributes.phtml +143 -143
  54. app/design/adminhtml/default/default/template/nrapps/idealo/config.phtml +14 -14
  55. app/design/adminhtml/default/default/template/nrapps/idealo/delivery_time_update_button.phtml +18 -18
  56. app/design/adminhtml/default/default/template/nrapps/idealo/notifications.phtml +9 -9
  57. app/etc/modules/NRApps_Idealo.xml +12 -12
  58. app/locale/de_DE/NRApps_Idealo.csv +180 -180
  59. app/locale/de_DE/template/email/nrapps_idealo_error.html +14 -14
  60. package.xml +5 -8
  61. shell/idealo_delete_existing_offers.php +14 -14
  62. shell/idealo_export.php +14 -14
app/code/community/NRApps/Idealo/Block/Adminhtml/Attributes.php CHANGED
@@ -1,100 +1,100 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Adminhtml_Attributes extends Mage_Adminhtml_Block_Widget
4
- {
5
- /** @var Mage_Catalog_Model_Resource_Product_Attribute_Collection */
6
- protected $_attributes;
7
-
8
- /** @var string[] */
9
- protected $_attributeCodes = array();
10
-
11
- public function __construct()
12
- {
13
- parent::__construct();
14
- $this->setTemplate('nrapps/idealo/attributes.phtml');
15
- $this->setTitle($this->__('Manage Attributes'));
16
- }
17
-
18
- /**
19
- * Retrieve the POST URL for the form
20
- *
21
- * @return string URL
22
- */
23
- public function getPostActionUrl()
24
- {
25
- return $this->getUrl('*/*/save');
26
- }
27
-
28
- public function getAttributeData()
29
- {
30
- return Mage::getSingleton('nrapps_idealo/source_feedAttributes')->getAllOptions();
31
- }
32
-
33
- /**
34
- * @param Varien_Object $attribute
35
- * @return bool
36
- */
37
- public function attributeExists($attribute)
38
- {
39
- Mage::log($attribute->getType());
40
- return in_array($attribute->getCode(), $this->getProductAttributeCodes($attribute->getType()));
41
- }
42
-
43
- public function isAttributeNone($attribute)
44
- {
45
- return Mage::getStoreConfig('nrapps_idealo/attributes/' . $attribute->getCode()) == 'none';
46
- }
47
-
48
- /**
49
- * @param string[]|string $types
50
- * @return string[]
51
- */
52
- public function getProductAttributeCodes($types = null)
53
- {
54
- return $this->getProductAttributes($types)->getColumnValues('attribute_code');
55
- }
56
-
57
- /**
58
- * @param string[]|string $types
59
- * @return Mage_Catalog_Model_Resource_Product_Attribute_Collection
60
- */
61
- public function getProductAttributes($types = null)
62
- {
63
- return Mage::helper('nrapps_idealo')->getProductAttributes($types);
64
- }
65
-
66
- /**
67
- * @param string $attributeType
68
- * @return string
69
- */
70
- public function getAttributeTypeLabel($attributeType)
71
- {
72
- switch ($attributeType) {
73
- case 'select':
74
- return $this->__('Select field (dropdown)');
75
- case 'yesno':
76
- return $this->__('Select field (yes / no)');
77
- case 'text':
78
- return $this->__('Text field');
79
- case 'decimal':
80
- return $this->__('Text field (decimal value)');
81
- case 'price':
82
- return $this->__('Text field (price)');
83
- default:
84
- return $attributeType;
85
- }
86
- }
87
-
88
- /**
89
- * @param Varien_Object $attribute
90
- * @return string
91
- */
92
- public function getSelectedAttributeCode($attribute)
93
- {
94
- if (Mage::getStoreConfig('nrapps_idealo/attributes/' . $attribute->getCode())) {
95
- return Mage::getStoreConfig('nrapps_idealo/attributes/' . $attribute->getCode());
96
- }
97
-
98
- return $attribute->getCode();
99
- }
100
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Adminhtml_Attributes extends Mage_Adminhtml_Block_Widget
4
+ {
5
+ /** @var Mage_Catalog_Model_Resource_Product_Attribute_Collection */
6
+ protected $_attributes;
7
+
8
+ /** @var string[] */
9
+ protected $_attributeCodes = array();
10
+
11
+ public function __construct()
12
+ {
13
+ parent::__construct();
14
+ $this->setTemplate('nrapps/idealo/attributes.phtml');
15
+ $this->setTitle($this->__('Manage Attributes'));
16
+ }
17
+
18
+ /**
19
+ * Retrieve the POST URL for the form
20
+ *
21
+ * @return string URL
22
+ */
23
+ public function getPostActionUrl()
24
+ {
25
+ return $this->getUrl('*/*/save');
26
+ }
27
+
28
+ public function getAttributeData()
29
+ {
30
+ return Mage::getSingleton('nrapps_idealo/source_feedAttributes')->getAllOptions();
31
+ }
32
+
33
+ /**
34
+ * @param Varien_Object $attribute
35
+ * @return bool
36
+ */
37
+ public function attributeExists($attribute)
38
+ {
39
+ Mage::log($attribute->getType());
40
+ return in_array($attribute->getCode(), $this->getProductAttributeCodes($attribute->getType()));
41
+ }
42
+
43
+ public function isAttributeNone($attribute)
44
+ {
45
+ return Mage::getStoreConfig('nrapps_idealo/attributes/' . $attribute->getCode()) == 'none';
46
+ }
47
+
48
+ /**
49
+ * @param string[]|string $types
50
+ * @return string[]
51
+ */
52
+ public function getProductAttributeCodes($types = null)
53
+ {
54
+ return $this->getProductAttributes($types)->getColumnValues('attribute_code');
55
+ }
56
+
57
+ /**
58
+ * @param string[]|string $types
59
+ * @return Mage_Catalog_Model_Resource_Product_Attribute_Collection
60
+ */
61
+ public function getProductAttributes($types = null)
62
+ {
63
+ return Mage::helper('nrapps_idealo')->getProductAttributes($types);
64
+ }
65
+
66
+ /**
67
+ * @param string $attributeType
68
+ * @return string
69
+ */
70
+ public function getAttributeTypeLabel($attributeType)
71
+ {
72
+ switch ($attributeType) {
73
+ case 'select':
74
+ return $this->__('Select field (dropdown)');
75
+ case 'yesno':
76
+ return $this->__('Select field (yes / no)');
77
+ case 'text':
78
+ return $this->__('Text field');
79
+ case 'decimal':
80
+ return $this->__('Text field (decimal value)');
81
+ case 'price':
82
+ return $this->__('Text field (price)');
83
+ default:
84
+ return $attributeType;
85
+ }
86
+ }
87
+
88
+ /**
89
+ * @param Varien_Object $attribute
90
+ * @return string
91
+ */
92
+ public function getSelectedAttributeCode($attribute)
93
+ {
94
+ if (Mage::getStoreConfig('nrapps_idealo/attributes/' . $attribute->getCode())) {
95
+ return Mage::getStoreConfig('nrapps_idealo/attributes/' . $attribute->getCode());
96
+ }
97
+
98
+ return $attribute->getCode();
99
+ }
100
+ }
app/code/community/NRApps/Idealo/Block/Adminhtml/Notifications.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
4
- {
5
- const INSTALL_STATE_START = 0;
6
- const INSTALL_STATE_ATTRIBUTES = 1;
7
- const INSTALL_STATE_CONFIG = 2;
8
- const INSTALL_STATE_FINISHED = 3;
9
-
10
- public function getMessage()
11
- {
12
- if (Mage::helper('nrapps_idealo')->isInstalled()) {
13
- return '';
14
- }
15
-
16
- $message = '';
17
- switch($this->_getInstallState()) {
18
-
19
- case self::INSTALL_STATE_START:
20
- $message = Mage::helper('nrapps_idealo')->__(
21
- 'The idealo Connect is now installed. <a href="%s">Click here to start the configuration process.</a>',
22
- Mage::helper('adminhtml')->getUrl('adminhtml/idealo_attributes/')
23
- );
24
- break;
25
-
26
- case self::INSTALL_STATE_ATTRIBUTES:
27
- $message = Mage::helper('nrapps_idealo')->__(
28
- 'idealo Connect Setup Step 1/2: Attributes Setup'
29
- );
30
- break;
31
-
32
- case self::INSTALL_STATE_CONFIG:
33
- $message = Mage::helper('nrapps_idealo')->__(
34
- 'idealo Connect Setup Step 2/2: Configuration and Default Values'
35
- );
36
- break;
37
- }
38
-
39
- return $message;
40
- }
41
-
42
- protected function _getInstallState()
43
- {
44
- return intval(Mage::app()->loadCache('nrapps_idealo_install_state'));
45
- }
46
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Adminhtml_Notifications extends Mage_Adminhtml_Block_Template
4
+ {
5
+ const INSTALL_STATE_START = 0;
6
+ const INSTALL_STATE_ATTRIBUTES = 1;
7
+ const INSTALL_STATE_CONFIG = 2;
8
+ const INSTALL_STATE_FINISHED = 3;
9
+
10
+ public function getMessage()
11
+ {
12
+ if (Mage::helper('nrapps_idealo')->isInstalled()) {
13
+ return '';
14
+ }
15
+
16
+ $message = '';
17
+ switch($this->_getInstallState()) {
18
+
19
+ case self::INSTALL_STATE_START:
20
+ $message = Mage::helper('nrapps_idealo')->__(
21
+ 'The idealo Connect is now installed. <a href="%s">Click here to start the configuration process.</a>',
22
+ Mage::helper('adminhtml')->getUrl('adminhtml/idealo_attributes/')
23
+ );
24
+ break;
25
+
26
+ case self::INSTALL_STATE_ATTRIBUTES:
27
+ $message = Mage::helper('nrapps_idealo')->__(
28
+ 'idealo Connect Setup Step 1/2: Attributes Setup'
29
+ );
30
+ break;
31
+
32
+ case self::INSTALL_STATE_CONFIG:
33
+ $message = Mage::helper('nrapps_idealo')->__(
34
+ 'idealo Connect Setup Step 2/2: Configuration and Default Values'
35
+ );
36
+ break;
37
+ }
38
+
39
+ return $message;
40
+ }
41
+
42
+ protected function _getInstallState()
43
+ {
44
+ return intval(Mage::app()->loadCache('nrapps_idealo_install_state'));
45
+ }
46
  }
app/code/community/NRApps/Idealo/Block/Config/Adminhtml/Form/Field/Attributes.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Config_Adminhtml_Form_Field_Attributes extends Mage_Core_Block_Html_Select
4
- {
5
- public function _toHtml()
6
- {
7
- $options = Mage::getSingleton('nrapps_idealo/source_productAttributes')->getOptionArray();
8
- foreach ($options as $a => $label) {
9
- $this->addOption($a, $this->_addSlashesDependingOnMagentoVersion($label));
10
- }
11
-
12
- $this->setExtraParams('style="width: 200px;"');
13
-
14
- return parent::_toHtml();
15
- }
16
-
17
- public function setInputName($value)
18
- {
19
- return $this->setName($value);
20
- }
21
-
22
- /**
23
- * Add slashes for Magento CE 1.9.2.0+ and EE 1.14.2.0+. This is needed as Magento has introduced its own
24
- * escaping in app/design/adminhtml/default/default/template/system/config/form/field/array.phtml in these versions.
25
- *
26
- * @param string $label
27
- * @return string
28
- */
29
- protected function _addSlashesDependingOnMagentoVersion($label)
30
- {
31
- if (method_exists('Mage', 'getEdition')) {
32
- switch (Mage::getEdition()) {
33
- case Mage::EDITION_COMMUNITY:
34
- if (version_compare(Mage::getVersion(), '1.9.2.0') >= 0) {
35
- return $label;
36
- }
37
- break;
38
- case Mage::EDITION_ENTERPRISE:
39
- if (version_compare(Mage::getVersion(), '1.14.2.0') >= 0) {
40
- return $label;
41
- }
42
- break;
43
- }
44
- }
45
- return addslashes($label);
46
- }
47
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Config_Adminhtml_Form_Field_Attributes extends Mage_Core_Block_Html_Select
4
+ {
5
+ public function _toHtml()
6
+ {
7
+ $options = Mage::getSingleton('nrapps_idealo/source_productAttributes')->getOptionArray();
8
+ foreach ($options as $a => $label) {
9
+ $this->addOption($a, $this->_addSlashesDependingOnMagentoVersion($label));
10
+ }
11
+
12
+ $this->setExtraParams('style="width: 200px;"');
13
+
14
+ return parent::_toHtml();
15
+ }
16
+
17
+ public function setInputName($value)
18
+ {
19
+ return $this->setName($value);
20
+ }
21
+
22
+ /**
23
+ * Add slashes for Magento CE 1.9.2.0+ and EE 1.14.2.0+. This is needed as Magento has introduced its own
24
+ * escaping in app/design/adminhtml/default/default/template/system/config/form/field/array.phtml in these versions.
25
+ *
26
+ * @param string $label
27
+ * @return string
28
+ */
29
+ protected function _addSlashesDependingOnMagentoVersion($label)
30
+ {
31
+ if (method_exists('Mage', 'getEdition')) {
32
+ switch (Mage::getEdition()) {
33
+ case Mage::EDITION_COMMUNITY:
34
+ if (version_compare(Mage::getVersion(), '1.9.2.0') >= 0) {
35
+ return $label;
36
+ }
37
+ break;
38
+ case Mage::EDITION_ENTERPRISE:
39
+ if (version_compare(Mage::getVersion(), '1.14.2.0') >= 0) {
40
+ return $label;
41
+ }
42
+ break;
43
+ }
44
+ }
45
+ return addslashes($label);
46
+ }
47
  }
app/code/community/NRApps/Idealo/Block/Config/Adminhtml/Form/Field/Dummy.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Config_Adminhtml_Form_Field_Dummy extends Mage_Core_Block_Html_Select
4
- {
5
- public function _toHtml()
6
- {
7
- $options = Mage::getSingleton('nrapps_idealo/source_productAttributes')->getOptionArray();
8
- foreach ($options as $a => $label) {
9
- $this->addOption($a, $this->_addSlashesDependingOnMagentoVersion($label));
10
- }
11
-
12
- $this->setExtraParams('style="display: none;"');
13
-
14
- return parent::_toHtml();
15
- }
16
-
17
- public function setInputName($value)
18
- {
19
- return $this->setName($value);
20
- }
21
-
22
- /**
23
- * Add slashes for Magento CE 1.9.2.0+ and EE 1.14.2.0+. This is needed as Magento has introduced its own
24
- * escaping in app/design/adminhtml/default/default/template/system/config/form/field/array.phtml in these versions.
25
- *
26
- * @param string $label
27
- * @return string
28
- */
29
- protected function _addSlashesDependingOnMagentoVersion($label)
30
- {
31
- if (method_exists('Mage', 'getEdition')) {
32
- switch (Mage::getEdition()) {
33
- case Mage::EDITION_COMMUNITY:
34
- if (version_compare(Mage::getVersion(), '1.9.2.0') >= 0) {
35
- return $label;
36
- }
37
- break;
38
- case Mage::EDITION_ENTERPRISE:
39
- if (version_compare(Mage::getVersion(), '1.14.2.0') >= 0) {
40
- return $label;
41
- }
42
- break;
43
- }
44
- }
45
- return addslashes($label);
46
- }
47
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Config_Adminhtml_Form_Field_Dummy extends Mage_Core_Block_Html_Select
4
+ {
5
+ public function _toHtml()
6
+ {
7
+ $options = Mage::getSingleton('nrapps_idealo/source_productAttributes')->getOptionArray();
8
+ foreach ($options as $a => $label) {
9
+ $this->addOption($a, $this->_addSlashesDependingOnMagentoVersion($label));
10
+ }
11
+
12
+ $this->setExtraParams('style="display: none;"');
13
+
14
+ return parent::_toHtml();
15
+ }
16
+
17
+ public function setInputName($value)
18
+ {
19
+ return $this->setName($value);
20
+ }
21
+
22
+ /**
23
+ * Add slashes for Magento CE 1.9.2.0+ and EE 1.14.2.0+. This is needed as Magento has introduced its own
24
+ * escaping in app/design/adminhtml/default/default/template/system/config/form/field/array.phtml in these versions.
25
+ *
26
+ * @param string $label
27
+ * @return string
28
+ */
29
+ protected function _addSlashesDependingOnMagentoVersion($label)
30
+ {
31
+ if (method_exists('Mage', 'getEdition')) {
32
+ switch (Mage::getEdition()) {
33
+ case Mage::EDITION_COMMUNITY:
34
+ if (version_compare(Mage::getVersion(), '1.9.2.0') >= 0) {
35
+ return $label;
36
+ }
37
+ break;
38
+ case Mage::EDITION_ENTERPRISE:
39
+ if (version_compare(Mage::getVersion(), '1.14.2.0') >= 0) {
40
+ return $label;
41
+ }
42
+ break;
43
+ }
44
+ }
45
+ return addslashes($label);
46
+ }
47
  }
app/code/community/NRApps/Idealo/Block/Config/Adminhtml/Form/Field/Listings.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Config_Adminhtml_Form_Field_Listings extends Mage_Core_Block_Html_Select
4
- {
5
- public function _toHtml()
6
- {
7
- $options = Mage::getSingleton('nrapps_idealo/source_listingCountries')->getOptionArray();
8
- foreach ($options as $a => $label) {
9
- $this->addOption($a, $this->_addSlashesDependingOnMagentoVersion($label));
10
- }
11
-
12
- $this->setExtraParams('style="width: 107px;"');
13
-
14
- return parent::_toHtml();
15
- }
16
-
17
- public function setInputName($value)
18
- {
19
- return $this->setName($value);
20
- }
21
-
22
- /**
23
- * Add slashes for Magento CE 1.9.2.0+ and EE 1.14.2.0+. This is needed as Magento has introduced its own
24
- * escaping in app/design/adminhtml/default/default/template/system/config/form/field/array.phtml in these versions.
25
- *
26
- * @param string $label
27
- * @return string
28
- */
29
- protected function _addSlashesDependingOnMagentoVersion($label)
30
- {
31
- if (method_exists('Mage', 'getEdition')) {
32
- switch (Mage::getEdition()) {
33
- case Mage::EDITION_COMMUNITY:
34
- if (version_compare(Mage::getVersion(), '1.9.2.0') >= 0) {
35
- return $label;
36
- }
37
- break;
38
- case Mage::EDITION_ENTERPRISE:
39
- if (version_compare(Mage::getVersion(), '1.14.2.0') >= 0) {
40
- return $label;
41
- }
42
- break;
43
- }
44
- }
45
- return addslashes($label);
46
- }
47
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Config_Adminhtml_Form_Field_Listings extends Mage_Core_Block_Html_Select
4
+ {
5
+ public function _toHtml()
6
+ {
7
+ $options = Mage::getSingleton('nrapps_idealo/source_listingCountries')->getOptionArray();
8
+ foreach ($options as $a => $label) {
9
+ $this->addOption($a, $this->_addSlashesDependingOnMagentoVersion($label));
10
+ }
11
+
12
+ $this->setExtraParams('style="width: 107px;"');
13
+
14
+ return parent::_toHtml();
15
+ }
16
+
17
+ public function setInputName($value)
18
+ {
19
+ return $this->setName($value);
20
+ }
21
+
22
+ /**
23
+ * Add slashes for Magento CE 1.9.2.0+ and EE 1.14.2.0+. This is needed as Magento has introduced its own
24
+ * escaping in app/design/adminhtml/default/default/template/system/config/form/field/array.phtml in these versions.
25
+ *
26
+ * @param string $label
27
+ * @return string
28
+ */
29
+ protected function _addSlashesDependingOnMagentoVersion($label)
30
+ {
31
+ if (method_exists('Mage', 'getEdition')) {
32
+ switch (Mage::getEdition()) {
33
+ case Mage::EDITION_COMMUNITY:
34
+ if (version_compare(Mage::getVersion(), '1.9.2.0') >= 0) {
35
+ return $label;
36
+ }
37
+ break;
38
+ case Mage::EDITION_ENTERPRISE:
39
+ if (version_compare(Mage::getVersion(), '1.14.2.0') >= 0) {
40
+ return $label;
41
+ }
42
+ break;
43
+ }
44
+ }
45
+ return addslashes($label);
46
+ }
47
  }
app/code/community/NRApps/Idealo/Block/Config/Adminhtml/Form/Field/PaymentMethods.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods extends Mage_Core_Block_Html_Select
4
- {
5
- public function _toHtml()
6
- {
7
- $options = Mage::getSingleton('nrapps_idealo/source_paymentMethods')->getOptionArray();
8
- foreach ($options as $a => $label) {
9
- $this->addOption($a, $this->_addSlashesDependingOnMagentoVersion($label));
10
- }
11
-
12
- $this->setExtraParams('style="width: 107px;"');
13
-
14
- return parent::_toHtml();
15
- }
16
-
17
- public function setInputName($value)
18
- {
19
- return $this->setName($value);
20
- }
21
-
22
- /**
23
- * Add slashes for Magento CE 1.9.2.0+ and EE 1.14.2.0+. This is needed as Magento has introduced its own
24
- * escaping in app/design/adminhtml/default/default/template/system/config/form/field/array.phtml in these versions.
25
- *
26
- * @param string $label
27
- * @return string
28
- */
29
- protected function _addSlashesDependingOnMagentoVersion($label)
30
- {
31
- if (method_exists('Mage', 'getEdition')) {
32
- switch (Mage::getEdition()) {
33
- case Mage::EDITION_COMMUNITY:
34
- if (version_compare(Mage::getVersion(), '1.9.2.0') >= 0) {
35
- return $label;
36
- }
37
- break;
38
- case Mage::EDITION_ENTERPRISE:
39
- if (version_compare(Mage::getVersion(), '1.14.2.0') >= 0) {
40
- return $label;
41
- }
42
- break;
43
- }
44
- }
45
- return $this->jsQuoteEscape($label);
46
- }
47
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods extends Mage_Core_Block_Html_Select
4
+ {
5
+ public function _toHtml()
6
+ {
7
+ $options = Mage::getSingleton('nrapps_idealo/source_paymentMethods')->getOptionArray();
8
+ foreach ($options as $a => $label) {
9
+ $this->addOption($a, $this->_addSlashesDependingOnMagentoVersion($label));
10
+ }
11
+
12
+ $this->setExtraParams('style="width: 107px;"');
13
+
14
+ return parent::_toHtml();
15
+ }
16
+
17
+ public function setInputName($value)
18
+ {
19
+ return $this->setName($value);
20
+ }
21
+
22
+ /**
23
+ * Add slashes for Magento CE 1.9.2.0+ and EE 1.14.2.0+. This is needed as Magento has introduced its own
24
+ * escaping in app/design/adminhtml/default/default/template/system/config/form/field/array.phtml in these versions.
25
+ *
26
+ * @param string $label
27
+ * @return string
28
+ */
29
+ protected function _addSlashesDependingOnMagentoVersion($label)
30
+ {
31
+ if (method_exists('Mage', 'getEdition')) {
32
+ switch (Mage::getEdition()) {
33
+ case Mage::EDITION_COMMUNITY:
34
+ if (version_compare(Mage::getVersion(), '1.9.2.0') >= 0) {
35
+ return $label;
36
+ }
37
+ break;
38
+ case Mage::EDITION_ENTERPRISE:
39
+ if (version_compare(Mage::getVersion(), '1.14.2.0') >= 0) {
40
+ return $label;
41
+ }
42
+ break;
43
+ }
44
+ }
45
+ return $this->jsQuoteEscape($label);
46
+ }
47
  }
app/code/community/NRApps/Idealo/Block/Config/Attributes.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
-
4
- class NRApps_Idealo_Block_Config_Attributes extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
- {
6
-
7
- protected $_itemRenderer;
8
-
9
- public function _prepareToRender()
10
- {
11
- $this->addColumn('attribute_code', array(
12
- 'label' => Mage::helper('nrapps_idealo')->__('Attribute'),
13
- 'renderer' => $this->_getRenderer(),
14
- 'style' => 'width:200px',
15
- ));
16
-
17
- $this->addColumn('sort_order', array(
18
- 'label' => Mage::helper('nrapps_idealo')->__('Sort Order'),
19
- 'style' => 'width:100px',
20
- ));
21
-
22
- $this->_addAfter = false;
23
- $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
24
- }
25
-
26
- /**
27
- * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
28
- */
29
- protected function _getRenderer() {
30
- if (!$this->_itemRenderer) {
31
- $this->_itemRenderer = $this->getLayout()->createBlock(
32
- 'nrapps_idealo/config_adminhtml_form_field_attributes', '',
33
- array('is_render_to_js_template' => true)
34
- );
35
- }
36
- return $this->_itemRenderer;
37
- }
38
-
39
- protected function _prepareArrayRow(Varien_Object $row)
40
- {
41
- $row->setData(
42
- 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
43
- 'selected="selected"'
44
- );
45
- }
46
-
47
  }
1
+ <?php
2
+
3
+
4
+ class NRApps_Idealo_Block_Config_Attributes extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
+ {
6
+
7
+ protected $_itemRenderer;
8
+
9
+ public function _prepareToRender()
10
+ {
11
+ $this->addColumn('attribute_code', array(
12
+ 'label' => Mage::helper('nrapps_idealo')->__('Attribute'),
13
+ 'renderer' => $this->_getRenderer(),
14
+ 'style' => 'width:200px',
15
+ ));
16
+
17
+ $this->addColumn('sort_order', array(
18
+ 'label' => Mage::helper('nrapps_idealo')->__('Sort Order'),
19
+ 'style' => 'width:100px',
20
+ ));
21
+
22
+ $this->_addAfter = false;
23
+ $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
24
+ }
25
+
26
+ /**
27
+ * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
28
+ */
29
+ protected function _getRenderer() {
30
+ if (!$this->_itemRenderer) {
31
+ $this->_itemRenderer = $this->getLayout()->createBlock(
32
+ 'nrapps_idealo/config_adminhtml_form_field_attributes', '',
33
+ array('is_render_to_js_template' => true)
34
+ );
35
+ }
36
+ return $this->_itemRenderer;
37
+ }
38
+
39
+ protected function _prepareArrayRow(Varien_Object $row)
40
+ {
41
+ $row->setData(
42
+ 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
43
+ 'selected="selected"'
44
+ );
45
+ }
46
+
47
  }
app/code/community/NRApps/Idealo/Block/Config/AttributesNoSortOrder.php CHANGED
@@ -1,42 +1,42 @@
1
- <?php
2
-
3
-
4
- class NRApps_Idealo_Block_Config_AttributesNoSortOrder extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
- {
6
-
7
- protected $_itemRenderer;
8
-
9
- public function _prepareToRender()
10
- {
11
- $this->addColumn('attribute_code', array(
12
- 'label' => Mage::helper('nrapps_idealo')->__('Attribute'),
13
- 'renderer' => $this->_getRenderer(),
14
- 'style' => 'width:200px',
15
- ));
16
-
17
- $this->_addAfter = false;
18
- $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
19
- }
20
-
21
- /**
22
- * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
23
- */
24
- protected function _getRenderer() {
25
- if (!$this->_itemRenderer) {
26
- $this->_itemRenderer = $this->getLayout()->createBlock(
27
- 'nrapps_idealo/config_adminhtml_form_field_attributes', '',
28
- array('is_render_to_js_template' => true)
29
- );
30
- }
31
- return $this->_itemRenderer;
32
- }
33
-
34
- protected function _prepareArrayRow(Varien_Object $row)
35
- {
36
- $row->setData(
37
- 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
38
- 'selected="selected"'
39
- );
40
- }
41
-
42
  }
1
+ <?php
2
+
3
+
4
+ class NRApps_Idealo_Block_Config_AttributesNoSortOrder extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
+ {
6
+
7
+ protected $_itemRenderer;
8
+
9
+ public function _prepareToRender()
10
+ {
11
+ $this->addColumn('attribute_code', array(
12
+ 'label' => Mage::helper('nrapps_idealo')->__('Attribute'),
13
+ 'renderer' => $this->_getRenderer(),
14
+ 'style' => 'width:200px',
15
+ ));
16
+
17
+ $this->_addAfter = false;
18
+ $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
19
+ }
20
+
21
+ /**
22
+ * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
23
+ */
24
+ protected function _getRenderer() {
25
+ if (!$this->_itemRenderer) {
26
+ $this->_itemRenderer = $this->getLayout()->createBlock(
27
+ 'nrapps_idealo/config_adminhtml_form_field_attributes', '',
28
+ array('is_render_to_js_template' => true)
29
+ );
30
+ }
31
+ return $this->_itemRenderer;
32
+ }
33
+
34
+ protected function _prepareArrayRow(Varien_Object $row)
35
+ {
36
+ $row->setData(
37
+ 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
38
+ 'selected="selected"'
39
+ );
40
+ }
41
+
42
  }
app/code/community/NRApps/Idealo/Block/Config/DeliveryTimeMapping.php CHANGED
@@ -1,82 +1,82 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Config_DeliveryTimeMapping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
- {
5
- protected $_itemRenderer;
6
-
7
- public function _prepareToRender()
8
- {
9
- $this->addColumn('dummy', array(
10
- 'label' => ' ',
11
- 'renderer' => $this->_getRenderer(),
12
- ));
13
- $this->addColumn('attribute_value', array(
14
- 'label' => Mage::helper('nrapps_idealo')->__('Attribute value'),
15
- 'style' => 'width:100px',
16
- ));
17
-
18
- $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE, array(
19
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.de'),
20
- 'style' => 'width:100px',
21
- ));
22
-
23
- $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_AT, array(
24
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.at'),
25
- 'style' => 'width:100px',
26
- ));
27
-
28
- $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_UK, array(
29
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.co.uk'),
30
- 'style' => 'width:100px',
31
- ));
32
-
33
- $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_FR, array(
34
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.fr'),
35
- 'style' => 'width:100px',
36
- ));
37
-
38
- $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_IT, array(
39
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.it'),
40
- 'style' => 'width:100px',
41
- ));
42
-
43
- $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_ES, array(
44
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.es'),
45
- 'style' => 'width:100px',
46
- ));
47
-
48
- $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_PL, array(
49
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.pl'),
50
- 'style' => 'width:100px',
51
- ));
52
-
53
- $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_IN, array(
54
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.in'),
55
- 'style' => 'width:100px',
56
- ));
57
-
58
- $this->_addAfter = false;
59
- $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
60
- }
61
-
62
- /**
63
- * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
64
- */
65
- protected function _getRenderer() {
66
- if (!$this->_itemRenderer) {
67
- $this->_itemRenderer = $this->getLayout()->createBlock(
68
- 'nrapps_idealo/config_adminhtml_form_field_dummy', '',
69
- array('is_render_to_js_template' => true)
70
- );
71
- }
72
- return $this->_itemRenderer;
73
- }
74
-
75
- protected function _prepareArrayRow(Varien_Object $row)
76
- {
77
- $row->setData(
78
- 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
79
- 'selected="selected"'
80
- );
81
- }
82
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Config_DeliveryTimeMapping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $_itemRenderer;
6
+
7
+ public function _prepareToRender()
8
+ {
9
+ $this->addColumn('dummy', array(
10
+ 'label' => ' ',
11
+ 'renderer' => $this->_getRenderer(),
12
+ ));
13
+ $this->addColumn('attribute_value', array(
14
+ 'label' => Mage::helper('nrapps_idealo')->__('Attribute value'),
15
+ 'style' => 'width:100px',
16
+ ));
17
+
18
+ $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE, array(
19
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.de'),
20
+ 'style' => 'width:100px',
21
+ ));
22
+
23
+ $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_AT, array(
24
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.at'),
25
+ 'style' => 'width:100px',
26
+ ));
27
+
28
+ $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_UK, array(
29
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.co.uk'),
30
+ 'style' => 'width:100px',
31
+ ));
32
+
33
+ $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_FR, array(
34
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.fr'),
35
+ 'style' => 'width:100px',
36
+ ));
37
+
38
+ $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_IT, array(
39
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.it'),
40
+ 'style' => 'width:100px',
41
+ ));
42
+
43
+ $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_ES, array(
44
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.es'),
45
+ 'style' => 'width:100px',
46
+ ));
47
+
48
+ $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_PL, array(
49
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.pl'),
50
+ 'style' => 'width:100px',
51
+ ));
52
+
53
+ $this->addColumn(NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_IN, array(
54
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.in'),
55
+ 'style' => 'width:100px',
56
+ ));
57
+
58
+ $this->_addAfter = false;
59
+ $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
60
+ }
61
+
62
+ /**
63
+ * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
64
+ */
65
+ protected function _getRenderer() {
66
+ if (!$this->_itemRenderer) {
67
+ $this->_itemRenderer = $this->getLayout()->createBlock(
68
+ 'nrapps_idealo/config_adminhtml_form_field_dummy', '',
69
+ array('is_render_to_js_template' => true)
70
+ );
71
+ }
72
+ return $this->_itemRenderer;
73
+ }
74
+
75
+ protected function _prepareArrayRow(Varien_Object $row)
76
+ {
77
+ $row->setData(
78
+ 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
79
+ 'selected="selected"'
80
+ );
81
+ }
82
+ }
app/code/community/NRApps/Idealo/Block/Config/DeliveryTimeUpdateButton.php CHANGED
@@ -1,33 +1,33 @@
1
- <?php
2
-
3
-
4
- class NRApps_Idealo_Block_Config_DeliveryTimeUpdateButton extends Mage_Adminhtml_Block_System_Config_Form_Field
5
- {
6
- /**
7
- * @param Varien_Data_Form_Element_Abstract $element
8
- * @return string
9
- */
10
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
11
- {
12
- return $this->getLayout()->createBlock('adminhtml/template')->setTemplate('nrapps/idealo/delivery_time_update_button.phtml')->toHtml();
13
- }
14
-
15
- /**
16
- * Enter description here...
17
- *
18
- * @param Varien_Data_Form_Element_Abstract $element
19
- * @return string
20
- */
21
- public function render(Varien_Data_Form_Element_Abstract $element)
22
- {
23
- $id = $element->getHtmlId();
24
-
25
- $html = '<tr id="row_' . $id . '">'
26
- . '<td colspan="3">' . $this->_getElementHtml($element) . '</td>';
27
-
28
-
29
- $html.= '<td></td>';
30
- $html.= '</tr>';
31
- return $html;
32
- }
33
  }
1
+ <?php
2
+
3
+
4
+ class NRApps_Idealo_Block_Config_DeliveryTimeUpdateButton extends Mage_Adminhtml_Block_System_Config_Form_Field
5
+ {
6
+ /**
7
+ * @param Varien_Data_Form_Element_Abstract $element
8
+ * @return string
9
+ */
10
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
11
+ {
12
+ return $this->getLayout()->createBlock('adminhtml/template')->setTemplate('nrapps/idealo/delivery_time_update_button.phtml')->toHtml();
13
+ }
14
+
15
+ /**
16
+ * Enter description here...
17
+ *
18
+ * @param Varien_Data_Form_Element_Abstract $element
19
+ * @return string
20
+ */
21
+ public function render(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ $id = $element->getHtmlId();
24
+
25
+ $html = '<tr id="row_' . $id . '">'
26
+ . '<td colspan="3">' . $this->_getElementHtml($element) . '</td>';
27
+
28
+
29
+ $html.= '<td></td>';
30
+ $html.= '</tr>';
31
+ return $html;
32
+ }
33
  }
app/code/community/NRApps/Idealo/Block/Config/Description.php CHANGED
@@ -1,33 +1,33 @@
1
- <?php
2
-
3
-
4
- class NRApps_Idealo_Block_Config_Description extends Mage_Adminhtml_Block_System_Config_Form_Field
5
- {
6
- /**
7
- * @param Varien_Data_Form_Element_Abstract $element
8
- * @return string
9
- */
10
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
11
- {
12
- return $this->getLayout()->createBlock('adminhtml/template')->setTemplate('nrapps/idealo/config.phtml')->toHtml();
13
- }
14
-
15
- /**
16
- * Enter description here...
17
- *
18
- * @param Varien_Data_Form_Element_Abstract $element
19
- * @return string
20
- */
21
- public function render(Varien_Data_Form_Element_Abstract $element)
22
- {
23
- $id = $element->getHtmlId();
24
-
25
- $html = '<tr id="row_' . $id . '">'
26
- . '<td colspan="3">' . $this->_getElementHtml($element) . '</td>';
27
-
28
-
29
- $html.= '<td></td>';
30
- $html.= '</tr>';
31
- return $html;
32
- }
33
  }
1
+ <?php
2
+
3
+
4
+ class NRApps_Idealo_Block_Config_Description extends Mage_Adminhtml_Block_System_Config_Form_Field
5
+ {
6
+ /**
7
+ * @param Varien_Data_Form_Element_Abstract $element
8
+ * @return string
9
+ */
10
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
11
+ {
12
+ return $this->getLayout()->createBlock('adminhtml/template')->setTemplate('nrapps/idealo/config.phtml')->toHtml();
13
+ }
14
+
15
+ /**
16
+ * Enter description here...
17
+ *
18
+ * @param Varien_Data_Form_Element_Abstract $element
19
+ * @return string
20
+ */
21
+ public function render(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ $id = $element->getHtmlId();
24
+
25
+ $html = '<tr id="row_' . $id . '">'
26
+ . '<td colspan="3">' . $this->_getElementHtml($element) . '</td>';
27
+
28
+
29
+ $html.= '<td></td>';
30
+ $html.= '</tr>';
31
+ return $html;
32
+ }
33
  }
app/code/community/NRApps/Idealo/Block/Config/PaymentMethods.php CHANGED
@@ -1,52 +1,52 @@
1
- <?php
2
-
3
-
4
- class NRApps_Idealo_Block_Config_PaymentMethods extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
- {
6
-
7
- protected $_itemRenderer;
8
-
9
- public function _prepareToRender()
10
- {
11
- $this->addColumn('payment_method', array(
12
- 'label' => Mage::helper('nrapps_idealo')->__('Payment Method'),
13
- 'renderer' => $this->_getRenderer(),
14
- 'style' => 'width:100px',
15
- ));
16
-
17
- $this->addColumn('surcharge', array(
18
- 'label' => Mage::helper('nrapps_idealo')->__('Fixed Surcharge'),
19
- 'style' => 'width:100px',
20
- ));
21
-
22
- $this->addColumn('percental_surcharge', array(
23
- 'label' => Mage::helper('nrapps_idealo')->__('Percental Surcharge'),
24
- 'style' => 'width:100px',
25
- ));
26
-
27
- $this->_addAfter = false;
28
- $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
29
- }
30
-
31
- /**
32
- * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
33
- */
34
- protected function _getRenderer() {
35
- if (!$this->_itemRenderer) {
36
- $this->_itemRenderer = $this->getLayout()->createBlock(
37
- 'nrapps_idealo/config_adminhtml_form_field_paymentMethods', '',
38
- array('is_render_to_js_template' => true)
39
- );
40
- }
41
- return $this->_itemRenderer;
42
- }
43
-
44
- protected function _prepareArrayRow(Varien_Object $row)
45
- {
46
- $row->setData(
47
- 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('payment_method')),
48
- 'selected="selected"'
49
- );
50
- }
51
-
52
  }
1
+ <?php
2
+
3
+
4
+ class NRApps_Idealo_Block_Config_PaymentMethods extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
+ {
6
+
7
+ protected $_itemRenderer;
8
+
9
+ public function _prepareToRender()
10
+ {
11
+ $this->addColumn('payment_method', array(
12
+ 'label' => Mage::helper('nrapps_idealo')->__('Payment Method'),
13
+ 'renderer' => $this->_getRenderer(),
14
+ 'style' => 'width:100px',
15
+ ));
16
+
17
+ $this->addColumn('surcharge', array(
18
+ 'label' => Mage::helper('nrapps_idealo')->__('Fixed Surcharge'),
19
+ 'style' => 'width:100px',
20
+ ));
21
+
22
+ $this->addColumn('percental_surcharge', array(
23
+ 'label' => Mage::helper('nrapps_idealo')->__('Percental Surcharge'),
24
+ 'style' => 'width:100px',
25
+ ));
26
+
27
+ $this->_addAfter = false;
28
+ $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
29
+ }
30
+
31
+ /**
32
+ * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
33
+ */
34
+ protected function _getRenderer() {
35
+ if (!$this->_itemRenderer) {
36
+ $this->_itemRenderer = $this->getLayout()->createBlock(
37
+ 'nrapps_idealo/config_adminhtml_form_field_paymentMethods', '',
38
+ array('is_render_to_js_template' => true)
39
+ );
40
+ }
41
+ return $this->_itemRenderer;
42
+ }
43
+
44
+ protected function _prepareArrayRow(Varien_Object $row)
45
+ {
46
+ $row->setData(
47
+ 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('payment_method')),
48
+ 'selected="selected"'
49
+ );
50
+ }
51
+
52
  }
app/code/community/NRApps/Idealo/Block/Config/ShippingComments.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
-
3
-
4
- class NRApps_Idealo_Block_Config_ShippingComments extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
- {
6
-
7
- protected $_itemRenderer;
8
-
9
- public function _prepareToRender()
10
- {
11
- $this->addColumn('listing_at', array(
12
- 'label' => Mage::helper('nrapps_idealo')->__('for listing at'),
13
- 'renderer' => $this->_getRenderer(),
14
- 'style' => 'width:100px',
15
- ));
16
-
17
- $this->addColumn('comment', array(
18
- 'label' => Mage::helper('nrapps_idealo')->__('Shipping Comment'),
19
- 'style' => 'width:360px',
20
- ));
21
-
22
- $this->_addAfter = false;
23
- $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
24
- }
25
-
26
- /**
27
- * @return NRApps_Idealo_Block_Config_ShippingComment
28
- */
29
- protected function _getRenderer() {
30
- if (!$this->_itemRenderer) {
31
- $this->_itemRenderer = $this->getLayout()->createBlock(
32
- 'nrapps_idealo/config_adminhtml_form_field_listings', '',
33
- array('is_render_to_js_template' => true)
34
- );
35
- }
36
- return $this->_itemRenderer;
37
- }
38
-
39
- protected function _prepareArrayRow(Varien_Object $row)
40
- {
41
- $row->setData(
42
- 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('listing_at')),
43
- 'selected="selected"'
44
- );
45
- }
46
-
47
  }
1
+ <?php
2
+
3
+
4
+ class NRApps_Idealo_Block_Config_ShippingComments extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
5
+ {
6
+
7
+ protected $_itemRenderer;
8
+
9
+ public function _prepareToRender()
10
+ {
11
+ $this->addColumn('listing_at', array(
12
+ 'label' => Mage::helper('nrapps_idealo')->__('for listing at'),
13
+ 'renderer' => $this->_getRenderer(),
14
+ 'style' => 'width:100px',
15
+ ));
16
+
17
+ $this->addColumn('comment', array(
18
+ 'label' => Mage::helper('nrapps_idealo')->__('Shipping Comment'),
19
+ 'style' => 'width:360px',
20
+ ));
21
+
22
+ $this->_addAfter = false;
23
+ $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
24
+ }
25
+
26
+ /**
27
+ * @return NRApps_Idealo_Block_Config_ShippingComment
28
+ */
29
+ protected function _getRenderer() {
30
+ if (!$this->_itemRenderer) {
31
+ $this->_itemRenderer = $this->getLayout()->createBlock(
32
+ 'nrapps_idealo/config_adminhtml_form_field_listings', '',
33
+ array('is_render_to_js_template' => true)
34
+ );
35
+ }
36
+ return $this->_itemRenderer;
37
+ }
38
+
39
+ protected function _prepareArrayRow(Varien_Object $row)
40
+ {
41
+ $row->setData(
42
+ 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('listing_at')),
43
+ 'selected="selected"'
44
+ );
45
+ }
46
+
47
  }
app/code/community/NRApps/Idealo/Block/Config/ShippingCosts.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Config_ShippingCosts extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
- {
5
- protected $_itemRenderer;
6
-
7
- public function _prepareToRender()
8
- {
9
- $this->addColumn('dummy', array(
10
- 'label' => ' ',
11
- 'renderer' => $this->_getRenderer(),
12
- ));
13
- $this->addColumn('from_price', array(
14
- 'label' => Mage::helper('nrapps_idealo')->__('From Price'),
15
- 'style' => 'width:100px',
16
- ));
17
- $this->addColumn('cost', array(
18
- 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost'),
19
- 'style' => 'width:100px',
20
- ));
21
-
22
- $this->_addAfter = false;
23
- $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
24
- }
25
-
26
- /**
27
- * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
28
- */
29
- protected function _getRenderer() {
30
- if (!$this->_itemRenderer) {
31
- $this->_itemRenderer = $this->getLayout()->createBlock(
32
- 'nrapps_idealo/config_adminhtml_form_field_dummy', '',
33
- array('is_render_to_js_template' => true)
34
- );
35
- }
36
- return $this->_itemRenderer;
37
- }
38
-
39
- protected function _prepareArrayRow(Varien_Object $row)
40
- {
41
- $row->setData(
42
- 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
43
- 'selected="selected"'
44
- );
45
- }
46
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Config_ShippingCosts extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $_itemRenderer;
6
+
7
+ public function _prepareToRender()
8
+ {
9
+ $this->addColumn('dummy', array(
10
+ 'label' => ' ',
11
+ 'renderer' => $this->_getRenderer(),
12
+ ));
13
+ $this->addColumn('from_price', array(
14
+ 'label' => Mage::helper('nrapps_idealo')->__('From Price'),
15
+ 'style' => 'width:100px',
16
+ ));
17
+ $this->addColumn('cost', array(
18
+ 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost'),
19
+ 'style' => 'width:100px',
20
+ ));
21
+
22
+ $this->_addAfter = false;
23
+ $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
24
+ }
25
+
26
+ /**
27
+ * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
28
+ */
29
+ protected function _getRenderer() {
30
+ if (!$this->_itemRenderer) {
31
+ $this->_itemRenderer = $this->getLayout()->createBlock(
32
+ 'nrapps_idealo/config_adminhtml_form_field_dummy', '',
33
+ array('is_render_to_js_template' => true)
34
+ );
35
+ }
36
+ return $this->_itemRenderer;
37
+ }
38
+
39
+ protected function _prepareArrayRow(Varien_Object $row)
40
+ {
41
+ $row->setData(
42
+ 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
43
+ 'selected="selected"'
44
+ );
45
+ }
46
+ }
app/code/community/NRApps/Idealo/Block/Config/ShippingCostsWeight.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Block_Config_ShippingCostsWeight extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
- {
5
- protected $_itemRenderer;
6
-
7
- public function _prepareToRender()
8
- {
9
- $this->addColumn('dummy', array(
10
- 'label' => ' ',
11
- 'renderer' => $this->_getRenderer(),
12
- ));
13
- $this->addColumn('from_weight', array(
14
- 'label' => Mage::helper('nrapps_idealo')->__('From Weight'),
15
- 'style' => 'width:100px',
16
- ));
17
- $this->addColumn('cost', array(
18
- 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost'),
19
- 'style' => 'width:100px',
20
- ));
21
-
22
- $this->_addAfter = false;
23
- $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
24
- }
25
-
26
- /**
27
- * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
28
- */
29
- protected function _getRenderer() {
30
- if (!$this->_itemRenderer) {
31
- $this->_itemRenderer = $this->getLayout()->createBlock(
32
- 'nrapps_idealo/config_adminhtml_form_field_dummy', '',
33
- array('is_render_to_js_template' => true)
34
- );
35
- }
36
- return $this->_itemRenderer;
37
- }
38
-
39
- protected function _prepareArrayRow(Varien_Object $row)
40
- {
41
- $row->setData(
42
- 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
43
- 'selected="selected"'
44
- );
45
- }
46
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Block_Config_ShippingCostsWeight extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $_itemRenderer;
6
+
7
+ public function _prepareToRender()
8
+ {
9
+ $this->addColumn('dummy', array(
10
+ 'label' => ' ',
11
+ 'renderer' => $this->_getRenderer(),
12
+ ));
13
+ $this->addColumn('from_weight', array(
14
+ 'label' => Mage::helper('nrapps_idealo')->__('From Weight'),
15
+ 'style' => 'width:100px',
16
+ ));
17
+ $this->addColumn('cost', array(
18
+ 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost'),
19
+ 'style' => 'width:100px',
20
+ ));
21
+
22
+ $this->_addAfter = false;
23
+ $this->_addButtonLabel = Mage::helper('nrapps_idealo')->__('Add');
24
+ }
25
+
26
+ /**
27
+ * @return NRApps_Idealo_Block_Config_Adminhtml_Form_Field_PaymentMethods
28
+ */
29
+ protected function _getRenderer() {
30
+ if (!$this->_itemRenderer) {
31
+ $this->_itemRenderer = $this->getLayout()->createBlock(
32
+ 'nrapps_idealo/config_adminhtml_form_field_dummy', '',
33
+ array('is_render_to_js_template' => true)
34
+ );
35
+ }
36
+ return $this->_itemRenderer;
37
+ }
38
+
39
+ protected function _prepareArrayRow(Varien_Object $row)
40
+ {
41
+ $row->setData(
42
+ 'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('attribute_code')),
43
+ 'selected="selected"'
44
+ );
45
+ }
46
+ }
app/code/community/NRApps/Idealo/Helper/Data.php CHANGED
@@ -1,136 +1,136 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
- public function isInstalled()
6
- {
7
- return Mage::getStoreConfigFlag('nrapps_idealo/is_installed');
8
- }
9
-
10
- public function setIsInstalled()
11
- {
12
- Mage::getResourceModel('core/setup', 'core_setup')->setConfigData('nrapps_idealo/is_installed', 1);
13
- Mage::app()->getCacheInstance()->cleanType('config');
14
- }
15
-
16
- /**
17
- * Output notice to admin if not all necessary product attributes are assigned
18
- */
19
- public function checkAttributesAssigned()
20
- {
21
- if ($this->isInstalled() && !$this->_allAttributesAssigned()) {
22
- Mage::getSingleton('adminhtml/session')->addNotice(
23
- $this->__(
24
- 'idealo Connect requires you to set up attributes. Click <a href="%s">here</a> to go to the attribute management.',
25
- Mage::helper('adminhtml')->getUrl('adminhtml/idealo_attributes/')
26
- )
27
- );
28
- }
29
- }
30
-
31
- /**
32
- * Check if all necessary product attributes are assigned via admin form
33
- *
34
- * @return bool
35
- */
36
- protected function _allAttributesAssigned()
37
- {
38
- foreach (Mage::getStoreConfig('nrapps_idealo/attributes') as $assignedAttributeCode) {
39
- if (!$assignedAttributeCode) {
40
- return false;
41
- }
42
- }
43
- return true;
44
- }
45
-
46
- /**
47
- * @param string[]|string $types
48
- * @return Mage_Catalog_Model_Resource_Product_Attribute_Collection
49
- */
50
- public function getProductAttributes($types = null)
51
- {
52
- Mage::log($types);
53
- /** @var $attributes Mage_Catalog_Model_Resource_Product_Attribute_Collection */
54
- $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
55
- ->addFieldToFilter('frontend_label', array('notnull' => true))
56
- ->addFieldToFilter('frontend_label', array('neq' => ''))
57
- ->setOrder('frontend_label', 'ASC');
58
-
59
- if (!is_null($types)) {
60
- if (!is_array($types)) {
61
- $types = array($types);
62
- }
63
- $frontendTypes = array();
64
- $backendTypes = array();
65
- $sourceModels = array();
66
- foreach($types as $type) {
67
- if ($type == 'decimal') {
68
- $backendTypes[] = $type;
69
- } elseif ($type == 'yesno') {
70
- $sourceModels[] = 'eav/entity_attribute_source_boolean';
71
- } else {
72
- $frontendTypes[] = $type;
73
- }
74
- }
75
- if (sizeof($frontendTypes)) {
76
- $attributes->addFieldToFilter('frontend_input', array('in' => $frontendTypes));
77
- }
78
- if (sizeof($backendTypes)) {
79
- $attributes->addFieldToFilter('backend_type', array('in' => $backendTypes));
80
- }
81
- }
82
-
83
- return $attributes;
84
- }
85
-
86
- /**
87
- * log facility (??)
88
- *
89
- * @param string $message
90
- * @param integer $level
91
- * @param string $file
92
- */
93
- public function log($message, $level = null, $file = '')
94
- {
95
- static $loggers = array();
96
-
97
- $level = is_null($level) ? Zend_Log::DEBUG : $level;
98
- $file = empty($file) ? 'system.log' : $file;
99
-
100
- try {
101
- if (!isset($loggers[$file])) {
102
- $logDir = Mage::getBaseDir('media') . DS . 'nrapps_idealo' . DS . 'log';
103
- $logFile = $logDir . DS . $file;
104
-
105
- if (!is_dir($logDir)) {
106
- mkdir($logDir, 0777, true);
107
- }
108
-
109
- if (!file_exists($logFile)) {
110
- file_put_contents($logFile, '');
111
- chmod($logFile, 0777);
112
- }
113
-
114
- $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
115
- $formatter = new Zend_Log_Formatter_Simple($format);
116
- $writerModel = (string)Mage::getConfig()->getNode('global/log/core/writer_model');
117
- if (!$writerModel) {
118
- $writer = new Zend_Log_Writer_Stream($logFile);
119
- }
120
- else {
121
- $writer = new $writerModel($logFile);
122
- }
123
- $writer->setFormatter($formatter);
124
- $loggers[$file] = new Zend_Log($writer);
125
- }
126
-
127
- if (is_array($message) || is_object($message)) {
128
- $message = print_r($message, true);
129
- }
130
-
131
- $loggers[$file]->log($message, $level);
132
- }
133
- catch (Exception $e) {
134
- }
135
- }
136
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function isInstalled()
6
+ {
7
+ return Mage::getStoreConfigFlag('nrapps_idealo/is_installed');
8
+ }
9
+
10
+ public function setIsInstalled()
11
+ {
12
+ Mage::getResourceModel('core/setup', 'core_setup')->setConfigData('nrapps_idealo/is_installed', 1);
13
+ Mage::app()->getCacheInstance()->cleanType('config');
14
+ }
15
+
16
+ /**
17
+ * Output notice to admin if not all necessary product attributes are assigned
18
+ */
19
+ public function checkAttributesAssigned()
20
+ {
21
+ if ($this->isInstalled() && !$this->_allAttributesAssigned()) {
22
+ Mage::getSingleton('adminhtml/session')->addNotice(
23
+ $this->__(
24
+ 'idealo Connect requires you to set up attributes. Click <a href="%s">here</a> to go to the attribute management.',
25
+ Mage::helper('adminhtml')->getUrl('adminhtml/idealo_attributes/')
26
+ )
27
+ );
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Check if all necessary product attributes are assigned via admin form
33
+ *
34
+ * @return bool
35
+ */
36
+ protected function _allAttributesAssigned()
37
+ {
38
+ foreach (Mage::getStoreConfig('nrapps_idealo/attributes') as $assignedAttributeCode) {
39
+ if (!$assignedAttributeCode) {
40
+ return false;
41
+ }
42
+ }
43
+ return true;
44
+ }
45
+
46
+ /**
47
+ * @param string[]|string $types
48
+ * @return Mage_Catalog_Model_Resource_Product_Attribute_Collection
49
+ */
50
+ public function getProductAttributes($types = null)
51
+ {
52
+ Mage::log($types);
53
+ /** @var $attributes Mage_Catalog_Model_Resource_Product_Attribute_Collection */
54
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
55
+ ->addFieldToFilter('frontend_label', array('notnull' => true))
56
+ ->addFieldToFilter('frontend_label', array('neq' => ''))
57
+ ->setOrder('frontend_label', 'ASC');
58
+
59
+ if (!is_null($types)) {
60
+ if (!is_array($types)) {
61
+ $types = array($types);
62
+ }
63
+ $frontendTypes = array();
64
+ $backendTypes = array();
65
+ $sourceModels = array();
66
+ foreach($types as $type) {
67
+ if ($type == 'decimal') {
68
+ $backendTypes[] = $type;
69
+ } elseif ($type == 'yesno') {
70
+ $sourceModels[] = 'eav/entity_attribute_source_boolean';
71
+ } else {
72
+ $frontendTypes[] = $type;
73
+ }
74
+ }
75
+ if (sizeof($frontendTypes)) {
76
+ $attributes->addFieldToFilter('frontend_input', array('in' => $frontendTypes));
77
+ }
78
+ if (sizeof($backendTypes)) {
79
+ $attributes->addFieldToFilter('backend_type', array('in' => $backendTypes));
80
+ }
81
+ }
82
+
83
+ return $attributes;
84
+ }
85
+
86
+ /**
87
+ * log facility (??)
88
+ *
89
+ * @param string $message
90
+ * @param integer $level
91
+ * @param string $file
92
+ */
93
+ public function log($message, $level = null, $file = '')
94
+ {
95
+ static $loggers = array();
96
+
97
+ $level = is_null($level) ? Zend_Log::DEBUG : $level;
98
+ $file = empty($file) ? 'system.log' : $file;
99
+
100
+ try {
101
+ if (!isset($loggers[$file])) {
102
+ $logDir = Mage::getBaseDir('media') . DS . 'nrapps_idealo' . DS . 'log';
103
+ $logFile = $logDir . DS . $file;
104
+
105
+ if (!is_dir($logDir)) {
106
+ mkdir($logDir, 0777, true);
107
+ }
108
+
109
+ if (!file_exists($logFile)) {
110
+ file_put_contents($logFile, '');
111
+ chmod($logFile, 0777);
112
+ }
113
+
114
+ $format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
115
+ $formatter = new Zend_Log_Formatter_Simple($format);
116
+ $writerModel = (string)Mage::getConfig()->getNode('global/log/core/writer_model');
117
+ if (!$writerModel) {
118
+ $writer = new Zend_Log_Writer_Stream($logFile);
119
+ }
120
+ else {
121
+ $writer = new $writerModel($logFile);
122
+ }
123
+ $writer->setFormatter($formatter);
124
+ $loggers[$file] = new Zend_Log($writer);
125
+ }
126
+
127
+ if (is_array($message) || is_object($message)) {
128
+ $message = print_r($message, true);
129
+ }
130
+
131
+ $loggers[$file]->log($message, $level);
132
+ }
133
+ catch (Exception $e) {
134
+ }
135
+ }
136
  }
app/code/community/NRApps/Idealo/Model/Api.php CHANGED
@@ -1,357 +1,357 @@
1
- <?php
2
- class NRApps_Idealo_Model_Api
3
- {
4
- const LIMIT_NUMBER_PRODUCTS_PER_RUN = 100;
5
- const LIMIT_NUMBER_RUNS = 10;
6
- const LIMIT_TIMEOUT_PER_PRODUCT = 3;
7
-
8
- protected $_runIndex = 0;
9
-
10
- public function sendKeepAlive()
11
- {
12
- if (Mage::getStoreConfigFlag('nrapps_idealo/settings/test_mode') || !Mage::getStoreConfigFlag('nrapps_idealo/settings/is_active')) {
13
- return;
14
- }
15
-
16
- $xml = $this->_getKeepAliveXml();
17
-
18
- $response = $this->_getResponseFromAPI($xml);
19
-
20
- $this->_logRequest($response, $xml);
21
- }
22
-
23
- public function transferAll()
24
- {
25
- $this->deleteExistingOffersOnFirstRun();
26
-
27
- foreach(Mage::app()->getStores() as $store) {
28
-
29
- if (Mage::getStoreConfigFlag('nrapps_idealo/settings/test_mode', $store->getId())) {
30
- continue;
31
- }
32
-
33
- try {
34
- $this->transferStoreData($store->getId());
35
- } catch (Exception $e) {
36
- Mage::logException($e);
37
- }
38
- }
39
- }
40
-
41
- public function transferStoreData($storeId)
42
- {
43
- /** @var $indexResource NRApps_Idealo_Model_Resource_Indexer */
44
- $indexResource = Mage::getResourceModel('nrapps_idealo/indexer');
45
-
46
- $canProcess = true;
47
- while ($canProcess && ++$this->_runIndex <= self::LIMIT_NUMBER_RUNS) {
48
- $dataToProcess = $indexResource->getDataToProcess($storeId, self::LIMIT_NUMBER_PRODUCTS_PER_RUN);
49
-
50
- if (sizeof($dataToProcess)) {
51
- $this->_processData($dataToProcess, $storeId);
52
- } else {
53
- if ($this->_runIndex == 1) {
54
- $this->sendKeepAlive();
55
- }
56
- $canProcess = false;
57
- }
58
- }
59
- }
60
-
61
- /**
62
- * @param array $dataToProcess
63
- * @param int $storeId
64
- */
65
- protected function _processData($dataToProcess, $storeId)
66
- {
67
- $xml = $this->_getAssembledXml($dataToProcess);
68
-
69
- $response = $this->_getResponseFromAPI($xml, $storeId);
70
-
71
- $this->_updateIndexOnApiResponse($response, $xml);
72
- }
73
-
74
- protected function _getAssembledXml($dataToProcess)
75
- {
76
- $xml = '';
77
-
78
- /** @var $feed NRApps_Idealo_Model_Feed */
79
- $feed = Mage::getSingleton('nrapps_idealo/feed');
80
-
81
- if ($feed->getIncludeHeader()) {
82
- $xml .= $feed->getHeader() . $feed->getEol();
83
- }
84
-
85
- foreach($dataToProcess as $dataRow) {
86
- $xml .= $dataRow['data'] . $feed->getEol();
87
- }
88
-
89
- $xml .= $feed->getFooter();
90
-
91
- return $xml;
92
- }
93
-
94
- protected function _getKeepAliveXml()
95
- {
96
- $xml = '';
97
-
98
- /** @var $feed NRApps_Idealo_Model_Feed */
99
- $feed = Mage::getSingleton('nrapps_idealo/feed');
100
-
101
- if ($feed->getIncludeHeader()) {
102
- $xml .= $feed->getHeader() . $feed->getEol();
103
- }
104
-
105
- $xml .= $feed->getFooter();
106
-
107
- return $xml;
108
- }
109
-
110
- /**
111
- * @param $xml
112
- * @param $storeId
113
- * @return mixed
114
- * @throws Mage_Core_Exception
115
- */
116
- protected function _getResponseFromAPI($xml, $storeId = null)
117
- {
118
- $url = Mage::getStoreConfig('nrapps_idealo/settings/api_update_url', $storeId);
119
- $shopId = Mage::getStoreConfig('nrapps_idealo/settings/shop_id', $storeId);
120
- $userName = Mage::getStoreConfig('nrapps_idealo/settings/user', $storeId);
121
- $password = Mage::getStoreConfig('nrapps_idealo/settings/password', $storeId);
122
-
123
- $header = array(
124
- 'shopId: ' . $shopId,
125
- 'Content-Type: application/xml; charset=UTF-8',
126
- 'Expect:' . '',
127
- 'shopsystem: Magento',
128
- 'shopsystemversion: ' . Mage::getVersion(),
129
- 'idealomodulversion: ' . Mage::getConfig()->getModuleConfig('NRApps_Idealo')->version,
130
- );
131
-
132
- $process = curl_init($url);
133
- curl_setopt($process, CURLOPT_HTTPHEADER, $header);
134
- curl_setopt($process, CURLOPT_USERPWD, $userName . ':' . $password);
135
- curl_setopt($process, CURLOPT_TIMEOUT, self::LIMIT_TIMEOUT_PER_PRODUCT * self::LIMIT_NUMBER_PRODUCTS_PER_RUN);
136
- curl_setopt($process, CURLOPT_POST, true);
137
- curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
138
- curl_setopt($process, CURLOPT_POSTFIELDS, $xml);
139
- curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
140
- if (Mage::getStoreConfigFlag('nrapps_idealo/settings/disable_certificate_check')) {
141
- curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
142
- }
143
- $return = curl_exec($process);
144
-
145
- if ($return === false) {
146
- $message = 'cURL Error ' . curl_errno($process) . ': ' . curl_error($process) . PHP_EOL . PHP_EOL;
147
- $message .= 'Request: ' . PHP_EOL . $xml . PHP_EOL . PHP_EOL;
148
- $this->_handleApiError($message);
149
- Mage::throwException($message);
150
- }
151
-
152
- if (substr(curl_getinfo($process, CURLINFO_HTTP_CODE), 0, 1) != 2) {
153
- $message = 'HTTP Status Code ' . curl_getinfo($process, CURLINFO_HTTP_CODE) . PHP_EOL . PHP_EOL;
154
- $message .= 'Request: ' . PHP_EOL . $xml . PHP_EOL . PHP_EOL;
155
- $message .= 'Response: ' . PHP_EOL . $return . PHP_EOL;
156
- $this->_handleApiError($message);
157
-
158
- Mage::throwException(
159
- 'HTTP Status Code ' . curl_getinfo($process, CURLINFO_HTTP_CODE) . ' on updateOffers request. ' .
160
- 'See var/log/idealo_exceptions.txt for details.'
161
- );
162
- }
163
-
164
- return $return;
165
- }
166
-
167
- protected function _updateIndexOnApiResponse($response, $xml)
168
- {
169
- $this->_logRequest($response, $xml);
170
-
171
- /** @var $indexResource NRApps_Idealo_Model_Resource_Indexer */
172
- $indexResource = Mage::getResourceModel('nrapps_idealo/indexer');
173
-
174
- try {
175
- $xml = new SimpleXMLElement($response);
176
- foreach ($xml->offerResponse as $xmlOfferResponse) {
177
- $sku = (string)$xmlOfferResponse->sku;
178
- list($storeId, $productId) = explode('p', $sku);
179
- $indexResource->markProcessed($storeId, $productId, (string)$xmlOfferResponse->status, (string)$xmlOfferResponse->statusMsg);
180
- }
181
- } catch (Exception $e) {
182
- $message = $e->getMessage() . PHP_EOL . PHP_EOL;
183
- $message .= 'Request: ' . PHP_EOL . $xml . PHP_EOL . PHP_EOL;
184
- $message .= 'Response: ' . PHP_EOL . $response . PHP_EOL;
185
- $this->_handleApiError($message);
186
- Mage::throwException($e);
187
- }
188
- }
189
-
190
- protected function _logRequest($response, $xml)
191
- {
192
- if (Mage::getStoreConfigFlag('nrapps_idealo/settings/logging')) {
193
- $message = 'Request: ' . PHP_EOL . $xml . PHP_EOL . PHP_EOL;
194
- $message .= 'Response: ' . PHP_EOL . $response . PHP_EOL;
195
- Mage::helper('nrapps_idealo')->log($message, null, 'idealo_requests.txt');
196
- }
197
- }
198
-
199
- /**
200
- * @param string $message
201
- */
202
- protected function _handleApiError($message)
203
- {
204
- Mage::helper('nrapps_idealo')->log($message, Zend_Log::ERR, 'idealo_exceptions.txt', true);
205
-
206
- // send email to administrator
207
- if ($emailAddresses = Mage::getStoreConfig('nrapps_idealo/email/error_recipient')) {
208
-
209
- foreach(explode(',', $emailAddresses) as $emailAddress) {
210
-
211
- $template = Mage::getStoreConfig('nrapps_idealo/email/error_template');
212
- $identity = Mage::getStoreConfig('nrapps_idealo/email/error_identity');
213
-
214
- $mailTemplate = Mage::getModel('core/email_template');
215
-
216
- // collect email variables
217
- $data = array(
218
- 'message' => $message,
219
- 'domain' => Mage::getStoreConfig('web/unsecure/base_url'),
220
- 'idealo_username' => Mage::getStoreConfig('nrapps_idealo/settings/user'),
221
- 'magento_version' => Mage::getVersion(),
222
- 'module_version' => Mage::getConfig()->getModuleConfig('NRApps_Idealo')->version,
223
-
224
- );
225
-
226
- try {
227
- // send mail
228
- $mailTemplate->sendTransactional($template, $identity, $emailAddress, '', $data);
229
- } catch (Exception $e) {
230
-
231
- Mage::logException($e);
232
- }
233
- }
234
- }
235
- }
236
-
237
- public function deleteExistingOffersOnFirstRun()
238
- {
239
- foreach(Mage::app()->getStores() as $store) {
240
-
241
- $this->_deleteExistingOffersForStore($store);
242
- }
243
- }
244
-
245
- /**
246
- * @param $storeId
247
- * @return mixed
248
- * @throws Mage_Core_Exception
249
- */
250
- protected function _getResponseFromGetAPI($storeId = null)
251
- {
252
- $url = Mage::getStoreConfig('nrapps_idealo/settings/api_get_url', $storeId);
253
-
254
- $params = array(
255
- 'pageSize=' . self::LIMIT_NUMBER_PRODUCTS_PER_RUN,
256
- 'pageNumber=' . 1,
257
- );
258
-
259
- if (strpos($url, '?') !== false) {
260
- $url .= '&';
261
- } else {
262
- $url .= '?';
263
- }
264
-
265
- $url .= implode('&', $params);
266
-
267
- $shopId = Mage::getStoreConfig('nrapps_idealo/settings/shop_id', $storeId);
268
- $userName = Mage::getStoreConfig('nrapps_idealo/settings/user', $storeId);
269
- $password = Mage::getStoreConfig('nrapps_idealo/settings/password', $storeId);
270
-
271
- $header = array(
272
- 'shopId: ' . $shopId,
273
- 'Content-Type: application/xml; charset=UTF-8',
274
- 'Expect:' . '',
275
- 'shopsystem: Magento',
276
- 'shopsystemversion: ' . Mage::getVersion(),
277
- 'idealomodulversion: ' . Mage::getConfig()->getModuleConfig('NRApps_Idealo')->version,
278
- );
279
-
280
- $process = curl_init($url);
281
- curl_setopt($process, CURLOPT_HTTPHEADER, $header);
282
- curl_setopt($process, CURLOPT_USERPWD, $userName . ':' . $password);
283
- curl_setopt($process, CURLOPT_TIMEOUT, self::LIMIT_TIMEOUT_PER_PRODUCT * self::LIMIT_NUMBER_PRODUCTS_PER_RUN);
284
- curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
285
- curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
286
- if (Mage::getStoreConfigFlag('nrapps_idealo/settings/disable_certificate_check')) {
287
- curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
288
- }
289
- $return = curl_exec($process);
290
-
291
- if ($return === false) {
292
- Mage::throwException(curl_error($process));
293
- }
294
-
295
- if (substr(curl_getinfo($process, CURLINFO_HTTP_CODE), 0, 1) != 2) {
296
- $message = 'HTTP Status Code ' . curl_getinfo($process, CURLINFO_HTTP_CODE) . PHP_EOL . PHP_EOL;
297
- $message .= 'URL: ' . PHP_EOL . $url . PHP_EOL;
298
- $message .= 'Response: ' . PHP_EOL . $return . PHP_EOL;
299
- $this->_handleApiError($message);
300
-
301
- Mage::throwException(
302
- 'HTTP Status Code ' . curl_getinfo($process, CURLINFO_HTTP_CODE) . ' on getOffers request. ' .
303
- 'See var/log/idealo_exceptions.txt for details.'
304
- );
305
- }
306
-
307
- return $return;
308
- }
309
-
310
- /**
311
- * @param Mage_Core_Model_Store $store
312
- */
313
- protected function _deleteExistingOffersForStore($store)
314
- {
315
- $storeId = $store->getId();
316
- if (Mage::getStoreConfigFlag('nrapps_idealo/settings/test_mode', $storeId)
317
- || !Mage::getStoreConfigFlag('nrapps_idealo/settings/is_active', $storeId)
318
- || Mage::getStoreConfigFlag('nrapps_idealo/existing_offers_deleted', $storeId)
319
- ) {
320
- return;
321
- }
322
-
323
- $canProcess = true;
324
- while ($canProcess && ++$this->_runIndex <= self::LIMIT_NUMBER_RUNS) {
325
- $response = $this->_getResponseFromGetAPI($storeId);
326
-
327
- $this->_logRequest($response, 'getOffers');
328
-
329
- $responseXml = new SimpleXMLElement($response);
330
-
331
- if (sizeof($responseXml)) {
332
- $rows = array();
333
- foreach ($responseXml as $offer) {
334
- if (!isset($offer->sku)) {
335
- continue;
336
- }
337
- $rows[] = '
338
- <offer>
339
- <command>Delete</command>
340
- <sku>' . (string)$offer->sku . '</sku>
341
- </offer>';
342
- }
343
-
344
- $xml = Mage::getModel('nrapps_idealo/generator')->getFeedContent(false, $rows);
345
-
346
- $response = $this->_getResponseFromAPI($xml, $storeId);
347
- $this->_logRequest($response, $xml);
348
- } else {
349
- $canProcess = false;
350
-
351
- Mage::getResourceModel('core/setup', 'core_setup')->setConfigData('nrapps_idealo/existing_offers_deleted', 1, 'stores', $storeId);
352
- Mage::app()->getCacheInstance()->cleanType('config');
353
- Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => 'config'));
354
- }
355
- }
356
- }
357
  }
1
+ <?php
2
+ class NRApps_Idealo_Model_Api
3
+ {
4
+ const LIMIT_NUMBER_PRODUCTS_PER_RUN = 100;
5
+ const LIMIT_NUMBER_RUNS = 10;
6
+ const LIMIT_TIMEOUT_PER_PRODUCT = 3;
7
+
8
+ protected $_runIndex = 0;
9
+
10
+ public function sendKeepAlive()
11
+ {
12
+ if (Mage::getStoreConfigFlag('nrapps_idealo/settings/test_mode') || !Mage::getStoreConfigFlag('nrapps_idealo/settings/is_active')) {
13
+ return;
14
+ }
15
+
16
+ $xml = $this->_getKeepAliveXml();
17
+
18
+ $response = $this->_getResponseFromAPI($xml);
19
+
20
+ $this->_logRequest($response, $xml);
21
+ }
22
+
23
+ public function transferAll()
24
+ {
25
+ $this->deleteExistingOffersOnFirstRun();
26
+
27
+ foreach(Mage::app()->getStores() as $store) {
28
+
29
+ if (Mage::getStoreConfigFlag('nrapps_idealo/settings/test_mode', $store->getId())) {
30
+ continue;
31
+ }
32
+
33
+ try {
34
+ $this->transferStoreData($store->getId());
35
+ } catch (Exception $e) {
36
+ Mage::logException($e);
37
+ }
38
+ }
39
+ }
40
+
41
+ public function transferStoreData($storeId)
42
+ {
43
+ /** @var $indexResource NRApps_Idealo_Model_Resource_Indexer */
44
+ $indexResource = Mage::getResourceModel('nrapps_idealo/indexer');
45
+
46
+ $canProcess = true;
47
+ while ($canProcess && ++$this->_runIndex <= self::LIMIT_NUMBER_RUNS) {
48
+ $dataToProcess = $indexResource->getDataToProcess($storeId, self::LIMIT_NUMBER_PRODUCTS_PER_RUN);
49
+
50
+ if (sizeof($dataToProcess)) {
51
+ $this->_processData($dataToProcess, $storeId);
52
+ } else {
53
+ if ($this->_runIndex == 1) {
54
+ $this->sendKeepAlive();
55
+ }
56
+ $canProcess = false;
57
+ }
58
+ }
59
+ }
60
+
61
+ /**
62
+ * @param array $dataToProcess
63
+ * @param int $storeId
64
+ */
65
+ protected function _processData($dataToProcess, $storeId)
66
+ {
67
+ $xml = $this->_getAssembledXml($dataToProcess);
68
+
69
+ $response = $this->_getResponseFromAPI($xml, $storeId);
70
+
71
+ $this->_updateIndexOnApiResponse($response, $xml);
72
+ }
73
+
74
+ protected function _getAssembledXml($dataToProcess)
75
+ {
76
+ $xml = '';
77
+
78
+ /** @var $feed NRApps_Idealo_Model_Feed */
79
+ $feed = Mage::getSingleton('nrapps_idealo/feed');
80
+
81
+ if ($feed->getIncludeHeader()) {
82
+ $xml .= $feed->getHeader() . $feed->getEol();
83
+ }
84
+
85
+ foreach($dataToProcess as $dataRow) {
86
+ $xml .= $dataRow['data'] . $feed->getEol();
87
+ }
88
+
89
+ $xml .= $feed->getFooter();
90
+
91
+ return $xml;
92
+ }
93
+
94
+ protected function _getKeepAliveXml()
95
+ {
96
+ $xml = '';
97
+
98
+ /** @var $feed NRApps_Idealo_Model_Feed */
99
+ $feed = Mage::getSingleton('nrapps_idealo/feed');
100
+
101
+ if ($feed->getIncludeHeader()) {
102
+ $xml .= $feed->getHeader() . $feed->getEol();
103
+ }
104
+
105
+ $xml .= $feed->getFooter();
106
+
107
+ return $xml;
108
+ }
109
+
110
+ /**
111
+ * @param $xml
112
+ * @param $storeId
113
+ * @return mixed
114
+ * @throws Mage_Core_Exception
115
+ */
116
+ protected function _getResponseFromAPI($xml, $storeId = null)
117
+ {
118
+ $url = Mage::getStoreConfig('nrapps_idealo/settings/api_update_url', $storeId);
119
+ $shopId = Mage::getStoreConfig('nrapps_idealo/settings/shop_id', $storeId);
120
+ $userName = Mage::getStoreConfig('nrapps_idealo/settings/user', $storeId);
121
+ $password = Mage::getStoreConfig('nrapps_idealo/settings/password', $storeId);
122
+
123
+ $header = array(
124
+ 'shopId: ' . $shopId,
125
+ 'Content-Type: application/xml; charset=UTF-8',
126
+ 'Expect:' . '',
127
+ 'shopsystem: Magento',
128
+ 'shopsystemversion: ' . Mage::getVersion(),
129
+ 'idealomodulversion: ' . Mage::getConfig()->getModuleConfig('NRApps_Idealo')->version,
130
+ );
131
+
132
+ $process = curl_init($url);
133
+ curl_setopt($process, CURLOPT_HTTPHEADER, $header);
134
+ curl_setopt($process, CURLOPT_USERPWD, $userName . ':' . $password);
135
+ curl_setopt($process, CURLOPT_TIMEOUT, self::LIMIT_TIMEOUT_PER_PRODUCT * self::LIMIT_NUMBER_PRODUCTS_PER_RUN);
136
+ curl_setopt($process, CURLOPT_POST, true);
137
+ curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
138
+ curl_setopt($process, CURLOPT_POSTFIELDS, $xml);
139
+ curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
140
+ if (Mage::getStoreConfigFlag('nrapps_idealo/settings/disable_certificate_check')) {
141
+ curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
142
+ }
143
+ $return = curl_exec($process);
144
+
145
+ if ($return === false) {
146
+ $message = 'cURL Error ' . curl_errno($process) . ': ' . curl_error($process) . PHP_EOL . PHP_EOL;
147
+ $message .= 'Request: ' . PHP_EOL . $xml . PHP_EOL . PHP_EOL;
148
+ $this->_handleApiError($message);
149
+ Mage::throwException($message);
150
+ }
151
+
152
+ if (substr(curl_getinfo($process, CURLINFO_HTTP_CODE), 0, 1) != 2) {
153
+ $message = 'HTTP Status Code ' . curl_getinfo($process, CURLINFO_HTTP_CODE) . PHP_EOL . PHP_EOL;
154
+ $message .= 'Request: ' . PHP_EOL . $xml . PHP_EOL . PHP_EOL;
155
+ $message .= 'Response: ' . PHP_EOL . $return . PHP_EOL;
156
+ $this->_handleApiError($message);
157
+
158
+ Mage::throwException(
159
+ 'HTTP Status Code ' . curl_getinfo($process, CURLINFO_HTTP_CODE) . ' on updateOffers request. ' .
160
+ 'See var/log/idealo_exceptions.txt for details.'
161
+ );
162
+ }
163
+
164
+ return $return;
165
+ }
166
+
167
+ protected function _updateIndexOnApiResponse($response, $xml)
168
+ {
169
+ $this->_logRequest($response, $xml);
170
+
171
+ /** @var $indexResource NRApps_Idealo_Model_Resource_Indexer */
172
+ $indexResource = Mage::getResourceModel('nrapps_idealo/indexer');
173
+
174
+ try {
175
+ $xml = new SimpleXMLElement($response);
176
+ foreach ($xml->offerResponse as $xmlOfferResponse) {
177
+ $sku = (string)$xmlOfferResponse->sku;
178
+ list($storeId, $productId) = explode('p', $sku);
179
+ $indexResource->markProcessed($storeId, $productId, (string)$xmlOfferResponse->status, (string)$xmlOfferResponse->statusMsg);
180
+ }
181
+ } catch (Exception $e) {
182
+ $message = $e->getMessage() . PHP_EOL . PHP_EOL;
183
+ $message .= 'Request: ' . PHP_EOL . $xml . PHP_EOL . PHP_EOL;
184
+ $message .= 'Response: ' . PHP_EOL . $response . PHP_EOL;
185
+ $this->_handleApiError($message);
186
+ Mage::throwException($e);
187
+ }
188
+ }
189
+
190
+ protected function _logRequest($response, $xml)
191
+ {
192
+ if (Mage::getStoreConfigFlag('nrapps_idealo/settings/logging')) {
193
+ $message = 'Request: ' . PHP_EOL . $xml . PHP_EOL . PHP_EOL;
194
+ $message .= 'Response: ' . PHP_EOL . $response . PHP_EOL;
195
+ Mage::helper('nrapps_idealo')->log($message, null, 'idealo_requests.txt');
196
+ }
197
+ }
198
+
199
+ /**
200
+ * @param string $message
201
+ */
202
+ protected function _handleApiError($message)
203
+ {
204
+ Mage::helper('nrapps_idealo')->log($message, Zend_Log::ERR, 'idealo_exceptions.txt', true);
205
+
206
+ // send email to administrator
207
+ if ($emailAddresses = Mage::getStoreConfig('nrapps_idealo/email/error_recipient')) {
208
+
209
+ foreach(explode(',', $emailAddresses) as $emailAddress) {
210
+
211
+ $template = Mage::getStoreConfig('nrapps_idealo/email/error_template');
212
+ $identity = Mage::getStoreConfig('nrapps_idealo/email/error_identity');
213
+
214
+ $mailTemplate = Mage::getModel('core/email_template');
215
+
216
+ // collect email variables
217
+ $data = array(
218
+ 'message' => $message,
219
+ 'domain' => Mage::getStoreConfig('web/unsecure/base_url'),
220
+ 'idealo_username' => Mage::getStoreConfig('nrapps_idealo/settings/user'),
221
+ 'magento_version' => Mage::getVersion(),
222
+ 'module_version' => Mage::getConfig()->getModuleConfig('NRApps_Idealo')->version,
223
+
224
+ );
225
+
226
+ try {
227
+ // send mail
228
+ $mailTemplate->sendTransactional($template, $identity, $emailAddress, '', $data);
229
+ } catch (Exception $e) {
230
+
231
+ Mage::logException($e);
232
+ }
233
+ }
234
+ }
235
+ }
236
+
237
+ public function deleteExistingOffersOnFirstRun()
238
+ {
239
+ foreach(Mage::app()->getStores() as $store) {
240
+
241
+ $this->_deleteExistingOffersForStore($store);
242
+ }
243
+ }
244
+
245
+ /**
246
+ * @param $storeId
247
+ * @return mixed
248
+ * @throws Mage_Core_Exception
249
+ */
250
+ protected function _getResponseFromGetAPI($storeId = null)
251
+ {
252
+ $url = Mage::getStoreConfig('nrapps_idealo/settings/api_get_url', $storeId);
253
+
254
+ $params = array(
255
+ 'pageSize=' . self::LIMIT_NUMBER_PRODUCTS_PER_RUN,
256
+ 'pageNumber=' . 1,
257
+ );
258
+
259
+ if (strpos($url, '?') !== false) {
260
+ $url .= '&';
261
+ } else {
262
+ $url .= '?';
263
+ }
264
+
265
+ $url .= implode('&', $params);
266
+
267
+ $shopId = Mage::getStoreConfig('nrapps_idealo/settings/shop_id', $storeId);
268
+ $userName = Mage::getStoreConfig('nrapps_idealo/settings/user', $storeId);
269
+ $password = Mage::getStoreConfig('nrapps_idealo/settings/password', $storeId);
270
+
271
+ $header = array(
272
+ 'shopId: ' . $shopId,
273
+ 'Content-Type: application/xml; charset=UTF-8',
274
+ 'Expect:' . '',
275
+ 'shopsystem: Magento',
276
+ 'shopsystemversion: ' . Mage::getVersion(),
277
+ 'idealomodulversion: ' . Mage::getConfig()->getModuleConfig('NRApps_Idealo')->version,
278
+ );
279
+
280
+ $process = curl_init($url);
281
+ curl_setopt($process, CURLOPT_HTTPHEADER, $header);
282
+ curl_setopt($process, CURLOPT_USERPWD, $userName . ':' . $password);
283
+ curl_setopt($process, CURLOPT_TIMEOUT, self::LIMIT_TIMEOUT_PER_PRODUCT * self::LIMIT_NUMBER_PRODUCTS_PER_RUN);
284
+ curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
285
+ curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
286
+ if (Mage::getStoreConfigFlag('nrapps_idealo/settings/disable_certificate_check')) {
287
+ curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
288
+ }
289
+ $return = curl_exec($process);
290
+
291
+ if ($return === false) {
292
+ Mage::throwException(curl_error($process));
293
+ }
294
+
295
+ if (substr(curl_getinfo($process, CURLINFO_HTTP_CODE), 0, 1) != 2) {
296
+ $message = 'HTTP Status Code ' . curl_getinfo($process, CURLINFO_HTTP_CODE) . PHP_EOL . PHP_EOL;
297
+ $message .= 'URL: ' . PHP_EOL . $url . PHP_EOL;
298
+ $message .= 'Response: ' . PHP_EOL . $return . PHP_EOL;
299
+ $this->_handleApiError($message);
300
+
301
+ Mage::throwException(
302
+ 'HTTP Status Code ' . curl_getinfo($process, CURLINFO_HTTP_CODE) . ' on getOffers request. ' .
303
+ 'See var/log/idealo_exceptions.txt for details.'
304
+ );
305
+ }
306
+
307
+ return $return;
308
+ }
309
+
310
+ /**
311
+ * @param Mage_Core_Model_Store $store
312
+ */
313
+ protected function _deleteExistingOffersForStore($store)
314
+ {
315
+ $storeId = $store->getId();
316
+ if (Mage::getStoreConfigFlag('nrapps_idealo/settings/test_mode', $storeId)
317
+ || !Mage::getStoreConfigFlag('nrapps_idealo/settings/is_active', $storeId)
318
+ || Mage::getStoreConfigFlag('nrapps_idealo/existing_offers_deleted', $storeId)
319
+ ) {
320
+ return;
321
+ }
322
+
323
+ $canProcess = true;
324
+ while ($canProcess && ++$this->_runIndex <= self::LIMIT_NUMBER_RUNS) {
325
+ $response = $this->_getResponseFromGetAPI($storeId);
326
+
327
+ $this->_logRequest($response, 'getOffers');
328
+
329
+ $responseXml = new SimpleXMLElement($response);
330
+
331
+ if (sizeof($responseXml)) {
332
+ $rows = array();
333
+ foreach ($responseXml as $offer) {
334
+ if (!isset($offer->sku)) {
335
+ continue;
336
+ }
337
+ $rows[] = '
338
+ <offer>
339
+ <command>Delete</command>
340
+ <sku>' . (string)$offer->sku . '</sku>
341
+ </offer>';
342
+ }
343
+
344
+ $xml = Mage::getModel('nrapps_idealo/generator')->getFeedContent(false, $rows);
345
+
346
+ $response = $this->_getResponseFromAPI($xml, $storeId);
347
+ $this->_logRequest($response, $xml);
348
+ } else {
349
+ $canProcess = false;
350
+
351
+ Mage::getResourceModel('core/setup', 'core_setup')->setConfigData('nrapps_idealo/existing_offers_deleted', 1, 'stores', $storeId);
352
+ Mage::app()->getCacheInstance()->cleanType('config');
353
+ Mage::dispatchEvent('adminhtml_cache_refresh_type', array('type' => 'config'));
354
+ }
355
+ }
356
+ }
357
  }
app/code/community/NRApps/Idealo/Model/Attribute.php CHANGED
@@ -1,68 +1,68 @@
1
- <?php
2
- class NRApps_Idealo_Model_Attribute
3
- {
4
- /**
5
- * Create a new product attribute
6
- *
7
- * @param string $attributeCode
8
- * @param string $attributeType
9
- */
10
- public function createAttribute($attributeCode, $attributeType)
11
- {
12
- $attributeData = array(
13
- 'type' => 'varchar',
14
- 'input' => $attributeType,
15
- 'label' => Mage::getSingleton('nrapps_idealo/source_feedAttributes')->getOption($attributeCode)->getLabel(),
16
- 'user_defined' => 1,
17
- 'group' => 'idealo',
18
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
19
- 'required' => 0,
20
- 'visible' => 1,
21
- 'searchable' => 1,
22
- 'filterable' => 0,
23
- 'filterable_in_search' => 0,
24
- 'visible_on_front' => 0,
25
- 'is_configurable' => 0,
26
- );
27
-
28
- $attributeInfo = Mage::getSingleton('nrapps_idealo/source_feedAttributes')->getOption($attributeCode);
29
- if (isset($attributeInfo['note'])) {
30
- $attributeData['note'] = $attributeInfo['note'];
31
- }
32
-
33
- if ($attributeType == 'select') {
34
- $attributeData['type'] = 'int';
35
- $attributeData['source'] = 'eav/entity_attribute_source_table';
36
- $attributeData['global'] = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE;
37
- }
38
-
39
- if ($attributeType == 'yesno') {
40
- $attributeData['type'] = 'varchar';
41
- $attributeData['input'] = 'select';
42
- $attributeData['source'] = 'nrapps_idealo/source_yesNoDefault';
43
- $attributeData['global'] = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE;
44
- }
45
-
46
- if ($attributeType == 'decimal') {
47
- $attributeData['type'] = 'decimal';
48
- $attributeData['input'] = 'text';
49
- $attributeData['global'] = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE;
50
- }
51
-
52
- if ($attributeType == 'price') {
53
- $attributeData['type'] = 'decimal';
54
- $attributeData['input'] = 'price';
55
- $attributeData['global'] = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE;
56
- }
57
-
58
- $this->_getSetup()->addAttribute('catalog_product', $attributeCode, $attributeData);
59
- }
60
-
61
- /**
62
- * @return Mage_Catalog_Model_Resource_Setup
63
- */
64
- protected function _getSetup()
65
- {
66
- return Mage::getResourceModel('catalog/setup', 'catalog_setup');
67
- }
68
  }
1
+ <?php
2
+ class NRApps_Idealo_Model_Attribute
3
+ {
4
+ /**
5
+ * Create a new product attribute
6
+ *
7
+ * @param string $attributeCode
8
+ * @param string $attributeType
9
+ */
10
+ public function createAttribute($attributeCode, $attributeType)
11
+ {
12
+ $attributeData = array(
13
+ 'type' => 'varchar',
14
+ 'input' => $attributeType,
15
+ 'label' => Mage::getSingleton('nrapps_idealo/source_feedAttributes')->getOption($attributeCode)->getLabel(),
16
+ 'user_defined' => 1,
17
+ 'group' => 'idealo',
18
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
19
+ 'required' => 0,
20
+ 'visible' => 1,
21
+ 'searchable' => 1,
22
+ 'filterable' => 0,
23
+ 'filterable_in_search' => 0,
24
+ 'visible_on_front' => 0,
25
+ 'is_configurable' => 0,
26
+ );
27
+
28
+ $attributeInfo = Mage::getSingleton('nrapps_idealo/source_feedAttributes')->getOption($attributeCode);
29
+ if (isset($attributeInfo['note'])) {
30
+ $attributeData['note'] = $attributeInfo['note'];
31
+ }
32
+
33
+ if ($attributeType == 'select') {
34
+ $attributeData['type'] = 'int';
35
+ $attributeData['source'] = 'eav/entity_attribute_source_table';
36
+ $attributeData['global'] = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE;
37
+ }
38
+
39
+ if ($attributeType == 'yesno') {
40
+ $attributeData['type'] = 'varchar';
41
+ $attributeData['input'] = 'select';
42
+ $attributeData['source'] = 'nrapps_idealo/source_yesNoDefault';
43
+ $attributeData['global'] = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE;
44
+ }
45
+
46
+ if ($attributeType == 'decimal') {
47
+ $attributeData['type'] = 'decimal';
48
+ $attributeData['input'] = 'text';
49
+ $attributeData['global'] = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE;
50
+ }
51
+
52
+ if ($attributeType == 'price') {
53
+ $attributeData['type'] = 'decimal';
54
+ $attributeData['input'] = 'price';
55
+ $attributeData['global'] = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE;
56
+ }
57
+
58
+ $this->_getSetup()->addAttribute('catalog_product', $attributeCode, $attributeData);
59
+ }
60
+
61
+ /**
62
+ * @return Mage_Catalog_Model_Resource_Setup
63
+ */
64
+ protected function _getSetup()
65
+ {
66
+ return Mage::getResourceModel('catalog/setup', 'catalog_setup');
67
+ }
68
  }
app/code/community/NRApps/Idealo/Model/Backend/Serialized/Array.php CHANGED
@@ -1,18 +1,18 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Backend_Serialized_Array extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array
4
- {
5
- protected function _beforeSave()
6
- {
7
- $value = $this->getValue();
8
- if (is_array($value)) {
9
- foreach($value as $key => $row) {
10
- if (isset($row['sort_order']) && !strlen(trim($row['sort_order']))) {
11
- $value[$key]['sort_order'] = 0;
12
- }
13
- }
14
- $this->setValue($value);
15
- }
16
- parent::_beforeSave();
17
- }
18
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Backend_Serialized_Array extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array
4
+ {
5
+ protected function _beforeSave()
6
+ {
7
+ $value = $this->getValue();
8
+ if (is_array($value)) {
9
+ foreach($value as $key => $row) {
10
+ if (isset($row['sort_order']) && !strlen(trim($row['sort_order']))) {
11
+ $value[$key]['sort_order'] = 0;
12
+ }
13
+ }
14
+ $this->setValue($value);
15
+ }
16
+ parent::_beforeSave();
17
+ }
18
  }
app/code/community/NRApps/Idealo/Model/Csv/Feed.php CHANGED
@@ -1,65 +1,65 @@
1
- <?php
2
- class NRApps_Idealo_Model_Csv_Feed extends NRApps_Idealo_Model_Feed
3
- {
4
- public function getIncludeHeader()
5
- {
6
- return true;
7
- }
8
-
9
- public function getCharset()
10
- {
11
- return 'utf-8';
12
- }
13
-
14
- public function getHeader($testMode = false)
15
- {
16
- $headerLine = 'Artikelnummer im Shop$EAN / Barcodenummer$Original Herstellerartikelnummer$Herstellername$Produktname$Produktgruppe im Shop (möglichst als Pfad ausgehend von der Wurzelkategorie)$Preis (Brutto)$Lieferzeit DE$Lieferzeit AT$Lieferzeit UK$Lieferzeit FR$Lieferzeit IT$Lieferzeit ES$Lieferzeit PL$Lieferzeit IN$ProduktURL$BildURL_1 (großes Bild)$BildURL_2 (großes Bild)$BildURL_3 (großes Bild)$BildURL_4$BildURL_5$Vorkasse DE$Nachnahme DE$Kreditkarte DE$Paypal DE$Sofortüberweisung DE$Bankeinzug DE$Rechnung DE$Moneybookers DE$Click & Buy DE$Giropay DE$Versandkosten Kommentar DE (max. 150 Zeichen)$Vorkasse AT$Nachnahme AT$Kreditkarte AT$Paypal AT$Sofortüberweisung AT$Bankeinzug AT$Rechnung AT$Moneybookers AT$Click & Buy AT$Giropay AT$Versandkosten Kommentar AT (max. 150 Zeichen)$Vorkasse UK$Nachnahme UK$Kreditkarte UK$Paypal UK$Sofortüberweisung UK$Bankeinzug UK$Rechnung UK$Moneybookers UK$Click & Buy UK$Giropay UK$Versandkosten Kommentar UK (max. 150 Zeichen)$Vorkasse FR$Nachnahme FR$Kreditkarte FR$Paypal FR$Sofortüberweisung FR$Bankeinzug FR$Rechnung FR$Moneybookers FR$Click & Buy FR$Giropay FR$Versandkosten Kommentar FR (max. 150 Zeichen)$Vorkasse IT$Nachnahme IT$Kreditkarte IT$Paypal IT$Sofortüberweisung IT$Bankeinzug IT$Rechnung IT$Moneybookers IT$Click & Buy IT$Giropay IT$Versandkosten Kommentar IT (max. 150 Zeichen)$Vorkasse ES$Nachnahme ES$Kreditkarte ES$Paypal ES$Sofortüberweisung ES$Bankeinzug ES$Rechnung ES$Moneybookers ES$Click & Buy ES$Giropay ES$Versandkosten Kommentar ES (max. 150 Zeichen)$Vorkasse PL$Nachnahme PL$Kreditkarte PL$Paypal PL$Sofortüberweisung PL$Bankeinzug PL$Rechnung PL$Moneybookers PL$Click & Buy PL$Giropay PL$Versandkosten Kommentar PL (max. 150 Zeichen)$Vorkasse IN$Nachnahme IN$Kreditkarte IN$Paypal IN$Sofortüberweisung IN$Bankeinzug IN$Rechnung IN$Moneybookers IN$Click & Buy IN$Giropay IN$Versandkosten Kommentar IN (max. 150 Zeichen)$Produktbeschreibung (max. 1000 Zeichen)$Grundpreis (Produktabhängig)$Direktkauf';
17
- if (is_array($this->getAdditionalAttributeCodes())) {
18
- foreach($this->getAdditionalAttributeCodes() as $attributeCode) {
19
- $headerLine .= '$' . Mage::getResourceSingleton('catalog/product')->getAttribute($attributeCode)->getFrontendLabel();
20
- }
21
- }
22
- return $headerLine;
23
- }
24
-
25
- public function getBody()
26
- {
27
- $bodyLine = '{{var sku}}${{var ean}}${{var manufacturer_sku}}${{var manufacturer}}${{var offer_name}}${{var category_path}}${{if special_price}}{{var special_price}}{{else}}{{var price}}{{/if}}${{var delivery_time_DE}}${{var delivery_time_AT}}${{var delivery_time_UK}}${{var delivery_time_FR}}${{var delivery_time_IT}}${{var delivery_time_ES}}${{var delivery_time_PL}}${{var delivery_time_IN}}${{var url}}${{var image}}${{var additional_image_1}}${{var additional_image_2}}${{var additional_image_3}}${{var additional_image_4}}${{var shipping_cost_PREPAID_DE}}${{var shipping_cost_COD_DE}}${{var shipping_cost_CREDITCARD_DE}}${{var shipping_cost_PAYPAL_DE}}${{var shipping_cost_SOFORTUEBERWEISUNG_DE}}${{var shipping_cost_DIRECTDEBIT_DE}}${{var shipping_cost_INVOICE_DE}}${{var shipping_cost_MONEYBOOKERS_DE}}${{var shipping_cost_CLICKANDBUY_DE}}${{var shipping_cost_GIROPAY_DE}}${{var shipping_comment_DE}}${{var shipping_cost_PREPAID_AT}}${{var shipping_cost_COD_AT}}${{var shipping_cost_CREDITCARD_AT}}${{var shipping_cost_PAYPAL_AT}}${{var shipping_cost_SOFORTUEBERWEISUNG_AT}}${{var shipping_cost_DIRECTDEBIT_AT}}${{var shipping_cost_INVOICE_AT}}${{var shipping_cost_MONEYBOOKERS_AT}}${{var shipping_cost_CLICKANDBUY_AT}}${{var shipping_cost_GIROPAY_AT}}${{var shipping_comment_AT}}${{var shipping_cost_PREPAID_UK}}${{var shipping_cost_COD_UK}}${{var shipping_cost_CREDITCARD_UK}}${{var shipping_cost_PAYPAL_UK}}${{var shipping_cost_SOFORTUEBERWEISUNG_UK}}${{var shipping_cost_DIRECTDEBIT_UK}}${{var shipping_cost_INVOICE_UK}}${{var shipping_cost_MONEYBOOKERS_UK}}${{var shipping_cost_CLICKANDBUY_UK}}${{var shipping_cost_GIROPAY_UK}}${{var shipping_comment_UK}}${{var shipping_cost_PREPAID_FR}}${{var shipping_cost_COD_FR}}${{var shipping_cost_CREDITCARD_FR}}${{var shipping_cost_PAYPAL_FR}}${{var shipping_cost_SOFORTUEBERWEISUNG_FR}}${{var shipping_cost_DIRECTDEBIT_FR}}${{var shipping_cost_INVOICE_FR}}${{var shipping_cost_MONEYBOOKERS_FR}}${{var shipping_cost_CLICKANDBUY_FR}}${{var shipping_cost_GIROPAY_FR}}${{var shipping_comment_FR}}${{var shipping_cost_PREPAID_IT}}${{var shipping_cost_COD_IT}}${{var shipping_cost_CREDITCARD_IT}}${{var shipping_cost_PAYPAL_IT}}${{var shipping_cost_SOFORTUEBERWEISUNG_IT}}${{var shipping_cost_DIRECTDEBIT_IT}}${{var shipping_cost_INVOICE_IT}}${{var shipping_cost_MONEYBOOKERS_IT}}${{var shipping_cost_CLICKANDBUY_IT}}${{var shipping_cost_GIROPAY_IT}}${{var shipping_comment_IT}}${{var shipping_cost_PREPAID_ES}}${{var shipping_cost_COD_ES}}${{var shipping_cost_CREDITCARD_ES}}${{var shipping_cost_PAYPAL_ES}}${{var shipping_cost_SOFORTUEBERWEISUNG_ES}}${{var shipping_cost_DIRECTDEBIT_ES}}${{var shipping_cost_INVOICE_ES}}${{var shipping_cost_MONEYBOOKERS_ES}}${{var shipping_cost_CLICKANDBUY_ES}}${{var shipping_cost_GIROPAY_ES}}${{var shipping_comment_ES}}${{var shipping_cost_PREPAID_PL}}${{var shipping_cost_COD_PL}}${{var shipping_cost_CREDITCARD_PL}}${{var shipping_cost_PAYPAL_PL}}${{var shipping_cost_SOFORTUEBERWEISUNG_PL}}${{var shipping_cost_DIRECTDEBIT_PL}}${{var shipping_cost_INVOICE_PL}}${{var shipping_cost_MONEYBOOKERS_PL}}${{var shipping_cost_CLICKANDBUY_PL}}${{var shipping_cost_GIROPAY_PL}}${{var shipping_comment_PL}}${{var shipping_cost_PREPAID_IN}}${{var shipping_cost_COD_IN}}${{var shipping_cost_CREDITCARD_IN}}${{var shipping_cost_PAYPAL_IN}}${{var shipping_cost_SOFORTUEBERWEISUNG_IN}}${{var shipping_cost_DIRECTDEBIT_IN}}${{var shipping_cost_INVOICE_IN}}${{var shipping_cost_MONEYBOOKERS_IN}}${{var shipping_cost_CLICKANDBUY_IN}}${{var shipping_cost_GIROPAY_IN}}${{var shipping_comment_IN}}${{var description}}${{if base_price}}{{var base_price}}{{/if}}${{if is_ecommerce_checkout_approved}}true{{/if}}';
28
- if (is_array($this->getAdditionalAttributeCodes())) {
29
- foreach($this->getAdditionalAttributeCodes() as $attributeCode) {
30
- $bodyLine .= '${{var ' . $attributeCode . '}}';
31
- }
32
- }
33
- return $bodyLine;
34
- }
35
-
36
- public function getFooter()
37
- {
38
- return '';
39
- }
40
-
41
- public function getEol()
42
- {
43
- return PHP_EOL;
44
- }
45
-
46
- public function getType()
47
- {
48
- return 'csv';
49
- }
50
-
51
- public function getFilename()
52
- {
53
- return '';
54
- }
55
-
56
- public function getQuoteSymbol()
57
- {
58
- return '$';
59
- }
60
-
61
- public function getQuoteSymbolReplacement()
62
- {
63
- return '&#36;';
64
- }
65
  }
1
+ <?php
2
+ class NRApps_Idealo_Model_Csv_Feed extends NRApps_Idealo_Model_Feed
3
+ {
4
+ public function getIncludeHeader()
5
+ {
6
+ return true;
7
+ }
8
+
9
+ public function getCharset()
10
+ {
11
+ return 'utf-8';
12
+ }
13
+
14
+ public function getHeader($testMode = false)
15
+ {
16
+ $headerLine = 'Artikelnummer im Shop$EAN / Barcodenummer$Original Herstellerartikelnummer$Herstellername$Produktname$Produktgruppe im Shop (möglichst als Pfad ausgehend von der Wurzelkategorie)$Preis (Brutto)$Lieferzeit DE$Lieferzeit AT$Lieferzeit UK$Lieferzeit FR$Lieferzeit IT$Lieferzeit ES$Lieferzeit PL$Lieferzeit IN$ProduktURL$BildURL_1 (großes Bild)$BildURL_2 (großes Bild)$BildURL_3 (großes Bild)$BildURL_4$BildURL_5$Vorkasse DE$Nachnahme DE$Kreditkarte DE$Paypal DE$Sofortüberweisung DE$Bankeinzug DE$Rechnung DE$Moneybookers DE$Click & Buy DE$Giropay DE$Versandkosten Kommentar DE (max. 150 Zeichen)$Vorkasse AT$Nachnahme AT$Kreditkarte AT$Paypal AT$Sofortüberweisung AT$Bankeinzug AT$Rechnung AT$Moneybookers AT$Click & Buy AT$Giropay AT$Versandkosten Kommentar AT (max. 150 Zeichen)$Vorkasse UK$Nachnahme UK$Kreditkarte UK$Paypal UK$Sofortüberweisung UK$Bankeinzug UK$Rechnung UK$Moneybookers UK$Click & Buy UK$Giropay UK$Versandkosten Kommentar UK (max. 150 Zeichen)$Vorkasse FR$Nachnahme FR$Kreditkarte FR$Paypal FR$Sofortüberweisung FR$Bankeinzug FR$Rechnung FR$Moneybookers FR$Click & Buy FR$Giropay FR$Versandkosten Kommentar FR (max. 150 Zeichen)$Vorkasse IT$Nachnahme IT$Kreditkarte IT$Paypal IT$Sofortüberweisung IT$Bankeinzug IT$Rechnung IT$Moneybookers IT$Click & Buy IT$Giropay IT$Versandkosten Kommentar IT (max. 150 Zeichen)$Vorkasse ES$Nachnahme ES$Kreditkarte ES$Paypal ES$Sofortüberweisung ES$Bankeinzug ES$Rechnung ES$Moneybookers ES$Click & Buy ES$Giropay ES$Versandkosten Kommentar ES (max. 150 Zeichen)$Vorkasse PL$Nachnahme PL$Kreditkarte PL$Paypal PL$Sofortüberweisung PL$Bankeinzug PL$Rechnung PL$Moneybookers PL$Click & Buy PL$Giropay PL$Versandkosten Kommentar PL (max. 150 Zeichen)$Vorkasse IN$Nachnahme IN$Kreditkarte IN$Paypal IN$Sofortüberweisung IN$Bankeinzug IN$Rechnung IN$Moneybookers IN$Click & Buy IN$Giropay IN$Versandkosten Kommentar IN (max. 150 Zeichen)$Produktbeschreibung (max. 1000 Zeichen)$Grundpreis (Produktabhängig)$Direktkauf';
17
+ if (is_array($this->getAdditionalAttributeCodes())) {
18
+ foreach($this->getAdditionalAttributeCodes() as $attributeCode) {
19
+ $headerLine .= '$' . Mage::getResourceSingleton('catalog/product')->getAttribute($attributeCode)->getFrontendLabel();
20
+ }
21
+ }
22
+ return $headerLine;
23
+ }
24
+
25
+ public function getBody()
26
+ {
27
+ $bodyLine = '{{var sku}}${{var ean}}${{var manufacturer_sku}}${{var manufacturer}}${{var offer_name}}${{var category_path}}${{if special_price}}{{var special_price}}{{else}}{{var price}}{{/if}}${{var delivery_time_DE}}${{var delivery_time_AT}}${{var delivery_time_UK}}${{var delivery_time_FR}}${{var delivery_time_IT}}${{var delivery_time_ES}}${{var delivery_time_PL}}${{var delivery_time_IN}}${{var url}}${{var image}}${{var additional_image_1}}${{var additional_image_2}}${{var additional_image_3}}${{var additional_image_4}}${{var shipping_cost_PREPAID_DE}}${{var shipping_cost_COD_DE}}${{var shipping_cost_CREDITCARD_DE}}${{var shipping_cost_PAYPAL_DE}}${{var shipping_cost_SOFORTUEBERWEISUNG_DE}}${{var shipping_cost_DIRECTDEBIT_DE}}${{var shipping_cost_INVOICE_DE}}${{var shipping_cost_MONEYBOOKERS_DE}}${{var shipping_cost_CLICKANDBUY_DE}}${{var shipping_cost_GIROPAY_DE}}${{var shipping_comment_DE}}${{var shipping_cost_PREPAID_AT}}${{var shipping_cost_COD_AT}}${{var shipping_cost_CREDITCARD_AT}}${{var shipping_cost_PAYPAL_AT}}${{var shipping_cost_SOFORTUEBERWEISUNG_AT}}${{var shipping_cost_DIRECTDEBIT_AT}}${{var shipping_cost_INVOICE_AT}}${{var shipping_cost_MONEYBOOKERS_AT}}${{var shipping_cost_CLICKANDBUY_AT}}${{var shipping_cost_GIROPAY_AT}}${{var shipping_comment_AT}}${{var shipping_cost_PREPAID_UK}}${{var shipping_cost_COD_UK}}${{var shipping_cost_CREDITCARD_UK}}${{var shipping_cost_PAYPAL_UK}}${{var shipping_cost_SOFORTUEBERWEISUNG_UK}}${{var shipping_cost_DIRECTDEBIT_UK}}${{var shipping_cost_INVOICE_UK}}${{var shipping_cost_MONEYBOOKERS_UK}}${{var shipping_cost_CLICKANDBUY_UK}}${{var shipping_cost_GIROPAY_UK}}${{var shipping_comment_UK}}${{var shipping_cost_PREPAID_FR}}${{var shipping_cost_COD_FR}}${{var shipping_cost_CREDITCARD_FR}}${{var shipping_cost_PAYPAL_FR}}${{var shipping_cost_SOFORTUEBERWEISUNG_FR}}${{var shipping_cost_DIRECTDEBIT_FR}}${{var shipping_cost_INVOICE_FR}}${{var shipping_cost_MONEYBOOKERS_FR}}${{var shipping_cost_CLICKANDBUY_FR}}${{var shipping_cost_GIROPAY_FR}}${{var shipping_comment_FR}}${{var shipping_cost_PREPAID_IT}}${{var shipping_cost_COD_IT}}${{var shipping_cost_CREDITCARD_IT}}${{var shipping_cost_PAYPAL_IT}}${{var shipping_cost_SOFORTUEBERWEISUNG_IT}}${{var shipping_cost_DIRECTDEBIT_IT}}${{var shipping_cost_INVOICE_IT}}${{var shipping_cost_MONEYBOOKERS_IT}}${{var shipping_cost_CLICKANDBUY_IT}}${{var shipping_cost_GIROPAY_IT}}${{var shipping_comment_IT}}${{var shipping_cost_PREPAID_ES}}${{var shipping_cost_COD_ES}}${{var shipping_cost_CREDITCARD_ES}}${{var shipping_cost_PAYPAL_ES}}${{var shipping_cost_SOFORTUEBERWEISUNG_ES}}${{var shipping_cost_DIRECTDEBIT_ES}}${{var shipping_cost_INVOICE_ES}}${{var shipping_cost_MONEYBOOKERS_ES}}${{var shipping_cost_CLICKANDBUY_ES}}${{var shipping_cost_GIROPAY_ES}}${{var shipping_comment_ES}}${{var shipping_cost_PREPAID_PL}}${{var shipping_cost_COD_PL}}${{var shipping_cost_CREDITCARD_PL}}${{var shipping_cost_PAYPAL_PL}}${{var shipping_cost_SOFORTUEBERWEISUNG_PL}}${{var shipping_cost_DIRECTDEBIT_PL}}${{var shipping_cost_INVOICE_PL}}${{var shipping_cost_MONEYBOOKERS_PL}}${{var shipping_cost_CLICKANDBUY_PL}}${{var shipping_cost_GIROPAY_PL}}${{var shipping_comment_PL}}${{var shipping_cost_PREPAID_IN}}${{var shipping_cost_COD_IN}}${{var shipping_cost_CREDITCARD_IN}}${{var shipping_cost_PAYPAL_IN}}${{var shipping_cost_SOFORTUEBERWEISUNG_IN}}${{var shipping_cost_DIRECTDEBIT_IN}}${{var shipping_cost_INVOICE_IN}}${{var shipping_cost_MONEYBOOKERS_IN}}${{var shipping_cost_CLICKANDBUY_IN}}${{var shipping_cost_GIROPAY_IN}}${{var shipping_comment_IN}}${{var description}}${{if base_price}}{{var base_price}}{{/if}}${{if is_ecommerce_checkout_approved}}true{{/if}}';
28
+ if (is_array($this->getAdditionalAttributeCodes())) {
29
+ foreach($this->getAdditionalAttributeCodes() as $attributeCode) {
30
+ $bodyLine .= '${{var ' . $attributeCode . '}}';
31
+ }
32
+ }
33
+ return $bodyLine;
34
+ }
35
+
36
+ public function getFooter()
37
+ {
38
+ return '';
39
+ }
40
+
41
+ public function getEol()
42
+ {
43
+ return PHP_EOL;
44
+ }
45
+
46
+ public function getType()
47
+ {
48
+ return 'csv';
49
+ }
50
+
51
+ public function getFilename()
52
+ {
53
+ return '';
54
+ }
55
+
56
+ public function getQuoteSymbol()
57
+ {
58
+ return '$';
59
+ }
60
+
61
+ public function getQuoteSymbolReplacement()
62
+ {
63
+ return '&#36;';
64
+ }
65
  }
app/code/community/NRApps/Idealo/Model/Csv/Generator.php CHANGED
@@ -1,19 +1,19 @@
1
- <?php
2
- class NRApps_Idealo_Model_Csv_Generator extends NRApps_Idealo_Model_Generator
3
- {
4
- /**
5
- * @return NRApps_Idealo_Model_Feed
6
- */
7
- public function getFeed()
8
- {
9
- $feed = Mage::getSingleton('nrapps_idealo/csv_feed');
10
- if (!is_array($feed->getAdditionalAttributeCodes())) {
11
- $attributeCodes = array();
12
- foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/product_options/add_attributes_to_export', $this->_getStoreId())) as $row) {
13
- $attributeCodes[] = $row['attribute_code'];
14
- }
15
- $feed->setAdditionalAttributeCodes($attributeCodes);
16
- }
17
- return $feed;
18
- }
19
  }
1
+ <?php
2
+ class NRApps_Idealo_Model_Csv_Generator extends NRApps_Idealo_Model_Generator
3
+ {
4
+ /**
5
+ * @return NRApps_Idealo_Model_Feed
6
+ */
7
+ public function getFeed()
8
+ {
9
+ $feed = Mage::getSingleton('nrapps_idealo/csv_feed');
10
+ if (!is_array($feed->getAdditionalAttributeCodes())) {
11
+ $attributeCodes = array();
12
+ foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/product_options/add_attributes_to_export', $this->_getStoreId())) as $row) {
13
+ $attributeCodes[] = $row['attribute_code'];
14
+ }
15
+ $feed->setAdditionalAttributeCodes($attributeCodes);
16
+ }
17
+ return $feed;
18
+ }
19
  }
app/code/community/NRApps/Idealo/Model/DeliveryTime.php CHANGED
@@ -1,146 +1,146 @@
1
- <?php
2
- class NRApps_Idealo_Model_DeliveryTime
3
- {
4
- protected $_mapping = null;
5
-
6
- public function update()
7
- {
8
- $deliveryTimeAttributeCode = Mage::getStoreConfig('nrapps_idealo/attributes/delivery_time');
9
- if (!$deliveryTimeAttributeCode) {
10
- return;
11
- }
12
-
13
- /** @var Mage_Catalog_Model_Resource_Eav_Attribute $deliveryTimeAttribute */
14
- $deliveryTimeAttribute = Mage::getResourceModel('catalog/product')->getAttribute($deliveryTimeAttributeCode);
15
- if (!$deliveryTimeAttribute->getId()) {
16
- return;
17
- }
18
-
19
- if ($deliveryTimeAttribute->getFrontendInput() == 'select') {
20
- $this->_updateDeliveryTimeForSelectAttribute($deliveryTimeAttribute);
21
- } else {
22
- $this->_updateDeliveryTimeForTextAttribute($deliveryTimeAttribute);
23
- }
24
- }
25
-
26
- /**
27
- * @param Mage_Catalog_Model_Resource_Eav_Attribute $deliveryTimeAttribute
28
- */
29
- protected function _updateDeliveryTimeForSelectAttribute($deliveryTimeAttribute)
30
- {
31
- $options = $deliveryTimeAttribute->getSource()->getAllOptions();
32
- $newOptionsAdded = false;
33
-
34
- foreach($options as $option) {
35
- if (!$option['label'] || !$option['value']) {
36
- continue;
37
- }
38
-
39
- if (!$this->_labelExists($option['label'])) {
40
- $this->_addLabel($option['label']);
41
- $newOptionsAdded = true;
42
- }
43
- }
44
-
45
- $defaultLabel = Mage::getStoreConfig('nrapps_idealo/default_values/delivery_time');
46
- if (!$this->_labelExists($defaultLabel)) {
47
- $this->_addLabel($defaultLabel);
48
- $newOptionsAdded = true;
49
- }
50
-
51
-
52
- if ($newOptionsAdded) {
53
- $this->_saveMapping();
54
- }
55
- }
56
-
57
- /**
58
- * @param Mage_Catalog_Model_Resource_Eav_Attribute $deliveryTimeAttribute
59
- */
60
- protected function _updateDeliveryTimeForTextAttribute($deliveryTimeAttribute)
61
- {
62
- $newOptionsAdded = false;
63
-
64
- /** @var $productResource Mage_Catalog_Model_Resource_Product */
65
- $productResource = Mage::getResourceModel('catalog/product');
66
-
67
- /** @var $connection Varien_Db_Adapter_Interface */
68
- $connection = $productResource->getReadConnection();
69
-
70
- $condition = $connection->quoteInto('attribute_id = ?', $deliveryTimeAttribute->getId());
71
-
72
- $select = $connection->select()
73
- ->distinct()
74
- ->from($connection->getTableName($deliveryTimeAttribute->getBackendTable()), array('value'))
75
- ->where('value IS NOT NULL')
76
- ->where($condition)
77
- ->group('value');
78
-
79
- foreach($select->query()->fetchAll(Zend_Db::FETCH_COLUMN) as $value) {
80
- if (!$this->_labelExists($value)) {
81
- $this->_addLabel($value);
82
- $newOptionsAdded = true;
83
- }
84
- }
85
-
86
- $defaultLabel = Mage::getStoreConfig('nrapps_idealo/default_values/delivery_time');
87
- if (!$this->_labelExists($defaultLabel)) {
88
- $this->_addLabel($defaultLabel);
89
- $newOptionsAdded = true;
90
- }
91
-
92
- if ($newOptionsAdded) {
93
- $this->_saveMapping();
94
- }
95
- }
96
-
97
- /**
98
- * @param string $label
99
- * @return boolean
100
- */
101
- protected function _labelExists($label)
102
- {
103
- foreach($this->_getMapping() as $row) {
104
- if ($row['attribute_value'] == $label) {
105
- return true;
106
- }
107
- }
108
-
109
- return false;
110
- }
111
-
112
- protected function _addLabel($label)
113
- {
114
- $this->_mapping[] = array(
115
- 'attribute_value' => $label,
116
- NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE => $label,
117
- NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_AT => '',
118
- NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_UK => '',
119
- NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_FR => '',
120
- NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_IT => '',
121
- NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_ES => '',
122
- NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_PL => '',
123
- NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_IN => '',
124
- );
125
- }
126
-
127
- protected function _getMapping()
128
- {
129
- if (is_null($this->_mapping)) {
130
- $this->_mapping = @unserialize(Mage::getStoreConfig('nrapps_idealo/delivery_times/mapping'));
131
- if (!$this->_mapping)
132
- {
133
- $this->_mapping = array();
134
- }
135
- }
136
-
137
- return $this->_mapping;
138
- }
139
-
140
- protected function _saveMapping()
141
- {
142
- /** @var $installer Mage_Core_Model_Resource_Setup */
143
- $installer = Mage::getResourceModel('core/setup', 'core_setup');
144
- $installer->setConfigData('nrapps_idealo/delivery_times/mapping', serialize($this->_mapping));
145
- }
146
  }
1
+ <?php
2
+ class NRApps_Idealo_Model_DeliveryTime
3
+ {
4
+ protected $_mapping = null;
5
+
6
+ public function update()
7
+ {
8
+ $deliveryTimeAttributeCode = Mage::getStoreConfig('nrapps_idealo/attributes/delivery_time');
9
+ if (!$deliveryTimeAttributeCode) {
10
+ return;
11
+ }
12
+
13
+ /** @var Mage_Catalog_Model_Resource_Eav_Attribute $deliveryTimeAttribute */
14
+ $deliveryTimeAttribute = Mage::getResourceModel('catalog/product')->getAttribute($deliveryTimeAttributeCode);
15
+ if (!$deliveryTimeAttribute->getId()) {
16
+ return;
17
+ }
18
+
19
+ if ($deliveryTimeAttribute->getFrontendInput() == 'select') {
20
+ $this->_updateDeliveryTimeForSelectAttribute($deliveryTimeAttribute);
21
+ } else {
22
+ $this->_updateDeliveryTimeForTextAttribute($deliveryTimeAttribute);
23
+ }
24
+ }
25
+
26
+ /**
27
+ * @param Mage_Catalog_Model_Resource_Eav_Attribute $deliveryTimeAttribute
28
+ */
29
+ protected function _updateDeliveryTimeForSelectAttribute($deliveryTimeAttribute)
30
+ {
31
+ $options = $deliveryTimeAttribute->getSource()->getAllOptions();
32
+ $newOptionsAdded = false;
33
+
34
+ foreach($options as $option) {
35
+ if (!$option['label'] || !$option['value']) {
36
+ continue;
37
+ }
38
+
39
+ if (!$this->_labelExists($option['label'])) {
40
+ $this->_addLabel($option['label']);
41
+ $newOptionsAdded = true;
42
+ }
43
+ }
44
+
45
+ $defaultLabel = Mage::getStoreConfig('nrapps_idealo/default_values/delivery_time');
46
+ if (!$this->_labelExists($defaultLabel)) {
47
+ $this->_addLabel($defaultLabel);
48
+ $newOptionsAdded = true;
49
+ }
50
+
51
+
52
+ if ($newOptionsAdded) {
53
+ $this->_saveMapping();
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @param Mage_Catalog_Model_Resource_Eav_Attribute $deliveryTimeAttribute
59
+ */
60
+ protected function _updateDeliveryTimeForTextAttribute($deliveryTimeAttribute)
61
+ {
62
+ $newOptionsAdded = false;
63
+
64
+ /** @var $productResource Mage_Catalog_Model_Resource_Product */
65
+ $productResource = Mage::getResourceModel('catalog/product');
66
+
67
+ /** @var $connection Varien_Db_Adapter_Interface */
68
+ $connection = $productResource->getReadConnection();
69
+
70
+ $condition = $connection->quoteInto('attribute_id = ?', $deliveryTimeAttribute->getId());
71
+
72
+ $select = $connection->select()
73
+ ->distinct()
74
+ ->from($connection->getTableName($deliveryTimeAttribute->getBackendTable()), array('value'))
75
+ ->where('value IS NOT NULL')
76
+ ->where($condition)
77
+ ->group('value');
78
+
79
+ foreach($select->query()->fetchAll(Zend_Db::FETCH_COLUMN) as $value) {
80
+ if (!$this->_labelExists($value)) {
81
+ $this->_addLabel($value);
82
+ $newOptionsAdded = true;
83
+ }
84
+ }
85
+
86
+ $defaultLabel = Mage::getStoreConfig('nrapps_idealo/default_values/delivery_time');
87
+ if (!$this->_labelExists($defaultLabel)) {
88
+ $this->_addLabel($defaultLabel);
89
+ $newOptionsAdded = true;
90
+ }
91
+
92
+ if ($newOptionsAdded) {
93
+ $this->_saveMapping();
94
+ }
95
+ }
96
+
97
+ /**
98
+ * @param string $label
99
+ * @return boolean
100
+ */
101
+ protected function _labelExists($label)
102
+ {
103
+ foreach($this->_getMapping() as $row) {
104
+ if ($row['attribute_value'] == $label) {
105
+ return true;
106
+ }
107
+ }
108
+
109
+ return false;
110
+ }
111
+
112
+ protected function _addLabel($label)
113
+ {
114
+ $this->_mapping[] = array(
115
+ 'attribute_value' => $label,
116
+ NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE => $label,
117
+ NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_AT => '',
118
+ NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_UK => '',
119
+ NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_FR => '',
120
+ NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_IT => '',
121
+ NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_ES => '',
122
+ NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_PL => '',
123
+ NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_IN => '',
124
+ );
125
+ }
126
+
127
+ protected function _getMapping()
128
+ {
129
+ if (is_null($this->_mapping)) {
130
+ $this->_mapping = @unserialize(Mage::getStoreConfig('nrapps_idealo/delivery_times/mapping'));
131
+ if (!$this->_mapping)
132
+ {
133
+ $this->_mapping = array();
134
+ }
135
+ }
136
+
137
+ return $this->_mapping;
138
+ }
139
+
140
+ protected function _saveMapping()
141
+ {
142
+ /** @var $installer Mage_Core_Model_Resource_Setup */
143
+ $installer = Mage::getResourceModel('core/setup', 'core_setup');
144
+ $installer->setConfigData('nrapps_idealo/delivery_times/mapping', serialize($this->_mapping));
145
+ }
146
  }
app/code/community/NRApps/Idealo/Model/Feed.php CHANGED
@@ -1,87 +1,87 @@
1
- <?php
2
- class NRApps_Idealo_Model_Feed extends Varien_Object
3
- {
4
-
5
-
6
- public function getIncludeHeader()
7
- {
8
- return true;
9
- }
10
-
11
- public function getCharset()
12
- {
13
- return 'utf-8';
14
- }
15
-
16
- public function getHeader()
17
- {
18
- $date = Zend_Date::now();
19
- $date->setTimezone(Mage::getStoreConfig('general/locale/timezone'));
20
- $timestamp = $date->get('YYYY-MM-ddTHH:mm:ss');
21
- return '<?xml version="1.0" encoding="UTF-8"?>
22
- <offers>
23
- <updateTimestamp>' . $timestamp . '</updateTimestamp>';
24
-
25
- }
26
-
27
- public function getBody()
28
- {
29
- return '
30
- <offer>
31
- <command>InsertOrReplace</command>
32
- <sku>{{var store_id}}p{{var entity_id}}</sku>
33
- <title><![CDATA[{{var offer_name}}]]></title>
34
- <url><![CDATA[{{var url}}]]></url>
35
- {{foreach delivery_times as row}}<delivery{{if row.context}} context="{{var row.context}}"{{/if}}><![CDATA[{{var row.delivery_time}}]]></delivery>
36
- {{/foreach}}<price>{{if special_price}}{{var special_price}}{{else}}{{var price}}{{/if}}</price>
37
- {{if image}}<image>{{var image}}</image>
38
- {{/if}}{{foreach shipping_costs as row}}<shipping{{if row.context}} context="{{var row.context}}"{{/if}} type="{{var row.payment_method}}">{{var row.shipping_cost}}</shipping>
39
- {{/foreach}}{{foreach shipping_comments as row}}<shippingComment{{if row.context}} context="{{var row.context}}"{{/if}}><![CDATA[{{var row.shipping_comment}}]]></shippingComment>
40
- {{/foreach}}<category><![CDATA[{{var category_path}}]]></category>
41
- {{if manufacturer}}<brand><![CDATA[{{var manufacturer}}]]></brand>
42
- {{/if}}{{if oen}}<oen><![CDATA[{{var oen}}]]></oen>
43
- {{/if}}{{if kba}}<kba><![CDATA[{{var kba}}]]></kba>
44
- {{/if}}{{if ean}}<ean><![CDATA[{{var ean}}]]></ean>
45
- {{/if}}{{if han}}<han><![CDATA[{{var han}}]]></han>
46
- {{/if}}{{if pzn}}<pzn><![CDATA[{{var pzn}}]]></pzn>
47
- {{/if}}<description><![CDATA[{{var description}}]]></description>
48
- {{if is_used}}<used>true</used>
49
- {{/if}}{{if is_rebuild}}<rebuild>true</rebuild>
50
- {{/if}}{{if has_contract}}<contract>true</contract>
51
- {{/if}}{{if is_downloadable}}<downloadable>true</downloadable>
52
- {{/if}}{{if special_price}}<formerPrices>
53
- <formerPrice>{{var price}}</formerPrice>
54
- </formerPrices>
55
- {{/if}}{{if base_price}}<basePrice measure="{{var base_price_base_amount}}" unit="{{var base_price_base_unit}}">{{var base_price_raw}}</basePrice>
56
- {{/if}}{{if merchant}}<merchant><![CDATA[{{var merchant}}]]></merchant>
57
- {{/if}}<attributes>
58
- {{foreach additional_attributes as row}}{{if row.attribute_value}} <attribute name="{{var row.attribute_code}}">
59
- <value><![CDATA[{{var row.attribute_value}}]]></value>
60
- </attribute>
61
- {{/if}}{{/foreach}}</attributes>
62
- {{if is_ecommerce_checkout_approved}}<eCommerce>
63
- <checkoutApproved>true</checkoutApproved>
64
- </eCommerce>{{/if}}
65
- </offer>';
66
- }
67
-
68
- public function getFooter()
69
- {
70
- return '</offers>';
71
- }
72
-
73
- public function getEol()
74
- {
75
- return PHP_EOL;
76
- }
77
-
78
- public function getType()
79
- {
80
- return 'xml';
81
- }
82
-
83
- public function getFilename()
84
- {
85
- return '';
86
- }
87
  }
1
+ <?php
2
+ class NRApps_Idealo_Model_Feed extends Varien_Object
3
+ {
4
+
5
+
6
+ public function getIncludeHeader()
7
+ {
8
+ return true;
9
+ }
10
+
11
+ public function getCharset()
12
+ {
13
+ return 'utf-8';
14
+ }
15
+
16
+ public function getHeader()
17
+ {
18
+ $date = Zend_Date::now();
19
+ $date->setTimezone(Mage::getStoreConfig('general/locale/timezone'));
20
+ $timestamp = $date->get('YYYY-MM-ddTHH:mm:ss');
21
+ return '<?xml version="1.0" encoding="UTF-8"?>
22
+ <offers>
23
+ <updateTimestamp>' . $timestamp . '</updateTimestamp>';
24
+
25
+ }
26
+
27
+ public function getBody()
28
+ {
29
+ return '
30
+ <offer>
31
+ <command>InsertOrReplace</command>
32
+ <sku>{{var store_id}}p{{var entity_id}}</sku>
33
+ <title><![CDATA[{{var offer_name}}]]></title>
34
+ <url><![CDATA[{{var url}}]]></url>
35
+ {{foreach delivery_times as row}}<delivery{{if row.context}} context="{{var row.context}}"{{/if}}><![CDATA[{{var row.delivery_time}}]]></delivery>
36
+ {{/foreach}}<price>{{if special_price}}{{var special_price}}{{else}}{{var price}}{{/if}}</price>
37
+ {{if image}}<image>{{var image}}</image>
38
+ {{/if}}{{foreach shipping_costs as row}}<shipping{{if row.context}} context="{{var row.context}}"{{/if}} type="{{var row.payment_method}}">{{var row.shipping_cost}}</shipping>
39
+ {{/foreach}}{{foreach shipping_comments as row}}<shippingComment{{if row.context}} context="{{var row.context}}"{{/if}}><![CDATA[{{var row.shipping_comment}}]]></shippingComment>
40
+ {{/foreach}}<category><![CDATA[{{var category_path}}]]></category>
41
+ {{if manufacturer}}<brand><![CDATA[{{var manufacturer}}]]></brand>
42
+ {{/if}}{{if oen}}<oen><![CDATA[{{var oen}}]]></oen>
43
+ {{/if}}{{if kba}}<kba><![CDATA[{{var kba}}]]></kba>
44
+ {{/if}}{{if ean}}<ean><![CDATA[{{var ean}}]]></ean>
45
+ {{/if}}{{if han}}<han><![CDATA[{{var han}}]]></han>
46
+ {{/if}}{{if pzn}}<pzn><![CDATA[{{var pzn}}]]></pzn>
47
+ {{/if}}<description><![CDATA[{{var description}}]]></description>
48
+ {{if is_used}}<used>true</used>
49
+ {{/if}}{{if is_rebuild}}<rebuild>true</rebuild>
50
+ {{/if}}{{if has_contract}}<contract>true</contract>
51
+ {{/if}}{{if is_downloadable}}<downloadable>true</downloadable>
52
+ {{/if}}{{if special_price}}<formerPrices>
53
+ <formerPrice>{{var price}}</formerPrice>
54
+ </formerPrices>
55
+ {{/if}}{{if base_price}}<basePrice measure="{{var base_price_base_amount}}" unit="{{var base_price_base_unit}}">{{var base_price_raw}}</basePrice>
56
+ {{/if}}{{if merchant}}<merchant><![CDATA[{{var merchant}}]]></merchant>
57
+ {{/if}}<attributes>
58
+ {{foreach additional_attributes as row}}{{if row.attribute_value}} <attribute name="{{var row.attribute_code}}">
59
+ <value><![CDATA[{{var row.attribute_value}}]]></value>
60
+ </attribute>
61
+ {{/if}}{{/foreach}}</attributes>
62
+ {{if is_ecommerce_checkout_approved}}<eCommerce>
63
+ <checkoutApproved>true</checkoutApproved>
64
+ </eCommerce>{{/if}}
65
+ </offer>';
66
+ }
67
+
68
+ public function getFooter()
69
+ {
70
+ return '</offers>';
71
+ }
72
+
73
+ public function getEol()
74
+ {
75
+ return PHP_EOL;
76
+ }
77
+
78
+ public function getType()
79
+ {
80
+ return 'xml';
81
+ }
82
+
83
+ public function getFilename()
84
+ {
85
+ return '';
86
+ }
87
  }
app/code/community/NRApps/Idealo/Model/Filter.php CHANGED
@@ -1,91 +1,91 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Filter extends Varien_Filter_Template
4
- {
5
- const CONSTRUCTION_EACH_PATTERN = '/{{foreach\s(.*?)as\s(.*?)}}(.*?){{\\/foreach\s*}}/si';
6
-
7
- /**
8
- * @param string $value
9
- * @return string
10
- */
11
- public function filter($value)
12
- {
13
- try {
14
-
15
- $pattern = self::CONSTRUCTION_EACH_PATTERN;
16
- $directive = 'foreachDirective';
17
-
18
- if (preg_match_all($pattern, $value, $constructions, PREG_SET_ORDER)) {
19
- foreach ($constructions as $construction) {
20
- $replacedValue = '';
21
- $callback = array($this, $directive);
22
- if (!is_callable($callback)) {
23
- continue;
24
- }
25
- try {
26
- $replacedValue = call_user_func($callback, $construction);
27
- } catch (Exception $e) {
28
- Mage::throwException($e);
29
- }
30
- $value = str_replace($construction[0], $replacedValue, $value);
31
- }
32
- }
33
-
34
- $value = parent::filter($value);
35
- } catch (Exception $e) {
36
- Mage::throwException(Mage::helper('nrapps_idealo')->__('The filter can not be applied to the template'));
37
- }
38
-
39
- return $value;
40
- }
41
-
42
- /**
43
- *
44
- * @param array $construction
45
- * @return string
46
- */
47
- public function foreachDirective($construction)
48
- {
49
- if (count($this->_templateVars) == 0) {
50
- // If template preprocessing
51
- return $construction[0];
52
- }
53
-
54
- if ($this->_getVariable($construction[1], '') == '') {
55
- return '';
56
- } else {
57
-
58
- $value = '';
59
- foreach ($this->_getVariable($construction[1]) as $item) {
60
- $subFilter = new self;
61
- $subFilter->setVariables(array($construction[2] => $item));
62
- $value .= $subFilter->filter($construction[3]);
63
- }
64
-
65
- return $value;
66
- }
67
- }
68
-
69
- public function varDirective($construction)
70
- {
71
- if (count($this->_templateVars)==0) {
72
- // If template preprocessing
73
- return $construction[0];
74
- }
75
-
76
- $maxLength = null;
77
- $variable = $construction[2];
78
- $colonPosition = strpos($variable, ':');
79
- if ($colonPosition !== false) {
80
- $maxLength = substr($variable, $colonPosition + 1);
81
- $variable = substr($variable, 0, $colonPosition);
82
- }
83
- $replacedValue = $this->_getVariable($variable, '');
84
-
85
- if (!is_null($maxLength)) {
86
- $replacedValue = substr($replacedValue, 0, $maxLength);
87
- }
88
-
89
- return $replacedValue;
90
- }
91
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Filter extends Varien_Filter_Template
4
+ {
5
+ const CONSTRUCTION_EACH_PATTERN = '/{{foreach\s(.*?)as\s(.*?)}}(.*?){{\\/foreach\s*}}/si';
6
+
7
+ /**
8
+ * @param string $value
9
+ * @return string
10
+ */
11
+ public function filter($value)
12
+ {
13
+ try {
14
+
15
+ $pattern = self::CONSTRUCTION_EACH_PATTERN;
16
+ $directive = 'foreachDirective';
17
+
18
+ if (preg_match_all($pattern, $value, $constructions, PREG_SET_ORDER)) {
19
+ foreach ($constructions as $construction) {
20
+ $replacedValue = '';
21
+ $callback = array($this, $directive);
22
+ if (!is_callable($callback)) {
23
+ continue;
24
+ }
25
+ try {
26
+ $replacedValue = call_user_func($callback, $construction);
27
+ } catch (Exception $e) {
28
+ Mage::throwException($e);
29
+ }
30
+ $value = str_replace($construction[0], $replacedValue, $value);
31
+ }
32
+ }
33
+
34
+ $value = parent::filter($value);
35
+ } catch (Exception $e) {
36
+ Mage::throwException(Mage::helper('nrapps_idealo')->__('The filter can not be applied to the template'));
37
+ }
38
+
39
+ return $value;
40
+ }
41
+
42
+ /**
43
+ *
44
+ * @param array $construction
45
+ * @return string
46
+ */
47
+ public function foreachDirective($construction)
48
+ {
49
+ if (count($this->_templateVars) == 0) {
50
+ // If template preprocessing
51
+ return $construction[0];
52
+ }
53
+
54
+ if ($this->_getVariable($construction[1], '') == '') {
55
+ return '';
56
+ } else {
57
+
58
+ $value = '';
59
+ foreach ($this->_getVariable($construction[1]) as $item) {
60
+ $subFilter = new self;
61
+ $subFilter->setVariables(array($construction[2] => $item));
62
+ $value .= $subFilter->filter($construction[3]);
63
+ }
64
+
65
+ return $value;
66
+ }
67
+ }
68
+
69
+ public function varDirective($construction)
70
+ {
71
+ if (count($this->_templateVars)==0) {
72
+ // If template preprocessing
73
+ return $construction[0];
74
+ }
75
+
76
+ $maxLength = null;
77
+ $variable = $construction[2];
78
+ $colonPosition = strpos($variable, ':');
79
+ if ($colonPosition !== false) {
80
+ $maxLength = substr($variable, $colonPosition + 1);
81
+ $variable = substr($variable, 0, $colonPosition);
82
+ }
83
+ $replacedValue = $this->_getVariable($variable, '');
84
+
85
+ if (!is_null($maxLength)) {
86
+ $replacedValue = substr($replacedValue, 0, $maxLength);
87
+ }
88
+
89
+ return $replacedValue;
90
+ }
91
  }
app/code/community/NRApps/Idealo/Model/Generator.php CHANGED
@@ -1,1388 +1,1388 @@
1
- <?php
2
- class NRApps_Idealo_Model_Generator extends Mage_Core_Model_Abstract
3
- {
4
- /** @var Mage_Core_Model_Store */
5
- protected $_store;
6
-
7
- /** @var Mage_Catalog_Model_Entity_Attribute[] */
8
- protected $_attributes = array();
9
-
10
- /** @var string[] */
11
- protected $_categoryNames = array();
12
-
13
- /** @var array int[]|null */
14
- protected $_excludedCategoryIds = null;
15
-
16
- /** @var string[] */
17
- protected $_categoryPaths = array();
18
-
19
- /** @var array[] */
20
- protected $_categoryAttributeValues = array();
21
-
22
- /** @var array[] */
23
- protected $_categoryAttributeLevels = array();
24
-
25
- /** @var string[] */
26
- protected $_usedAttributeCodes = array();
27
-
28
- /** @var string[] */
29
- protected $_productSkusById = array();
30
-
31
- /** @var Mage_Catalog_Model_Product */
32
- protected $_product;
33
-
34
- /**
35
- * @param Mage_Core_Model_Store $store
36
- */
37
- public function __construct(Mage_Core_Model_Store $store)
38
- {
39
- parent::__construct();
40
-
41
- $this->_init('nrapps_idealo/indexer');
42
-
43
- $this->_store = $store;
44
- }
45
-
46
- /**
47
- * @return Mage_Core_Model_Store
48
- */
49
- public function getStore()
50
- {
51
- return $this->_store;
52
- }
53
-
54
- /**
55
- * @return NRApps_Idealo_Model_Feed
56
- */
57
- public function getFeed()
58
- {
59
- return Mage::getSingleton('nrapps_idealo/feed');
60
- }
61
-
62
- /**
63
- * @return string
64
- */
65
- public function getFeedType()
66
- {
67
- return $this->getFeed()->getType();
68
- }
69
-
70
- /**
71
- * @param bool $useIndex
72
- * @param string[] $alternativeContent
73
- * @return string
74
- */
75
- public function getFeedContent($useIndex = true, $alternativeContent = array())
76
- {
77
- $feedContent = array();
78
- if ($this->getFeed()->getIncludeHeader()) {
79
- $feedContent[] = $this->_getHeader();
80
- }
81
-
82
- if ($useIndex) {
83
- foreach ($this->getProductDataFromIndex() as $productRow) {
84
- $feedContent[] = $productRow['data'];
85
- }
86
- } else {
87
- foreach($alternativeContent as $row) {
88
- $feedContent[] = $row;
89
- }
90
- }
91
-
92
- if ($footer = $this->_getFooter()) {
93
- $feedContent[] = $footer;
94
- }
95
-
96
- return implode($this->_getEol(), $feedContent);
97
- }
98
-
99
- /**
100
- * @return string
101
- */
102
- public function generateFile()
103
- {
104
- $filename = $this->_getFilename();
105
-
106
- $dirname = Mage::getBaseDir('media') . DS . 'nrapps_idealo' . DS;
107
-
108
- if (!is_dir($dirname)) {
109
- mkdir($dirname, 0777, true);
110
- }
111
-
112
- $path = $dirname . $filename;
113
-
114
- $fileHandle = fopen($path, 'w');
115
-
116
- if ($this->getFeed()->getIncludeHeader()) {
117
- $this->_writeLineToFile($fileHandle, $this->_getHeader());
118
- }
119
-
120
- $feedIndexDbStatement = $this->_getFeedIndexDbStatement();
121
- $productData = array();
122
- $i = 0;
123
- // write product data to file in chunks
124
- while ($productRow = $feedIndexDbStatement->fetch()) {
125
- $productData[] = $productRow['data'];
126
- if ($i++ > 1000) {
127
- $i = 0;
128
- $this->_writeLineToFile($fileHandle, $productData);
129
- $productData = array();
130
- }
131
- }
132
- $this->_writeLineToFile($fileHandle, $productData);
133
-
134
- if ($footer = $this->_getFooter()) {
135
- $this->_writeLineToFile($fileHandle, $footer);
136
- }
137
-
138
- fclose($fileHandle);
139
-
140
- return $filename;
141
- }
142
-
143
- /**
144
- * @return Zend_Db_Statement
145
- */
146
- protected function _getFeedIndexDbStatement()
147
- {
148
- $condition = $this->_getResource()->getReadConnection()->quoteInto('store_id = ?', $this->_getStoreId());
149
- $condition .= ' AND ' . $this->_getResource()->getReadConnection()->quoteInto('feed_type = ?', $this->getFeedType());
150
- $select = $this->_getResource()->getReadConnection()->select()
151
- ->from($this->_getResource()->getTable('nrapps_idealo/index'), array('data'))
152
- ->where($condition);
153
-
154
- $statement = $this->_getResource()->getReadConnection()->query($select);
155
- return $statement;
156
- }
157
-
158
- /**
159
- * @param resource $fileHandle
160
- * @param string $content
161
- */
162
- protected function _writeLineToFile($fileHandle, $content)
163
- {
164
- if (is_array($content)) {
165
- $content = implode($this->_getEol(), $content);
166
- }
167
- if (!trim($content)) {
168
- return;
169
- }
170
-
171
- $content .= $this->_getEol();
172
-
173
- fwrite($fileHandle, $content);
174
- }
175
-
176
- /**
177
- * @return string
178
- */
179
- protected function _getFilename()
180
- {
181
- if ($filename = $this->getFeed()->getFilename()) {
182
- return $filename;
183
- }
184
- return 'idealo_' . $this->_getStoreId() . '_' . $this->getStore()->getCode() . '.' . $this->getFeed()->getType();
185
- }
186
-
187
- /**
188
- * @return string
189
- */
190
- protected function _getEol()
191
- {
192
- $search = array('\n', '\r', '\t');
193
- $replacement = array("\n", "\r", "\t");
194
-
195
- return str_replace($search, $replacement, $this->getFeed()->getEol());
196
- }
197
-
198
- /**
199
- * @return string
200
- */
201
- protected function _getHeader()
202
- {
203
- $search = array('\n', '\r', '\t');
204
- $replacement = array("\n", "\r", "\t");
205
-
206
- return str_replace($search, $replacement, $this->getFeed()->getHeader());
207
- }
208
-
209
- /**
210
- * @return string
211
- */
212
- protected function _getBody()
213
- {
214
- $search = array('\n', '\r', '\t');
215
- $replacement = array("\n", "\r", "\t");
216
-
217
- return str_replace($search, $replacement, $this->getFeed()->getBody());
218
- }
219
-
220
- /**
221
- * @return string
222
- */
223
- protected function _getFooter()
224
- {
225
- $search = array('\n', '\r', '\t');
226
- $replacement = array("\n", "\r", "\t");
227
-
228
- return str_replace($search, $replacement, $this->getFeed()->getFooter());
229
- }
230
-
231
- /**
232
- * @return array
233
- */
234
- public function getProductDataFromIndex()
235
- {
236
- return Mage::getResourceSingleton('nrapps_idealo/indexer')->getDataByStoreId($this->_getStoreId());
237
- }
238
-
239
- /**
240
- * @param Mage_Catalog_Model_Product $product
241
- * @return string
242
- */
243
- public function getProductData(Mage_Catalog_Model_Product $product)
244
- {
245
- $product->setStoreId($this->_getStoreId());
246
-
247
- /* @var $processor Mage_Cms_Model_Template_Filter */
248
- $processor = Mage::getModel('nrapps_idealo/filter');
249
-
250
- $productData = $this->_getProductData($product);
251
-
252
- $processor->setVariables($productData);
253
-
254
- return $processor->filter($this->_getBody());
255
- }
256
-
257
- /**
258
- * @param Mage_Catalog_Model_Product $product
259
- * @return array
260
- */
261
- protected function _getProductData(Mage_Catalog_Model_Product $product)
262
- {
263
- $product->setStockItem(Mage::getModel('cataloginventory/stock_item')->loadByProduct($product));
264
-
265
- $productDataTransport = new Varien_Object();
266
- Mage::dispatchEvent('nrapps_idealo_generate_product_data_before', array('product' => $product, 'product_data' => $productDataTransport, 'store_id' => $this->getStore()->getId()));
267
-
268
- $productData = $productDataTransport->getData();
269
-
270
- if ($this->_isAttributeUsed('base_price') || $this->_isAttributeUsed('base_price_raw')) {
271
-
272
- $this->_loadDefaultBasePriceValues($product);
273
-
274
- if ($this->_isAttributeUsed('base_price')) {
275
- $productData['base_price'] = $this->_getBasePrice($product);
276
- }
277
-
278
- if ($this->_isAttributeUsed('base_price_raw')) {
279
- $productData['base_price_raw'] = $this->_getBasePriceRaw($product);
280
- }
281
- }
282
-
283
- foreach ($product->getData() as $key => $value) {
284
- if ($this->_isAttributeUsed($key)) {
285
- $productData[$key] = $this->_getAttributeValue($product, $key);
286
-
287
- $productDataRaw = $this->_getAttributeValueRaw($product, $key);
288
- if ($productDataRaw !== null) {
289
- $productData[$key . '__raw'] = $productDataRaw;
290
- }
291
- }
292
- }
293
-
294
- $productData['offer_name'] = $this->_getOfferName($product);
295
-
296
- $productData['url'] = $this->_getEncodedValue($this->_getProductUrl($product));
297
-
298
- $productData['qty'] = $product->getStockItem()->getQty();
299
- $productData['is_in_stock'] = $product->getStockItem()->getIsInStock();
300
-
301
- $productData['price'] = ( $this->_getPrice($product) ? $this->_formatPrice($this->_getPrice($product)) : '' );
302
-
303
- $productData['currency_code'] = $this->getStore()->getBaseCurrencyCode();
304
- $productData['country_code'] = Mage::getStoreConfig('general/country/default', $this->_getStoreId());
305
- $productData['language_code'] = current(explode('_', Mage::getStoreConfig('general/locale/code', $this->_getStoreId())));
306
- $productData['store_code'] = $this->getStore()->getCode();
307
- $productData['is_downloadable'] = ( $product->getTypeId() == 'downloadable' );
308
-
309
- $productCategoryIds = $this->_getCategoryIds($product);
310
- if ($this->_isAttributeUsed('category_names') || $this->_isAttributeUsed('category_name')) {
311
- $productData['category_names'] = $this->_getCategoryNamesByIds($productCategoryIds);
312
- $productData['category_name'] = current($productData['category_names']);
313
- }
314
- if ($this->_isAttributeUsed('category_paths') || $this->_isAttributeUsed('category_path') || $this->_isAttributeUsed($this->_getCategoryAttributeCodes())) {
315
- $productData['category_paths'] = $this->_getCategoryPathsByIds($productCategoryIds);
316
- $productData['category_path'] = current($productData['category_paths']);
317
- foreach ($this->_getCategoryAttributeCodes() as $attributeCode) {
318
- if ($this->_isAttributeUsed($attributeCode)) {
319
- if (!$product->getData($attributeCode)) {
320
- $storedLevel = 0;
321
- foreach ($productCategoryIds as $categoryId) {
322
- if (isset($this->_categoryAttributeValues[$attributeCode][$categoryId]) && $this->_categoryAttributeValues[$attributeCode][$categoryId] && $this->_categoryAttributeLevels[$attributeCode][$categoryId] > $storedLevel) {
323
- $storedLevel = $this->_categoryAttributeLevels[$attributeCode][$categoryId];
324
- $productData[$attributeCode] = $this->_getEncodedValue($this->_categoryAttributeValues[$attributeCode][$categoryId]);
325
- }
326
- }
327
- }
328
- }
329
- }
330
- }
331
-
332
- $this->_addImageData($product, $productData);
333
-
334
- if ($product->getParentProductIds()) {
335
- $productData['parent_product_sku'] = $this->_getSkuByProductId(current($product->getParentProductIds()));
336
- }
337
-
338
- // Manage custom attributes defined in attribute management
339
- foreach (Mage::getStoreConfig('nrapps_idealo/attributes') as $attributeIdentifier => $attributeCode) {
340
- if ($attributeIdentifier == 'shipping_cost') {
341
- continue;
342
- } else if (!isset($productData[$attributeIdentifier]) || !$productData[$attributeIdentifier]) {
343
- if ($attributeCode != 'none' && $this->_isAttributeUsed($attributeIdentifier)) {
344
- if (!strlen($product->getData($attributeIdentifier))) {
345
- if ($this->_getAttribute($attributeCode)->getSourceModel() == 'nrapps_idealo/source_yesNoDefault') {
346
- $productData[$attributeIdentifier] = intval(Mage::getStoreConfig('nrapps_idealo/default_values/' . $attributeIdentifier, $this->_getStoreId()));
347
- } else {
348
- $productData[$attributeIdentifier] = $this->_getEncodedValue(Mage::getStoreConfig('nrapps_idealo/default_values/' . $attributeIdentifier, $this->_getStoreId()));
349
- }
350
- } else {
351
- $productData[$attributeIdentifier] = $this->_getAttributeValue($product, $attributeCode);
352
- }
353
- }
354
- }
355
- }
356
-
357
- $this->_addAdditionalAttributesData($productData);
358
-
359
- foreach(explode(',', Mage::getStoreConfig('nrapps_idealo/listing/listing_at', $this->_getStoreId())) as $listingCountry) {
360
- $this->_addPaymentMethodData($productData, $listingCountry);
361
- }
362
- $this->_addMinimumOrderAmountData($productData);
363
- $this->_addShippingCommentsData($productData);
364
- $this->_addDeliveryTimesData($productData);
365
-
366
- $productDataTransport->setData($productData);
367
-
368
- Mage::dispatchEvent('nrapps_idealo_generate_product_data_after', array('product' => $product, 'product_data' => $productDataTransport, 'store_id' => $this->getStore()->getId(), 'generator' => $this));
369
-
370
- return $productDataTransport->getData();
371
- }
372
-
373
- /**
374
- * generate image urls
375
- *
376
- * @param Mage_Catalog_Model_Product $product
377
- * @param array $productData
378
- */
379
- protected function _addImageData(Mage_Catalog_Model_Product $product, &$productData)
380
- {
381
- unset($productData['image']);
382
- unset($productData['small_image']);
383
- unset($productData['thumbnail']);
384
-
385
- foreach (array('image', 'small_image', 'thumbnail') as $imageAttributeCode) {
386
- if ($this->_isAttributeUsed($imageAttributeCode)) {
387
- $productImage = $this->_getProductImage($product, $imageAttributeCode);
388
- if ($productImage && file_exists(Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . $productImage)) {
389
- $productData[$imageAttributeCode] = Mage::getBaseUrl('media') . 'catalog/product' . $productImage;
390
- }
391
- }
392
- }
393
-
394
- $productData['additional_images'] = array();
395
- if (is_object($product->getMediaGalleryImages())) {
396
- $i = 1;
397
- foreach ($product->getMediaGalleryImages() as $image) {
398
- // limit to 10 images
399
- if ($i > 10) {
400
- break;
401
- }
402
- $productData['additional_image_' . $i++] = Mage::getBaseUrl('media') . 'catalog/product' . $image->getFile();
403
- $productData['additional_images'][] = Mage::getBaseUrl('media') . 'catalog/product' . $image->getFile();
404
- }
405
- }
406
- }
407
-
408
- /**
409
- * add data for additional attributes
410
- *
411
- * @param array $productData
412
- */
413
- protected function _addAdditionalAttributesData(&$productData)
414
- {
415
- $productData['additional_attributes'] = array();
416
- foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/product_options/add_attributes_to_export', $this->_getStoreId())) as $row) {
417
-
418
- /** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
419
- $attribute = $this->_getAttribute($row['attribute_code']);
420
- if (!$attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
421
- return;
422
- }
423
- if (!isset($productData[$attribute->getAttributeCode()])) {
424
- continue;
425
- }
426
-
427
- $productData['additional_attributes'][] = new Varien_Object(array(
428
- 'attribute_code' => $attribute->getFrontendLabel(),
429
- 'attribute_value' => $productData[$attribute->getAttributeCode()],
430
- ));
431
- }
432
- }
433
-
434
- /**
435
- * add data for payment methods
436
- *
437
- * @param array $productData
438
- * @param string $listingCountry
439
- */
440
- protected function _addPaymentMethodData(&$productData, $listingCountry)
441
- {
442
- $productData['shipping_cost'] = $this->_getEncodedValue($this->_getDefaultShippingCost($productData['price'], $productData['weight'], $listingCountry));
443
- if (!isset($productData['shipping_costs'])) {
444
- $productData['shipping_costs'] = array();
445
- }
446
- foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/' . $this->_getConfigGroup($listingCountry) . '/payment_methods', $this->_getStoreId())) as $row) {
447
-
448
- if (!isset($productData['shipping_cost'])) {
449
- $productData['shipping_cost'] = 0;
450
- }
451
- $shippingCost = $productData['shipping_cost'] + floatval($row['surcharge']);
452
- if (isset($row['percental_surcharge']) && $row['percental_surcharge']) {
453
-
454
- $percentalSurcharge = floatval($row['percental_surcharge']);
455
- if (Mage::getStoreConfig('nrapps_idealo/' . $this->_getConfigGroup($listingCountry) . '/percental_surcharge_calculation_method') ==
456
- NRApps_Idealo_Model_Source_PercentalSurchargeCalculationMethod::CALCULATION_METHOD_PRODUCT_PRICE_AND_SHIPPING_COST) {
457
-
458
- $shippingCost += $shippingCost * $percentalSurcharge / 100;
459
- }
460
- $productPrice = $productData['price'];
461
- if (isset($productData['special_price']) && $productData['special_price']) {
462
-
463
- $productPrice = $productData['special_price'];
464
- }
465
- $shippingCost += $productPrice * $percentalSurcharge / 100;
466
- }
467
-
468
- if (Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_surcharge/is_active')) {
469
- $productPrice = $productData['price'];
470
- if (isset($productData['special_price']) && $productData['special_price']) {
471
- $productPrice = $productData['special_price'];
472
- }
473
- $minimumOrderAmountForSurcharge = Mage::getStoreConfig('nrapps_idealo/minimum_order_surcharge/minimum_order_value');
474
- if ($minimumOrderAmountForSurcharge > $productPrice) {
475
- $shippingCost += Mage::getStoreConfig('nrapps_idealo/minimum_order_surcharge/surcharge');
476
- }
477
- }
478
-
479
- if (Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_weight_surcharge/is_active')) {
480
-
481
- if ($productWeight = $productData['weight']) {
482
- $minimumOrderWeightForSurcharge = Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/minimum_order_weight');
483
- if ($minimumOrderWeightForSurcharge > $productWeight) {
484
- $shippingCost += Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/surcharge');
485
- }
486
- }
487
- }
488
-
489
- $shippingCost = number_format($shippingCost, 2);
490
-
491
- $productData['shipping_cost_' . $row['payment_method']] = $shippingCost;
492
- $productData['shipping_costs'][] = new Varien_Object(array(
493
- 'payment_method' => $row['payment_method'],
494
- 'shipping_cost' => $shippingCost,
495
- 'context' => $this->_getContext($listingCountry),
496
- ));
497
- $productData['shipping_cost_' . $row['payment_method'] . $this->_getSuffix($listingCountry)] = $shippingCost;
498
- }
499
- }
500
-
501
- /**
502
- * add data for shipping comments
503
- *
504
- * @param array $productData
505
- */
506
- protected function _addShippingCommentsData(&$productData)
507
- {
508
- $productData['shipping_comments'] = array();
509
- foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/default_values/shipping_comments', $this->_getStoreId())) as $row) {
510
-
511
- $comment = $row['comment'];
512
- if (isset($productData['shipping_comment']) && trim($productData['shipping_comment'])) {
513
- $comment .= $this->_getLineDivider() . $productData['shipping_comment'];
514
- }
515
- $productData['shipping_comments'][] = new Varien_Object(array(
516
- 'shipping_comment' => $comment,
517
- 'context' => $this->_getContext($row['listing_at'])
518
- ));
519
- $productData['shipping_comment' . $this->_getSuffix($row['listing_at'])] = $comment;
520
- }
521
- }
522
-
523
- /**
524
- * add data for delivery times
525
- *
526
- * @param array $productData
527
- */
528
- protected function _addDeliveryTimesData(&$productData)
529
- {
530
- if (!isset($productData['delivery_times'])) {
531
- $productData['delivery_times'] = array();
532
- }
533
-
534
- if (!isset($productData['delivery_time']) || !$productData['delivery_time']) {
535
- return;
536
- }
537
-
538
- foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/delivery_times/mapping', $this->_getStoreId())) as $row) {
539
-
540
- if ($row['attribute_value'] == $productData['delivery_time']) {
541
- foreach(explode(',', Mage::getStoreConfig('nrapps_idealo/listing/listing_at', $this->_getStoreId())) as $listingCountry) {
542
- if (isset($row[$listingCountry]) && $row[$listingCountry]) {
543
- $productData['delivery_times'][] = new Varien_Object(array(
544
- 'delivery_time' => $row[$listingCountry],
545
- 'context' => $this->_getContext($listingCountry)
546
- ));
547
- $productData['delivery_time' . $this->_getSuffix($listingCountry)] = $row[$listingCountry];
548
- }
549
- }
550
- break;
551
- }
552
- }
553
- }
554
-
555
- /**
556
- * add data for minimum order value and minimum order surcharge
557
- *
558
- * @param array $productData
559
- */
560
- protected function _addMinimumOrderAmountData(&$productData)
561
- {
562
- if (!isset($productData['shipping_comment'])) {
563
- $productData['shipping_comment'] = '';
564
- }
565
-
566
- if (Mage::getStoreConfigFlag('sales/minimum_order/active') || Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_surcharge/is_active')) {
567
- $productPrice = $productData['price'];
568
- if (isset($productData['special_price']) && $productData['special_price']) {
569
- $productPrice = $productData['special_price'];
570
- }
571
- $minimumOrderAmount = Mage::getStoreConfig('sales/minimum_order/amount');
572
- if (Mage::getStoreConfigFlag('sales/minimum_order/active') && $minimumOrderAmount > $productPrice) {
573
- if ($productData['shipping_comment']) {
574
- $productData['shipping_comment'] .= $this->_getLineDivider();
575
- }
576
- $productData['shipping_comment'] .= Mage::helper('nrapps_idealo')->__(
577
- 'Minimum order amount: %s',
578
- Mage::helper('core')->formatCurrency($minimumOrderAmount, false)
579
- );
580
- }
581
- $minimumOrderAmountForSurcharge = Mage::getStoreConfig('nrapps_idealo/minimum_order_surcharge/minimum_order_value');
582
- if (Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_surcharge/is_active') && $minimumOrderAmountForSurcharge > $productPrice) {
583
- if ($productData['shipping_comment']) {
584
- $productData['shipping_comment'] .= $this->_getLineDivider();
585
- }
586
- $productData['shipping_comment'] .= Mage::helper('nrapps_idealo')->__(
587
- 'For orders below %s, a surcharge of %s will be charged.',
588
- Mage::helper('core')->formatCurrency($minimumOrderAmountForSurcharge, false),
589
- Mage::helper('core')->formatCurrency(Mage::getStoreConfig('nrapps_idealo/minimum_order_surcharge/surcharge'), false)
590
- );
591
- }
592
- }
593
-
594
- if (Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_weight_surcharge/is_active')) {
595
-
596
- if ($productWeight = $productData['weight']) {
597
- $minimumOrderWeightForSurcharge = Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/minimum_order_weight');
598
- if ($minimumOrderWeightForSurcharge > $productWeight) {
599
- if ($productData['shipping_comment']) {
600
- $productData['shipping_comment'] .= $this->_getLineDivider();
601
- }
602
- $productData['shipping_comment'] .= Mage::helper('nrapps_idealo')->__(
603
- 'For orders below a weight of %s %s, a surcharge of %s will be charged.',
604
- $minimumOrderWeightForSurcharge,
605
- Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/unit'),
606
- Mage::helper('core')->formatCurrency(Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/surcharge'), false)
607
- );
608
- }
609
- }
610
- }
611
- }
612
-
613
- /**
614
- * @param Mage_Catalog_Model_Product $product
615
- * @return float
616
- */
617
- protected function _getPrice(Mage_Catalog_Model_Product $product)
618
- {
619
- if ($product->getParentProductIds()) {
620
-
621
- if (Mage::getStoreConfig('nrapps_idealo/default_values/configurable_child_products_price', $this->_getStoreId())
622
- == NRApps_Idealo_Model_Source_ConfigurableChildProductsPriceType::PRICE_TYPE_PARENT_WITH_MODIFICATIONS) {
623
-
624
- /** @var $parentProduct Mage_Catalog_Model_Product */
625
- $parentProduct = $this->_getProduct(current($product->getParentProductIds()));
626
-
627
- /** @var $productTypeInstance Mage_Catalog_Model_Product_Type_Configurable */
628
- $productTypeInstance = $parentProduct->getTypeInstance(true);
629
-
630
- /** @var $configurableAttributes array */
631
- $configurableAttributes = $productTypeInstance->getConfigurableAttributesAsArray($parentProduct);
632
-
633
- /**
634
- * Required to determinate product child price
635
- * @see Mage_Catalog_Model_Product_Type_Configurable_Price::getFinalPrice()
636
- */
637
- $customOptionAttributes = array();
638
- foreach ($configurableAttributes as $attribute) {
639
- $customOptionAttributes[$attribute['attribute_id']] = $product->getData($attribute['attribute_code']);
640
- }
641
-
642
- $parentProduct->addCustomOption('attributes', serialize($customOptionAttributes));
643
-
644
- /** @var $priceModel Mage_Catalog_Model_Product_Type_Configurable_Price */
645
- $priceModel = Mage::getModel('catalog/product_type_configurable_price');
646
-
647
- return $priceModel->getFinalPrice(null, $parentProduct);
648
- }
649
-
650
- if (Mage::getStoreConfig('nrapps_idealo/default_values/configurable_child_products_price', $this->_getStoreId())
651
- == NRApps_Idealo_Model_Source_ConfigurableChildProductsPriceType::PRICE_TYPE_PARENT_WITHOUT_MODIFICATIONS) {
652
-
653
- return Mage::getResourceSingleton('catalog/product')->getAttributeRawValue(current($product->getParentProductIds()), 'price', $product->getStoreId());
654
- }
655
- }
656
-
657
- if ($product->isGrouped()) {
658
-
659
- $childrenIds = $product->getTypeInstance(true)->getChildrenIds($product->getId());
660
-
661
- if (!sizeof($childrenIds)) {
662
- return 0;
663
- }
664
-
665
- $usedAttributes = array('price', 'special_price', 'special_from_date', 'special_to_date');
666
-
667
- foreach (Mage::getStoreConfig('nrapps_idealo/attributes') as $attributeCode => $newAttributeCode) {
668
- if ($newAttributeCode && $newAttributeCode != 'none') {
669
- $usedAttributes[] = $newAttributeCode;
670
- } else if ($newAttributeCode != 'none') {
671
- $usedAttributes[] = $attributeCode;
672
- }
673
- }
674
-
675
- /** @var $childrenProducts Mage_Catalog_Model_Resource_Product_Collection */
676
- $childrenProducts = Mage::getResourceModel('catalog/product_collection')
677
- ->addAttributeToFilter('entity_id', array('in' => $childrenIds))
678
- ->addWebsiteFilter($this->getStore()->getWebsiteId())
679
- ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
680
- ->addAttributeToSelect('nrapps_idealo_exclude')
681
- ->addAttributeToSelect($usedAttributes)
682
- ->setOrder('price');
683
-
684
- foreach ($childrenProducts as $childProduct) { /** @var Mage_Catalog_Model_Product $childProduct */
685
- if ($childProduct->getId() && !$childProduct->getFeedgeneratorExclude()) {
686
- foreach ($usedAttributes as $attributeCode) {
687
- if (!$product->getData($attributeCode) && $childProduct->getData($attributeCode)) {
688
- $product->setData($attributeCode, $childProduct->getData($attributeCode));
689
- }
690
- }
691
- return $childProduct->getPriceModel()->getFinalPrice(1, $childProduct);
692
- }
693
- }
694
- }
695
-
696
- return $product->getPrice();
697
- }
698
-
699
- /**
700
- * @param Mage_Catalog_Model_Product $product
701
- * @return string
702
- */
703
- protected function _getBasePrice(Mage_Catalog_Model_Product $product)
704
- {
705
- if (Mage::getConfig()->getModuleConfig('DerModPro_BasePrice')->is('active', 'true')) {
706
-
707
- if (! ($productAmount = $product->getBasePriceAmount())) return '';
708
-
709
- if (! ($referenceAmount = $product->getBasePriceBaseAmount())) return '';
710
- if (! ($productPrice = $product->getFinalPrice())) return '';
711
- if (! is_numeric($productAmount) || ! is_numeric($referenceAmount) || ! is_numeric($productPrice)) return '';
712
-
713
- $productUnit = $product->getBasePriceUnit();
714
- $referenceUnit = $product->getBasePriceBaseUnit();
715
- $referenceUnitLabel = Mage::helper('baseprice')->__($referenceUnit . ' short');
716
-
717
- $productPrice = Mage::helper('tax')->getPrice($product, $productPrice, Mage::getStoreConfig('catalog/baseprice/base_price_incl_tax'));
718
- $basePriceModel = Mage::getModel('baseprice/baseprice', array('reference_unit' => $referenceUnit, 'reference_amount' => $referenceAmount));
719
- $basePrice = $basePriceModel->getBasePrice($productAmount, $productUnit, $productPrice);
720
-
721
- $basePrice = Mage::helper('core')->currencyByStore($basePrice, $product->getStoreId(), true, false);
722
-
723
- return $basePrice . ' / ' . $referenceAmount . ' ' . $referenceUnitLabel;
724
- }
725
-
726
- return '';
727
- }
728
-
729
- /**
730
- * @param Mage_Catalog_Model_Product $product
731
- * @return string
732
- */
733
- protected function _getBasePriceRaw(Mage_Catalog_Model_Product $product)
734
- {
735
- if (Mage::getConfig()->getModuleConfig('DerModPro_BasePrice')->is('active', 'true')) {
736
-
737
- if (! ($productAmount = $product->getBasePriceAmount())) return '';
738
-
739
- if (! ($referenceAmount = $product->getBasePriceBaseAmount())) return '';
740
- if (! ($productPrice = $product->getFinalPrice())) return '';
741
- if (! is_numeric($productAmount) || ! is_numeric($referenceAmount) || ! is_numeric($productPrice)) return '';
742
-
743
- $productUnit = $product->getBasePriceUnit();
744
- $referenceUnit = $product->getBasePriceBaseUnit();
745
-
746
- $productPrice = Mage::helper('tax')->getPrice($product, $productPrice, Mage::getStoreConfig('catalog/baseprice/base_price_incl_tax'));
747
- $basePriceModel = Mage::getModel('baseprice/baseprice', array('reference_unit' => $referenceUnit, 'reference_amount' => $referenceAmount));
748
- $basePrice = $basePriceModel->getBasePrice($productAmount, $productUnit, $productPrice);
749
-
750
- return $basePrice;
751
- }
752
-
753
- return '';
754
- }
755
-
756
- /**
757
- * Set the configuration default values on the product model.
758
- * Used when products already existed when the extension was installed.
759
- *
760
- * @param Mage_Catalog_Model_Product $product
761
- * @return DerModPro_BasePrice_Helper_Data
762
- */
763
- protected function _loadDefaultBasePriceValues($product)
764
- {
765
- foreach (array('base_price_base_amount', 'base_price_unit', 'base_price_base_unit') as $attributeCode) {
766
- if (! $product->getDataUsingMethod($attributeCode)) {
767
- /** @var $attribute Mage_Eav_Model_Entity_Attribute */
768
- $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $attributeCode);
769
- $product->setDataUsingMethod($attributeCode, $attribute->getFrontend()->getValue($product));
770
- }
771
- }
772
- return $this;
773
- }
774
-
775
- /**
776
- * @param int $productId
777
- * @return Mage_Catalog_Model_Product
778
- */
779
- protected function _getProduct($productId)
780
- {
781
- if (is_null($this->_product) || $this->_product->getId() != $productId) {
782
- $this->_product = Mage::getModel('catalog/product')->setStoreId()->load($productId);
783
- }
784
- return $this->_product;
785
- }
786
-
787
- /**
788
- * @return int
789
- */
790
- protected function _getStoreId()
791
- {
792
- return $this->getStore()->getId();
793
- }
794
-
795
- /**
796
- * @param float $productPrice
797
- * @param float $productWeight
798
- * @param string $listingCountry
799
- * @return float
800
- */
801
- protected function _getDefaultShippingCost($productPrice, $productWeight = 0.00, $listingCountry)
802
- {
803
- $defaultShippingCost = null;
804
-
805
- $group = $this->_getConfigGroup($listingCountry);
806
-
807
- switch (Mage::getStoreConfig('nrapps_idealo/' . $group . '/shipping_costs_calculation_method', $this->_getStoreId())) {
808
-
809
- case NRApps_Idealo_Model_Source_ShippingCostsMethod::SHIPPING_COSTS_BY_PRICE:
810
- $shippingCosts = unserialize(Mage::getStoreConfig('nrapps_idealo/' . $group . '/shipping_costs', $this->_getStoreId()));
811
-
812
- $selectedMinPrice = 0;
813
- foreach ($shippingCosts as $shippingCost) {
814
- if ($shippingCost['from_price'] <= $productPrice) {
815
- if (is_null($defaultShippingCost) || $shippingCost['from_price'] > $selectedMinPrice) {
816
- $defaultShippingCost = $this->_formatPrice(floatval($shippingCost['cost']));
817
- $selectedMinPrice = $shippingCost['from_price'];
818
- }
819
- }
820
- }
821
- break;
822
-
823
- case NRApps_Idealo_Model_Source_ShippingCostsMethod::SHIPPING_COSTS_BY_WEIGHT:
824
- $shippingCosts = unserialize(Mage::getStoreConfig('nrapps_idealo/' . $group . '/shipping_costs_by_weight', $this->_getStoreId()));
825
-
826
- foreach ($shippingCosts as $shippingCost) {
827
- if ($shippingCost['from_weight'] <= floatval($productWeight)) {
828
- if (is_null($defaultShippingCost) || $defaultShippingCost < floatval($shippingCost['cost'])) {
829
- $defaultShippingCost = $this->_formatPrice(floatval($shippingCost['cost']));
830
- }
831
- }
832
- }
833
- break;
834
- }
835
-
836
- if (is_null($defaultShippingCost)) {
837
- $defaultShippingCost = 0.00;
838
- }
839
-
840
- return $defaultShippingCost;
841
- }
842
-
843
- /**
844
- * @param Mage_Catalog_Model_Product $product
845
- * @return string
846
- */
847
- protected function _getProductUrl(Mage_Catalog_Model_Product $product)
848
- {
849
- if (!$product->isVisibleInSiteVisibility()) {
850
- if ($product->getParentProductIds()) {
851
-
852
- // get product url of parent product
853
- $productId = current($product->getParentProductIds());
854
-
855
- /** @var $rewrite Mage_Core_Model_Url_Rewrite */
856
- $rewrite = Mage::getModel('core/url_rewrite');
857
- $rewrite->setStoreId($this->_getStoreId())
858
- ->loadByIdPath('product/' . $productId);
859
- if ($rewrite->getId()) {
860
- $requestPath = $rewrite->getRequestPath();
861
- $routeParams['_direct'] = $requestPath;
862
- $routeParams['_store_to_url'] = true;
863
- $routeParams['_store'] = $this->_getStoreId();
864
-
865
- $parentProduct = $this->_getProduct($productId);
866
- if ($parentProduct->isConfigurable()) {
867
- /** @var Mage_Catalog_Model_Product_Type_Configurable $typeInstance */
868
- $typeInstance = $parentProduct->getTypeInstance();
869
- $urlParts = array();
870
- foreach($typeInstance->getConfigurableAttributes($parentProduct) as $attribute) {
871
- $urlParts[] = $attribute->getAttributeId() . '=' . $product->getData($attribute->getProductAttribute()->getAttributeCode());
872
- }
873
- if (sizeof($urlParts)) {
874
- return Mage::getModel('core/url')->getUrl(null, $routeParams) . '#' . implode('&', $urlParts);
875
- }
876
- }
877
-
878
- return Mage::getModel('core/url')->getUrl(null, $routeParams);
879
- }
880
- }
881
- }
882
-
883
- return $product->getProductUrl();
884
- }
885
-
886
- /**
887
- * Get Image filename from product or configurable parent product
888
- *
889
- * @param Mage_Catalog_Model_Product $product
890
- * @param string $imageAttribute
891
- * @return string
892
- */
893
- protected function _getProductImage(Mage_Catalog_Model_Product $product, $imageAttribute = 'image')
894
- {
895
- $productImage = $product->getData($imageAttribute);
896
- if ($productImage && $productImage != 'no_selection') {
897
- return $productImage;
898
- }
899
-
900
- if ($product->getParentProductIds()) {
901
- $parentProductId = current($product->getParentProductIds());
902
- $parentProductImage = $this->_getProduct($parentProductId)->getData($imageAttribute);
903
- if ($parentProductImage && $parentProductImage != 'no_selection') {
904
- return $parentProductImage;
905
- }
906
- }
907
-
908
- return '';
909
- }
910
-
911
- /**
912
- * @param int $productId
913
- * @return string
914
- */
915
- protected function _getSkuByProductId($productId)
916
- {
917
- if (!isset($this->_productSkusById[$productId])) {
918
- $this->_productSkusById[$productId] = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($productId, 'sku', Mage_Core_Model_App::ADMIN_STORE_ID);
919
- }
920
- return $this->_productSkusById[$productId];
921
- }
922
-
923
- /**
924
- * @param Mage_Catalog_Model_Product $product
925
- * @param $attributeCode
926
- * @return string|null
927
- */
928
- protected function _getAttributeValue(Mage_Catalog_Model_Product $product, $attributeCode)
929
- {
930
- if (!$product->getData($attributeCode) || is_object($product->getData($attributeCode)) || is_array($product->getData($attributeCode))) {
931
- return null;
932
- }
933
-
934
- $value = $this->_getRawAttributeValue($product, $attributeCode);
935
- if ($value == 'no-display') {
936
- return null;
937
- }
938
- return $this->_getEncodedValue($value);
939
- }
940
-
941
- /**
942
- * @param Mage_Catalog_Model_Product $product
943
- * @param $attributeCode
944
- *
945
- * @return string|null
946
- */
947
- protected function _getAttributeValueRaw(Mage_Catalog_Model_Product $product, $attributeCode)
948
- {
949
- if (!$product->getData($attributeCode) || is_object($product->getData($attributeCode)) || is_array($product->getData($attributeCode))) {
950
- return null;
951
- }
952
-
953
- $value = $this->_getRawAttributeValueRaw($product, $attributeCode);
954
- if ($value == 'no-display') {
955
- return null;
956
- }
957
-
958
- return $this->_getEncodedValue($value);
959
- }
960
-
961
- /**
962
- * @param string $value
963
- * @return string
964
- */
965
- protected function _getEncodedValue($value)
966
- {
967
- if ($value === 'no-display') {
968
- return '';
969
- }
970
-
971
- switch ($this->getFeed()->getType()) {
972
-
973
- case 'csv':
974
- if ($search = $this->getFeed()->getQuoteSymbol()) {
975
- if ($search == '\t') {
976
- $search = "\t";
977
- }
978
- $replacement = $this->getFeed()->getQuoteSymbolReplacement();
979
- return str_replace($search, $replacement, $value);
980
- } else {
981
- return $value;
982
- }
983
-
984
- case 'xml':
985
-
986
- return $value;
987
- }
988
- }
989
-
990
- /**
991
- * @param Mage_Catalog_Model_Product $product
992
- * @param $attributeCode
993
- * @return mixed
994
- */
995
- protected function _getRawAttributeValue(Mage_Catalog_Model_Product $product, $attributeCode)
996
- {
997
- /** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
998
- $attribute = $this->_getAttribute($attributeCode);
999
- if (!$attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
1000
- return null;
1001
- }
1002
-
1003
- switch($attribute->getFrontendInput()) {
1004
- case 'textarea':
1005
- return str_replace(array("\r\n", "\n", "\r"), '<br />', trim($product->getData($attributeCode)));
1006
- case 'multiselect':
1007
- $value = '';
1008
- $valueIds = explode(',', $product->getData($attributeCode));
1009
- foreach($valueIds as $valueId) {
1010
- $value[] = $attribute->getSource()->getOptionText($valueId);
1011
- }
1012
- return implode(', ', $value);
1013
- case 'select':
1014
- if (strpos($attributeCode, 'google_') !== false) {
1015
- return $product->getData($attributeCode);
1016
- }
1017
- if (strpos($attributeCode, 'leguide_') !== false) {
1018
- return $product->getData($attributeCode);
1019
- }
1020
- return $product->getAttributeText($attributeCode);
1021
- case 'price':
1022
- return $this->_formatPrice($product->getData($attributeCode));
1023
- case 'date':
1024
- $date = new Zend_Date($product->getData($attributeCode), Zend_Date::ISO_8601);
1025
- $date->setTimezone(Mage::getStoreConfig('general/locale/timezone'));
1026
- return $date->get(Zend_Date::ISO_8601);
1027
- default:
1028
- return trim($product->getData($attributeCode));
1029
- }
1030
- }
1031
-
1032
- /**
1033
- * @param Mage_Catalog_Model_Product $product
1034
- * @param $attributeCode
1035
- * @return mixed
1036
- */
1037
- protected function _getRawAttributeValueRaw(Mage_Catalog_Model_Product $product, $attributeCode)
1038
- {
1039
- /** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
1040
- $attribute = $this->_getAttribute($attributeCode);
1041
- if (!$attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
1042
- return null;
1043
- }
1044
-
1045
- if ($attribute->getFrontendInput() == 'select' || $attribute->getFrontendInput() == 'multiselect') {
1046
- return $product->getData($attributeCode);
1047
- }
1048
-
1049
- return null;
1050
- }
1051
-
1052
- /**
1053
- * @param string $attributeCode
1054
- * @return Mage_Catalog_Model_Resource_Eav_Attribute
1055
- */
1056
- protected function _getAttribute($attributeCode)
1057
- {
1058
- if (!isset($this->_attributes[$attributeCode])) {
1059
- /** @var Mage_Catalog_Model_Resource_Eav_Attribute $attribute */
1060
- $attribute = Mage::getSingleton('eav/config')
1061
- ->getAttribute('catalog_product', $attributeCode)->setStoreId($this->_getStoreId());
1062
-
1063
- $this->_attributes[$attributeCode] = $attribute;
1064
- }
1065
-
1066
- return $this->_attributes[$attributeCode];
1067
- }
1068
-
1069
- /**
1070
- * Return the category name(s) of the given category id(s) i.e. "Cell Phones"
1071
- *
1072
- * @param int|int[] $categoryIds
1073
- * @return string[]
1074
- */
1075
- protected function _getCategoryNamesByIds($categoryIds)
1076
- {
1077
- if (is_array($categoryIds)) {
1078
- $categoryNames = array();
1079
- foreach ($categoryIds as $categoryId) {
1080
- $categoryName = $this->_getCategoryNamesByIds($categoryId);
1081
- if ($categoryName) {
1082
- $categoryNames[$categoryId] = $categoryName;
1083
- }
1084
- }
1085
- return $categoryNames;
1086
- }
1087
-
1088
- $categoryId = $categoryIds;
1089
- if (!isset($this->_categoryNames[$categoryId]) && !$this->isExcludedCategoryId($categoryId)) {
1090
- $this->_categoryNames[$categoryId] =
1091
- $this->_getEncodedValue(Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, 'name', $this->getStore()->getId()));
1092
- }
1093
- return isset($this->_categoryNames[$categoryId]) ? $this->_categoryNames[$categoryId] : '';
1094
- }
1095
-
1096
- /**
1097
- * Get attributes which should be taken from categories if not present at the product itself
1098
- * Configured in config.xml
1099
- *
1100
- * @return array
1101
- */
1102
- protected function _getCategoryAttributeCodes()
1103
- {
1104
- if (!is_array(Mage::getStoreConfig('nrapps_idealo/category_attributes'))) {
1105
- return array();
1106
- }
1107
- return array_keys(Mage::getStoreConfig('nrapps_idealo/category_attributes'));
1108
- }
1109
-
1110
- /**
1111
- * Return the category path(s) of the given category id(s) i.e. "Electronics &gt; Computers &gt; Build Your Own"
1112
- *
1113
- * @param int|int[] $categoryIds
1114
- * @return string|string[]
1115
- */
1116
- protected function _getCategoryPathsByIds($categoryIds)
1117
- {
1118
- if (is_array($categoryIds)) {
1119
- $categoryPaths = array();
1120
- $i = 0;
1121
- foreach ($categoryIds as $categoryId) {
1122
- // limit to 10 categories
1123
- if ($i++ >= 10) {
1124
- break;
1125
- }
1126
- if ($categoryPath = $this->_getCategoryPathsByIds($categoryId)) {
1127
- $categoryPaths[$categoryId] = $categoryPath;
1128
- }
1129
- }
1130
- return $categoryPaths;
1131
- }
1132
-
1133
- /** @var int $categoryId */
1134
- $categoryId = $categoryIds;
1135
- if ($this->isExcludedCategoryId($categoryId)) {
1136
- return '';
1137
- }
1138
-
1139
- if (!isset($this->_categoryPaths[$categoryId]) && !$this->isExcludedCategoryId($categoryId)) {
1140
-
1141
- $parentCategoryId = Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, 'parent_id', $this->_getStoreId());
1142
- $categoryLevel = Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, 'level', $this->_getStoreId());
1143
- foreach ($this->_getCategoryAttributeCodes() as $attributeCode) {
1144
- $this->_categoryAttributeValues[$attributeCode][$categoryId] = Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, $attributeCode, $this->_getStoreId());
1145
- $this->_categoryAttributeLevels[$attributeCode][$categoryId] = $categoryLevel;
1146
- }
1147
- if ($parentCategoryId == $this->getStore()->getGroup()->getRootCategoryId() || $parentCategoryId == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
1148
- $this->_categoryPaths[$categoryId] = $this->_getCategoryNamesByIds($categoryId);
1149
- } else {
1150
- $parentCategoryPath = $this->_getCategoryPathsByIds($parentCategoryId);
1151
- if (!$parentCategoryPath) {
1152
- return '';
1153
- }
1154
-
1155
- $this->_categoryPaths[$categoryId] = $parentCategoryPath . $this->_getCategoryPathDivider() . $this->_getCategoryNamesByIds($categoryId);
1156
- foreach ($this->_getCategoryAttributeCodes() as $attributeCode) {
1157
- if (!$this->_categoryAttributeValues[$attributeCode][$categoryId]) {
1158
- $this->_categoryAttributeValues[$attributeCode][$categoryId] = $this->_categoryAttributeValues[$attributeCode][$parentCategoryId];
1159
- $this->_categoryAttributeLevels[$attributeCode][$categoryId] = $this->_categoryAttributeLevels[$attributeCode][$parentCategoryId];
1160
- }
1161
- }
1162
- }
1163
- }
1164
- return $this->_categoryPaths[$categoryId];
1165
- }
1166
-
1167
- /**
1168
- * @return string
1169
- */
1170
- protected function _getCategoryPathDivider()
1171
- {
1172
- return ' > ';
1173
- }
1174
-
1175
- /**
1176
- * Check if attribute / any attribute is used
1177
- *
1178
- * @param string|string[] $attributeCodes
1179
- * @return bool
1180
- */
1181
- protected function _isAttributeUsed($attributeCodes)
1182
- {
1183
- $additionalUsedAttributeCodes = $this->_getAdditionalUsedAttributeCodes();
1184
-
1185
- if (is_array($attributeCodes)) {
1186
- foreach ($attributeCodes as $attributeCode) {
1187
- if ($this->_isAttributeUsed($attributeCode)) {
1188
- return true;
1189
- }
1190
- }
1191
- return false;
1192
- }
1193
- $attributeCode = $attributeCodes;
1194
- if (!isset($this->_usedAttributeCodes[$attributeCode])) {
1195
- if (in_array($attributeCode, $additionalUsedAttributeCodes)) {
1196
- $this->_usedAttributeCodes[$attributeCode] = true;
1197
- } else {
1198
- $this->_usedAttributeCodes[$attributeCode] = (strpos($this->getFeed()->getBody(), $attributeCode) !== false);
1199
- }
1200
- }
1201
- return $this->_usedAttributeCodes[$attributeCode];
1202
- }
1203
-
1204
- /**
1205
- * @param float $price
1206
- * @return string
1207
- */
1208
- protected function _formatPrice($price)
1209
- {
1210
- return number_format($price, 2, '.', '');
1211
- }
1212
-
1213
- /**
1214
- * Get attribute codes which should always be included into the product data
1215
- *
1216
- * @return string[]
1217
- */
1218
- protected function _getAdditionalUsedAttributeCodes()
1219
- {
1220
- $attributeCodesObject = new Varien_Object();
1221
-
1222
- $attributeCodes = array(
1223
- 'shipping_cost',
1224
- 'weight',
1225
- 'price',
1226
- 'special_price',
1227
- );
1228
-
1229
- foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/product_options/add_attributes_to_export', $this->_getStoreId())) as $row) {
1230
- $attributeCodes[] = $row['attribute_code'];
1231
- }
1232
-
1233
- $attributeCodesObject->setAttributeCodes($attributeCodes);
1234
-
1235
- return $attributeCodesObject->getAttributeCodes();
1236
- }
1237
-
1238
- /**
1239
- * Sort categories so lowest level categories are first
1240
- *
1241
- * @param Mage_Catalog_Model_Product $product
1242
- * @return array
1243
- */
1244
- protected function _getCategoryIds(Mage_Catalog_Model_Product $product)
1245
- {
1246
- $categoryIds = $product->getCategoryIds();
1247
-
1248
- /** @var $categoryCollection Mage_Catalog_Model_Resource_Category_Collection */
1249
- $categoryCollection = Mage::getResourceModel('catalog/category_collection')
1250
- ->addAttributeToFilter('entity_id', array('in' => $categoryIds))
1251
- ->addAttributeToFilter('level', array('gt' => 1))
1252
- ->setOrder('level', 'DESC');
1253
- return array_keys($categoryCollection->getItems());
1254
- }
1255
-
1256
- /**
1257
- * @param int $categoryId
1258
- */
1259
- protected function _excludeCategoryId($categoryId)
1260
- {
1261
- $this->_excludedCategoryIds[$categoryId] = $categoryId;
1262
- }
1263
-
1264
- /**
1265
- * @param int $categoryId
1266
- * @return bool
1267
- */
1268
- public function isExcludedCategoryId($categoryId)
1269
- {
1270
- if (is_null($this->_excludedCategoryIds)) {
1271
-
1272
- $this->_excludedCategoryIds = array();
1273
-
1274
- /** @var $categories Mage_Catalog_Model_Resource_Category_Collection */
1275
- $categories = Mage::getResourceModel('catalog/category_collection')
1276
- ->setStoreId($this->_getStoreId())
1277
- ->addAttributeToSelect(array('is_active', 'include_in_menu', 'nrapps_idealo_exclude'))
1278
- ->addAttributeToFilter('level', array('gt' => 0))
1279
- ->setOrder('level', 'asc');
1280
-
1281
- foreach ($categories as $category) { /** @var Mage_Catalog_Model_Category $category */
1282
- if ($category->getLevel() == 1 && $category->getId() != $this->getStore()->getGroup()->getRootCategoryId()) {
1283
- // Exclude categories which are not in the current store root
1284
- $this->_excludeCategoryId($category->getId());
1285
- }
1286
- if (in_array($category->getParentId(), $this->_excludedCategoryIds)) {
1287
- // exclude categories whose parents are excluded
1288
- $this->_excludeCategoryId($category->getId());
1289
- }
1290
- if (!$category->getIsActive() || !$category->getIncludeInMenu() || $category->getFeedgeneratorExclude()) {
1291
- // exclude inactive, invisible or excluded categories
1292
- $this->_excludeCategoryId($category->getId());
1293
- }
1294
- }
1295
- }
1296
- return isset($this->_excludedCategoryIds[$categoryId]);
1297
- }
1298
-
1299
- protected function _getOfferName($product)
1300
- {
1301
- $offerName = $product->getName();
1302
-
1303
- $attributes = array(
1304
- 0 => array(),
1305
- );
1306
-
1307
- // get product url of parent product
1308
- if ($productId = current($product->getParentProductIds())) {
1309
-
1310
- $parentProduct = $this->_getProduct($productId);
1311
- if ($parentProduct->isConfigurable()) {
1312
- /** @var Mage_Catalog_Model_Product_Type_Configurable $typeInstance */
1313
- $typeInstance = $parentProduct->getTypeInstance();
1314
- foreach ($typeInstance->getConfigurableAttributes($parentProduct) as $attribute) {
1315
- $attributes[0][] = $attribute->getProductAttribute()->getAttributeCode();
1316
- }
1317
- }
1318
- }
1319
-
1320
- $configuredAttributes = Mage::getStoreConfig('nrapps_idealo/product_options/add_attribute_contents_to_name');
1321
- if ($configuredAttributes) {
1322
- if ($configuredAttributes = @unserialize($configuredAttributes)) {
1323
- foreach($configuredAttributes as $configuredAttributeData) {
1324
- if (!in_array($configuredAttributeData['attribute_code'], $attributes[0])) {
1325
- $attributes[$configuredAttributeData['sort_order']][] = $configuredAttributeData['attribute_code'];
1326
- }
1327
- }
1328
- }
1329
- }
1330
-
1331
- ksort($attributes);
1332
- foreach($attributes as $attributesBySort) {
1333
- foreach($attributesBySort as $attributeCode) {
1334
- if ($value = $this->_getAttributeValue($product, $attributeCode)) {
1335
- $offerName .= ' ' . $value;
1336
- }
1337
- }
1338
- }
1339
-
1340
- return $offerName;
1341
- }
1342
-
1343
- /**
1344
- * @param string $listingCountry
1345
- * @return string
1346
- */
1347
- protected function _getConfigGroup($listingCountry)
1348
- {
1349
- switch ($listingCountry) {
1350
- case NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE:
1351
- $group = 'shipping';
1352
- break;
1353
- default:
1354
- $group = 'shipping_' . strtolower($listingCountry);
1355
- return $group;
1356
- }
1357
- return $group;
1358
- }
1359
-
1360
- /**
1361
- * @param $listingCountry
1362
- * @return string
1363
- */
1364
- protected function _getContext($listingCountry)
1365
- {
1366
- return $listingCountry;
1367
- }
1368
-
1369
- /**
1370
- * @param $listingCountry
1371
- * @return string
1372
- */
1373
- protected function _getSuffix($listingCountry)
1374
- {
1375
- return '_' . $listingCountry;
1376
- }
1377
-
1378
- /**
1379
- * @return string
1380
- */
1381
- protected function _getLineDivider()
1382
- {
1383
- if ($this->getFeed()->getType() == 'csv') {
1384
- return '; ';
1385
- }
1386
- return PHP_EOL;
1387
- }
1388
  }
1
+ <?php
2
+ class NRApps_Idealo_Model_Generator extends Mage_Core_Model_Abstract
3
+ {
4
+ /** @var Mage_Core_Model_Store */
5
+ protected $_store;
6
+
7
+ /** @var Mage_Catalog_Model_Entity_Attribute[] */
8
+ protected $_attributes = array();
9
+
10
+ /** @var string[] */
11
+ protected $_categoryNames = array();
12
+
13
+ /** @var array int[]|null */
14
+ protected $_excludedCategoryIds = null;
15
+
16
+ /** @var string[] */
17
+ protected $_categoryPaths = array();
18
+
19
+ /** @var array[] */
20
+ protected $_categoryAttributeValues = array();
21
+
22
+ /** @var array[] */
23
+ protected $_categoryAttributeLevels = array();
24
+
25
+ /** @var string[] */
26
+ protected $_usedAttributeCodes = array();
27
+
28
+ /** @var string[] */
29
+ protected $_productSkusById = array();
30
+
31
+ /** @var Mage_Catalog_Model_Product */
32
+ protected $_product;
33
+
34
+ /**
35
+ * @param Mage_Core_Model_Store $store
36
+ */
37
+ public function __construct(Mage_Core_Model_Store $store)
38
+ {
39
+ parent::__construct();
40
+
41
+ $this->_init('nrapps_idealo/indexer');
42
+
43
+ $this->_store = $store;
44
+ }
45
+
46
+ /**
47
+ * @return Mage_Core_Model_Store
48
+ */
49
+ public function getStore()
50
+ {
51
+ return $this->_store;
52
+ }
53
+
54
+ /**
55
+ * @return NRApps_Idealo_Model_Feed
56
+ */
57
+ public function getFeed()
58
+ {
59
+ return Mage::getSingleton('nrapps_idealo/feed');
60
+ }
61
+
62
+ /**
63
+ * @return string
64
+ */
65
+ public function getFeedType()
66
+ {
67
+ return $this->getFeed()->getType();
68
+ }
69
+
70
+ /**
71
+ * @param bool $useIndex
72
+ * @param string[] $alternativeContent
73
+ * @return string
74
+ */
75
+ public function getFeedContent($useIndex = true, $alternativeContent = array())
76
+ {
77
+ $feedContent = array();
78
+ if ($this->getFeed()->getIncludeHeader()) {
79
+ $feedContent[] = $this->_getHeader();
80
+ }
81
+
82
+ if ($useIndex) {
83
+ foreach ($this->getProductDataFromIndex() as $productRow) {
84
+ $feedContent[] = $productRow['data'];
85
+ }
86
+ } else {
87
+ foreach($alternativeContent as $row) {
88
+ $feedContent[] = $row;
89
+ }
90
+ }
91
+
92
+ if ($footer = $this->_getFooter()) {
93
+ $feedContent[] = $footer;
94
+ }
95
+
96
+ return implode($this->_getEol(), $feedContent);
97
+ }
98
+
99
+ /**
100
+ * @return string
101
+ */
102
+ public function generateFile()
103
+ {
104
+ $filename = $this->_getFilename();
105
+
106
+ $dirname = Mage::getBaseDir('media') . DS . 'nrapps_idealo' . DS;
107
+
108
+ if (!is_dir($dirname)) {
109
+ mkdir($dirname, 0777, true);
110
+ }
111
+
112
+ $path = $dirname . $filename;
113
+
114
+ $fileHandle = fopen($path, 'w');
115
+
116
+ if ($this->getFeed()->getIncludeHeader()) {
117
+ $this->_writeLineToFile($fileHandle, $this->_getHeader());
118
+ }
119
+
120
+ $feedIndexDbStatement = $this->_getFeedIndexDbStatement();
121
+ $productData = array();
122
+ $i = 0;
123
+ // write product data to file in chunks
124
+ while ($productRow = $feedIndexDbStatement->fetch()) {
125
+ $productData[] = $productRow['data'];
126
+ if ($i++ > 1000) {
127
+ $i = 0;
128
+ $this->_writeLineToFile($fileHandle, $productData);
129
+ $productData = array();
130
+ }
131
+ }
132
+ $this->_writeLineToFile($fileHandle, $productData);
133
+
134
+ if ($footer = $this->_getFooter()) {
135
+ $this->_writeLineToFile($fileHandle, $footer);
136
+ }
137
+
138
+ fclose($fileHandle);
139
+
140
+ return $filename;
141
+ }
142
+
143
+ /**
144
+ * @return Zend_Db_Statement
145
+ */
146
+ protected function _getFeedIndexDbStatement()
147
+ {
148
+ $condition = $this->_getResource()->getReadConnection()->quoteInto('store_id = ?', $this->_getStoreId());
149
+ $condition .= ' AND ' . $this->_getResource()->getReadConnection()->quoteInto('feed_type = ?', $this->getFeedType());
150
+ $select = $this->_getResource()->getReadConnection()->select()
151
+ ->from($this->_getResource()->getTable('nrapps_idealo/index'), array('data'))
152
+ ->where($condition);
153
+
154
+ $statement = $this->_getResource()->getReadConnection()->query($select);
155
+ return $statement;
156
+ }
157
+
158
+ /**
159
+ * @param resource $fileHandle
160
+ * @param string $content
161
+ */
162
+ protected function _writeLineToFile($fileHandle, $content)
163
+ {
164
+ if (is_array($content)) {
165
+ $content = implode($this->_getEol(), $content);
166
+ }
167
+ if (!trim($content)) {
168
+ return;
169
+ }
170
+
171
+ $content .= $this->_getEol();
172
+
173
+ fwrite($fileHandle, $content);
174
+ }
175
+
176
+ /**
177
+ * @return string
178
+ */
179
+ protected function _getFilename()
180
+ {
181
+ if ($filename = $this->getFeed()->getFilename()) {
182
+ return $filename;
183
+ }
184
+ return 'idealo_' . $this->_getStoreId() . '_' . $this->getStore()->getCode() . '.' . $this->getFeed()->getType();
185
+ }
186
+
187
+ /**
188
+ * @return string
189
+ */
190
+ protected function _getEol()
191
+ {
192
+ $search = array('\n', '\r', '\t');
193
+ $replacement = array("\n", "\r", "\t");
194
+
195
+ return str_replace($search, $replacement, $this->getFeed()->getEol());
196
+ }
197
+
198
+ /**
199
+ * @return string
200
+ */
201
+ protected function _getHeader()
202
+ {
203
+ $search = array('\n', '\r', '\t');
204
+ $replacement = array("\n", "\r", "\t");
205
+
206
+ return str_replace($search, $replacement, $this->getFeed()->getHeader());
207
+ }
208
+
209
+ /**
210
+ * @return string
211
+ */
212
+ protected function _getBody()
213
+ {
214
+ $search = array('\n', '\r', '\t');
215
+ $replacement = array("\n", "\r", "\t");
216
+
217
+ return str_replace($search, $replacement, $this->getFeed()->getBody());
218
+ }
219
+
220
+ /**
221
+ * @return string
222
+ */
223
+ protected function _getFooter()
224
+ {
225
+ $search = array('\n', '\r', '\t');
226
+ $replacement = array("\n", "\r", "\t");
227
+
228
+ return str_replace($search, $replacement, $this->getFeed()->getFooter());
229
+ }
230
+
231
+ /**
232
+ * @return array
233
+ */
234
+ public function getProductDataFromIndex()
235
+ {
236
+ return Mage::getResourceSingleton('nrapps_idealo/indexer')->getDataByStoreId($this->_getStoreId());
237
+ }
238
+
239
+ /**
240
+ * @param Mage_Catalog_Model_Product $product
241
+ * @return string
242
+ */
243
+ public function getProductData(Mage_Catalog_Model_Product $product)
244
+ {
245
+ $product->setStoreId($this->_getStoreId());
246
+
247
+ /* @var $processor Mage_Cms_Model_Template_Filter */
248
+ $processor = Mage::getModel('nrapps_idealo/filter');
249
+
250
+ $productData = $this->_getProductData($product);
251
+
252
+ $processor->setVariables($productData);
253
+
254
+ return $processor->filter($this->_getBody());
255
+ }
256
+
257
+ /**
258
+ * @param Mage_Catalog_Model_Product $product
259
+ * @return array
260
+ */
261
+ protected function _getProductData(Mage_Catalog_Model_Product $product)
262
+ {
263
+ $product->setStockItem(Mage::getModel('cataloginventory/stock_item')->loadByProduct($product));
264
+
265
+ $productDataTransport = new Varien_Object();
266
+ Mage::dispatchEvent('nrapps_idealo_generate_product_data_before', array('product' => $product, 'product_data' => $productDataTransport, 'store_id' => $this->getStore()->getId()));
267
+
268
+ $productData = $productDataTransport->getData();
269
+
270
+ if ($this->_isAttributeUsed('base_price') || $this->_isAttributeUsed('base_price_raw')) {
271
+
272
+ $this->_loadDefaultBasePriceValues($product);
273
+
274
+ if ($this->_isAttributeUsed('base_price')) {
275
+ $productData['base_price'] = $this->_getBasePrice($product);
276
+ }
277
+
278
+ if ($this->_isAttributeUsed('base_price_raw')) {
279
+ $productData['base_price_raw'] = $this->_getBasePriceRaw($product);
280
+ }
281
+ }
282
+
283
+ foreach ($product->getData() as $key => $value) {
284
+ if ($this->_isAttributeUsed($key)) {
285
+ $productData[$key] = $this->_getAttributeValue($product, $key);
286
+
287
+ $productDataRaw = $this->_getAttributeValueRaw($product, $key);
288
+ if ($productDataRaw !== null) {
289
+ $productData[$key . '__raw'] = $productDataRaw;
290
+ }
291
+ }
292
+ }
293
+
294
+ $productData['offer_name'] = $this->_getOfferName($product);
295
+
296
+ $productData['url'] = $this->_getEncodedValue($this->_getProductUrl($product));
297
+
298
+ $productData['qty'] = $product->getStockItem()->getQty();
299
+ $productData['is_in_stock'] = $product->getStockItem()->getIsInStock();
300
+
301
+ $productData['price'] = ( $this->_getPrice($product) ? $this->_formatPrice($this->_getPrice($product)) : '' );
302
+
303
+ $productData['currency_code'] = $this->getStore()->getBaseCurrencyCode();
304
+ $productData['country_code'] = Mage::getStoreConfig('general/country/default', $this->_getStoreId());
305
+ $productData['language_code'] = current(explode('_', Mage::getStoreConfig('general/locale/code', $this->_getStoreId())));
306
+ $productData['store_code'] = $this->getStore()->getCode();
307
+ $productData['is_downloadable'] = ( $product->getTypeId() == 'downloadable' );
308
+
309
+ $productCategoryIds = $this->_getCategoryIds($product);
310
+ if ($this->_isAttributeUsed('category_names') || $this->_isAttributeUsed('category_name')) {
311
+ $productData['category_names'] = $this->_getCategoryNamesByIds($productCategoryIds);
312
+ $productData['category_name'] = current($productData['category_names']);
313
+ }
314
+ if ($this->_isAttributeUsed('category_paths') || $this->_isAttributeUsed('category_path') || $this->_isAttributeUsed($this->_getCategoryAttributeCodes())) {
315
+ $productData['category_paths'] = $this->_getCategoryPathsByIds($productCategoryIds);
316
+ $productData['category_path'] = current($productData['category_paths']);
317
+ foreach ($this->_getCategoryAttributeCodes() as $attributeCode) {
318
+ if ($this->_isAttributeUsed($attributeCode)) {
319
+ if (!$product->getData($attributeCode)) {
320
+ $storedLevel = 0;
321
+ foreach ($productCategoryIds as $categoryId) {
322
+ if (isset($this->_categoryAttributeValues[$attributeCode][$categoryId]) && $this->_categoryAttributeValues[$attributeCode][$categoryId] && $this->_categoryAttributeLevels[$attributeCode][$categoryId] > $storedLevel) {
323
+ $storedLevel = $this->_categoryAttributeLevels[$attributeCode][$categoryId];
324
+ $productData[$attributeCode] = $this->_getEncodedValue($this->_categoryAttributeValues[$attributeCode][$categoryId]);
325
+ }
326
+ }
327
+ }
328
+ }
329
+ }
330
+ }
331
+
332
+ $this->_addImageData($product, $productData);
333
+
334
+ if ($product->getParentProductIds()) {
335
+ $productData['parent_product_sku'] = $this->_getSkuByProductId(current($product->getParentProductIds()));
336
+ }
337
+
338
+ // Manage custom attributes defined in attribute management
339
+ foreach (Mage::getStoreConfig('nrapps_idealo/attributes') as $attributeIdentifier => $attributeCode) {
340
+ if ($attributeIdentifier == 'shipping_cost') {
341
+ continue;
342
+ } else if (!isset($productData[$attributeIdentifier]) || !$productData[$attributeIdentifier]) {
343
+ if ($attributeCode != 'none' && $this->_isAttributeUsed($attributeIdentifier)) {
344
+ if (!strlen($product->getData($attributeIdentifier))) {
345
+ if ($this->_getAttribute($attributeCode)->getSourceModel() == 'nrapps_idealo/source_yesNoDefault') {
346
+ $productData[$attributeIdentifier] = intval(Mage::getStoreConfig('nrapps_idealo/default_values/' . $attributeIdentifier, $this->_getStoreId()));
347
+ } else {
348
+ $productData[$attributeIdentifier] = $this->_getEncodedValue(Mage::getStoreConfig('nrapps_idealo/default_values/' . $attributeIdentifier, $this->_getStoreId()));
349
+ }
350
+ } else {
351
+ $productData[$attributeIdentifier] = $this->_getAttributeValue($product, $attributeCode);
352
+ }
353
+ }
354
+ }
355
+ }
356
+
357
+ $this->_addAdditionalAttributesData($productData);
358
+
359
+ foreach(explode(',', Mage::getStoreConfig('nrapps_idealo/listing/listing_at', $this->_getStoreId())) as $listingCountry) {
360
+ $this->_addPaymentMethodData($productData, $listingCountry);
361
+ }
362
+ $this->_addMinimumOrderAmountData($productData);
363
+ $this->_addShippingCommentsData($productData);
364
+ $this->_addDeliveryTimesData($productData);
365
+
366
+ $productDataTransport->setData($productData);
367
+
368
+ Mage::dispatchEvent('nrapps_idealo_generate_product_data_after', array('product' => $product, 'product_data' => $productDataTransport, 'store_id' => $this->getStore()->getId(), 'generator' => $this));
369
+
370
+ return $productDataTransport->getData();
371
+ }
372
+
373
+ /**
374
+ * generate image urls
375
+ *
376
+ * @param Mage_Catalog_Model_Product $product
377
+ * @param array $productData
378
+ */
379
+ protected function _addImageData(Mage_Catalog_Model_Product $product, &$productData)
380
+ {
381
+ unset($productData['image']);
382
+ unset($productData['small_image']);
383
+ unset($productData['thumbnail']);
384
+
385
+ foreach (array('image', 'small_image', 'thumbnail') as $imageAttributeCode) {
386
+ if ($this->_isAttributeUsed($imageAttributeCode)) {
387
+ $productImage = $this->_getProductImage($product, $imageAttributeCode);
388
+ if ($productImage && file_exists(Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . $productImage)) {
389
+ $productData[$imageAttributeCode] = Mage::getBaseUrl('media') . 'catalog/product' . $productImage;
390
+ }
391
+ }
392
+ }
393
+
394
+ $productData['additional_images'] = array();
395
+ if (is_object($product->getMediaGalleryImages())) {
396
+ $i = 1;
397
+ foreach ($product->getMediaGalleryImages() as $image) {
398
+ // limit to 10 images
399
+ if ($i > 10) {
400
+ break;
401
+ }
402
+ $productData['additional_image_' . $i++] = Mage::getBaseUrl('media') . 'catalog/product' . $image->getFile();
403
+ $productData['additional_images'][] = Mage::getBaseUrl('media') . 'catalog/product' . $image->getFile();
404
+ }
405
+ }
406
+ }
407
+
408
+ /**
409
+ * add data for additional attributes
410
+ *
411
+ * @param array $productData
412
+ */
413
+ protected function _addAdditionalAttributesData(&$productData)
414
+ {
415
+ $productData['additional_attributes'] = array();
416
+ foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/product_options/add_attributes_to_export', $this->_getStoreId())) as $row) {
417
+
418
+ /** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
419
+ $attribute = $this->_getAttribute($row['attribute_code']);
420
+ if (!$attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
421
+ return;
422
+ }
423
+ if (!isset($productData[$attribute->getAttributeCode()])) {
424
+ continue;
425
+ }
426
+
427
+ $productData['additional_attributes'][] = new Varien_Object(array(
428
+ 'attribute_code' => $attribute->getFrontendLabel(),
429
+ 'attribute_value' => $productData[$attribute->getAttributeCode()],
430
+ ));
431
+ }
432
+ }
433
+
434
+ /**
435
+ * add data for payment methods
436
+ *
437
+ * @param array $productData
438
+ * @param string $listingCountry
439
+ */
440
+ protected function _addPaymentMethodData(&$productData, $listingCountry)
441
+ {
442
+ $productData['shipping_cost'] = $this->_getEncodedValue($this->_getDefaultShippingCost($productData['price'], $productData['weight'], $listingCountry));
443
+ if (!isset($productData['shipping_costs'])) {
444
+ $productData['shipping_costs'] = array();
445
+ }
446
+ foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/' . $this->_getConfigGroup($listingCountry) . '/payment_methods', $this->_getStoreId())) as $row) {
447
+
448
+ if (!isset($productData['shipping_cost'])) {
449
+ $productData['shipping_cost'] = 0;
450
+ }
451
+ $shippingCost = $productData['shipping_cost'] + floatval($row['surcharge']);
452
+ if (isset($row['percental_surcharge']) && $row['percental_surcharge']) {
453
+
454
+ $percentalSurcharge = floatval($row['percental_surcharge']);
455
+ if (Mage::getStoreConfig('nrapps_idealo/' . $this->_getConfigGroup($listingCountry) . '/percental_surcharge_calculation_method') ==
456
+ NRApps_Idealo_Model_Source_PercentalSurchargeCalculationMethod::CALCULATION_METHOD_PRODUCT_PRICE_AND_SHIPPING_COST) {
457
+
458
+ $shippingCost += $shippingCost * $percentalSurcharge / 100;
459
+ }
460
+ $productPrice = $productData['price'];
461
+ if (isset($productData['special_price']) && $productData['special_price']) {
462
+
463
+ $productPrice = $productData['special_price'];
464
+ }
465
+ $shippingCost += $productPrice * $percentalSurcharge / 100;
466
+ }
467
+
468
+ if (Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_surcharge/is_active')) {
469
+ $productPrice = $productData['price'];
470
+ if (isset($productData['special_price']) && $productData['special_price']) {
471
+ $productPrice = $productData['special_price'];
472
+ }
473
+ $minimumOrderAmountForSurcharge = Mage::getStoreConfig('nrapps_idealo/minimum_order_surcharge/minimum_order_value');
474
+ if ($minimumOrderAmountForSurcharge > $productPrice) {
475
+ $shippingCost += Mage::getStoreConfig('nrapps_idealo/minimum_order_surcharge/surcharge');
476
+ }
477
+ }
478
+
479
+ if (Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_weight_surcharge/is_active')) {
480
+
481
+ if ($productWeight = $productData['weight']) {
482
+ $minimumOrderWeightForSurcharge = Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/minimum_order_weight');
483
+ if ($minimumOrderWeightForSurcharge > $productWeight) {
484
+ $shippingCost += Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/surcharge');
485
+ }
486
+ }
487
+ }
488
+
489
+ $shippingCost = number_format($shippingCost, 2);
490
+
491
+ $productData['shipping_cost_' . $row['payment_method']] = $shippingCost;
492
+ $productData['shipping_costs'][] = new Varien_Object(array(
493
+ 'payment_method' => $row['payment_method'],
494
+ 'shipping_cost' => $shippingCost,
495
+ 'context' => $this->_getContext($listingCountry),
496
+ ));
497
+ $productData['shipping_cost_' . $row['payment_method'] . $this->_getSuffix($listingCountry)] = $shippingCost;
498
+ }
499
+ }
500
+
501
+ /**
502
+ * add data for shipping comments
503
+ *
504
+ * @param array $productData
505
+ */
506
+ protected function _addShippingCommentsData(&$productData)
507
+ {
508
+ $productData['shipping_comments'] = array();
509
+ foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/default_values/shipping_comments', $this->_getStoreId())) as $row) {
510
+
511
+ $comment = $row['comment'];
512
+ if (isset($productData['shipping_comment']) && trim($productData['shipping_comment'])) {
513
+ $comment .= $this->_getLineDivider() . $productData['shipping_comment'];
514
+ }
515
+ $productData['shipping_comments'][] = new Varien_Object(array(
516
+ 'shipping_comment' => $comment,
517
+ 'context' => $this->_getContext($row['listing_at'])
518
+ ));
519
+ $productData['shipping_comment' . $this->_getSuffix($row['listing_at'])] = $comment;
520
+ }
521
+ }
522
+
523
+ /**
524
+ * add data for delivery times
525
+ *
526
+ * @param array $productData
527
+ */
528
+ protected function _addDeliveryTimesData(&$productData)
529
+ {
530
+ if (!isset($productData['delivery_times'])) {
531
+ $productData['delivery_times'] = array();
532
+ }
533
+
534
+ if (!isset($productData['delivery_time']) || !$productData['delivery_time']) {
535
+ return;
536
+ }
537
+
538
+ foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/delivery_times/mapping', $this->_getStoreId())) as $row) {
539
+
540
+ if ($row['attribute_value'] == $productData['delivery_time']) {
541
+ foreach(explode(',', Mage::getStoreConfig('nrapps_idealo/listing/listing_at', $this->_getStoreId())) as $listingCountry) {
542
+ if (isset($row[$listingCountry]) && $row[$listingCountry]) {
543
+ $productData['delivery_times'][] = new Varien_Object(array(
544
+ 'delivery_time' => $row[$listingCountry],
545
+ 'context' => $this->_getContext($listingCountry)
546
+ ));
547
+ $productData['delivery_time' . $this->_getSuffix($listingCountry)] = $row[$listingCountry];
548
+ }
549
+ }
550
+ break;
551
+ }
552
+ }
553
+ }
554
+
555
+ /**
556
+ * add data for minimum order value and minimum order surcharge
557
+ *
558
+ * @param array $productData
559
+ */
560
+ protected function _addMinimumOrderAmountData(&$productData)
561
+ {
562
+ if (!isset($productData['shipping_comment'])) {
563
+ $productData['shipping_comment'] = '';
564
+ }
565
+
566
+ if (Mage::getStoreConfigFlag('sales/minimum_order/active') || Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_surcharge/is_active')) {
567
+ $productPrice = $productData['price'];
568
+ if (isset($productData['special_price']) && $productData['special_price']) {
569
+ $productPrice = $productData['special_price'];
570
+ }
571
+ $minimumOrderAmount = Mage::getStoreConfig('sales/minimum_order/amount');
572
+ if (Mage::getStoreConfigFlag('sales/minimum_order/active') && $minimumOrderAmount > $productPrice) {
573
+ if ($productData['shipping_comment']) {
574
+ $productData['shipping_comment'] .= $this->_getLineDivider();
575
+ }
576
+ $productData['shipping_comment'] .= Mage::helper('nrapps_idealo')->__(
577
+ 'Minimum order amount: %s',
578
+ Mage::helper('core')->formatCurrency($minimumOrderAmount, false)
579
+ );
580
+ }
581
+ $minimumOrderAmountForSurcharge = Mage::getStoreConfig('nrapps_idealo/minimum_order_surcharge/minimum_order_value');
582
+ if (Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_surcharge/is_active') && $minimumOrderAmountForSurcharge > $productPrice) {
583
+ if ($productData['shipping_comment']) {
584
+ $productData['shipping_comment'] .= $this->_getLineDivider();
585
+ }
586
+ $productData['shipping_comment'] .= Mage::helper('nrapps_idealo')->__(
587
+ 'For orders below %s, a surcharge of %s will be charged.',
588
+ Mage::helper('core')->formatCurrency($minimumOrderAmountForSurcharge, false),
589
+ Mage::helper('core')->formatCurrency(Mage::getStoreConfig('nrapps_idealo/minimum_order_surcharge/surcharge'), false)
590
+ );
591
+ }
592
+ }
593
+
594
+ if (Mage::getStoreConfigFlag('nrapps_idealo/minimum_order_weight_surcharge/is_active')) {
595
+
596
+ if ($productWeight = $productData['weight']) {
597
+ $minimumOrderWeightForSurcharge = Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/minimum_order_weight');
598
+ if ($minimumOrderWeightForSurcharge > $productWeight) {
599
+ if ($productData['shipping_comment']) {
600
+ $productData['shipping_comment'] .= $this->_getLineDivider();
601
+ }
602
+ $productData['shipping_comment'] .= Mage::helper('nrapps_idealo')->__(
603
+ 'For orders below a weight of %s %s, a surcharge of %s will be charged.',
604
+ $minimumOrderWeightForSurcharge,
605
+ Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/unit'),
606
+ Mage::helper('core')->formatCurrency(Mage::getStoreConfig('nrapps_idealo/minimum_order_weight_surcharge/surcharge'), false)
607
+ );
608
+ }
609
+ }
610
+ }
611
+ }
612
+
613
+ /**
614
+ * @param Mage_Catalog_Model_Product $product
615
+ * @return float
616
+ */
617
+ protected function _getPrice(Mage_Catalog_Model_Product $product)
618
+ {
619
+ if ($product->getParentProductIds()) {
620
+
621
+ if (Mage::getStoreConfig('nrapps_idealo/product_options/configurable_child_products_price', $this->_getStoreId())
622
+ == NRApps_Idealo_Model_Source_ConfigurableChildProductsPriceType::PRICE_TYPE_PARENT_WITH_MODIFICATIONS) {
623
+
624
+ /** @var $parentProduct Mage_Catalog_Model_Product */
625
+ $parentProduct = $this->_getProduct(current($product->getParentProductIds()));
626
+
627
+ /** @var $productTypeInstance Mage_Catalog_Model_Product_Type_Configurable */
628
+ $productTypeInstance = $parentProduct->getTypeInstance(true);
629
+
630
+ /** @var $configurableAttributes array */
631
+ $configurableAttributes = $productTypeInstance->getConfigurableAttributesAsArray($parentProduct);
632
+
633
+ /**
634
+ * Required to determinate product child price
635
+ * @see Mage_Catalog_Model_Product_Type_Configurable_Price::getFinalPrice()
636
+ */
637
+ $customOptionAttributes = array();
638
+ foreach ($configurableAttributes as $attribute) {
639
+ $customOptionAttributes[$attribute['attribute_id']] = $product->getData($attribute['attribute_code']);
640
+ }
641
+
642
+ $parentProduct->addCustomOption('attributes', serialize($customOptionAttributes));
643
+
644
+ /** @var $priceModel Mage_Catalog_Model_Product_Type_Configurable_Price */
645
+ $priceModel = Mage::getModel('catalog/product_type_configurable_price');
646
+
647
+ return $priceModel->getFinalPrice(null, $parentProduct);
648
+ }
649
+
650
+ if (Mage::getStoreConfig('nrapps_idealo/product_options/configurable_child_products_price', $this->_getStoreId())
651
+ == NRApps_Idealo_Model_Source_ConfigurableChildProductsPriceType::PRICE_TYPE_PARENT_WITHOUT_MODIFICATIONS) {
652
+
653
+ return Mage::getResourceSingleton('catalog/product')->getAttributeRawValue(current($product->getParentProductIds()), 'price', $product->getStoreId());
654
+ }
655
+ }
656
+
657
+ if ($product->isGrouped()) {
658
+
659
+ $childrenIds = $product->getTypeInstance(true)->getChildrenIds($product->getId());
660
+
661
+ if (!sizeof($childrenIds)) {
662
+ return 0;
663
+ }
664
+
665
+ $usedAttributes = array('price', 'special_price', 'special_from_date', 'special_to_date');
666
+
667
+ foreach (Mage::getStoreConfig('nrapps_idealo/attributes') as $attributeCode => $newAttributeCode) {
668
+ if ($newAttributeCode && $newAttributeCode != 'none') {
669
+ $usedAttributes[] = $newAttributeCode;
670
+ } else if ($newAttributeCode != 'none') {
671
+ $usedAttributes[] = $attributeCode;
672
+ }
673
+ }
674
+
675
+ /** @var $childrenProducts Mage_Catalog_Model_Resource_Product_Collection */
676
+ $childrenProducts = Mage::getResourceModel('catalog/product_collection')
677
+ ->addAttributeToFilter('entity_id', array('in' => $childrenIds))
678
+ ->addWebsiteFilter($this->getStore()->getWebsiteId())
679
+ ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
680
+ ->addAttributeToSelect('nrapps_idealo_exclude')
681
+ ->addAttributeToSelect($usedAttributes)
682
+ ->setOrder('price');
683
+
684
+ foreach ($childrenProducts as $childProduct) { /** @var Mage_Catalog_Model_Product $childProduct */
685
+ if ($childProduct->getId() && !$childProduct->getFeedgeneratorExclude()) {
686
+ foreach ($usedAttributes as $attributeCode) {
687
+ if (!$product->getData($attributeCode) && $childProduct->getData($attributeCode)) {
688
+ $product->setData($attributeCode, $childProduct->getData($attributeCode));
689
+ }
690
+ }
691
+ return $childProduct->getPriceModel()->getFinalPrice(1, $childProduct);
692
+ }
693
+ }
694
+ }
695
+
696
+ return $product->getPrice();
697
+ }
698
+
699
+ /**
700
+ * @param Mage_Catalog_Model_Product $product
701
+ * @return string
702
+ */
703
+ protected function _getBasePrice(Mage_Catalog_Model_Product $product)
704
+ {
705
+ if (Mage::getConfig()->getModuleConfig('DerModPro_BasePrice')->is('active', 'true')) {
706
+
707
+ if (! ($productAmount = $product->getBasePriceAmount())) return '';
708
+
709
+ if (! ($referenceAmount = $product->getBasePriceBaseAmount())) return '';
710
+ if (! ($productPrice = $product->getFinalPrice())) return '';
711
+ if (! is_numeric($productAmount) || ! is_numeric($referenceAmount) || ! is_numeric($productPrice)) return '';
712
+
713
+ $productUnit = $product->getBasePriceUnit();
714
+ $referenceUnit = $product->getBasePriceBaseUnit();
715
+ $referenceUnitLabel = Mage::helper('baseprice')->__($referenceUnit . ' short');
716
+
717
+ $productPrice = Mage::helper('tax')->getPrice($product, $productPrice, Mage::getStoreConfig('catalog/baseprice/base_price_incl_tax'));
718
+ $basePriceModel = Mage::getModel('baseprice/baseprice', array('reference_unit' => $referenceUnit, 'reference_amount' => $referenceAmount));
719
+ $basePrice = $basePriceModel->getBasePrice($productAmount, $productUnit, $productPrice);
720
+
721
+ $basePrice = Mage::helper('core')->currencyByStore($basePrice, $product->getStoreId(), true, false);
722
+
723
+ return $basePrice . ' / ' . $referenceAmount . ' ' . $referenceUnitLabel;
724
+ }
725
+
726
+ return '';
727
+ }
728
+
729
+ /**
730
+ * @param Mage_Catalog_Model_Product $product
731
+ * @return string
732
+ */
733
+ protected function _getBasePriceRaw(Mage_Catalog_Model_Product $product)
734
+ {
735
+ if (Mage::getConfig()->getModuleConfig('DerModPro_BasePrice')->is('active', 'true')) {
736
+
737
+ if (! ($productAmount = $product->getBasePriceAmount())) return '';
738
+
739
+ if (! ($referenceAmount = $product->getBasePriceBaseAmount())) return '';
740
+ if (! ($productPrice = $product->getFinalPrice())) return '';
741
+ if (! is_numeric($productAmount) || ! is_numeric($referenceAmount) || ! is_numeric($productPrice)) return '';
742
+
743
+ $productUnit = $product->getBasePriceUnit();
744
+ $referenceUnit = $product->getBasePriceBaseUnit();
745
+
746
+ $productPrice = Mage::helper('tax')->getPrice($product, $productPrice, Mage::getStoreConfig('catalog/baseprice/base_price_incl_tax'));
747
+ $basePriceModel = Mage::getModel('baseprice/baseprice', array('reference_unit' => $referenceUnit, 'reference_amount' => $referenceAmount));
748
+ $basePrice = $basePriceModel->getBasePrice($productAmount, $productUnit, $productPrice);
749
+
750
+ return $basePrice;
751
+ }
752
+
753
+ return '';
754
+ }
755
+
756
+ /**
757
+ * Set the configuration default values on the product model.
758
+ * Used when products already existed when the extension was installed.
759
+ *
760
+ * @param Mage_Catalog_Model_Product $product
761
+ * @return DerModPro_BasePrice_Helper_Data
762
+ */
763
+ protected function _loadDefaultBasePriceValues($product)
764
+ {
765
+ foreach (array('base_price_base_amount', 'base_price_unit', 'base_price_base_unit') as $attributeCode) {
766
+ if (! $product->getDataUsingMethod($attributeCode)) {
767
+ /** @var $attribute Mage_Eav_Model_Entity_Attribute */
768
+ $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $attributeCode);
769
+ $product->setDataUsingMethod($attributeCode, $attribute->getFrontend()->getValue($product));
770
+ }
771
+ }
772
+ return $this;
773
+ }
774
+
775
+ /**
776
+ * @param int $productId
777
+ * @return Mage_Catalog_Model_Product
778
+ */
779
+ protected function _getProduct($productId)
780
+ {
781
+ if (is_null($this->_product) || $this->_product->getId() != $productId) {
782
+ $this->_product = Mage::getModel('catalog/product')->setStoreId()->load($productId);
783
+ }
784
+ return $this->_product;
785
+ }
786
+
787
+ /**
788
+ * @return int
789
+ */
790
+ protected function _getStoreId()
791
+ {
792
+ return $this->getStore()->getId();
793
+ }
794
+
795
+ /**
796
+ * @param float $productPrice
797
+ * @param float $productWeight
798
+ * @param string $listingCountry
799
+ * @return float
800
+ */
801
+ protected function _getDefaultShippingCost($productPrice, $productWeight = 0.00, $listingCountry)
802
+ {
803
+ $defaultShippingCost = null;
804
+
805
+ $group = $this->_getConfigGroup($listingCountry);
806
+
807
+ switch (Mage::getStoreConfig('nrapps_idealo/' . $group . '/shipping_costs_calculation_method', $this->_getStoreId())) {
808
+
809
+ case NRApps_Idealo_Model_Source_ShippingCostsMethod::SHIPPING_COSTS_BY_PRICE:
810
+ $shippingCosts = unserialize(Mage::getStoreConfig('nrapps_idealo/' . $group . '/shipping_costs', $this->_getStoreId()));
811
+
812
+ $selectedMinPrice = 0;
813
+ foreach ($shippingCosts as $shippingCost) {
814
+ if ($shippingCost['from_price'] <= $productPrice) {
815
+ if (is_null($defaultShippingCost) || $shippingCost['from_price'] > $selectedMinPrice) {
816
+ $defaultShippingCost = $this->_formatPrice(floatval($shippingCost['cost']));
817
+ $selectedMinPrice = $shippingCost['from_price'];
818
+ }
819
+ }
820
+ }
821
+ break;
822
+
823
+ case NRApps_Idealo_Model_Source_ShippingCostsMethod::SHIPPING_COSTS_BY_WEIGHT:
824
+ $shippingCosts = unserialize(Mage::getStoreConfig('nrapps_idealo/' . $group . '/shipping_costs_by_weight', $this->_getStoreId()));
825
+
826
+ foreach ($shippingCosts as $shippingCost) {
827
+ if ($shippingCost['from_weight'] <= floatval($productWeight)) {
828
+ if (is_null($defaultShippingCost) || $defaultShippingCost < floatval($shippingCost['cost'])) {
829
+ $defaultShippingCost = $this->_formatPrice(floatval($shippingCost['cost']));
830
+ }
831
+ }
832
+ }
833
+ break;
834
+ }
835
+
836
+ if (is_null($defaultShippingCost)) {
837
+ $defaultShippingCost = 0.00;
838
+ }
839
+
840
+ return $defaultShippingCost;
841
+ }
842
+
843
+ /**
844
+ * @param Mage_Catalog_Model_Product $product
845
+ * @return string
846
+ */
847
+ protected function _getProductUrl(Mage_Catalog_Model_Product $product)
848
+ {
849
+ if (!$product->isVisibleInSiteVisibility()) {
850
+ if ($product->getParentProductIds()) {
851
+
852
+ // get product url of parent product
853
+ $productId = current($product->getParentProductIds());
854
+
855
+ /** @var $rewrite Mage_Core_Model_Url_Rewrite */
856
+ $rewrite = Mage::getModel('core/url_rewrite');
857
+ $rewrite->setStoreId($this->_getStoreId())
858
+ ->loadByIdPath('product/' . $productId);
859
+ if ($rewrite->getId()) {
860
+ $requestPath = $rewrite->getRequestPath();
861
+ $routeParams['_direct'] = $requestPath;
862
+ $routeParams['_store_to_url'] = true;
863
+ $routeParams['_store'] = $this->_getStoreId();
864
+
865
+ $parentProduct = $this->_getProduct($productId);
866
+ if ($parentProduct->isConfigurable()) {
867
+ /** @var Mage_Catalog_Model_Product_Type_Configurable $typeInstance */
868
+ $typeInstance = $parentProduct->getTypeInstance();
869
+ $urlParts = array();
870
+ foreach($typeInstance->getConfigurableAttributes($parentProduct) as $attribute) {
871
+ $urlParts[] = $attribute->getAttributeId() . '=' . $product->getData($attribute->getProductAttribute()->getAttributeCode());
872
+ }
873
+ if (sizeof($urlParts)) {
874
+ return Mage::getModel('core/url')->getUrl(null, $routeParams) . '#' . implode('&', $urlParts);
875
+ }
876
+ }
877
+
878
+ return Mage::getModel('core/url')->getUrl(null, $routeParams);
879
+ }
880
+ }
881
+ }
882
+
883
+ return $product->getProductUrl();
884
+ }
885
+
886
+ /**
887
+ * Get Image filename from product or configurable parent product
888
+ *
889
+ * @param Mage_Catalog_Model_Product $product
890
+ * @param string $imageAttribute
891
+ * @return string
892
+ */
893
+ protected function _getProductImage(Mage_Catalog_Model_Product $product, $imageAttribute = 'image')
894
+ {
895
+ $productImage = $product->getData($imageAttribute);
896
+ if ($productImage && $productImage != 'no_selection') {
897
+ return $productImage;
898
+ }
899
+
900
+ if ($product->getParentProductIds()) {
901
+ $parentProductId = current($product->getParentProductIds());
902
+ $parentProductImage = $this->_getProduct($parentProductId)->getData($imageAttribute);
903
+ if ($parentProductImage && $parentProductImage != 'no_selection') {
904
+ return $parentProductImage;
905
+ }
906
+ }
907
+
908
+ return '';
909
+ }
910
+
911
+ /**
912
+ * @param int $productId
913
+ * @return string
914
+ */
915
+ protected function _getSkuByProductId($productId)
916
+ {
917
+ if (!isset($this->_productSkusById[$productId])) {
918
+ $this->_productSkusById[$productId] = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($productId, 'sku', Mage_Core_Model_App::ADMIN_STORE_ID);
919
+ }
920
+ return $this->_productSkusById[$productId];
921
+ }
922
+
923
+ /**
924
+ * @param Mage_Catalog_Model_Product $product
925
+ * @param $attributeCode
926
+ * @return string|null
927
+ */
928
+ protected function _getAttributeValue(Mage_Catalog_Model_Product $product, $attributeCode)
929
+ {
930
+ if (!$product->getData($attributeCode) || is_object($product->getData($attributeCode)) || is_array($product->getData($attributeCode))) {
931
+ return null;
932
+ }
933
+
934
+ $value = $this->_getRawAttributeValue($product, $attributeCode);
935
+ if ($value == 'no-display') {
936
+ return null;
937
+ }
938
+ return $this->_getEncodedValue($value);
939
+ }
940
+
941
+ /**
942
+ * @param Mage_Catalog_Model_Product $product
943
+ * @param $attributeCode
944
+ *
945
+ * @return string|null
946
+ */
947
+ protected function _getAttributeValueRaw(Mage_Catalog_Model_Product $product, $attributeCode)
948
+ {
949
+ if (!$product->getData($attributeCode) || is_object($product->getData($attributeCode)) || is_array($product->getData($attributeCode))) {
950
+ return null;
951
+ }
952
+
953
+ $value = $this->_getRawAttributeValueRaw($product, $attributeCode);
954
+ if ($value == 'no-display') {
955
+ return null;
956
+ }
957
+
958
+ return $this->_getEncodedValue($value);
959
+ }
960
+
961
+ /**
962
+ * @param string $value
963
+ * @return string
964
+ */
965
+ protected function _getEncodedValue($value)
966
+ {
967
+ if ($value === 'no-display') {
968
+ return '';
969
+ }
970
+
971
+ switch ($this->getFeed()->getType()) {
972
+
973
+ case 'csv':
974
+ if ($search = $this->getFeed()->getQuoteSymbol()) {
975
+ if ($search == '\t') {
976
+ $search = "\t";
977
+ }
978
+ $replacement = $this->getFeed()->getQuoteSymbolReplacement();
979
+ return str_replace($search, $replacement, $value);
980
+ } else {
981
+ return $value;
982
+ }
983
+
984
+ case 'xml':
985
+
986
+ return $value;
987
+ }
988
+ }
989
+
990
+ /**
991
+ * @param Mage_Catalog_Model_Product $product
992
+ * @param $attributeCode
993
+ * @return mixed
994
+ */
995
+ protected function _getRawAttributeValue(Mage_Catalog_Model_Product $product, $attributeCode)
996
+ {
997
+ /** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
998
+ $attribute = $this->_getAttribute($attributeCode);
999
+ if (!$attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
1000
+ return null;
1001
+ }
1002
+
1003
+ switch($attribute->getFrontendInput()) {
1004
+ case 'textarea':
1005
+ return str_replace(array("\r\n", "\n", "\r"), '<br />', trim($product->getData($attributeCode)));
1006
+ case 'multiselect':
1007
+ $value = '';
1008
+ $valueIds = explode(',', $product->getData($attributeCode));
1009
+ foreach($valueIds as $valueId) {
1010
+ $value[] = $attribute->getSource()->getOptionText($valueId);
1011
+ }
1012
+ return implode(', ', $value);
1013
+ case 'select':
1014
+ if (strpos($attributeCode, 'google_') !== false) {
1015
+ return $product->getData($attributeCode);
1016
+ }
1017
+ if (strpos($attributeCode, 'leguide_') !== false) {
1018
+ return $product->getData($attributeCode);
1019
+ }
1020
+ return $product->getAttributeText($attributeCode);
1021
+ case 'price':
1022
+ return $this->_formatPrice($product->getData($attributeCode));
1023
+ case 'date':
1024
+ $date = new Zend_Date($product->getData($attributeCode), Zend_Date::ISO_8601);
1025
+ $date->setTimezone(Mage::getStoreConfig('general/locale/timezone'));
1026
+ return $date->get(Zend_Date::ISO_8601);
1027
+ default:
1028
+ return trim($product->getData($attributeCode));
1029
+ }
1030
+ }
1031
+
1032
+ /**
1033
+ * @param Mage_Catalog_Model_Product $product
1034
+ * @param $attributeCode
1035
+ * @return mixed
1036
+ */
1037
+ protected function _getRawAttributeValueRaw(Mage_Catalog_Model_Product $product, $attributeCode)
1038
+ {
1039
+ /** @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
1040
+ $attribute = $this->_getAttribute($attributeCode);
1041
+ if (!$attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute) {
1042
+ return null;
1043
+ }
1044
+
1045
+ if ($attribute->getFrontendInput() == 'select' || $attribute->getFrontendInput() == 'multiselect') {
1046
+ return $product->getData($attributeCode);
1047
+ }
1048
+
1049
+ return null;
1050
+ }
1051
+
1052
+ /**
1053
+ * @param string $attributeCode
1054
+ * @return Mage_Catalog_Model_Resource_Eav_Attribute
1055
+ */
1056
+ protected function _getAttribute($attributeCode)
1057
+ {
1058
+ if (!isset($this->_attributes[$attributeCode])) {
1059
+ /** @var Mage_Catalog_Model_Resource_Eav_Attribute $attribute */
1060
+ $attribute = Mage::getSingleton('eav/config')
1061
+ ->getAttribute('catalog_product', $attributeCode)->setStoreId($this->_getStoreId());
1062
+
1063
+ $this->_attributes[$attributeCode] = $attribute;
1064
+ }
1065
+
1066
+ return $this->_attributes[$attributeCode];
1067
+ }
1068
+
1069
+ /**
1070
+ * Return the category name(s) of the given category id(s) i.e. "Cell Phones"
1071
+ *
1072
+ * @param int|int[] $categoryIds
1073
+ * @return string[]
1074
+ */
1075
+ protected function _getCategoryNamesByIds($categoryIds)
1076
+ {
1077
+ if (is_array($categoryIds)) {
1078
+ $categoryNames = array();
1079
+ foreach ($categoryIds as $categoryId) {
1080
+ $categoryName = $this->_getCategoryNamesByIds($categoryId);
1081
+ if ($categoryName) {
1082
+ $categoryNames[$categoryId] = $categoryName;
1083
+ }
1084
+ }
1085
+ return $categoryNames;
1086
+ }
1087
+
1088
+ $categoryId = $categoryIds;
1089
+ if (!isset($this->_categoryNames[$categoryId]) && !$this->isExcludedCategoryId($categoryId)) {
1090
+ $this->_categoryNames[$categoryId] =
1091
+ $this->_getEncodedValue(Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, 'name', $this->getStore()->getId()));
1092
+ }
1093
+ return isset($this->_categoryNames[$categoryId]) ? $this->_categoryNames[$categoryId] : '';
1094
+ }
1095
+
1096
+ /**
1097
+ * Get attributes which should be taken from categories if not present at the product itself
1098
+ * Configured in config.xml
1099
+ *
1100
+ * @return array
1101
+ */
1102
+ protected function _getCategoryAttributeCodes()
1103
+ {
1104
+ if (!is_array(Mage::getStoreConfig('nrapps_idealo/category_attributes'))) {
1105
+ return array();
1106
+ }
1107
+ return array_keys(Mage::getStoreConfig('nrapps_idealo/category_attributes'));
1108
+ }
1109
+
1110
+ /**
1111
+ * Return the category path(s) of the given category id(s) i.e. "Electronics &gt; Computers &gt; Build Your Own"
1112
+ *
1113
+ * @param int|int[] $categoryIds
1114
+ * @return string|string[]
1115
+ */
1116
+ protected function _getCategoryPathsByIds($categoryIds)
1117
+ {
1118
+ if (is_array($categoryIds)) {
1119
+ $categoryPaths = array();
1120
+ $i = 0;
1121
+ foreach ($categoryIds as $categoryId) {
1122
+ // limit to 10 categories
1123
+ if ($i++ >= 10) {
1124
+ break;
1125
+ }
1126
+ if ($categoryPath = $this->_getCategoryPathsByIds($categoryId)) {
1127
+ $categoryPaths[$categoryId] = $categoryPath;
1128
+ }
1129
+ }
1130
+ return $categoryPaths;
1131
+ }
1132
+
1133
+ /** @var int $categoryId */
1134
+ $categoryId = $categoryIds;
1135
+ if ($this->isExcludedCategoryId($categoryId)) {
1136
+ return '';
1137
+ }
1138
+
1139
+ if (!isset($this->_categoryPaths[$categoryId]) && !$this->isExcludedCategoryId($categoryId)) {
1140
+
1141
+ $parentCategoryId = Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, 'parent_id', $this->_getStoreId());
1142
+ $categoryLevel = Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, 'level', $this->_getStoreId());
1143
+ foreach ($this->_getCategoryAttributeCodes() as $attributeCode) {
1144
+ $this->_categoryAttributeValues[$attributeCode][$categoryId] = Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, $attributeCode, $this->_getStoreId());
1145
+ $this->_categoryAttributeLevels[$attributeCode][$categoryId] = $categoryLevel;
1146
+ }
1147
+ if ($parentCategoryId == $this->getStore()->getGroup()->getRootCategoryId() || $parentCategoryId == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
1148
+ $this->_categoryPaths[$categoryId] = $this->_getCategoryNamesByIds($categoryId);
1149
+ } else {
1150
+ $parentCategoryPath = $this->_getCategoryPathsByIds($parentCategoryId);
1151
+ if (!$parentCategoryPath) {
1152
+ return '';
1153
+ }
1154
+
1155
+ $this->_categoryPaths[$categoryId] = $parentCategoryPath . $this->_getCategoryPathDivider() . $this->_getCategoryNamesByIds($categoryId);
1156
+ foreach ($this->_getCategoryAttributeCodes() as $attributeCode) {
1157
+ if (!$this->_categoryAttributeValues[$attributeCode][$categoryId]) {
1158
+ $this->_categoryAttributeValues[$attributeCode][$categoryId] = $this->_categoryAttributeValues[$attributeCode][$parentCategoryId];
1159
+ $this->_categoryAttributeLevels[$attributeCode][$categoryId] = $this->_categoryAttributeLevels[$attributeCode][$parentCategoryId];
1160
+ }
1161
+ }
1162
+ }
1163
+ }
1164
+ return $this->_categoryPaths[$categoryId];
1165
+ }
1166
+
1167
+ /**
1168
+ * @return string
1169
+ */
1170
+ protected function _getCategoryPathDivider()
1171
+ {
1172
+ return ' > ';
1173
+ }
1174
+
1175
+ /**
1176
+ * Check if attribute / any attribute is used
1177
+ *
1178
+ * @param string|string[] $attributeCodes
1179
+ * @return bool
1180
+ */
1181
+ protected function _isAttributeUsed($attributeCodes)
1182
+ {
1183
+ $additionalUsedAttributeCodes = $this->_getAdditionalUsedAttributeCodes();
1184
+
1185
+ if (is_array($attributeCodes)) {
1186
+ foreach ($attributeCodes as $attributeCode) {
1187
+ if ($this->_isAttributeUsed($attributeCode)) {
1188
+ return true;
1189
+ }
1190
+ }
1191
+ return false;
1192
+ }
1193
+ $attributeCode = $attributeCodes;
1194
+ if (!isset($this->_usedAttributeCodes[$attributeCode])) {
1195
+ if (in_array($attributeCode, $additionalUsedAttributeCodes)) {
1196
+ $this->_usedAttributeCodes[$attributeCode] = true;
1197
+ } else {
1198
+ $this->_usedAttributeCodes[$attributeCode] = (strpos($this->getFeed()->getBody(), $attributeCode) !== false);
1199
+ }
1200
+ }
1201
+ return $this->_usedAttributeCodes[$attributeCode];
1202
+ }
1203
+
1204
+ /**
1205
+ * @param float $price
1206
+ * @return string
1207
+ */
1208
+ protected function _formatPrice($price)
1209
+ {
1210
+ return number_format($price, 2, '.', '');
1211
+ }
1212
+
1213
+ /**
1214
+ * Get attribute codes which should always be included into the product data
1215
+ *
1216
+ * @return string[]
1217
+ */
1218
+ protected function _getAdditionalUsedAttributeCodes()
1219
+ {
1220
+ $attributeCodesObject = new Varien_Object();
1221
+
1222
+ $attributeCodes = array(
1223
+ 'shipping_cost',
1224
+ 'weight',
1225
+ 'price',
1226
+ 'special_price',
1227
+ );
1228
+
1229
+ foreach (unserialize(Mage::getStoreConfig('nrapps_idealo/product_options/add_attributes_to_export', $this->_getStoreId())) as $row) {
1230
+ $attributeCodes[] = $row['attribute_code'];
1231
+ }
1232
+
1233
+ $attributeCodesObject->setAttributeCodes($attributeCodes);
1234
+
1235
+ return $attributeCodesObject->getAttributeCodes();
1236
+ }
1237
+
1238
+ /**
1239
+ * Sort categories so lowest level categories are first
1240
+ *
1241
+ * @param Mage_Catalog_Model_Product $product
1242
+ * @return array
1243
+ */
1244
+ protected function _getCategoryIds(Mage_Catalog_Model_Product $product)
1245
+ {
1246
+ $categoryIds = $product->getCategoryIds();
1247
+
1248
+ /** @var $categoryCollection Mage_Catalog_Model_Resource_Category_Collection */
1249
+ $categoryCollection = Mage::getResourceModel('catalog/category_collection')
1250
+ ->addAttributeToFilter('entity_id', array('in' => $categoryIds))
1251
+ ->addAttributeToFilter('level', array('gt' => 1))
1252
+ ->setOrder('level', 'DESC');
1253
+ return array_keys($categoryCollection->getItems());
1254
+ }
1255
+
1256
+ /**
1257
+ * @param int $categoryId
1258
+ */
1259
+ protected function _excludeCategoryId($categoryId)
1260
+ {
1261
+ $this->_excludedCategoryIds[$categoryId] = $categoryId;
1262
+ }
1263
+
1264
+ /**
1265
+ * @param int $categoryId
1266
+ * @return bool
1267
+ */
1268
+ public function isExcludedCategoryId($categoryId)
1269
+ {
1270
+ if (is_null($this->_excludedCategoryIds)) {
1271
+
1272
+ $this->_excludedCategoryIds = array();
1273
+
1274
+ /** @var $categories Mage_Catalog_Model_Resource_Category_Collection */
1275
+ $categories = Mage::getResourceModel('catalog/category_collection')
1276
+ ->setStoreId($this->_getStoreId())
1277
+ ->addAttributeToSelect(array('is_active', 'include_in_menu', 'nrapps_idealo_exclude'))
1278
+ ->addAttributeToFilter('level', array('gt' => 0))
1279
+ ->setOrder('level', 'asc');
1280
+
1281
+ foreach ($categories as $category) { /** @var Mage_Catalog_Model_Category $category */
1282
+ if ($category->getLevel() == 1 && $category->getId() != $this->getStore()->getGroup()->getRootCategoryId()) {
1283
+ // Exclude categories which are not in the current store root
1284
+ $this->_excludeCategoryId($category->getId());
1285
+ }
1286
+ if (in_array($category->getParentId(), $this->_excludedCategoryIds)) {
1287
+ // exclude categories whose parents are excluded
1288
+ $this->_excludeCategoryId($category->getId());
1289
+ }
1290
+ if (!$category->getIsActive() || !$category->getIncludeInMenu() || $category->getFeedgeneratorExclude()) {
1291
+ // exclude inactive, invisible or excluded categories
1292
+ $this->_excludeCategoryId($category->getId());
1293
+ }
1294
+ }
1295
+ }
1296
+ return isset($this->_excludedCategoryIds[$categoryId]);
1297
+ }
1298
+
1299
+ protected function _getOfferName($product)
1300
+ {
1301
+ $offerName = $product->getName();
1302
+
1303
+ $attributes = array(
1304
+ 0 => array(),
1305
+ );
1306
+
1307
+ // get product url of parent product
1308
+ if ($productId = current($product->getParentProductIds())) {
1309
+
1310
+ $parentProduct = $this->_getProduct($productId);
1311
+ if ($parentProduct->isConfigurable()) {
1312
+ /** @var Mage_Catalog_Model_Product_Type_Configurable $typeInstance */
1313
+ $typeInstance = $parentProduct->getTypeInstance();
1314
+ foreach ($typeInstance->getConfigurableAttributes($parentProduct) as $attribute) {
1315
+ $attributes[0][] = $attribute->getProductAttribute()->getAttributeCode();
1316
+ }
1317
+ }
1318
+ }
1319
+
1320
+ $configuredAttributes = Mage::getStoreConfig('nrapps_idealo/product_options/add_attribute_contents_to_name');
1321
+ if ($configuredAttributes) {
1322
+ if ($configuredAttributes = @unserialize($configuredAttributes)) {
1323
+ foreach($configuredAttributes as $configuredAttributeData) {
1324
+ if (!in_array($configuredAttributeData['attribute_code'], $attributes[0])) {
1325
+ $attributes[$configuredAttributeData['sort_order']][] = $configuredAttributeData['attribute_code'];
1326
+ }
1327
+ }
1328
+ }
1329
+ }
1330
+
1331
+ ksort($attributes);
1332
+ foreach($attributes as $attributesBySort) {
1333
+ foreach($attributesBySort as $attributeCode) {
1334
+ if ($value = $this->_getAttributeValue($product, $attributeCode)) {
1335
+ $offerName .= ' ' . $value;
1336
+ }
1337
+ }
1338
+ }
1339
+
1340
+ return $offerName;
1341
+ }
1342
+
1343
+ /**
1344
+ * @param string $listingCountry
1345
+ * @return string
1346
+ */
1347
+ protected function _getConfigGroup($listingCountry)
1348
+ {
1349
+ switch ($listingCountry) {
1350
+ case NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE:
1351
+ $group = 'shipping';
1352
+ break;
1353
+ default:
1354
+ $group = 'shipping_' . strtolower($listingCountry);
1355
+ return $group;
1356
+ }
1357
+ return $group;
1358
+ }
1359
+
1360
+ /**
1361
+ * @param $listingCountry
1362
+ * @return string
1363
+ */
1364
+ protected function _getContext($listingCountry)
1365
+ {
1366
+ return $listingCountry;
1367
+ }
1368
+
1369
+ /**
1370
+ * @param $listingCountry
1371
+ * @return string
1372
+ */
1373
+ protected function _getSuffix($listingCountry)
1374
+ {
1375
+ return '_' . $listingCountry;
1376
+ }
1377
+
1378
+ /**
1379
+ * @return string
1380
+ */
1381
+ protected function _getLineDivider()
1382
+ {
1383
+ if ($this->getFeed()->getType() == 'csv') {
1384
+ return '; ';
1385
+ }
1386
+ return PHP_EOL;
1387
+ }
1388
  }
app/code/community/NRApps/Idealo/Model/Indexer.php CHANGED
@@ -1,600 +1,600 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Indexer extends Mage_Index_Model_Indexer_Abstract
4
- {
5
- const PRODUCT_COLLECTION_PAGE_SIZE = 500;
6
-
7
- protected $_matchedEntities = array(
8
- Mage_Catalog_Model_Product::ENTITY => array(
9
- Mage_Index_Model_Event::TYPE_SAVE,
10
- Mage_Index_Model_Event::TYPE_DELETE,
11
- Mage_Index_Model_Event::TYPE_MASS_ACTION,
12
- ),
13
- Mage_Catalog_Model_Category::ENTITY => array(
14
- Mage_Index_Model_Event::TYPE_SAVE
15
- ),
16
- );
17
-
18
- /** @var array[] */
19
- protected $_generatorsByStore = array();
20
-
21
- protected $_resourceName = 'nrapps_idealo/indexer';
22
-
23
- /**
24
- * Create Generators by store
25
- */
26
- protected function _initGenerators()
27
- {
28
- if (!sizeof($this->_generatorsByStore)) {
29
- foreach(Mage::app()->getStores() as $store) {
30
- $this->_generatorsByStore[$store->getId()][] = Mage::getModel('nrapps_idealo/generator', $store);
31
- $this->_generatorsByStore[$store->getId()][] = Mage::getModel('nrapps_idealo/csv_generator', $store);
32
- }
33
- }
34
- }
35
-
36
- public function getName()
37
- {
38
- return Mage::helper('nrapps_idealo')->__('idealo Connect');
39
- }
40
-
41
- public function getDescription()
42
- {
43
- return Mage::helper('nrapps_idealo')->__('Indexing of generated Product Data for idealo Connect');
44
- }
45
-
46
- /**
47
- * @param Mage_Index_Model_Event $event
48
- * @return $this
49
- */
50
- protected function _registerEvent(Mage_Index_Model_Event $event)
51
- {
52
- if ($event->getEntity() == Mage_Catalog_Model_Product::ENTITY) {
53
-
54
- $productIdsForUpdate = array();
55
- $productIdsForDeletion = array();
56
-
57
- /* @var $product Varien_Object */
58
- $product = $event->getDataObject();
59
-
60
- switch ($event->getType()) {
61
- case Mage_Index_Model_Event::TYPE_SAVE:
62
- $productIdsForUpdate[] = $product->getId();
63
- break;
64
-
65
- case Mage_Index_Model_Event::TYPE_DELETE:
66
- $productIdsForDeletion[] = $product->getId();
67
- break;
68
-
69
- case Mage_Index_Model_Event::TYPE_MASS_ACTION:
70
- $productIdsForUpdate = $product->getProductIds();
71
- break;
72
- }
73
-
74
- if (sizeof($productIdsForUpdate)) {
75
- $event->addNewData('nrapps_idealo_update_product_ids', $productIdsForUpdate);
76
- }
77
-
78
- if (sizeof($productIdsForDeletion)) {
79
- $event->addNewData('nrapps_idealo_delete_product_ids', $productIdsForDeletion);
80
- }
81
-
82
- }
83
-
84
- if ($event->getEntity() == Mage_Catalog_Model_Category::ENTITY) {
85
-
86
- /* @var $category Mage_Catalog_Model_Category */
87
- $category = $event->getDataObject();
88
-
89
- if ($this->_isCategoryAttributeChanged($category)) {
90
-
91
- $productIdsForUpdate = $this->_getCategoryChildren($category->getId());
92
-
93
- foreach($category->getAllChildren(true) as $categoryId) {
94
-
95
- $productIdsForUpdate = array_merge($productIdsForUpdate, $this->_getCategoryChildren($categoryId));
96
- }
97
-
98
- $event->addNewData('nrapps_idealo_update_product_ids', array_unique($productIdsForUpdate));
99
- }
100
- }
101
- return $this;
102
- }
103
-
104
- /**
105
- * Check if any of the configured category attributes is changed
106
- *
107
- * @param Varien_Object $object
108
- * @return bool
109
- */
110
- protected function _isCategoryAttributeChanged(Varien_Object $object)
111
- {
112
- foreach (Mage::getStoreConfig('nrapps_idealo/category_attributes') as $attributeCode => $value) {
113
-
114
- if ($object->getData($attributeCode) != $object->getOrigData($attributeCode)) {
115
-
116
- return true;
117
- }
118
- }
119
-
120
- return false;
121
- }
122
-
123
- /**
124
- * Get Product Ids by category id
125
- *
126
- * @param $categoryId
127
- * @return array
128
- */
129
- protected function _getCategoryChildren($categoryId)
130
- {
131
- return $this->getResource()->getProductIds($categoryId);
132
- }
133
-
134
- /**
135
- * @param Mage_Index_Model_Event $event
136
- */
137
- protected function _processEvent(Mage_Index_Model_Event $event)
138
- {
139
- $data = $event->getNewData();
140
-
141
- if (isset($data['nrapps_idealo_update_product_ids'])) {
142
- $productIds = $data['nrapps_idealo_update_product_ids'];
143
- if (is_array($productIds) && !empty($productIds)) {
144
-
145
- $this->_initGenerators();
146
-
147
- foreach($productIds as $productId) {
148
- $this->_updateIndexForProduct($productId, null, true);
149
- }
150
-
151
- foreach($this->_generatorsByStore as $storeGenerators) {
152
- foreach ($storeGenerators as $generator) {
153
- /** @var $generator NRApps_Idealo_Model_Generator */
154
- $generator->generateFile();
155
- }
156
- }
157
- }
158
- }
159
-
160
- if (isset($data['nrapps_idealo_delete_product_ids'])) {
161
- $productIds = $data['nrapps_idealo_delete_product_ids'];
162
- if (is_array($productIds) && !empty($productIds)) {
163
-
164
- $this->_initGenerators();
165
-
166
- foreach($productIds as $productId) {
167
- $this->_deleteIndexForProduct($productId);
168
- }
169
-
170
- foreach($this->_generatorsByStore as $storeGenerators) {
171
- foreach ($storeGenerators as $generator) {
172
- /** @var $generator NRApps_Idealo_Model_Generator */
173
- $generator->generateFile();
174
- }
175
- }
176
- }
177
- }
178
-
179
- if (isset($data['nrapps_idealo_recreate_files_needed'])) {
180
-
181
- $this->_initGenerators(null, true);
182
-
183
- if (Mage::getStoreConfigFlag('nrapps_idealo/settings/regenerate_files_on_product_save')) {
184
- foreach($this->_generatorsByStore as $storeGenerators) {
185
- foreach($storeGenerators as $generator) { /** @var $generator NRApps_Idealo_Model_Generator */
186
- $generator->generateFile();
187
- }
188
- }
189
- }
190
- }
191
- }
192
-
193
- /**
194
- * Reindex all feeds
195
- */
196
- public function reindexAll()
197
- {
198
- $this->_initGenerators();
199
-
200
- $this->_updateIndexForProducts();
201
-
202
- foreach($this->_generatorsByStore as $storeGenerators) {
203
- foreach ($storeGenerators as $generator) {
204
- /** @var $generator NRApps_Idealo_Model_Generator */
205
- $generator->generateFile();
206
- }
207
- }
208
-
209
- /* @var $indexProcess Mage_Index_Model_Process */
210
- $indexProcess = Mage::getModel('index/process')->load('nrapps_idealo', 'indexer_code');
211
- $indexProcess->setStatus(Mage_Index_Model_Process::STATUS_PENDING)->save();
212
- }
213
-
214
- /**
215
- * Regenerate all feed indices for all products
216
- */
217
- protected function _updateIndexForProducts()
218
- {
219
- $foundProductId = array();
220
- foreach($this->_generatorsByStore as $storeId => $storeGenerators) {
221
-
222
- $pageNumber = 1;
223
- do {
224
- $productCollection = $this->_getProductCollection($storeId, $pageNumber++);
225
-
226
- $appEmulation = Mage::getSingleton('core/app_emulation');
227
- $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
228
-
229
- Mage::getSingleton('core/translate')
230
- ->setLocale(Mage::getStoreConfig('general/locale/code', $storeId))
231
- ->init('frontend');
232
-
233
- foreach ($productCollection as $product) {
234
- /** @var $product Mage_Catalog_Model_Product */
235
- $this->_updateIndexForProduct($product, $storeId);
236
- $foundProductId[$product->getId()] = $product->getId();
237
- }
238
-
239
- $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
240
-
241
- } while ($pageNumber <= $productCollection->getLastPageNumber());
242
- }
243
-
244
- $outdatedIndexRows = $this->getResource()->getIndexRowsByProductIdsExclude($foundProductId);
245
-
246
- foreach($outdatedIndexRows as $indexRow) {
247
- $this->_deleteIndexForProduct($indexRow['product_id'], $indexRow['feed_type'], $indexRow['store_id']);
248
- }
249
- }
250
-
251
- /**
252
- * Get a collection for all products of a selected store, limited by pageNumber
253
- *
254
- * @param int $storeId
255
- * @param int $pageNumber
256
- * @return Mage_Catalog_Model_Resource_Product_Collection
257
- */
258
- protected function _getProductCollection($storeId, $pageNumber = 1)
259
- {
260
- /** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
261
- $productCollection = Mage::getResourceModel('catalog/product_collection')
262
- ->addAttributeToSelect('*')
263
- ->setPageSize(self::PRODUCT_COLLECTION_PAGE_SIZE)
264
- ->setCurPage($pageNumber)
265
- ->setStore(Mage::app()->getStore($storeId))
266
- ->addWebsiteFilter(Mage::app()->getStore($storeId)->getWebsiteId())
267
- ->setOrder('sku', 'ASC');
268
-
269
- $attributeSetIds = $this->_getIncludedAttributeSetIds($storeId);
270
- if (sizeof($attributeSetIds)) {
271
- $productCollection->addFieldToFilter('attribute_set_id', array('in' => $attributeSetIds));
272
- }
273
-
274
- $productTypes = $this->_getIncludedProductTypes($storeId);
275
- if (sizeof($productTypes)) {
276
- $productCollection->addFieldToFilter('type_id', array('in' => $productTypes));
277
- }
278
-
279
- Mage::dispatchEvent('nrapps_idealo_load_product_collection_before', array('collection' => $productCollection, 'store_id' => $storeId));
280
-
281
- $this->_addMediaGalleryAttributeToCollection($productCollection, $storeId);
282
-
283
- Mage::dispatchEvent('nrapps_idealo_load_product_collection_after', array('collection' => $productCollection, 'store_id' => $storeId));
284
-
285
- return $productCollection;
286
- }
287
-
288
- /**
289
- * @param int $storeId
290
- * @return array
291
- */
292
- protected function _getIncludedAttributeSetIds($storeId)
293
- {
294
- $attributeSetIds = explode(',', Mage::getStoreConfig('nrapps_idealo/product_options/allowed_attribute_sets'));
295
-
296
- if (in_array('all', $attributeSetIds)) {
297
- return array();
298
- }
299
-
300
- return $attributeSetIds;
301
- }
302
-
303
- /**
304
- * @param int $storeId
305
- * @return array
306
- */
307
- protected function _getIncludedProductTypes($storeId)
308
- {
309
- $productTypes = explode(',', Mage::getStoreConfig('nrapps_idealo/product_options/allowed_product_types'));
310
-
311
- if (in_array('all', $productTypes)) {
312
- return array();
313
- }
314
-
315
- return $productTypes;
316
- }
317
-
318
- /**
319
- * @param Mage_Catalog_Model_Resource_Product_Collection $_productCollection
320
- * @param int $storeId
321
- * @return Mage_Catalog_Model_Resource_Product_Collection
322
- */
323
- protected function _addMediaGalleryAttributeToCollection(Mage_Catalog_Model_Resource_Product_Collection $_productCollection, $storeId)
324
- {
325
- $productIds = $_productCollection->getColumnValues('entity_id');
326
-
327
- if (!sizeof($productIds)) {
328
- return $_productCollection->load();
329
- }
330
-
331
- $_mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'media_gallery')->getAttributeId();
332
-
333
- /** @var $resource Mage_Core_Model_Resource */
334
- $resource = Mage::getSingleton('core/resource');
335
- /** @var $_read Varien_Db_Adapter_Pdo_Mysql */
336
- $_read = $resource->getConnection('catalog_read');
337
-
338
- $query = '
339
- SELECT
340
- main.entity_id, `main`.`value_id`, `main`.`value` AS `file`,
341
- `value`.`label`, `value`.`position`, `value`.`disabled`, `default_value`.`label` AS `label_default`,
342
- `default_value`.`position` AS `position_default`,
343
- `default_value`.`disabled` AS `disabled_default`
344
- FROM `' . $resource->getTableName('catalog/product_attribute_media_gallery') . '` AS `main`
345
- LEFT JOIN `' . $resource->getTableName('catalog/product_attribute_media_gallery_value') . '` AS `value`
346
- ON main.value_id=value.value_id AND value.store_id=' . $storeId . '
347
- LEFT JOIN `' . $resource->getTableName('catalog/product_attribute_media_gallery_value') . '` AS `default_value`
348
- ON main.value_id=default_value.value_id AND default_value.store_id=0
349
- WHERE (
350
- main.attribute_id = ' . $_read->quote($_mediaGalleryAttributeId) . ')
351
- AND (main.entity_id IN (' . $_read->quote($productIds) . '))
352
- ORDER BY IF(value.position IS NULL, default_value.position, value.position) ASC
353
- ';
354
- $_mediaGalleryData = $_read->fetchAll($query);
355
-
356
- $_mediaGalleryByProductId = array();
357
- foreach ($_mediaGalleryData as $_galleryImage) {
358
- $k = $_galleryImage['entity_id'];
359
- unset($_galleryImage['entity_id']);
360
- if (!isset($_mediaGalleryByProductId[$k])) {
361
- $_mediaGalleryByProductId[$k] = array();
362
- }
363
- $_mediaGalleryByProductId[$k][] = $_galleryImage;
364
- }
365
- unset($_mediaGalleryData);
366
- foreach ($_productCollection as &$_product) {
367
- $_productId = $_product->getData('entity_id');
368
- if (isset($_mediaGalleryByProductId[$_productId])) {
369
- $_product->setData('media_gallery', array('images' => $_mediaGalleryByProductId[$_productId]));
370
- }
371
- }
372
- unset($_mediaGalleryByProductId);
373
-
374
- return $_productCollection;
375
- }
376
-
377
- /**
378
- * @param int|Mage_Catalog_Model_Product $product
379
- * @param int|null $restrictedStoreId
380
- * @param boolean $forceStoreEmulation
381
- */
382
- protected function _updateIndexForProduct($product, $restrictedStoreId = null, $forceStoreEmulation = false)
383
- {
384
- foreach($this->_generatorsByStore as $storeId => $storeGenerators) {
385
- foreach ($storeGenerators as $generator) {
386
-
387
- if (!is_null($restrictedStoreId) && $storeId != $restrictedStoreId) {
388
- continue;
389
- }
390
-
391
- if ($forceStoreEmulation) {
392
- $appEmulation = Mage::getSingleton('core/app_emulation');
393
- $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
394
- }
395
-
396
- /** @var $product Mage_Catalog_Model_Product */
397
- if (!$product instanceof Mage_Catalog_Model_Product || $product->getStoreId() != $storeId) {
398
- if ($product instanceof Mage_Catalog_Model_Product) {
399
- $product = $product->getId();
400
- }
401
- $product = Mage::getSingleton('catalog/product')
402
- ->reset()
403
- ->setStoreId($storeId)
404
- ->load($product);
405
- }
406
-
407
- if (!$product->getId()) {
408
- $this->_deleteIndexForProduct($product->getId(), null, $storeId);
409
- continue;
410
- }
411
-
412
- if (!$this->_canExportProduct($product, $storeId)) {
413
- $this->_deleteIndexForProduct($product->getId(), null, $storeId);
414
- continue;
415
- }
416
-
417
- $productData = $generator->getProductData($product);
418
- $indexData = array(
419
- 'store_id' => $storeId,
420
- 'product_id' => $product->getId(),
421
- 'data' => $productData,
422
- 'feed_type' => $generator->getFeedType(),
423
- );
424
-
425
- $this->getResource()->update($indexData);
426
-
427
- // index parent product(s)
428
- if (Mage::getStoreConfig('nrapps_idealo/product_options/configurable_export_type') == NRApps_Idealo_Model_Source_ConfigurableTypes::CONFIGURABLE_TYPE_EXPORT_PARENT
429
- && $parentProductIds = $product->getParentProductIds()
430
- ) {
431
- foreach ($parentProductIds as $parentProductId) {
432
- $this->_updateIndexForProduct($parentProductId, $restrictedStoreId);
433
- }
434
- }
435
-
436
- if ($forceStoreEmulation) {
437
- $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
438
- }
439
- }
440
- }
441
- }
442
-
443
- /**
444
- * @param int $productId
445
- * @param string $feedType
446
- * @param int|null $storeId
447
- */
448
- protected function _deleteIndexForProduct($productId, $feedType = null, $storeId = null)
449
- {
450
- if (is_null($feedType)) {
451
- $this->_deleteIndexForProduct($productId, 'xml', $storeId);
452
- $this->_deleteIndexForProduct($productId, 'csv', $storeId);
453
- return;
454
- }
455
-
456
- if (is_null($storeId)) {
457
- foreach (Mage::app()->getStores() as $store) {
458
- $this->_deleteIndexForProduct($productId, $feedType, $store->getId());
459
- }
460
- return;
461
- }
462
-
463
- if ($feedType == 'xml') {
464
- $data = '
465
- <offer>
466
- <command>Delete</command>
467
- <sku>' . $storeId . 'p' . $productId . '</sku>
468
- </offer>';
469
-
470
- $this->getResource()->update(array(
471
- 'store_id' => $storeId,
472
- 'product_id' => $productId,
473
- 'feed_type' => $feedType,
474
- 'data' => $data,
475
- ), true);
476
- } else {
477
- $this->getResource()->deleteByData(array(
478
- 'store_id' => $storeId,
479
- 'product_id' => $productId,
480
- 'feed_type' => $feedType,
481
- ), true);
482
- }
483
- }
484
-
485
- /**
486
- * @param Mage_Catalog_Model_Product $product
487
- * @param int $storeId
488
- * @return bool
489
- */
490
- protected function _canExportProduct($product, $storeId)
491
- {
492
- // allow disabling products for feeds: set $product->setData('nrapps_idealo_exclude', true) if you want to exclude a product
493
- Mage::dispatchEvent('nrapps_idealo_can_export_product', array('product' => $product, 'store_id' => $storeId));
494
-
495
- if ($product->getData('nrapps_idealo_exclude')) {
496
- return false;
497
- }
498
-
499
- $store = Mage::app()->getStore($storeId);
500
-
501
- if (!$store->getIsActive() || !Mage::getStoreConfigFlag('nrapps_idealo/settings/is_active', $storeId)) {
502
- return false;
503
- }
504
-
505
- if (!in_array($store->getWebsiteId(), $product->getWebsiteIds())) {
506
- return false;
507
- }
508
-
509
- if ($product->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
510
- return false;
511
- }
512
-
513
- if (!$this->_isAttributeSetAllowed($product->getAttributeSetId(), $storeId)) {
514
- return false;
515
- }
516
-
517
- switch(Mage::getStoreConfig('nrapps_idealo/product_options/configurable_export_type', $storeId)) {
518
-
519
- case NRApps_Idealo_Model_Source_ConfigurableTypes::CONFIGURABLE_TYPE_NO_EXPORT:
520
- if ($product->getTypeId() == 'configurable') {
521
- return false;
522
- }
523
- if (!$product->isVisibleInSiteVisibility()) {
524
- return false;
525
- }
526
- break;
527
-
528
- case NRApps_Idealo_Model_Source_ConfigurableTypes::CONFIGURABLE_TYPE_EXPORT_CHILDREN:
529
- if ($product->getTypeId() == 'configurable') {
530
- return false;
531
- }
532
- if ($this->_isProductTypeAllowed('configurable', $storeId) && sizeof($parentProductIds = $this->_getConfigurableParentIds($product))) {
533
- $product->setParentProductIds($parentProductIds);
534
- } else {
535
- if (!$product->isVisibleInSiteVisibility()) {
536
- return false;
537
- }
538
- }
539
- break;
540
-
541
- case NRApps_Idealo_Model_Source_ConfigurableTypes::CONFIGURABLE_TYPE_EXPORT_PARENT:
542
- if (!$product->isVisibleInSiteVisibility()) {
543
- return false;
544
- }
545
- break;
546
- }
547
-
548
-
549
- if (!Mage::getStoreConfigFlag('cataloginventory/options/show_out_of_stock', $storeId) && !$product->isAvailable() && !$product->isConfigurable()) {
550
- return false;
551
- }
552
-
553
- if (!$this->_isProductTypeAllowed($product->getTypeId(), $storeId)) {
554
- return false;
555
- }
556
-
557
- if (!Mage::getStoreConfig('nrapps_idealo/product_options/export_flexible_price_bundles', $storeId)
558
- && $product->getTypeId() == 'bundle'
559
- && !$product->getPriceType()) {
560
- return false;
561
- }
562
-
563
- return true;
564
- }
565
-
566
- /**
567
- * @param int $attributeSetId
568
- * @param int $storeId
569
- * @return bool
570
- */
571
- protected function _isAttributeSetAllowed($attributeSetId, $storeId)
572
- {
573
- $allowedAttributeSetIds = explode(',', Mage::getStoreConfig('nrapps_idealo/product_options/allowed_attribute_sets', $storeId));
574
-
575
- return in_array(NRApps_Idealo_Model_Source_AttributeSets::ATTRIBUTE_SETS_ALL, $allowedAttributeSetIds)
576
- || in_array($attributeSetId, $allowedAttributeSetIds);
577
- }
578
-
579
- /**
580
- * @param string $productType
581
- * @param int $storeId
582
- * @return bool
583
- */
584
- protected function _isProductTypeAllowed($productType, $storeId)
585
- {
586
- $allowedProductTypes = explode(',', Mage::getStoreConfig('nrapps_idealo/product_options/allowed_product_types', $storeId));
587
-
588
- return (in_array('all', $allowedProductTypes) || in_array($productType, $allowedProductTypes));
589
- }
590
-
591
- /**
592
- * @param Mage_Catalog_Model_Product $product
593
- * @return array
594
- */
595
- protected function _getConfigurableParentIds($product)
596
- {
597
- return Mage::getModel('catalog/product_type_configurable')
598
- ->getParentIdsByChild($product->getId());
599
- }
600
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Indexer extends Mage_Index_Model_Indexer_Abstract
4
+ {
5
+ const PRODUCT_COLLECTION_PAGE_SIZE = 500;
6
+
7
+ protected $_matchedEntities = array(
8
+ Mage_Catalog_Model_Product::ENTITY => array(
9
+ Mage_Index_Model_Event::TYPE_SAVE,
10
+ Mage_Index_Model_Event::TYPE_DELETE,
11
+ Mage_Index_Model_Event::TYPE_MASS_ACTION,
12
+ ),
13
+ Mage_Catalog_Model_Category::ENTITY => array(
14
+ Mage_Index_Model_Event::TYPE_SAVE
15
+ ),
16
+ );
17
+
18
+ /** @var array[] */
19
+ protected $_generatorsByStore = array();
20
+
21
+ protected $_resourceName = 'nrapps_idealo/indexer';
22
+
23
+ /**
24
+ * Create Generators by store
25
+ */
26
+ protected function _initGenerators()
27
+ {
28
+ if (!sizeof($this->_generatorsByStore)) {
29
+ foreach(Mage::app()->getStores() as $store) {
30
+ $this->_generatorsByStore[$store->getId()][] = Mage::getModel('nrapps_idealo/generator', $store);
31
+ $this->_generatorsByStore[$store->getId()][] = Mage::getModel('nrapps_idealo/csv_generator', $store);
32
+ }
33
+ }
34
+ }
35
+
36
+ public function getName()
37
+ {
38
+ return Mage::helper('nrapps_idealo')->__('idealo Connect');
39
+ }
40
+
41
+ public function getDescription()
42
+ {
43
+ return Mage::helper('nrapps_idealo')->__('Indexing of generated Product Data for idealo Connect');
44
+ }
45
+
46
+ /**
47
+ * @param Mage_Index_Model_Event $event
48
+ * @return $this
49
+ */
50
+ protected function _registerEvent(Mage_Index_Model_Event $event)
51
+ {
52
+ if ($event->getEntity() == Mage_Catalog_Model_Product::ENTITY) {
53
+
54
+ $productIdsForUpdate = array();
55
+ $productIdsForDeletion = array();
56
+
57
+ /* @var $product Varien_Object */
58
+ $product = $event->getDataObject();
59
+
60
+ switch ($event->getType()) {
61
+ case Mage_Index_Model_Event::TYPE_SAVE:
62
+ $productIdsForUpdate[] = $product->getId();
63
+ break;
64
+
65
+ case Mage_Index_Model_Event::TYPE_DELETE:
66
+ $productIdsForDeletion[] = $product->getId();
67
+ break;
68
+
69
+ case Mage_Index_Model_Event::TYPE_MASS_ACTION:
70
+ $productIdsForUpdate = $product->getProductIds();
71
+ break;
72
+ }
73
+
74
+ if (sizeof($productIdsForUpdate)) {
75
+ $event->addNewData('nrapps_idealo_update_product_ids', $productIdsForUpdate);
76
+ }
77
+
78
+ if (sizeof($productIdsForDeletion)) {
79
+ $event->addNewData('nrapps_idealo_delete_product_ids', $productIdsForDeletion);
80
+ }
81
+
82
+ }
83
+
84
+ if ($event->getEntity() == Mage_Catalog_Model_Category::ENTITY) {
85
+
86
+ /* @var $category Mage_Catalog_Model_Category */
87
+ $category = $event->getDataObject();
88
+
89
+ if ($this->_isCategoryAttributeChanged($category)) {
90
+
91
+ $productIdsForUpdate = $this->_getCategoryChildren($category->getId());
92
+
93
+ foreach($category->getAllChildren(true) as $categoryId) {
94
+
95
+ $productIdsForUpdate = array_merge($productIdsForUpdate, $this->_getCategoryChildren($categoryId));
96
+ }
97
+
98
+ $event->addNewData('nrapps_idealo_update_product_ids', array_unique($productIdsForUpdate));
99
+ }
100
+ }
101
+ return $this;
102
+ }
103
+
104
+ /**
105
+ * Check if any of the configured category attributes is changed
106
+ *
107
+ * @param Varien_Object $object
108
+ * @return bool
109
+ */
110
+ protected function _isCategoryAttributeChanged(Varien_Object $object)
111
+ {
112
+ foreach (Mage::getStoreConfig('nrapps_idealo/category_attributes') as $attributeCode => $value) {
113
+
114
+ if ($object->getData($attributeCode) != $object->getOrigData($attributeCode)) {
115
+
116
+ return true;
117
+ }
118
+ }
119
+
120
+ return false;
121
+ }
122
+
123
+ /**
124
+ * Get Product Ids by category id
125
+ *
126
+ * @param $categoryId
127
+ * @return array
128
+ */
129
+ protected function _getCategoryChildren($categoryId)
130
+ {
131
+ return $this->getResource()->getProductIds($categoryId);
132
+ }
133
+
134
+ /**
135
+ * @param Mage_Index_Model_Event $event
136
+ */
137
+ protected function _processEvent(Mage_Index_Model_Event $event)
138
+ {
139
+ $data = $event->getNewData();
140
+
141
+ if (isset($data['nrapps_idealo_update_product_ids'])) {
142
+ $productIds = $data['nrapps_idealo_update_product_ids'];
143
+ if (is_array($productIds) && !empty($productIds)) {
144
+
145
+ $this->_initGenerators();
146
+
147
+ foreach($productIds as $productId) {
148
+ $this->_updateIndexForProduct($productId, null, true);
149
+ }
150
+
151
+ foreach($this->_generatorsByStore as $storeGenerators) {
152
+ foreach ($storeGenerators as $generator) {
153
+ /** @var $generator NRApps_Idealo_Model_Generator */
154
+ $generator->generateFile();
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ if (isset($data['nrapps_idealo_delete_product_ids'])) {
161
+ $productIds = $data['nrapps_idealo_delete_product_ids'];
162
+ if (is_array($productIds) && !empty($productIds)) {
163
+
164
+ $this->_initGenerators();
165
+
166
+ foreach($productIds as $productId) {
167
+ $this->_deleteIndexForProduct($productId);
168
+ }
169
+
170
+ foreach($this->_generatorsByStore as $storeGenerators) {
171
+ foreach ($storeGenerators as $generator) {
172
+ /** @var $generator NRApps_Idealo_Model_Generator */
173
+ $generator->generateFile();
174
+ }
175
+ }
176
+ }
177
+ }
178
+
179
+ if (isset($data['nrapps_idealo_recreate_files_needed'])) {
180
+
181
+ $this->_initGenerators(null, true);
182
+
183
+ if (Mage::getStoreConfigFlag('nrapps_idealo/settings/regenerate_files_on_product_save')) {
184
+ foreach($this->_generatorsByStore as $storeGenerators) {
185
+ foreach($storeGenerators as $generator) { /** @var $generator NRApps_Idealo_Model_Generator */
186
+ $generator->generateFile();
187
+ }
188
+ }
189
+ }
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Reindex all feeds
195
+ */
196
+ public function reindexAll()
197
+ {
198
+ $this->_initGenerators();
199
+
200
+ $this->_updateIndexForProducts();
201
+
202
+ foreach($this->_generatorsByStore as $storeGenerators) {
203
+ foreach ($storeGenerators as $generator) {
204
+ /** @var $generator NRApps_Idealo_Model_Generator */
205
+ $generator->generateFile();
206
+ }
207
+ }
208
+
209
+ /* @var $indexProcess Mage_Index_Model_Process */
210
+ $indexProcess = Mage::getModel('index/process')->load('nrapps_idealo', 'indexer_code');
211
+ $indexProcess->setStatus(Mage_Index_Model_Process::STATUS_PENDING)->save();
212
+ }
213
+
214
+ /**
215
+ * Regenerate all feed indices for all products
216
+ */
217
+ protected function _updateIndexForProducts()
218
+ {
219
+ $foundProductId = array();
220
+ foreach($this->_generatorsByStore as $storeId => $storeGenerators) {
221
+
222
+ $pageNumber = 1;
223
+ do {
224
+ $productCollection = $this->_getProductCollection($storeId, $pageNumber++);
225
+
226
+ $appEmulation = Mage::getSingleton('core/app_emulation');
227
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
228
+
229
+ Mage::getSingleton('core/translate')
230
+ ->setLocale(Mage::getStoreConfig('general/locale/code', $storeId))
231
+ ->init('frontend');
232
+
233
+ foreach ($productCollection as $product) {
234
+ /** @var $product Mage_Catalog_Model_Product */
235
+ $this->_updateIndexForProduct($product, $storeId);
236
+ $foundProductId[$product->getId()] = $product->getId();
237
+ }
238
+
239
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
240
+
241
+ } while ($pageNumber <= $productCollection->getLastPageNumber());
242
+ }
243
+
244
+ $outdatedIndexRows = $this->getResource()->getIndexRowsByProductIdsExclude($foundProductId);
245
+
246
+ foreach($outdatedIndexRows as $indexRow) {
247
+ $this->_deleteIndexForProduct($indexRow['product_id'], $indexRow['feed_type'], $indexRow['store_id']);
248
+ }
249
+ }
250
+
251
+ /**
252
+ * Get a collection for all products of a selected store, limited by pageNumber
253
+ *
254
+ * @param int $storeId
255
+ * @param int $pageNumber
256
+ * @return Mage_Catalog_Model_Resource_Product_Collection
257
+ */
258
+ protected function _getProductCollection($storeId, $pageNumber = 1)
259
+ {
260
+ /** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
261
+ $productCollection = Mage::getResourceModel('catalog/product_collection')
262
+ ->addAttributeToSelect('*')
263
+ ->setPageSize(self::PRODUCT_COLLECTION_PAGE_SIZE)
264
+ ->setCurPage($pageNumber)
265
+ ->setStore(Mage::app()->getStore($storeId))
266
+ ->addWebsiteFilter(Mage::app()->getStore($storeId)->getWebsiteId())
267
+ ->setOrder('sku', 'ASC');
268
+
269
+ $attributeSetIds = $this->_getIncludedAttributeSetIds($storeId);
270
+ if (sizeof($attributeSetIds)) {
271
+ $productCollection->addFieldToFilter('attribute_set_id', array('in' => $attributeSetIds));
272
+ }
273
+
274
+ $productTypes = $this->_getIncludedProductTypes($storeId);
275
+ if (sizeof($productTypes)) {
276
+ $productCollection->addFieldToFilter('type_id', array('in' => $productTypes));
277
+ }
278
+
279
+ Mage::dispatchEvent('nrapps_idealo_load_product_collection_before', array('collection' => $productCollection, 'store_id' => $storeId));
280
+
281
+ $this->_addMediaGalleryAttributeToCollection($productCollection, $storeId);
282
+
283
+ Mage::dispatchEvent('nrapps_idealo_load_product_collection_after', array('collection' => $productCollection, 'store_id' => $storeId));
284
+
285
+ return $productCollection;
286
+ }
287
+
288
+ /**
289
+ * @param int $storeId
290
+ * @return array
291
+ */
292
+ protected function _getIncludedAttributeSetIds($storeId)
293
+ {
294
+ $attributeSetIds = explode(',', Mage::getStoreConfig('nrapps_idealo/product_options/allowed_attribute_sets'));
295
+
296
+ if (in_array('all', $attributeSetIds)) {
297
+ return array();
298
+ }
299
+
300
+ return $attributeSetIds;
301
+ }
302
+
303
+ /**
304
+ * @param int $storeId
305
+ * @return array
306
+ */
307
+ protected function _getIncludedProductTypes($storeId)
308
+ {
309
+ $productTypes = explode(',', Mage::getStoreConfig('nrapps_idealo/product_options/allowed_product_types'));
310
+
311
+ if (in_array('all', $productTypes)) {
312
+ return array();
313
+ }
314
+
315
+ return $productTypes;
316
+ }
317
+
318
+ /**
319
+ * @param Mage_Catalog_Model_Resource_Product_Collection $_productCollection
320
+ * @param int $storeId
321
+ * @return Mage_Catalog_Model_Resource_Product_Collection
322
+ */
323
+ protected function _addMediaGalleryAttributeToCollection(Mage_Catalog_Model_Resource_Product_Collection $_productCollection, $storeId)
324
+ {
325
+ $productIds = $_productCollection->getColumnValues('entity_id');
326
+
327
+ if (!sizeof($productIds)) {
328
+ return $_productCollection->load();
329
+ }
330
+
331
+ $_mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'media_gallery')->getAttributeId();
332
+
333
+ /** @var $resource Mage_Core_Model_Resource */
334
+ $resource = Mage::getSingleton('core/resource');
335
+ /** @var $_read Varien_Db_Adapter_Pdo_Mysql */
336
+ $_read = $resource->getConnection('catalog_read');
337
+
338
+ $query = '
339
+ SELECT
340
+ main.entity_id, `main`.`value_id`, `main`.`value` AS `file`,
341
+ `value`.`label`, `value`.`position`, `value`.`disabled`, `default_value`.`label` AS `label_default`,
342
+ `default_value`.`position` AS `position_default`,
343
+ `default_value`.`disabled` AS `disabled_default`
344
+ FROM `' . $resource->getTableName('catalog/product_attribute_media_gallery') . '` AS `main`
345
+ LEFT JOIN `' . $resource->getTableName('catalog/product_attribute_media_gallery_value') . '` AS `value`
346
+ ON main.value_id=value.value_id AND value.store_id=' . $storeId . '
347
+ LEFT JOIN `' . $resource->getTableName('catalog/product_attribute_media_gallery_value') . '` AS `default_value`
348
+ ON main.value_id=default_value.value_id AND default_value.store_id=0
349
+ WHERE (
350
+ main.attribute_id = ' . $_read->quote($_mediaGalleryAttributeId) . ')
351
+ AND (main.entity_id IN (' . $_read->quote($productIds) . '))
352
+ ORDER BY IF(value.position IS NULL, default_value.position, value.position) ASC
353
+ ';
354
+ $_mediaGalleryData = $_read->fetchAll($query);
355
+
356
+ $_mediaGalleryByProductId = array();
357
+ foreach ($_mediaGalleryData as $_galleryImage) {
358
+ $k = $_galleryImage['entity_id'];
359
+ unset($_galleryImage['entity_id']);
360
+ if (!isset($_mediaGalleryByProductId[$k])) {
361
+ $_mediaGalleryByProductId[$k] = array();
362
+ }
363
+ $_mediaGalleryByProductId[$k][] = $_galleryImage;
364
+ }
365
+ unset($_mediaGalleryData);
366
+ foreach ($_productCollection as &$_product) {
367
+ $_productId = $_product->getData('entity_id');
368
+ if (isset($_mediaGalleryByProductId[$_productId])) {
369
+ $_product->setData('media_gallery', array('images' => $_mediaGalleryByProductId[$_productId]));
370
+ }
371
+ }
372
+ unset($_mediaGalleryByProductId);
373
+
374
+ return $_productCollection;
375
+ }
376
+
377
+ /**
378
+ * @param int|Mage_Catalog_Model_Product $product
379
+ * @param int|null $restrictedStoreId
380
+ * @param boolean $forceStoreEmulation
381
+ */
382
+ protected function _updateIndexForProduct($product, $restrictedStoreId = null, $forceStoreEmulation = false)
383
+ {
384
+ foreach($this->_generatorsByStore as $storeId => $storeGenerators) {
385
+ foreach ($storeGenerators as $generator) {
386
+
387
+ if (!is_null($restrictedStoreId) && $storeId != $restrictedStoreId) {
388
+ continue;
389
+ }
390
+
391
+ if ($forceStoreEmulation) {
392
+ $appEmulation = Mage::getSingleton('core/app_emulation');
393
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
394
+ }
395
+
396
+ /** @var $product Mage_Catalog_Model_Product */
397
+ if (!$product instanceof Mage_Catalog_Model_Product || $product->getStoreId() != $storeId) {
398
+ if ($product instanceof Mage_Catalog_Model_Product) {
399
+ $product = $product->getId();
400
+ }
401
+ $product = Mage::getSingleton('catalog/product')
402
+ ->reset()
403
+ ->setStoreId($storeId)
404
+ ->load($product);
405
+ }
406
+
407
+ if (!$product->getId()) {
408
+ $this->_deleteIndexForProduct($product->getId(), null, $storeId);
409
+ continue;
410
+ }
411
+
412
+ if (!$this->_canExportProduct($product, $storeId)) {
413
+ $this->_deleteIndexForProduct($product->getId(), null, $storeId);
414
+ continue;
415
+ }
416
+
417
+ $productData = $generator->getProductData($product);
418
+ $indexData = array(
419
+ 'store_id' => $storeId,
420
+ 'product_id' => $product->getId(),
421
+ 'data' => $productData,
422
+ 'feed_type' => $generator->getFeedType(),
423
+ );
424
+
425
+ $this->getResource()->update($indexData);
426
+
427
+ // index parent product(s)
428
+ if (Mage::getStoreConfig('nrapps_idealo/product_options/configurable_export_type') == NRApps_Idealo_Model_Source_ConfigurableTypes::CONFIGURABLE_TYPE_EXPORT_PARENT
429
+ && $parentProductIds = $product->getParentProductIds()
430
+ ) {
431
+ foreach ($parentProductIds as $parentProductId) {
432
+ $this->_updateIndexForProduct($parentProductId, $restrictedStoreId);
433
+ }
434
+ }
435
+
436
+ if ($forceStoreEmulation) {
437
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
438
+ }
439
+ }
440
+ }
441
+ }
442
+
443
+ /**
444
+ * @param int $productId
445
+ * @param string $feedType
446
+ * @param int|null $storeId
447
+ */
448
+ protected function _deleteIndexForProduct($productId, $feedType = null, $storeId = null)
449
+ {
450
+ if (is_null($feedType)) {
451
+ $this->_deleteIndexForProduct($productId, 'xml', $storeId);
452
+ $this->_deleteIndexForProduct($productId, 'csv', $storeId);
453
+ return;
454
+ }
455
+
456
+ if (is_null($storeId)) {
457
+ foreach (Mage::app()->getStores() as $store) {
458
+ $this->_deleteIndexForProduct($productId, $feedType, $store->getId());
459
+ }
460
+ return;
461
+ }
462
+
463
+ if ($feedType == 'xml') {
464
+ $data = '
465
+ <offer>
466
+ <command>Delete</command>
467
+ <sku>' . $storeId . 'p' . $productId . '</sku>
468
+ </offer>';
469
+
470
+ $this->getResource()->update(array(
471
+ 'store_id' => $storeId,
472
+ 'product_id' => $productId,
473
+ 'feed_type' => $feedType,
474
+ 'data' => $data,
475
+ ), true);
476
+ } else {
477
+ $this->getResource()->deleteByData(array(
478
+ 'store_id' => $storeId,
479
+ 'product_id' => $productId,
480
+ 'feed_type' => $feedType,
481
+ ), true);
482
+ }
483
+ }
484
+
485
+ /**
486
+ * @param Mage_Catalog_Model_Product $product
487
+ * @param int $storeId
488
+ * @return bool
489
+ */
490
+ protected function _canExportProduct($product, $storeId)
491
+ {
492
+ // allow disabling products for feeds: set $product->setData('nrapps_idealo_exclude', true) if you want to exclude a product
493
+ Mage::dispatchEvent('nrapps_idealo_can_export_product', array('product' => $product, 'store_id' => $storeId));
494
+
495
+ if ($product->getData('nrapps_idealo_exclude')) {
496
+ return false;
497
+ }
498
+
499
+ $store = Mage::app()->getStore($storeId);
500
+
501
+ if (!$store->getIsActive() || !Mage::getStoreConfigFlag('nrapps_idealo/settings/is_active', $storeId)) {
502
+ return false;
503
+ }
504
+
505
+ if (!in_array($store->getWebsiteId(), $product->getWebsiteIds())) {
506
+ return false;
507
+ }
508
+
509
+ if ($product->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
510
+ return false;
511
+ }
512
+
513
+ if (!$this->_isAttributeSetAllowed($product->getAttributeSetId(), $storeId)) {
514
+ return false;
515
+ }
516
+
517
+ switch(Mage::getStoreConfig('nrapps_idealo/product_options/configurable_export_type', $storeId)) {
518
+
519
+ case NRApps_Idealo_Model_Source_ConfigurableTypes::CONFIGURABLE_TYPE_NO_EXPORT:
520
+ if ($product->getTypeId() == 'configurable') {
521
+ return false;
522
+ }
523
+ if (!$product->isVisibleInSiteVisibility()) {
524
+ return false;
525
+ }
526
+ break;
527
+
528
+ case NRApps_Idealo_Model_Source_ConfigurableTypes::CONFIGURABLE_TYPE_EXPORT_CHILDREN:
529
+ if ($product->getTypeId() == 'configurable') {
530
+ return false;
531
+ }
532
+ if ($this->_isProductTypeAllowed('configurable', $storeId) && sizeof($parentProductIds = $this->_getConfigurableParentIds($product))) {
533
+ $product->setParentProductIds($parentProductIds);
534
+ } else {
535
+ if (!$product->isVisibleInSiteVisibility()) {
536
+ return false;
537
+ }
538
+ }
539
+ break;
540
+
541
+ case NRApps_Idealo_Model_Source_ConfigurableTypes::CONFIGURABLE_TYPE_EXPORT_PARENT:
542
+ if (!$product->isVisibleInSiteVisibility()) {
543
+ return false;
544
+ }
545
+ break;
546
+ }
547
+
548
+
549
+ if (!Mage::getStoreConfigFlag('cataloginventory/options/show_out_of_stock', $storeId) && !$product->isAvailable() && !$product->isConfigurable()) {
550
+ return false;
551
+ }
552
+
553
+ if (!$this->_isProductTypeAllowed($product->getTypeId(), $storeId)) {
554
+ return false;
555
+ }
556
+
557
+ if (!Mage::getStoreConfig('nrapps_idealo/product_options/export_flexible_price_bundles', $storeId)
558
+ && $product->getTypeId() == 'bundle'
559
+ && !$product->getPriceType()) {
560
+ return false;
561
+ }
562
+
563
+ return true;
564
+ }
565
+
566
+ /**
567
+ * @param int $attributeSetId
568
+ * @param int $storeId
569
+ * @return bool
570
+ */
571
+ protected function _isAttributeSetAllowed($attributeSetId, $storeId)
572
+ {
573
+ $allowedAttributeSetIds = explode(',', Mage::getStoreConfig('nrapps_idealo/product_options/allowed_attribute_sets', $storeId));
574
+
575
+ return in_array(NRApps_Idealo_Model_Source_AttributeSets::ATTRIBUTE_SETS_ALL, $allowedAttributeSetIds)
576
+ || in_array($attributeSetId, $allowedAttributeSetIds);
577
+ }
578
+
579
+ /**
580
+ * @param string $productType
581
+ * @param int $storeId
582
+ * @return bool
583
+ */
584
+ protected function _isProductTypeAllowed($productType, $storeId)
585
+ {
586
+ $allowedProductTypes = explode(',', Mage::getStoreConfig('nrapps_idealo/product_options/allowed_product_types', $storeId));
587
+
588
+ return (in_array('all', $allowedProductTypes) || in_array($productType, $allowedProductTypes));
589
+ }
590
+
591
+ /**
592
+ * @param Mage_Catalog_Model_Product $product
593
+ * @return array
594
+ */
595
+ protected function _getConfigurableParentIds($product)
596
+ {
597
+ return Mage::getModel('catalog/product_type_configurable')
598
+ ->getParentIdsByChild($product->getId());
599
+ }
600
  }
app/code/community/NRApps/Idealo/Model/Observer.php CHANGED
@@ -1,231 +1,231 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Observer
4
- {
5
- /**
6
- * Check if necessary attributes are assigned
7
- *
8
- * @param Varien_Event_Observer $event
9
- * @event admin_session_user_login_success
10
- */
11
- public function onAdminUserLoginSuccess(Varien_Event_Observer $event)
12
- {
13
- Mage::helper('nrapps_idealo')->checkAttributesAssigned();
14
- }
15
-
16
- /**
17
- * Check if any attribute default values have changed. If so, mark feeds which use the attribute(s) as outdated.
18
- *
19
- * @param Varien_Event_Observer $observer
20
- * @event controller_action_predispatch_adminhtml_system_config_save
21
- */
22
- public function onConfigChange(Varien_Event_Observer $observer)
23
- {
24
- /** @var $action Mage_Adminhtml_Controller_Action */
25
- $action = $observer->getControllerAction();
26
-
27
- if ($action->getRequest()->getParam('section') != 'nrapps_idealo') {
28
- return;
29
- }
30
-
31
- $store = $action->getRequest()->getParam('store');
32
- if ($store) {
33
- $storeId = Mage::app()->getStore($store)->getId();
34
- } else {
35
- $storeId = null;
36
- }
37
-
38
- $groupValues = $action->getRequest()->getParam('groups');
39
-
40
- if (intval(Mage::app()->loadCache('nrapps_idealo_install_state')) === intval(NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_CONFIG)) {
41
-
42
- Mage::helper('nrapps_idealo')->setIsInstalled();
43
-
44
- /* @var $indexProcess Mage_Index_Model_Process */
45
- $indexProcess = Mage::getModel('index/process')->load('nrapps_idealo', 'indexer_code');
46
- $indexProcess->setStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX)->save();
47
-
48
- Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('nrapps_idealo')->__(
49
- 'The idealo Connect module has been installed and configured. Please update the <a href="%s">idealo Connect Index</a> now.',
50
- Mage::helper('adminhtml')->getUrl('adminhtml/process/list')
51
- ));
52
-
53
- } else {
54
-
55
- if ($this->_hasUpdatedConfigValues($groupValues, $storeId)) {
56
-
57
- /* @var $indexProcess Mage_Index_Model_Process */
58
- $indexProcess = Mage::getModel('index/process')->load('nrapps_idealo', 'indexer_code');
59
- $indexProcess->setStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX)->save();
60
-
61
- Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('nrapps_idealo')->__(
62
- 'Configuration data has been changed. Please update the <a href="%s">idealo Connect Index</a> now.',
63
- Mage::helper('adminhtml')->getUrl('adminhtml/process/list')
64
- ));
65
- }
66
- }
67
-
68
- if (isset($groupValues['settings']['fields']['is_active']['value']) && Mage::getStoreConfig('nrapps_idealo/settings/is_active', $storeId) != $groupValues['settings']['fields']['is_active']['value']) {
69
-
70
- if ($groupValues['settings']['fields']['is_active']['value']) {
71
- $logMessage = 'idealo Module has been activated.';
72
- } else {
73
- $logMessage = 'idealo Module has been deactivated.';
74
- }
75
- if ($storeId) {
76
- $store = Mage::app()->getStore($storeId);
77
- $logMessage .= ' (Store ' . $store->getName() . ' [' . $store->getCode() . '])';
78
- }
79
- Mage::helper('nrapps_idealo')->log($logMessage, Zend_Log::INFO, 'idealo_activations.txt', true);
80
- }
81
-
82
- $this->_updateAttributes();
83
- }
84
-
85
- /**
86
- * Send keep alive request to idealo and output error if it fails
87
- *
88
- * @param Varien_Event_Observer $observer
89
- * @event controller_action_postdispatch_adminhtml_system_config_save
90
- */
91
- public function afterConfigChange(Varien_Event_Observer $observer)
92
- {
93
- /** @var $action Mage_Adminhtml_Controller_Action */
94
- $action = $observer->getControllerAction();
95
-
96
- if ($action->getRequest()->getParam('section') != 'nrapps_idealo') {
97
- return;
98
- }
99
-
100
- if (Mage::getStoreConfigFlag('nrapps_idealo/settings/test_mode')) {
101
- return;
102
- }
103
-
104
- try {
105
- Mage::getSingleton('nrapps_idealo/api')->sendKeepAlive();
106
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('nrapps_idealo')->__(
107
- 'Connection to idealo API successful.'
108
- ));
109
- } catch (Exception $e) {
110
- Mage::logException($e);
111
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('nrapps_idealo')->__(
112
- 'Connection to idealo API has failed, please check the credentials.'
113
- ));
114
- }
115
-
116
- if (!Mage::getResourceModel('cron/schedule_collection')->getSize()) {
117
- Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('nrapps_idealo')->__(
118
- 'It seems you have no cronjobs running. They are needed for transferring data to idealo. We strongly suggest you setup cronjobs. See <a href="http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job" target="_blank">here</a> for details.'
119
- ));
120
- }
121
- }
122
-
123
- /**
124
- * Translate labels of attributes
125
- */
126
- protected function _updateAttributes()
127
- {
128
- foreach(array_merge(array('nrapps_idealo_exclude' => 'nrapps_idealo_exclude'), Mage::getStoreConfig('nrapps_idealo/attributes')) as $identifierCode => $attributeCode) {
129
- if ($identifierCode == $attributeCode) {
130
- /** @var $attribute Mage_Eav_Model_Entity_Attribute */
131
- $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $attributeCode);
132
- $attributeTitle = $attribute->getFrontendLabel();
133
- $newAttributeTitle = Mage::helper('nrapps_idealo')->__($attributeTitle);
134
- if ($newAttributeTitle != $attributeTitle) {
135
- $this->_getSetup()->updateAttribute('catalog_product', $attributeCode, 'frontend_label', $newAttributeTitle);
136
- }
137
- }
138
- }
139
-
140
- if (is_array(Mage::getStoreConfig('nrapps_idealo/category_attributes'))) {
141
- foreach(array_keys(Mage::getStoreConfig('nrapps_idealo/category_attributes')) as $attributeCode) {
142
- /** @var $attribute Mage_Eav_Model_Entity_Attribute */
143
- $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_category', $attributeCode);
144
- $attributeTitle = $attribute->getFrontendLabel();
145
- $newAttributeTitle = Mage::helper('nrapps_idealo')->__($attributeTitle);
146
- if ($newAttributeTitle != $attributeTitle) {
147
- $this->_getSetup()->updateAttribute('catalog_category', $attributeCode, 'frontend_label', $newAttributeTitle);
148
- }
149
- }
150
- }
151
- }
152
-
153
- public function onAttributesControllerActionPredispatch($observer)
154
- {
155
- if (!Mage::helper('nrapps_idealo')->isInstalled() && Mage::app()->loadCache('nrapps_idealo_install_state')
156
- == NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_START) {
157
-
158
- Mage::app()->saveCache(
159
- NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_ATTRIBUTES,
160
- 'nrapps_idealo_install_state'
161
- );
162
- }
163
- }
164
-
165
- public function onConfigControllerActionPredispatch($observer)
166
- {
167
- if (!Mage::helper('nrapps_idealo')->isInstalled() && Mage::app()->loadCache('nrapps_idealo_install_state')
168
- == NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_ATTRIBUTES) {
169
-
170
- Mage::app()->saveCache(
171
- NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_CONFIG,
172
- 'nrapps_idealo_install_state'
173
- );
174
- }
175
- }
176
-
177
- /**
178
- * @return Mage_Catalog_Model_Resource_Setup
179
- */
180
- protected function _getSetup()
181
- {
182
- return Mage::getResourceModel('catalog/setup', 'catalog_setup');
183
- }
184
-
185
- /**
186
- * Check if any relevant config value has been changed so index has to be rebuilt
187
- *
188
- * @param array $groupValues
189
- * @param int $storeId
190
- * @return bool
191
- */
192
- protected function _hasUpdatedConfigValues($groupValues, $storeId)
193
- {
194
- if (isset($groupValues['settings']['fields']['is_active']['value']) && Mage::getStoreConfig('nrapps_idealo/settings/is_active', $storeId) != $groupValues['settings']['fields']['is_active']['value']) {
195
- return true;
196
- }
197
- foreach(array('default_values', 'shipping', 'product_options', 'minimum_order_surcharge', 'minimum_order_weight_surcharge') as $groupCode) {
198
- if (!isset($groupValues[$groupCode]['fields'])) {
199
- continue;
200
- }
201
- foreach ($groupValues[$groupCode]['fields'] as $fieldName => $fieldData) {
202
- if (isset($fieldData['value'])) {
203
- $fieldValue = $fieldData['value'];
204
- if (is_array($fieldValue)) {
205
- if (isset($fieldValue['__empty'])) {
206
- unset($fieldValue['__empty']);
207
- }
208
- switch($fieldName) {
209
- case 'shipping_comments':
210
- case 'shipping_costs':
211
- case 'shipping_costs_by_weight':
212
- case 'payment_methods':
213
- case 'add_attribute_contents_to_name':
214
- case 'add_attributes_to_export':
215
- $fieldValue = serialize($fieldValue);
216
- break;
217
- default:
218
- $fieldValue = implode(',', $fieldValue);
219
- }
220
- }
221
- $oldFieldValue = Mage::getStoreConfig('nrapps_idealo/' . $groupCode . '/' . $fieldName, $storeId);
222
- if ($oldFieldValue != $fieldValue) {
223
- return true;
224
- }
225
- }
226
- }
227
- }
228
-
229
- return false;
230
- }
231
  }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Observer
4
+ {
5
+ /**
6
+ * Check if necessary attributes are assigned
7
+ *
8
+ * @param Varien_Event_Observer $event
9
+ * @event admin_session_user_login_success
10
+ */
11
+ public function onAdminUserLoginSuccess(Varien_Event_Observer $event)
12
+ {
13
+ Mage::helper('nrapps_idealo')->checkAttributesAssigned();
14
+ }
15
+
16
+ /**
17
+ * Check if any attribute default values have changed. If so, mark feeds which use the attribute(s) as outdated.
18
+ *
19
+ * @param Varien_Event_Observer $observer
20
+ * @event controller_action_predispatch_adminhtml_system_config_save
21
+ */
22
+ public function onConfigChange(Varien_Event_Observer $observer)
23
+ {
24
+ /** @var $action Mage_Adminhtml_Controller_Action */
25
+ $action = $observer->getControllerAction();
26
+
27
+ if ($action->getRequest()->getParam('section') != 'nrapps_idealo') {
28
+ return;
29
+ }
30
+
31
+ $store = $action->getRequest()->getParam('store');
32
+ if ($store) {
33
+ $storeId = Mage::app()->getStore($store)->getId();
34
+ } else {
35
+ $storeId = null;
36
+ }
37
+
38
+ $groupValues = $action->getRequest()->getParam('groups');
39
+
40
+ if (intval(Mage::app()->loadCache('nrapps_idealo_install_state')) === intval(NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_CONFIG)) {
41
+
42
+ Mage::helper('nrapps_idealo')->setIsInstalled();
43
+
44
+ /* @var $indexProcess Mage_Index_Model_Process */
45
+ $indexProcess = Mage::getModel('index/process')->load('nrapps_idealo', 'indexer_code');
46
+ $indexProcess->setStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX)->save();
47
+
48
+ Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('nrapps_idealo')->__(
49
+ 'The idealo Connect module has been installed and configured. Please update the <a href="%s">idealo Connect Index</a> now.',
50
+ Mage::helper('adminhtml')->getUrl('adminhtml/process/list')
51
+ ));
52
+
53
+ } else {
54
+
55
+ if ($this->_hasUpdatedConfigValues($groupValues, $storeId)) {
56
+
57
+ /* @var $indexProcess Mage_Index_Model_Process */
58
+ $indexProcess = Mage::getModel('index/process')->load('nrapps_idealo', 'indexer_code');
59
+ $indexProcess->setStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX)->save();
60
+
61
+ Mage::getSingleton('adminhtml/session')->addNotice(Mage::helper('nrapps_idealo')->__(
62
+ 'Configuration data has been changed. Please update the <a href="%s">idealo Connect Index</a> now.',
63
+ Mage::helper('adminhtml')->getUrl('adminhtml/process/list')
64
+ ));
65
+ }
66
+ }
67
+
68
+ if (isset($groupValues['settings']['fields']['is_active']['value']) && Mage::getStoreConfig('nrapps_idealo/settings/is_active', $storeId) != $groupValues['settings']['fields']['is_active']['value']) {
69
+
70
+ if ($groupValues['settings']['fields']['is_active']['value']) {
71
+ $logMessage = 'idealo Module has been activated.';
72
+ } else {
73
+ $logMessage = 'idealo Module has been deactivated.';
74
+ }
75
+ if ($storeId) {
76
+ $store = Mage::app()->getStore($storeId);
77
+ $logMessage .= ' (Store ' . $store->getName() . ' [' . $store->getCode() . '])';
78
+ }
79
+ Mage::helper('nrapps_idealo')->log($logMessage, Zend_Log::INFO, 'idealo_activations.txt', true);
80
+ }
81
+
82
+ $this->_updateAttributes();
83
+ }
84
+
85
+ /**
86
+ * Send keep alive request to idealo and output error if it fails
87
+ *
88
+ * @param Varien_Event_Observer $observer
89
+ * @event controller_action_postdispatch_adminhtml_system_config_save
90
+ */
91
+ public function afterConfigChange(Varien_Event_Observer $observer)
92
+ {
93
+ /** @var $action Mage_Adminhtml_Controller_Action */
94
+ $action = $observer->getControllerAction();
95
+
96
+ if ($action->getRequest()->getParam('section') != 'nrapps_idealo') {
97
+ return;
98
+ }
99
+
100
+ if (Mage::getStoreConfigFlag('nrapps_idealo/settings/test_mode')) {
101
+ return;
102
+ }
103
+
104
+ try {
105
+ Mage::getSingleton('nrapps_idealo/api')->sendKeepAlive();
106
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('nrapps_idealo')->__(
107
+ 'Connection to idealo API successful.'
108
+ ));
109
+ } catch (Exception $e) {
110
+ Mage::logException($e);
111
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('nrapps_idealo')->__(
112
+ 'Connection to idealo API has failed, please check the credentials.'
113
+ ));
114
+ }
115
+
116
+ if (!Mage::getResourceModel('cron/schedule_collection')->getSize()) {
117
+ Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('nrapps_idealo')->__(
118
+ 'It seems you have no cronjobs running. They are needed for transferring data to idealo. We strongly suggest you setup cronjobs. See <a href="http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job" target="_blank">here</a> for details.'
119
+ ));
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Translate labels of attributes
125
+ */
126
+ protected function _updateAttributes()
127
+ {
128
+ foreach(array_merge(array('nrapps_idealo_exclude' => 'nrapps_idealo_exclude'), Mage::getStoreConfig('nrapps_idealo/attributes')) as $identifierCode => $attributeCode) {
129
+ if ($identifierCode == $attributeCode) {
130
+ /** @var $attribute Mage_Eav_Model_Entity_Attribute */
131
+ $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $attributeCode);
132
+ $attributeTitle = $attribute->getFrontendLabel();
133
+ $newAttributeTitle = Mage::helper('nrapps_idealo')->__($attributeTitle);
134
+ if ($newAttributeTitle != $attributeTitle) {
135
+ $this->_getSetup()->updateAttribute('catalog_product', $attributeCode, 'frontend_label', $newAttributeTitle);
136
+ }
137
+ }
138
+ }
139
+
140
+ if (is_array(Mage::getStoreConfig('nrapps_idealo/category_attributes'))) {
141
+ foreach(array_keys(Mage::getStoreConfig('nrapps_idealo/category_attributes')) as $attributeCode) {
142
+ /** @var $attribute Mage_Eav_Model_Entity_Attribute */
143
+ $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_category', $attributeCode);
144
+ $attributeTitle = $attribute->getFrontendLabel();
145
+ $newAttributeTitle = Mage::helper('nrapps_idealo')->__($attributeTitle);
146
+ if ($newAttributeTitle != $attributeTitle) {
147
+ $this->_getSetup()->updateAttribute('catalog_category', $attributeCode, 'frontend_label', $newAttributeTitle);
148
+ }
149
+ }
150
+ }
151
+ }
152
+
153
+ public function onAttributesControllerActionPredispatch($observer)
154
+ {
155
+ if (!Mage::helper('nrapps_idealo')->isInstalled() && Mage::app()->loadCache('nrapps_idealo_install_state')
156
+ == NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_START) {
157
+
158
+ Mage::app()->saveCache(
159
+ NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_ATTRIBUTES,
160
+ 'nrapps_idealo_install_state'
161
+ );
162
+ }
163
+ }
164
+
165
+ public function onConfigControllerActionPredispatch($observer)
166
+ {
167
+ if (!Mage::helper('nrapps_idealo')->isInstalled() && Mage::app()->loadCache('nrapps_idealo_install_state')
168
+ == NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_ATTRIBUTES) {
169
+
170
+ Mage::app()->saveCache(
171
+ NRApps_Idealo_Block_Adminhtml_Notifications::INSTALL_STATE_CONFIG,
172
+ 'nrapps_idealo_install_state'
173
+ );
174
+ }
175
+ }
176
+
177
+ /**
178
+ * @return Mage_Catalog_Model_Resource_Setup
179
+ */
180
+ protected function _getSetup()
181
+ {
182
+ return Mage::getResourceModel('catalog/setup', 'catalog_setup');
183
+ }
184
+
185
+ /**
186
+ * Check if any relevant config value has been changed so index has to be rebuilt
187
+ *
188
+ * @param array $groupValues
189
+ * @param int $storeId
190
+ * @return bool
191
+ */
192
+ protected function _hasUpdatedConfigValues($groupValues, $storeId)
193
+ {
194
+ if (isset($groupValues['settings']['fields']['is_active']['value']) && Mage::getStoreConfig('nrapps_idealo/settings/is_active', $storeId) != $groupValues['settings']['fields']['is_active']['value']) {
195
+ return true;
196
+ }
197
+ foreach(array('default_values', 'shipping', 'product_options', 'minimum_order_surcharge', 'minimum_order_weight_surcharge') as $groupCode) {
198
+ if (!isset($groupValues[$groupCode]['fields'])) {
199
+ continue;
200
+ }
201
+ foreach ($groupValues[$groupCode]['fields'] as $fieldName => $fieldData) {
202
+ if (isset($fieldData['value'])) {
203
+ $fieldValue = $fieldData['value'];
204
+ if (is_array($fieldValue)) {
205
+ if (isset($fieldValue['__empty'])) {
206
+ unset($fieldValue['__empty']);
207
+ }
208
+ switch($fieldName) {
209
+ case 'shipping_comments':
210
+ case 'shipping_costs':
211
+ case 'shipping_costs_by_weight':
212
+ case 'payment_methods':
213
+ case 'add_attribute_contents_to_name':
214
+ case 'add_attributes_to_export':
215
+ $fieldValue = serialize($fieldValue);
216
+ break;
217
+ default:
218
+ $fieldValue = implode(',', $fieldValue);
219
+ }
220
+ }
221
+ $oldFieldValue = Mage::getStoreConfig('nrapps_idealo/' . $groupCode . '/' . $fieldName, $storeId);
222
+ if ($oldFieldValue != $fieldValue) {
223
+ return true;
224
+ }
225
+ }
226
+ }
227
+ }
228
+
229
+ return false;
230
+ }
231
  }
app/code/community/NRApps/Idealo/Model/Resource/Indexer.php CHANGED
@@ -1,166 +1,166 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Resource_Indexer extends Mage_Core_Model_Resource_Db_Abstract
4
- {
5
- /**
6
- * Init resource model
7
- *
8
- * @return void
9
- */
10
- protected function _construct()
11
- {
12
- $this->_init('nrapps_idealo/index', 'index_id');
13
- }
14
-
15
- /**
16
- * Update single row - only if data has changed
17
- *
18
- * @param array $indexData
19
- * @param boolean $updateExistingRowsOnly
20
- */
21
- public function update($indexData, $updateExistingRowsOnly = false)
22
- {
23
- $existingData = $this->getDataByStoreIdProductIdAndFeedType($indexData['store_id'], $indexData['product_id'], $indexData['feed_type']);
24
- if ($updateExistingRowsOnly && !$existingData) {
25
- return;
26
- }
27
- if ($indexData['data'] === $existingData) {
28
- return;
29
- }
30
- $indexData['is_processed'] = 0;
31
- $indexData['status'] = null;
32
- $indexData['status_message'] = null;
33
- $this->_getWriteAdapter()->insertOnDuplicate($this->getTable('nrapps_idealo/index'), $indexData);
34
- }
35
-
36
- /**
37
- * Mark row as processed, including status
38
- *
39
- * @param int $storeId
40
- * @param int $productId
41
- * @param string $status
42
- * @param string $statusMessage
43
- */
44
- public function markProcessed($storeId, $productId, $status = 'OK', $statusMessage = '')
45
- {
46
- $condition = $this->_getReadAdapter()->quoteInto('store_id = ?', $storeId);
47
- $condition .= ' AND ' . $this->_getReadAdapter()->quoteInto('product_id = ?', $productId);
48
- $condition .= ' AND ' . $this->_getReadAdapter()->quoteInto('feed_type = ?', 'xml');
49
-
50
- $this->_getWriteAdapter()->update(
51
- $this->getTable('nrapps_idealo/index'),
52
- array(
53
- 'is_processed' => 1,
54
- 'status' => $status,
55
- 'status_message' => $statusMessage,
56
- 'transfer_date' => new Zend_Db_Expr('NOW()'),
57
- ),
58
- $condition
59
- );
60
- }
61
-
62
- /**
63
- * @param array $indexData
64
- */
65
- public function deleteByData($indexData)
66
- {
67
- $deleteWhere = array();
68
- foreach($indexData as $key => $value) {
69
- $deleteWhere[$key . ' = ?'] = $value;
70
- }
71
- $this->_getWriteAdapter()->delete($this->getTable('nrapps_idealo/index'), $deleteWhere);
72
- }
73
-
74
- /**
75
- * @param int $storeId
76
- */
77
- public function deleteFeedData($storeId)
78
- {
79
- $this->deleteByData(array('store_id' => $storeId));
80
- }
81
-
82
- /**
83
- * @param int $storeId
84
- * @param int $productId
85
- * @param string $feedType
86
- * @return string
87
- */
88
- public function getDataByStoreIdProductIdAndFeedType($storeId, $productId, $feedType)
89
- {
90
- $condition = $this->_getReadAdapter()->quoteInto('store_id = ?', $storeId)
91
- . ' AND ' . $this->_getReadAdapter()->quoteInto('product_id = ?', $productId)
92
- . ' AND ' . $this->_getReadAdapter()->quoteInto('feed_type = ?', $feedType)
93
- ;
94
- $select = $this->_getReadAdapter()->select()
95
- ->from($this->getTable('nrapps_idealo/index'), array('data'))
96
- ->where($condition);
97
-
98
- return $this->_getReadAdapter()->fetchOne($select);
99
- }
100
-
101
- /**
102
- * @param int $storeId
103
- * @return array
104
- */
105
- public function getDataByStoreId($storeId)
106
- {
107
- $condition = $this->_getReadAdapter()->quoteInto('store_id = ?', $storeId);
108
- $select = $this->_getReadAdapter()->select()
109
- ->from($this->getTable('nrapps_idealo/index'), array('data'))
110
- ->where($condition);
111
-
112
- return $this->_getReadAdapter()->fetchAll($select);
113
- }
114
-
115
- /**
116
- * @param int $storeId
117
- * @param int $limit
118
- * @return array
119
- */
120
- public function getDataToProcess($storeId = null, $limit = null)
121
- {
122
- $condition = $this->_getReadAdapter()->quoteInto('is_processed != ?', 1);
123
- if (!is_null($storeId)) {
124
- $condition .= ' AND ' . $this->_getReadAdapter()->quoteInto('store_id = ?', $storeId);
125
- }
126
- $condition .= ' AND ' . $this->_getReadAdapter()->quoteInto('feed_type = ?', 'xml');
127
-
128
- $select = $this->_getReadAdapter()->select()
129
- ->from($this->getTable('nrapps_idealo/index'), array('*'))
130
- ->where($condition);
131
-
132
- if ($limit) {
133
- $select->limit($limit);
134
- }
135
-
136
- return $this->_getReadAdapter()->fetchAll($select);
137
- }
138
-
139
- public function getIndexRowsByProductIdsExclude($productIds)
140
- {
141
- $condition = $this->_getReadAdapter()->quoteInto('product_id NOT IN (?)', $productIds);
142
-
143
- $select = $this->_getReadAdapter()->select()
144
- ->from($this->getTable('nrapps_idealo/index'), array('product_id', 'store_id'))
145
- ->where($condition);
146
-
147
- return $this->_getReadAdapter()->fetchAll($select);
148
- }
149
-
150
- /**
151
- * Retrieve product category identifiers
152
- *
153
- * @param int $categoryId
154
- * @return array
155
- */
156
- public function getProductIds($categoryId)
157
- {
158
- $adapter = $this->_getReadAdapter();
159
-
160
- $select = $adapter->select()
161
- ->from($this->getTable('catalog/category_product'), 'product_id')
162
- ->where('category_id = ?', (int)$categoryId);
163
-
164
- return $adapter->fetchCol($select);
165
- }
166
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Resource_Indexer extends Mage_Core_Model_Resource_Db_Abstract
4
+ {
5
+ /**
6
+ * Init resource model
7
+ *
8
+ * @return void
9
+ */
10
+ protected function _construct()
11
+ {
12
+ $this->_init('nrapps_idealo/index', 'index_id');
13
+ }
14
+
15
+ /**
16
+ * Update single row - only if data has changed
17
+ *
18
+ * @param array $indexData
19
+ * @param boolean $updateExistingRowsOnly
20
+ */
21
+ public function update($indexData, $updateExistingRowsOnly = false)
22
+ {
23
+ $existingData = $this->getDataByStoreIdProductIdAndFeedType($indexData['store_id'], $indexData['product_id'], $indexData['feed_type']);
24
+ if ($updateExistingRowsOnly && !$existingData) {
25
+ return;
26
+ }
27
+ if ($indexData['data'] === $existingData) {
28
+ return;
29
+ }
30
+ $indexData['is_processed'] = 0;
31
+ $indexData['status'] = null;
32
+ $indexData['status_message'] = null;
33
+ $this->_getWriteAdapter()->insertOnDuplicate($this->getTable('nrapps_idealo/index'), $indexData);
34
+ }
35
+
36
+ /**
37
+ * Mark row as processed, including status
38
+ *
39
+ * @param int $storeId
40
+ * @param int $productId
41
+ * @param string $status
42
+ * @param string $statusMessage
43
+ */
44
+ public function markProcessed($storeId, $productId, $status = 'OK', $statusMessage = '')
45
+ {
46
+ $condition = $this->_getReadAdapter()->quoteInto('store_id = ?', $storeId);
47
+ $condition .= ' AND ' . $this->_getReadAdapter()->quoteInto('product_id = ?', $productId);
48
+ $condition .= ' AND ' . $this->_getReadAdapter()->quoteInto('feed_type = ?', 'xml');
49
+
50
+ $this->_getWriteAdapter()->update(
51
+ $this->getTable('nrapps_idealo/index'),
52
+ array(
53
+ 'is_processed' => 1,
54
+ 'status' => $status,
55
+ 'status_message' => $statusMessage,
56
+ 'transfer_date' => new Zend_Db_Expr('NOW()'),
57
+ ),
58
+ $condition
59
+ );
60
+ }
61
+
62
+ /**
63
+ * @param array $indexData
64
+ */
65
+ public function deleteByData($indexData)
66
+ {
67
+ $deleteWhere = array();
68
+ foreach($indexData as $key => $value) {
69
+ $deleteWhere[$key . ' = ?'] = $value;
70
+ }
71
+ $this->_getWriteAdapter()->delete($this->getTable('nrapps_idealo/index'), $deleteWhere);
72
+ }
73
+
74
+ /**
75
+ * @param int $storeId
76
+ */
77
+ public function deleteFeedData($storeId)
78
+ {
79
+ $this->deleteByData(array('store_id' => $storeId));
80
+ }
81
+
82
+ /**
83
+ * @param int $storeId
84
+ * @param int $productId
85
+ * @param string $feedType
86
+ * @return string
87
+ */
88
+ public function getDataByStoreIdProductIdAndFeedType($storeId, $productId, $feedType)
89
+ {
90
+ $condition = $this->_getReadAdapter()->quoteInto('store_id = ?', $storeId)
91
+ . ' AND ' . $this->_getReadAdapter()->quoteInto('product_id = ?', $productId)
92
+ . ' AND ' . $this->_getReadAdapter()->quoteInto('feed_type = ?', $feedType)
93
+ ;
94
+ $select = $this->_getReadAdapter()->select()
95
+ ->from($this->getTable('nrapps_idealo/index'), array('data'))
96
+ ->where($condition);
97
+
98
+ return $this->_getReadAdapter()->fetchOne($select);
99
+ }
100
+
101
+ /**
102
+ * @param int $storeId
103
+ * @return array
104
+ */
105
+ public function getDataByStoreId($storeId)
106
+ {
107
+ $condition = $this->_getReadAdapter()->quoteInto('store_id = ?', $storeId);
108
+ $select = $this->_getReadAdapter()->select()
109
+ ->from($this->getTable('nrapps_idealo/index'), array('data'))
110
+ ->where($condition);
111
+
112
+ return $this->_getReadAdapter()->fetchAll($select);
113
+ }
114
+
115
+ /**
116
+ * @param int $storeId
117
+ * @param int $limit
118
+ * @return array
119
+ */
120
+ public function getDataToProcess($storeId = null, $limit = null)
121
+ {
122
+ $condition = $this->_getReadAdapter()->quoteInto('is_processed != ?', 1);
123
+ if (!is_null($storeId)) {
124
+ $condition .= ' AND ' . $this->_getReadAdapter()->quoteInto('store_id = ?', $storeId);
125
+ }
126
+ $condition .= ' AND ' . $this->_getReadAdapter()->quoteInto('feed_type = ?', 'xml');
127
+
128
+ $select = $this->_getReadAdapter()->select()
129
+ ->from($this->getTable('nrapps_idealo/index'), array('*'))
130
+ ->where($condition);
131
+
132
+ if ($limit) {
133
+ $select->limit($limit);
134
+ }
135
+
136
+ return $this->_getReadAdapter()->fetchAll($select);
137
+ }
138
+
139
+ public function getIndexRowsByProductIdsExclude($productIds)
140
+ {
141
+ $condition = $this->_getReadAdapter()->quoteInto('product_id NOT IN (?)', $productIds);
142
+
143
+ $select = $this->_getReadAdapter()->select()
144
+ ->from($this->getTable('nrapps_idealo/index'), array('product_id', 'store_id'))
145
+ ->where($condition);
146
+
147
+ return $this->_getReadAdapter()->fetchAll($select);
148
+ }
149
+
150
+ /**
151
+ * Retrieve product category identifiers
152
+ *
153
+ * @param int $categoryId
154
+ * @return array
155
+ */
156
+ public function getProductIds($categoryId)
157
+ {
158
+ $adapter = $this->_getReadAdapter();
159
+
160
+ $select = $adapter->select()
161
+ ->from($this->getTable('catalog/category_product'), 'product_id')
162
+ ->where('category_id = ?', (int)$categoryId);
163
+
164
+ return $adapter->fetchCol($select);
165
+ }
166
+ }
app/code/community/NRApps/Idealo/Model/Source/AttributeSets.php CHANGED
@@ -1,44 +1,44 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_AttributeSets
4
- {
5
- const ATTRIBUTE_SETS_ALL = 'all';
6
-
7
- /**
8
- * Options getter
9
- *
10
- * @return array
11
- */
12
- public function toOptionArray()
13
- {
14
- $options = array(
15
- array('value' => self::ATTRIBUTE_SETS_ALL, 'label' => Mage::helper('nrapps_idealo')->__('All')),
16
- );
17
-
18
- /** @var $product Mage_Catalog_Model_Product */
19
- $product = Mage::getSingleton('catalog/product');
20
- /** @var $attributeSetCollection Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection */
21
- $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')
22
- ->setEntityTypeFilter($product->getResource()->getEntityType()->getId());
23
-
24
- foreach($attributeSetCollection as $attributeSet) { /** @var $attributeSet Mage_Eav_Model_Entity_Attribute_Set */
25
- $options[] = array('value' => $attributeSet->getId(), 'label' => $attributeSet->getAttributeSetName());
26
- }
27
-
28
- return $options;
29
- }
30
-
31
- /**
32
- * Get options in "key-value" format
33
- *
34
- * @return array
35
- */
36
- public function toArray()
37
- {
38
- $options = array();
39
- foreach($this->toOptionArray() as $option) {
40
- $options[$option['value']] = $option['label'];
41
- }
42
- return $options;
43
- }
44
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_AttributeSets
4
+ {
5
+ const ATTRIBUTE_SETS_ALL = 'all';
6
+
7
+ /**
8
+ * Options getter
9
+ *
10
+ * @return array
11
+ */
12
+ public function toOptionArray()
13
+ {
14
+ $options = array(
15
+ array('value' => self::ATTRIBUTE_SETS_ALL, 'label' => Mage::helper('nrapps_idealo')->__('All')),
16
+ );
17
+
18
+ /** @var $product Mage_Catalog_Model_Product */
19
+ $product = Mage::getSingleton('catalog/product');
20
+ /** @var $attributeSetCollection Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection */
21
+ $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')
22
+ ->setEntityTypeFilter($product->getResource()->getEntityType()->getId());
23
+
24
+ foreach($attributeSetCollection as $attributeSet) { /** @var $attributeSet Mage_Eav_Model_Entity_Attribute_Set */
25
+ $options[] = array('value' => $attributeSet->getId(), 'label' => $attributeSet->getAttributeSetName());
26
+ }
27
+
28
+ return $options;
29
+ }
30
+
31
+ /**
32
+ * Get options in "key-value" format
33
+ *
34
+ * @return array
35
+ */
36
+ public function toArray()
37
+ {
38
+ $options = array();
39
+ foreach($this->toOptionArray() as $option) {
40
+ $options[$option['value']] = $option['label'];
41
+ }
42
+ return $options;
43
+ }
44
+ }
app/code/community/NRApps/Idealo/Model/Source/ConfigurableChildProductsPriceType.php CHANGED
@@ -1,59 +1,59 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_ConfigurableChildProductsPriceType extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
- {
5
- const PRICE_TYPE_PARENT_WITH_MODIFICATIONS = 'parent';
6
- const PRICE_TYPE_PARENT_WITHOUT_MODIFICATIONS = 'parent_without';
7
- const PRICE_TYPE_CHILD = 'child';
8
-
9
- public function getOptionArray()
10
- {
11
- $options = array();
12
- foreach($this->getAllOptions() as $option) {
13
- $options[$option['value']] = $option['label'];
14
- }
15
- return $options;
16
- }
17
-
18
- /**
19
- * Method used for configuration
20
- *
21
- * @return array
22
- */
23
- public function toOptionArray()
24
- {
25
- $options = array();
26
- foreach($this->getAllOptions() as $option) {
27
- if ($option['value']) {
28
- $options[$option['value']] = $option['label'];
29
- }
30
- }
31
- return $options;
32
- }
33
-
34
- /**
35
- * Method used for product attribute
36
- *
37
- * @return array
38
- */
39
- public function getAllOptions()
40
- {
41
- if (!$this->_options) {
42
- $this->_options = array(
43
- array(
44
- 'value' => self::PRICE_TYPE_PARENT_WITH_MODIFICATIONS,
45
- 'label' => Mage::helper('nrapps_idealo')->__('Price of parent product with modifications (Magento Default)'),
46
- ),
47
- array(
48
- 'value' => self::PRICE_TYPE_PARENT_WITHOUT_MODIFICATIONS,
49
- 'label' => Mage::helper('nrapps_idealo')->__('Price of parent product without modifications'),
50
- ),
51
- array(
52
- 'value' => self::PRICE_TYPE_CHILD,
53
- 'label' => Mage::helper('nrapps_idealo')->__('Price of child product (i.e. with BCP, SCP)'),
54
- ),
55
- );
56
- }
57
- return $this->_options;
58
- }
59
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_ConfigurableChildProductsPriceType extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
+ {
5
+ const PRICE_TYPE_PARENT_WITH_MODIFICATIONS = 'parent';
6
+ const PRICE_TYPE_PARENT_WITHOUT_MODIFICATIONS = 'parent_without';
7
+ const PRICE_TYPE_CHILD = 'child';
8
+
9
+ public function getOptionArray()
10
+ {
11
+ $options = array();
12
+ foreach($this->getAllOptions() as $option) {
13
+ $options[$option['value']] = $option['label'];
14
+ }
15
+ return $options;
16
+ }
17
+
18
+ /**
19
+ * Method used for configuration
20
+ *
21
+ * @return array
22
+ */
23
+ public function toOptionArray()
24
+ {
25
+ $options = array();
26
+ foreach($this->getAllOptions() as $option) {
27
+ if ($option['value']) {
28
+ $options[$option['value']] = $option['label'];
29
+ }
30
+ }
31
+ return $options;
32
+ }
33
+
34
+ /**
35
+ * Method used for product attribute
36
+ *
37
+ * @return array
38
+ */
39
+ public function getAllOptions()
40
+ {
41
+ if (!$this->_options) {
42
+ $this->_options = array(
43
+ array(
44
+ 'value' => self::PRICE_TYPE_PARENT_WITH_MODIFICATIONS,
45
+ 'label' => Mage::helper('nrapps_idealo')->__('Price of parent product with modifications (Magento Default)'),
46
+ ),
47
+ array(
48
+ 'value' => self::PRICE_TYPE_PARENT_WITHOUT_MODIFICATIONS,
49
+ 'label' => Mage::helper('nrapps_idealo')->__('Price of parent product without modifications'),
50
+ ),
51
+ array(
52
+ 'value' => self::PRICE_TYPE_CHILD,
53
+ 'label' => Mage::helper('nrapps_idealo')->__('Price of child product (i.e. with BCP, SCP)'),
54
+ ),
55
+ );
56
+ }
57
+ return $this->_options;
58
+ }
59
+ }
app/code/community/NRApps/Idealo/Model/Source/ConfigurableTypes.php CHANGED
@@ -1,27 +1,27 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_ConfigurableTypes
4
- {
5
- const CONFIGURABLE_TYPE_EXPORT_CHILDREN = 'export_children';
6
- const CONFIGURABLE_TYPE_EXPORT_PARENT = 'export_parent';
7
- const CONFIGURABLE_TYPE_NO_EXPORT = 'no_export';
8
-
9
- /**
10
- * Fetch options array
11
- *
12
- * @return array
13
- */
14
- public function getOptionArray()
15
- {
16
- return array(
17
- self::CONFIGURABLE_TYPE_EXPORT_CHILDREN => Mage::helper('nrapps_idealo')->__('Export Children Products'),
18
- self::CONFIGURABLE_TYPE_EXPORT_PARENT => Mage::helper('nrapps_idealo')->__('Export Parent Product'),
19
- self::CONFIGURABLE_TYPE_NO_EXPORT => Mage::helper('nrapps_idealo')->__('No Export'),
20
- );
21
- }
22
-
23
- public function toOptionArray()
24
- {
25
- return $this->getOptionArray();
26
- }
27
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_ConfigurableTypes
4
+ {
5
+ const CONFIGURABLE_TYPE_EXPORT_CHILDREN = 'export_children';
6
+ const CONFIGURABLE_TYPE_EXPORT_PARENT = 'export_parent';
7
+ const CONFIGURABLE_TYPE_NO_EXPORT = 'no_export';
8
+
9
+ /**
10
+ * Fetch options array
11
+ *
12
+ * @return array
13
+ */
14
+ public function getOptionArray()
15
+ {
16
+ return array(
17
+ self::CONFIGURABLE_TYPE_EXPORT_CHILDREN => Mage::helper('nrapps_idealo')->__('Export Children Products'),
18
+ self::CONFIGURABLE_TYPE_EXPORT_PARENT => Mage::helper('nrapps_idealo')->__('Export Parent Product'),
19
+ self::CONFIGURABLE_TYPE_NO_EXPORT => Mage::helper('nrapps_idealo')->__('No Export'),
20
+ );
21
+ }
22
+
23
+ public function toOptionArray()
24
+ {
25
+ return $this->getOptionArray();
26
+ }
27
+ }
app/code/community/NRApps/Idealo/Model/Source/FeedAttributes.php CHANGED
@@ -1,105 +1,105 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_FeedAttributes
4
- {
5
- protected $_options;
6
-
7
- public function getAllOptions()
8
- {
9
- if (!$this->_options) {
10
- $this->_options = array(
11
- 'manufacturer' => new Varien_Object(array(
12
- 'code' => 'manufacturer',
13
- 'label' => Mage::helper('nrapps_idealo')->__('Manufacturer'),
14
- 'type' => array('select', 'text'),
15
- )),
16
- 'delivery_time' => new Varien_Object(array(
17
- 'code' => 'delivery_time',
18
- 'label' => Mage::helper('nrapps_idealo')->__('Delivery Time'),
19
- 'type' => array('select', 'text'),
20
- )),
21
- 'shipping_cost' => new Varien_Object(array(
22
- 'code' => 'shipping_cost',
23
- 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost'),
24
- 'type' => 'price',
25
- 'note' => Mage::helper('nrapps_idealo')->__('Leave empty to use default'),
26
- )),
27
- 'shipping_comment' => new Varien_Object(array(
28
- 'code' => 'shipping_comment',
29
- 'label' => Mage::helper('nrapps_idealo')->__('Shipping Comment'),
30
- 'type' => 'text',
31
- 'note' => Mage::helper('nrapps_idealo')->__('Comment on shipping of article or methods of payment offered'),
32
- )),
33
- 'oen' => new Varien_Object(array(
34
- 'code' => 'oen',
35
- 'label' => Mage::helper('nrapps_idealo')->__('OEN'),
36
- 'type' => 'text',
37
- 'note' => Mage::helper('nrapps_idealo')->__('Original replacement part number consisting of manufacturer\'s initials and identifier code, separated by a comma'),
38
- )),
39
- 'kba' => new Varien_Object(array(
40
- 'code' => 'kba',
41
- 'label' => Mage::helper('nrapps_idealo')->__('KBA'),
42
- 'type' => 'text',
43
- 'note' => Mage::helper('nrapps_idealo')->__('Kraftfahrt-Bundesamt (KBA) number, i.e. German Federal Motor Transport Authority number, consisting of the 4 digits in the Manufacturer Key Number and the first 3 characters in the Type Key Number'),
44
- )),
45
- 'ean' => new Varien_Object(array(
46
- 'code' => 'ean',
47
- 'label' => Mage::helper('nrapps_idealo')->__('EAN'),
48
- 'type' => 'text',
49
- 'note' => Mage::helper('nrapps_idealo')->__('EAN/GTIN of the offer, improves allocation to product catalogue. ISBN numbers can also be given here'),
50
- )),
51
- 'han' => new Varien_Object(array(
52
- 'code' => 'han',
53
- 'label' => Mage::helper('nrapps_idealo')->__('HAN'),
54
- 'type' => 'text',
55
- 'note' => Mage::helper('nrapps_idealo')->__('Article number defined by manufacturer, improves allocation to product catalogue'),
56
- )),
57
- 'pzn' => new Varien_Object(array(
58
- 'code' => 'pzn',
59
- 'label' => Mage::helper('nrapps_idealo')->__('PZN'),
60
- 'type' => 'text',
61
- 'note' => Mage::helper('nrapps_idealo')->__('Central Pharmaceutical Number of offer (only for medical offers)'),
62
- )),
63
- 'is_used' => new Varien_Object(array(
64
- 'code' => 'is_used',
65
- 'label' => Mage::helper('nrapps_idealo')->__('Is Used'),
66
- 'type' => 'yesno',
67
- 'note' => Mage::helper('nrapps_idealo')->__('Marks offers that are not new (e.g. returns, demonstration model, opened packaging, etc.)'),
68
- )),
69
- 'is_rebuild' => new Varien_Object(array(
70
- 'code' => 'is_rebuild',
71
- 'label' => Mage::helper('nrapps_idealo')->__('Is Rebuild'),
72
- 'type' => 'yesno',
73
- 'note' => Mage::helper('nrapps_idealo')->__('Marks offers that are a replica of products by another manufacturer. This mark-up is necessary if the original product comes up in the offer title (e.g. "Quality battery compatible with Canon HK-2222")'),
74
- )),
75
- 'has_contract' => new Varien_Object(array(
76
- 'code' => 'has_contract',
77
- 'label' => Mage::helper('nrapps_idealo')->__('Has Contract'),
78
- 'type' => 'yesno',
79
- 'note' => Mage::helper('nrapps_idealo')->__('Marks offers that can only be acquired through signing a contract (e.g. mobile phones)'),
80
- )),
81
- 'is_ecommerce_checkout_approved' => new Varien_Object(array(
82
- 'code' => 'is_ecommerce_checkout_approved',
83
- 'label' => Mage::helper('nrapps_idealo')->__('idealo direct sale allowed'),
84
- 'type' => 'yesno',
85
- )),
86
- 'merchant' => new Varien_Object(array(
87
- 'code' => 'merchant',
88
- 'label' => Mage::helper('nrapps_idealo')->__('Merchant'),
89
- 'type' => array('select', 'text'),
90
- 'note' => Mage::helper('nrapps_idealo')->__('Merchant name (for resellers or marketplace merchants)'),
91
- )),
92
- );
93
- }
94
- return $this->_options;
95
- }
96
-
97
- public function getOption($value)
98
- {
99
- $options = $this->getAllOptions();
100
- if (isset($options[$value])) {
101
- return $options[$value];
102
- }
103
- return new Varien_Object();
104
- }
105
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_FeedAttributes
4
+ {
5
+ protected $_options;
6
+
7
+ public function getAllOptions()
8
+ {
9
+ if (!$this->_options) {
10
+ $this->_options = array(
11
+ 'manufacturer' => new Varien_Object(array(
12
+ 'code' => 'manufacturer',
13
+ 'label' => Mage::helper('nrapps_idealo')->__('Manufacturer'),
14
+ 'type' => array('select', 'text'),
15
+ )),
16
+ 'delivery_time' => new Varien_Object(array(
17
+ 'code' => 'delivery_time',
18
+ 'label' => Mage::helper('nrapps_idealo')->__('Delivery Time'),
19
+ 'type' => array('select', 'text'),
20
+ )),
21
+ 'shipping_cost' => new Varien_Object(array(
22
+ 'code' => 'shipping_cost',
23
+ 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost'),
24
+ 'type' => 'price',
25
+ 'note' => Mage::helper('nrapps_idealo')->__('Leave empty to use default'),
26
+ )),
27
+ 'shipping_comment' => new Varien_Object(array(
28
+ 'code' => 'shipping_comment',
29
+ 'label' => Mage::helper('nrapps_idealo')->__('Shipping Comment'),
30
+ 'type' => 'text',
31
+ 'note' => Mage::helper('nrapps_idealo')->__('Comment on shipping of article or methods of payment offered'),
32
+ )),
33
+ 'oen' => new Varien_Object(array(
34
+ 'code' => 'oen',
35
+ 'label' => Mage::helper('nrapps_idealo')->__('OEN'),
36
+ 'type' => 'text',
37
+ 'note' => Mage::helper('nrapps_idealo')->__('Original replacement part number consisting of manufacturer\'s initials and identifier code, separated by a comma'),
38
+ )),
39
+ 'kba' => new Varien_Object(array(
40
+ 'code' => 'kba',
41
+ 'label' => Mage::helper('nrapps_idealo')->__('KBA'),
42
+ 'type' => 'text',
43
+ 'note' => Mage::helper('nrapps_idealo')->__('Kraftfahrt-Bundesamt (KBA) number, i.e. German Federal Motor Transport Authority number, consisting of the 4 digits in the Manufacturer Key Number and the first 3 characters in the Type Key Number'),
44
+ )),
45
+ 'ean' => new Varien_Object(array(
46
+ 'code' => 'ean',
47
+ 'label' => Mage::helper('nrapps_idealo')->__('EAN'),
48
+ 'type' => 'text',
49
+ 'note' => Mage::helper('nrapps_idealo')->__('EAN/GTIN of the offer, improves allocation to product catalogue. ISBN numbers can also be given here'),
50
+ )),
51
+ 'han' => new Varien_Object(array(
52
+ 'code' => 'han',
53
+ 'label' => Mage::helper('nrapps_idealo')->__('HAN'),
54
+ 'type' => 'text',
55
+ 'note' => Mage::helper('nrapps_idealo')->__('Article number defined by manufacturer, improves allocation to product catalogue'),
56
+ )),
57
+ 'pzn' => new Varien_Object(array(
58
+ 'code' => 'pzn',
59
+ 'label' => Mage::helper('nrapps_idealo')->__('PZN'),
60
+ 'type' => 'text',
61
+ 'note' => Mage::helper('nrapps_idealo')->__('Central Pharmaceutical Number of offer (only for medical offers)'),
62
+ )),
63
+ 'is_used' => new Varien_Object(array(
64
+ 'code' => 'is_used',
65
+ 'label' => Mage::helper('nrapps_idealo')->__('Is Used'),
66
+ 'type' => 'yesno',
67
+ 'note' => Mage::helper('nrapps_idealo')->__('Marks offers that are not new (e.g. returns, demonstration model, opened packaging, etc.)'),
68
+ )),
69
+ 'is_rebuild' => new Varien_Object(array(
70
+ 'code' => 'is_rebuild',
71
+ 'label' => Mage::helper('nrapps_idealo')->__('Is Rebuild'),
72
+ 'type' => 'yesno',
73
+ 'note' => Mage::helper('nrapps_idealo')->__('Marks offers that are a replica of products by another manufacturer. This mark-up is necessary if the original product comes up in the offer title (e.g. "Quality battery compatible with Canon HK-2222")'),
74
+ )),
75
+ 'has_contract' => new Varien_Object(array(
76
+ 'code' => 'has_contract',
77
+ 'label' => Mage::helper('nrapps_idealo')->__('Has Contract'),
78
+ 'type' => 'yesno',
79
+ 'note' => Mage::helper('nrapps_idealo')->__('Marks offers that can only be acquired through signing a contract (e.g. mobile phones)'),
80
+ )),
81
+ 'is_ecommerce_checkout_approved' => new Varien_Object(array(
82
+ 'code' => 'is_ecommerce_checkout_approved',
83
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo direct sale allowed'),
84
+ 'type' => 'yesno',
85
+ )),
86
+ 'merchant' => new Varien_Object(array(
87
+ 'code' => 'merchant',
88
+ 'label' => Mage::helper('nrapps_idealo')->__('Merchant'),
89
+ 'type' => array('select', 'text'),
90
+ 'note' => Mage::helper('nrapps_idealo')->__('Merchant name (for resellers or marketplace merchants)'),
91
+ )),
92
+ );
93
+ }
94
+ return $this->_options;
95
+ }
96
+
97
+ public function getOption($value)
98
+ {
99
+ $options = $this->getAllOptions();
100
+ if (isset($options[$value])) {
101
+ return $options[$value];
102
+ }
103
+ return new Varien_Object();
104
+ }
105
+ }
app/code/community/NRApps/Idealo/Model/Source/ListingCountries.php CHANGED
@@ -1,78 +1,78 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_ListingCountries extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
- {
5
- const LISTING_COUNTRY_DE = 'DE';
6
- const LISTING_COUNTRY_AT = 'AT';
7
- const LISTING_COUNTRY_UK = 'UK';
8
- const LISTING_COUNTRY_FR = 'FR';
9
- const LISTING_COUNTRY_IT = 'IT';
10
- const LISTING_COUNTRY_ES = 'ES';
11
- const LISTING_COUNTRY_PL = 'PL';
12
- const LISTING_COUNTRY_IN = 'IN';
13
-
14
- public function getOptionArray()
15
- {
16
- $options = array();
17
- foreach($this->getAllOptions() as $option) {
18
- $options[$option['value']] = $option['label'];
19
- }
20
- return $options;
21
- }
22
-
23
- /**
24
- * Method used for configuration
25
- *
26
- * @return array
27
- */
28
- public function toOptionArray()
29
- {
30
- return $this->getAllOptions();
31
- }
32
-
33
- /**
34
- * Method used for product attribute
35
- *
36
- * @return array
37
- */
38
- public function getAllOptions()
39
- {
40
- if (!$this->_options) {
41
- $this->_options = array(
42
- array(
43
- 'value' => self::LISTING_COUNTRY_DE,
44
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.de'),
45
- ),
46
- array(
47
- 'value' => self::LISTING_COUNTRY_AT,
48
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.at'),
49
- ),
50
- array(
51
- 'value' => self::LISTING_COUNTRY_UK,
52
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.co.uk'),
53
- ),
54
- array(
55
- 'value' => self::LISTING_COUNTRY_FR,
56
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.fr'),
57
- ),
58
- array(
59
- 'value' => self::LISTING_COUNTRY_IT,
60
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.it'),
61
- ),
62
- array(
63
- 'value' => self::LISTING_COUNTRY_ES,
64
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.es'),
65
- ),
66
- array(
67
- 'value' => self::LISTING_COUNTRY_PL,
68
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.pl'),
69
- ),
70
- array(
71
- 'value' => self::LISTING_COUNTRY_IN,
72
- 'label' => Mage::helper('nrapps_idealo')->__('idealo.in'),
73
- ),
74
- );
75
- }
76
- return $this->_options;
77
- }
78
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_ListingCountries extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
+ {
5
+ const LISTING_COUNTRY_DE = 'DE';
6
+ const LISTING_COUNTRY_AT = 'AT';
7
+ const LISTING_COUNTRY_UK = 'UK';
8
+ const LISTING_COUNTRY_FR = 'FR';
9
+ const LISTING_COUNTRY_IT = 'IT';
10
+ const LISTING_COUNTRY_ES = 'ES';
11
+ const LISTING_COUNTRY_PL = 'PL';
12
+ const LISTING_COUNTRY_IN = 'IN';
13
+
14
+ public function getOptionArray()
15
+ {
16
+ $options = array();
17
+ foreach($this->getAllOptions() as $option) {
18
+ $options[$option['value']] = $option['label'];
19
+ }
20
+ return $options;
21
+ }
22
+
23
+ /**
24
+ * Method used for configuration
25
+ *
26
+ * @return array
27
+ */
28
+ public function toOptionArray()
29
+ {
30
+ return $this->getAllOptions();
31
+ }
32
+
33
+ /**
34
+ * Method used for product attribute
35
+ *
36
+ * @return array
37
+ */
38
+ public function getAllOptions()
39
+ {
40
+ if (!$this->_options) {
41
+ $this->_options = array(
42
+ array(
43
+ 'value' => self::LISTING_COUNTRY_DE,
44
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.de'),
45
+ ),
46
+ array(
47
+ 'value' => self::LISTING_COUNTRY_AT,
48
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.at'),
49
+ ),
50
+ array(
51
+ 'value' => self::LISTING_COUNTRY_UK,
52
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.co.uk'),
53
+ ),
54
+ array(
55
+ 'value' => self::LISTING_COUNTRY_FR,
56
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.fr'),
57
+ ),
58
+ array(
59
+ 'value' => self::LISTING_COUNTRY_IT,
60
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.it'),
61
+ ),
62
+ array(
63
+ 'value' => self::LISTING_COUNTRY_ES,
64
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.es'),
65
+ ),
66
+ array(
67
+ 'value' => self::LISTING_COUNTRY_PL,
68
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.pl'),
69
+ ),
70
+ array(
71
+ 'value' => self::LISTING_COUNTRY_IN,
72
+ 'label' => Mage::helper('nrapps_idealo')->__('idealo.in'),
73
+ ),
74
+ );
75
+ }
76
+ return $this->_options;
77
+ }
78
+ }
app/code/community/NRApps/Idealo/Model/Source/PaymentMethods.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_PaymentMethods
4
- {
5
- const PAYMENT_METHOD_INVOICE = 'INVOICE';
6
- const PAYMENT_METHOD_CREDITCARD = 'CREDITCARD';
7
- const PAYMENT_METHOD_PREPAID = 'PREPAID';
8
- const PAYMENT_METHOD_PAYPAL = 'PAYPAL';
9
- const PAYMENT_METHOD_DEBIT = 'DIRECTDEBIT';
10
- const PAYMENT_METHOD_CASHONDELIVERY = 'COD';
11
- const PAYMENT_METHOD_SOFORTUEBERWEISUNG = 'SOFORTUEBERWEISUNG';
12
- const PAYMENT_METHOD_GIROPAY = 'GIROPAY';
13
- const PAYMENT_METHOD_MONEYBOOKERS = 'MONEYBOOKERS';
14
- const PAYMENT_METHOD_CLICKANDBUY = 'CLICKANDBUY';
15
- const PAYMENT_METHOD_PAYSAFECARD = 'PAYSAFECARD';
16
- const PAYMENT_METHOD_GOOGLECHECKOUT = 'GOOGLECHECKOUT';
17
- const PAYMENT_METHOD_POSTALORDER = 'POSTALORDER';
18
- const PAYMENT_METHOD_EPS = 'EPS';
19
- const PAYMENT_METHOD_ICLEAR = 'ICLEAR';
20
-
21
- /**
22
- * @return array
23
- */
24
- public function getOptionArray()
25
- {
26
- return array(
27
- self::PAYMENT_METHOD_PREPAID => Mage::helper('nrapps_idealo')->__('Prepaid'),
28
- self::PAYMENT_METHOD_CASHONDELIVERY => Mage::helper('nrapps_idealo')->__('Cash on Delivery'),
29
- self::PAYMENT_METHOD_DEBIT => Mage::helper('nrapps_idealo')->__('Debit Payment'),
30
- self::PAYMENT_METHOD_PAYPAL => Mage::helper('nrapps_idealo')->__('PayPal'),
31
- self::PAYMENT_METHOD_INVOICE => Mage::helper('nrapps_idealo')->__('Invoice'),
32
- self::PAYMENT_METHOD_CREDITCARD => Mage::helper('nrapps_idealo')->__('Credit Card'),
33
- self::PAYMENT_METHOD_SOFORTUEBERWEISUNG => Mage::helper('nrapps_idealo')->__('Bank transfer via Sofort'),
34
- self::PAYMENT_METHOD_GIROPAY => Mage::helper('nrapps_idealo')->__('Giropay'),
35
- self::PAYMENT_METHOD_MONEYBOOKERS => Mage::helper('nrapps_idealo')->__('Moneybookers'),
36
- self::PAYMENT_METHOD_CLICKANDBUY => Mage::helper('nrapps_idealo')->__('Click & Buy'),
37
- self::PAYMENT_METHOD_PAYSAFECARD => Mage::helper('nrapps_idealo')->__('paysafecard'),
38
- self::PAYMENT_METHOD_GOOGLECHECKOUT => Mage::helper('nrapps_idealo')->__('Google Checkout'),
39
- self::PAYMENT_METHOD_POSTALORDER => Mage::helper('nrapps_idealo')->__('Payment by post'),
40
- self::PAYMENT_METHOD_EPS => Mage::helper('nrapps_idealo')->__('e-payment standard (Austria)'),
41
- self::PAYMENT_METHOD_ICLEAR => Mage::helper('nrapps_idealo')->__('iclear'),
42
- );
43
- }
44
-
45
- /**
46
- * @param string $option
47
- * @return string
48
- */
49
- public function getOptionLabel($option)
50
- {
51
- foreach($this->getOptionArray() as $optionCode => $optionLabel) {
52
- if ($option == $optionCode) {
53
- return $optionLabel;
54
- }
55
- }
56
- return '';
57
- }
58
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_PaymentMethods
4
+ {
5
+ const PAYMENT_METHOD_INVOICE = 'INVOICE';
6
+ const PAYMENT_METHOD_CREDITCARD = 'CREDITCARD';
7
+ const PAYMENT_METHOD_PREPAID = 'PREPAID';
8
+ const PAYMENT_METHOD_PAYPAL = 'PAYPAL';
9
+ const PAYMENT_METHOD_DEBIT = 'DIRECTDEBIT';
10
+ const PAYMENT_METHOD_CASHONDELIVERY = 'COD';
11
+ const PAYMENT_METHOD_SOFORTUEBERWEISUNG = 'SOFORTUEBERWEISUNG';
12
+ const PAYMENT_METHOD_GIROPAY = 'GIROPAY';
13
+ const PAYMENT_METHOD_MONEYBOOKERS = 'MONEYBOOKERS';
14
+ const PAYMENT_METHOD_CLICKANDBUY = 'CLICKANDBUY';
15
+ const PAYMENT_METHOD_PAYSAFECARD = 'PAYSAFECARD';
16
+ const PAYMENT_METHOD_GOOGLECHECKOUT = 'GOOGLECHECKOUT';
17
+ const PAYMENT_METHOD_POSTALORDER = 'POSTALORDER';
18
+ const PAYMENT_METHOD_EPS = 'EPS';
19
+ const PAYMENT_METHOD_ICLEAR = 'ICLEAR';
20
+
21
+ /**
22
+ * @return array
23
+ */
24
+ public function getOptionArray()
25
+ {
26
+ return array(
27
+ self::PAYMENT_METHOD_PREPAID => Mage::helper('nrapps_idealo')->__('Prepaid'),
28
+ self::PAYMENT_METHOD_CASHONDELIVERY => Mage::helper('nrapps_idealo')->__('Cash on Delivery'),
29
+ self::PAYMENT_METHOD_DEBIT => Mage::helper('nrapps_idealo')->__('Debit Payment'),
30
+ self::PAYMENT_METHOD_PAYPAL => Mage::helper('nrapps_idealo')->__('PayPal'),
31
+ self::PAYMENT_METHOD_INVOICE => Mage::helper('nrapps_idealo')->__('Invoice'),
32
+ self::PAYMENT_METHOD_CREDITCARD => Mage::helper('nrapps_idealo')->__('Credit Card'),
33
+ self::PAYMENT_METHOD_SOFORTUEBERWEISUNG => Mage::helper('nrapps_idealo')->__('Bank transfer via Sofort'),
34
+ self::PAYMENT_METHOD_GIROPAY => Mage::helper('nrapps_idealo')->__('Giropay'),
35
+ self::PAYMENT_METHOD_MONEYBOOKERS => Mage::helper('nrapps_idealo')->__('Moneybookers'),
36
+ self::PAYMENT_METHOD_CLICKANDBUY => Mage::helper('nrapps_idealo')->__('Click & Buy'),
37
+ self::PAYMENT_METHOD_PAYSAFECARD => Mage::helper('nrapps_idealo')->__('paysafecard'),
38
+ self::PAYMENT_METHOD_GOOGLECHECKOUT => Mage::helper('nrapps_idealo')->__('Google Checkout'),
39
+ self::PAYMENT_METHOD_POSTALORDER => Mage::helper('nrapps_idealo')->__('Payment by post'),
40
+ self::PAYMENT_METHOD_EPS => Mage::helper('nrapps_idealo')->__('e-payment standard (Austria)'),
41
+ self::PAYMENT_METHOD_ICLEAR => Mage::helper('nrapps_idealo')->__('iclear'),
42
+ );
43
+ }
44
+
45
+ /**
46
+ * @param string $option
47
+ * @return string
48
+ */
49
+ public function getOptionLabel($option)
50
+ {
51
+ foreach($this->getOptionArray() as $optionCode => $optionLabel) {
52
+ if ($option == $optionCode) {
53
+ return $optionLabel;
54
+ }
55
+ }
56
+ return '';
57
+ }
58
+ }
app/code/community/NRApps/Idealo/Model/Source/PercentalSurchargeCalculationMethod.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_PercentalSurchargeCalculationMethod extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
- {
5
- const CALCULATION_METHOD_PRODUCT_PRICE = 'product';
6
- const CALCULATION_METHOD_PRODUCT_PRICE_AND_SHIPPING_COST = 'product_shipping';
7
-
8
- public function getOptionArray()
9
- {
10
- $options = array();
11
- foreach($this->getAllOptions() as $option) {
12
- $options[$option['value']] = $option['label'];
13
- }
14
- return $options;
15
- }
16
-
17
- /**
18
- * Method used for configuration
19
- *
20
- * @return array
21
- */
22
- public function toOptionArray()
23
- {
24
- $options = array();
25
- foreach($this->getAllOptions() as $option) {
26
- if ($option['value']) {
27
- $options[$option['value']] = $option['label'];
28
- }
29
- }
30
- return $options;
31
- }
32
-
33
- /**
34
- * Method used for product attribute
35
- *
36
- * @return array
37
- */
38
- public function getAllOptions()
39
- {
40
- if (!$this->_options) {
41
- $this->_options = array(
42
- array(
43
- 'value' => self::CALCULATION_METHOD_PRODUCT_PRICE,
44
- 'label' => Mage::helper('nrapps_idealo')->__('Based on Product Price'),
45
- ),
46
- array(
47
- 'value' => self::CALCULATION_METHOD_PRODUCT_PRICE_AND_SHIPPING_COST,
48
- 'label' => Mage::helper('nrapps_idealo')->__('Based on Product Price plus Shipping Cost'),
49
- ),
50
- );
51
- }
52
- return $this->_options;
53
- }
54
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_PercentalSurchargeCalculationMethod extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
+ {
5
+ const CALCULATION_METHOD_PRODUCT_PRICE = 'product';
6
+ const CALCULATION_METHOD_PRODUCT_PRICE_AND_SHIPPING_COST = 'product_shipping';
7
+
8
+ public function getOptionArray()
9
+ {
10
+ $options = array();
11
+ foreach($this->getAllOptions() as $option) {
12
+ $options[$option['value']] = $option['label'];
13
+ }
14
+ return $options;
15
+ }
16
+
17
+ /**
18
+ * Method used for configuration
19
+ *
20
+ * @return array
21
+ */
22
+ public function toOptionArray()
23
+ {
24
+ $options = array();
25
+ foreach($this->getAllOptions() as $option) {
26
+ if ($option['value']) {
27
+ $options[$option['value']] = $option['label'];
28
+ }
29
+ }
30
+ return $options;
31
+ }
32
+
33
+ /**
34
+ * Method used for product attribute
35
+ *
36
+ * @return array
37
+ */
38
+ public function getAllOptions()
39
+ {
40
+ if (!$this->_options) {
41
+ $this->_options = array(
42
+ array(
43
+ 'value' => self::CALCULATION_METHOD_PRODUCT_PRICE,
44
+ 'label' => Mage::helper('nrapps_idealo')->__('Based on Product Price'),
45
+ ),
46
+ array(
47
+ 'value' => self::CALCULATION_METHOD_PRODUCT_PRICE_AND_SHIPPING_COST,
48
+ 'label' => Mage::helper('nrapps_idealo')->__('Based on Product Price plus Shipping Cost'),
49
+ ),
50
+ );
51
+ }
52
+ return $this->_options;
53
+ }
54
+ }
app/code/community/NRApps/Idealo/Model/Source/ProductAttributes.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_ProductAttributes
4
- {
5
-
6
- /**
7
- * @return array
8
- */
9
- public function getOptionArray()
10
- {
11
- $options = array();
12
- /** @var Mage_Eav_Model_Entity_Attribute_Abstract[] $attributes */
13
- $attributes = Mage::getResourceModel('catalog/product')
14
- ->loadAllAttributes()
15
- ->getAttributesByCode();
16
- foreach($attributes as $attribute) {
17
- $options[$attribute->getAttributeCode()] = $attribute->getFrontend()->getLabel() . ' [' . $attribute->getAttributeCode() . ']';
18
- }
19
- asort($options);
20
-
21
- return $options;
22
- }
23
-
24
- /**
25
- * @param string $option
26
- * @return string
27
- */
28
- public function getOptionLabel($option)
29
- {
30
- foreach($this->getOptionArray() as $optionCode => $optionLabel) {
31
- if ($option == $optionCode) {
32
- return $optionLabel;
33
- }
34
- }
35
- return '';
36
- }
37
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_ProductAttributes
4
+ {
5
+
6
+ /**
7
+ * @return array
8
+ */
9
+ public function getOptionArray()
10
+ {
11
+ $options = array();
12
+ /** @var Mage_Eav_Model_Entity_Attribute_Abstract[] $attributes */
13
+ $attributes = Mage::getResourceModel('catalog/product')
14
+ ->loadAllAttributes()
15
+ ->getAttributesByCode();
16
+ foreach($attributes as $attribute) {
17
+ $options[$attribute->getAttributeCode()] = $attribute->getFrontend()->getLabel() . ' [' . $attribute->getAttributeCode() . ']';
18
+ }
19
+ asort($options);
20
+
21
+ return $options;
22
+ }
23
+
24
+ /**
25
+ * @param string $option
26
+ * @return string
27
+ */
28
+ public function getOptionLabel($option)
29
+ {
30
+ foreach($this->getOptionArray() as $optionCode => $optionLabel) {
31
+ if ($option == $optionCode) {
32
+ return $optionLabel;
33
+ }
34
+ }
35
+ return '';
36
+ }
37
+ }
app/code/community/NRApps/Idealo/Model/Source/ProductTypes.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_ProductTypes
4
- {
5
-
6
- /**
7
- * Options getter
8
- *
9
- * @return array
10
- */
11
- public function toOptionArray()
12
- {
13
- return array(
14
- array(
15
- 'value' => 'all',
16
- 'label' => Mage::helper('nrapps_idealo')->__('All')
17
- ),
18
- array(
19
- 'value' => 'simple',
20
- 'label' => Mage::helper('catalog')->__('Simple Product')
21
- ),
22
- array(
23
- 'value' => 'virtual',
24
- 'label' => Mage::helper('catalog')->__('Virtual Product')
25
- ),
26
- array(
27
- 'value' => 'downloadable',
28
- 'label' => Mage::helper('catalog')->__('Downloadable Product')
29
- ),
30
- array(
31
- 'value' => 'grouped',
32
- 'label' => Mage::helper('catalog')->__('Grouped Product')
33
- ),
34
- array(
35
- 'value' => 'configurable',
36
- 'label' => Mage::helper('catalog')->__('Configurable Product')
37
- ),
38
- array(
39
- 'value' => 'bundle',
40
- 'label' => Mage::helper('catalog')->__('Bundle Product')
41
- ),
42
- );
43
- }
44
-
45
- /**
46
- * Get options in "key-value" format
47
- *
48
- * @return array
49
- */
50
- public function toArray()
51
- {
52
- $options = array();
53
- foreach($this->toOptionArray() as $option) {
54
- $options[$option['value']] = $option['label'];
55
- }
56
- return $options;
57
- }
58
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_ProductTypes
4
+ {
5
+
6
+ /**
7
+ * Options getter
8
+ *
9
+ * @return array
10
+ */
11
+ public function toOptionArray()
12
+ {
13
+ return array(
14
+ array(
15
+ 'value' => 'all',
16
+ 'label' => Mage::helper('nrapps_idealo')->__('All')
17
+ ),
18
+ array(
19
+ 'value' => 'simple',
20
+ 'label' => Mage::helper('catalog')->__('Simple Product')
21
+ ),
22
+ array(
23
+ 'value' => 'virtual',
24
+ 'label' => Mage::helper('catalog')->__('Virtual Product')
25
+ ),
26
+ array(
27
+ 'value' => 'downloadable',
28
+ 'label' => Mage::helper('catalog')->__('Downloadable Product')
29
+ ),
30
+ array(
31
+ 'value' => 'grouped',
32
+ 'label' => Mage::helper('catalog')->__('Grouped Product')
33
+ ),
34
+ array(
35
+ 'value' => 'configurable',
36
+ 'label' => Mage::helper('catalog')->__('Configurable Product')
37
+ ),
38
+ array(
39
+ 'value' => 'bundle',
40
+ 'label' => Mage::helper('catalog')->__('Bundle Product')
41
+ ),
42
+ );
43
+ }
44
+
45
+ /**
46
+ * Get options in "key-value" format
47
+ *
48
+ * @return array
49
+ */
50
+ public function toArray()
51
+ {
52
+ $options = array();
53
+ foreach($this->toOptionArray() as $option) {
54
+ $options[$option['value']] = $option['label'];
55
+ }
56
+ return $options;
57
+ }
58
+ }
app/code/community/NRApps/Idealo/Model/Source/ShippingCostsMethod.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_ShippingCostsMethod extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
- {
5
- const SHIPPING_COSTS_BY_PRICE = 'price';
6
- const SHIPPING_COSTS_BY_WEIGHT = 'weight';
7
-
8
- public function getOptionArray()
9
- {
10
- $options = array();
11
- foreach($this->getAllOptions() as $option) {
12
- $options[$option['value']] = $option['label'];
13
- }
14
- return $options;
15
- }
16
-
17
- /**
18
- * Method used for configuration
19
- *
20
- * @return array
21
- */
22
- public function toOptionArray()
23
- {
24
- $options = array();
25
- foreach($this->getAllOptions() as $option) {
26
- if ($option['value']) {
27
- $options[$option['value']] = $option['label'];
28
- }
29
- }
30
- return $options;
31
- }
32
-
33
- /**
34
- * Method used for product attribute
35
- *
36
- * @return array
37
- */
38
- public function getAllOptions()
39
- {
40
- if (!$this->_options) {
41
- $this->_options = array(
42
- array(
43
- 'value' => self::SHIPPING_COSTS_BY_PRICE,
44
- 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost based on Price'),
45
- ),
46
- array(
47
- 'value' => self::SHIPPING_COSTS_BY_WEIGHT,
48
- 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost based on Weight'),
49
- ),
50
- );
51
- }
52
- return $this->_options;
53
- }
54
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_ShippingCostsMethod extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
4
+ {
5
+ const SHIPPING_COSTS_BY_PRICE = 'price';
6
+ const SHIPPING_COSTS_BY_WEIGHT = 'weight';
7
+
8
+ public function getOptionArray()
9
+ {
10
+ $options = array();
11
+ foreach($this->getAllOptions() as $option) {
12
+ $options[$option['value']] = $option['label'];
13
+ }
14
+ return $options;
15
+ }
16
+
17
+ /**
18
+ * Method used for configuration
19
+ *
20
+ * @return array
21
+ */
22
+ public function toOptionArray()
23
+ {
24
+ $options = array();
25
+ foreach($this->getAllOptions() as $option) {
26
+ if ($option['value']) {
27
+ $options[$option['value']] = $option['label'];
28
+ }
29
+ }
30
+ return $options;
31
+ }
32
+
33
+ /**
34
+ * Method used for product attribute
35
+ *
36
+ * @return array
37
+ */
38
+ public function getAllOptions()
39
+ {
40
+ if (!$this->_options) {
41
+ $this->_options = array(
42
+ array(
43
+ 'value' => self::SHIPPING_COSTS_BY_PRICE,
44
+ 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost based on Price'),
45
+ ),
46
+ array(
47
+ 'value' => self::SHIPPING_COSTS_BY_WEIGHT,
48
+ 'label' => Mage::helper('nrapps_idealo')->__('Shipping Cost based on Weight'),
49
+ ),
50
+ );
51
+ }
52
+ return $this->_options;
53
+ }
54
+ }
app/code/community/NRApps/Idealo/Model/Source/Store.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
-
3
- class NRApps_Idealo_Model_Source_Store extends Mage_Eav_Model_Entity_Attribute_Source_Table
4
- {
5
- public function getOptionArray()
6
- {
7
- $options = array();
8
- foreach($this->getAllOptions() as $option) {
9
- $options[$option['value']] = $option['label'];
10
- }
11
- return $options;
12
- }
13
-
14
-
15
- public function getAllOptions()
16
- {
17
- if (!$this->_options) {
18
- $this->_options = Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false);
19
- }
20
- return $this->_options;
21
- }
22
-
23
- public function getOptionText($value)
24
- {
25
- if(!$value)$value ='0';
26
- $isMultiple = false;
27
- if (strpos($value, ',')) {
28
- $isMultiple = true;
29
- $value = explode(',', $value);
30
- }
31
-
32
- if (!$this->_options) {
33
- $collection = Mage::getResourceModel('core/store_collection');
34
- $this->_options = $collection->load()->toOptionArray();
35
- }
36
-
37
- if ($isMultiple) {
38
- $values = array();
39
- foreach ($value as $val) {
40
- $values[] = $this->_options[$val];
41
- }
42
- return $values;
43
- }
44
- else {
45
- return $this->_options[$value];
46
- }
47
- return false;
48
- }
49
- }
1
+ <?php
2
+
3
+ class NRApps_Idealo_Model_Source_Store extends Mage_Eav_Model_Entity_Attribute_Source_Table
4
+ {
5
+ public function getOptionArray()
6
+ {
7
+ $options = array();
8
+ foreach($this->getAllOptions() as $option) {
9
+ $options[$option['value']] = $option['label'];
10
+ }
11
+ return $options;
12
+ }
13
+
14
+
15
+ public function getAllOptions()
16
+ {
17
+ if (!$this->_options) {
18
+ $this->_options = Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false);
19
+ }
20
+ return $this->_options;
21
+ }
22
+
23
+ public function getOptionText($value)
24
+ {
25
+ if(!$value)$value ='0';
26
+ $isMultiple = false;
27
+ if (strpos($value, ',')) {
28
+ $isMultiple = true;
29
+ $value = explode(',', $value);
30
+ }
31
+
32
+ if (!$this->_options) {
33
+ $collection = Mage::getResourceModel('core/store_collection');
34
+ $this->_options = $collection->load()->toOptionArray();
35
+ }
36
+
37
+ if ($isMultiple) {
38
+ $values = array();
39
+ foreach ($value as $val) {
40
+ $values[] = $this->_options[$val];
41
+ }
42
+ return $values;
43
+ }
44
+ else {
45
+ return $this->_options[$value];
46
+ }
47
+ return false;
48
+ }
49
+ }
app/code/community/NRApps/Idealo/Model/Source/YesNoDefault.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
- class NRApps_Idealo_Model_Source_YesNoDefault extends Mage_Eav_Model_Entity_Attribute_Source_Boolean
3
- {
4
- /**
5
- * Retrieve all attribute options
6
- *
7
- * @return array
8
- */
9
- public function getAllOptions()
10
- {
11
- if (!$this->_options) {
12
- $this->_options = array(
13
- array(
14
- 'label' => Mage::helper('catalog')->__('Yes'),
15
- 'value' => 1
16
- ),
17
- array(
18
- 'label' => Mage::helper('catalog')->__('No'),
19
- 'value' => 0
20
- ),
21
- array(
22
- 'label' => Mage::helper('catalog')->__('Use config'),
23
- 'value' => ''
24
- ),
25
- );
26
- }
27
- return $this->_options;
28
- }
29
- }
1
+ <?php
2
+ class NRApps_Idealo_Model_Source_YesNoDefault extends Mage_Eav_Model_Entity_Attribute_Source_Boolean
3
+ {
4
+ /**
5
+ * Retrieve all attribute options
6
+ *
7
+ * @return array
8
+ */
9
+ public function getAllOptions()
10
+ {
11
+ if (!$this->_options) {
12
+ $this->_options = array(
13
+ array(
14
+ 'label' => Mage::helper('catalog')->__('Yes'),
15
+ 'value' => 1
16
+ ),
17
+ array(
18
+ 'label' => Mage::helper('catalog')->__('No'),
19
+ 'value' => 0
20
+ ),
21
+ array(
22
+ 'label' => Mage::helper('catalog')->__('Use config'),
23
+ 'value' => ''
24
+ ),
25
+ );
26
+ }
27
+ return $this->_options;
28
+ }
29
+ }
app/code/community/NRApps/Idealo/controllers/Adminhtml/Idealo/AttributesController.php CHANGED
@@ -1,104 +1,104 @@
1
- <?php
2
- class NRApps_Idealo_Adminhtml_Idealo_AttributesController extends Mage_Adminhtml_Controller_Action
3
- {
4
- public function indexAction()
5
- {
6
- $this->_title($this->__('idealo Connect'))
7
- ->_title($this->__('Manage Attributes'));
8
-
9
- $this->loadLayout();
10
-
11
- $this->getLayout()
12
- ->getBlock('content')
13
- ->append($this->getLayout()->createBlock('nrapps_idealo/adminhtml_attributes'));
14
-
15
- $this->_setActiveMenu('system/nrapps_idealo/attributes');
16
-
17
- $this->_addBreadcrumb(
18
- Mage::helper('nrapps_idealo')->__('idealo Connect'),
19
- Mage::helper('nrapps_idealo')->__('idealo Connect')
20
- );
21
- $this->_addBreadcrumb(
22
- Mage::helper('nrapps_idealo')->__('Manage Attributes'),
23
- Mage::helper('nrapps_idealo')->__('Manage Attributes')
24
- );
25
-
26
- $this->renderLayout();
27
- }
28
-
29
- /**
30
- * Basic action: setup save action
31
- *
32
- * @return void
33
- */
34
- public function saveAction()
35
- {
36
- if ($this->getRequest()->isPost()) {
37
-
38
- // Set (translated) default value for delivery time
39
- if (!Mage::getStoreConfig('nrapps_idealo/default_values/delivery_time')) {
40
- $this->_getSetup()->setConfigData(
41
- 'nrapps_idealo/default_values/delivery_time',
42
- $this->__('on stock')
43
- );
44
- }
45
-
46
- $attributes = $this->getRequest()->getParam('attribute');
47
- $existingAttributeCode = $this->getRequest()->getParam('existing_attribute');
48
- $newAttributeType = $this->getRequest()->getParam('new_attribute_type');
49
-
50
- $createdAttributes = 0;
51
- $updatedAttributeCodes = array();
52
- foreach($attributes as $attributeCode => $action) {
53
- if ($action == 'existing') {
54
- if (Mage::getStoreConfig('nrapps_idealo/attributes/' . $attributeCode) != $existingAttributeCode[$attributeCode]) {
55
- $this->_getSetup()->setConfigData('nrapps_idealo/attributes/' . $attributeCode, $existingAttributeCode[$attributeCode]);
56
- $updatedAttributeCodes[] = $attributeCode;
57
- }
58
- } else if ($action == 'create') {
59
- Mage::getSingleton('nrapps_idealo/attribute')->createAttribute($attributeCode, $newAttributeType[$attributeCode]);
60
- $this->_getSetup()->setConfigData('nrapps_idealo/attributes/' . $attributeCode, $attributeCode);
61
- $updatedAttributeCodes[] = $attributeCode;
62
- $createdAttributes++;
63
- } else if ($action == 'none') {
64
- $this->_getSetup()->setConfigData('nrapps_idealo/attributes/' . $attributeCode, 'none');
65
- }
66
-
67
- }
68
-
69
- if (sizeof($updatedAttributeCodes)) {
70
- /** @todo */
71
- //Mage::helper('nrapps_idealo')->checkForOutdatedFeeds($updatedAttributeCodes);
72
- Mage::app()->getCacheInstance()->cleanType('config');
73
- }
74
-
75
- if ($createdAttributes) {
76
- $this->_getSession()->addSuccess($this->__('%s attributes have been created. You can fill them on the product edit page in the tab "idealo".', $createdAttributes));
77
- }
78
-
79
- if (!Mage::helper('nrapps_idealo')->isInstalled()) {
80
- $this->_getSession()->addSuccess($this->__('The attributes have been assigned. Please choose the default settings now.'));
81
- $this->_getSession()->addNotice($this->__('If you see an error here, please logout and login again.'));
82
- $this->_redirect('*/idealo_settings/');
83
- } else {
84
- $this->_getSession()->addSuccess($this->__('The attributes have been assigned.'));
85
- $this->_redirectReferer();
86
- }
87
- } else {
88
- $this->_redirectReferer();
89
- }
90
- }
91
-
92
- /**
93
- * @return Mage_Catalog_Model_Resource_Setup
94
- */
95
- protected function _getSetup()
96
- {
97
- return Mage::getResourceModel('catalog/setup', 'catalog_setup');
98
- }
99
-
100
- protected function _isAllowed()
101
- {
102
- return Mage::getSingleton('admin/session')->isAllowed('system/nrapps_idealo/attributes');
103
- }
104
- }
1
+ <?php
2
+ class NRApps_Idealo_Adminhtml_Idealo_AttributesController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->_title($this->__('idealo Connect'))
7
+ ->_title($this->__('Manage Attributes'));
8
+
9
+ $this->loadLayout();
10
+
11
+ $this->getLayout()
12
+ ->getBlock('content')
13
+ ->append($this->getLayout()->createBlock('nrapps_idealo/adminhtml_attributes'));
14
+
15
+ $this->_setActiveMenu('system/nrapps_idealo/attributes');
16
+
17
+ $this->_addBreadcrumb(
18
+ Mage::helper('nrapps_idealo')->__('idealo Connect'),
19
+ Mage::helper('nrapps_idealo')->__('idealo Connect')
20
+ );
21
+ $this->_addBreadcrumb(
22
+ Mage::helper('nrapps_idealo')->__('Manage Attributes'),
23
+ Mage::helper('nrapps_idealo')->__('Manage Attributes')
24
+ );
25
+
26
+ $this->renderLayout();
27
+ }
28
+
29
+ /**
30
+ * Basic action: setup save action
31
+ *
32
+ * @return void
33
+ */
34
+ public function saveAction()
35
+ {
36
+ if ($this->getRequest()->isPost()) {
37
+
38
+ // Set (translated) default value for delivery time
39
+ if (!Mage::getStoreConfig('nrapps_idealo/default_values/delivery_time')) {
40
+ $this->_getSetup()->setConfigData(
41
+ 'nrapps_idealo/default_values/delivery_time',
42
+ $this->__('on stock')
43
+ );
44
+ }
45
+
46
+ $attributes = $this->getRequest()->getParam('attribute');
47
+ $existingAttributeCode = $this->getRequest()->getParam('existing_attribute');
48
+ $newAttributeType = $this->getRequest()->getParam('new_attribute_type');
49
+
50
+ $createdAttributes = 0;
51
+ $updatedAttributeCodes = array();
52
+ foreach($attributes as $attributeCode => $action) {
53
+ if ($action == 'existing') {
54
+ if (Mage::getStoreConfig('nrapps_idealo/attributes/' . $attributeCode) != $existingAttributeCode[$attributeCode]) {
55
+ $this->_getSetup()->setConfigData('nrapps_idealo/attributes/' . $attributeCode, $existingAttributeCode[$attributeCode]);
56
+ $updatedAttributeCodes[] = $attributeCode;
57
+ }
58
+ } else if ($action == 'create') {
59
+ Mage::getSingleton('nrapps_idealo/attribute')->createAttribute($attributeCode, $newAttributeType[$attributeCode]);
60
+ $this->_getSetup()->setConfigData('nrapps_idealo/attributes/' . $attributeCode, $attributeCode);
61
+ $updatedAttributeCodes[] = $attributeCode;
62
+ $createdAttributes++;
63
+ } else if ($action == 'none') {
64
+ $this->_getSetup()->setConfigData('nrapps_idealo/attributes/' . $attributeCode, 'none');
65
+ }
66
+
67
+ }
68
+
69
+ if (sizeof($updatedAttributeCodes)) {
70
+ /** @todo */
71
+ //Mage::helper('nrapps_idealo')->checkForOutdatedFeeds($updatedAttributeCodes);
72
+ Mage::app()->getCacheInstance()->cleanType('config');
73
+ }
74
+
75
+ if ($createdAttributes) {
76
+ $this->_getSession()->addSuccess($this->__('%s attributes have been created. You can fill them on the product edit page in the tab "idealo".', $createdAttributes));
77
+ }
78
+
79
+ if (!Mage::helper('nrapps_idealo')->isInstalled()) {
80
+ $this->_getSession()->addSuccess($this->__('The attributes have been assigned. Please choose the default settings now.'));
81
+ $this->_getSession()->addNotice($this->__('If you see an error here, please logout and login again.'));
82
+ $this->_redirect('*/idealo_settings/');
83
+ } else {
84
+ $this->_getSession()->addSuccess($this->__('The attributes have been assigned.'));
85
+ $this->_redirectReferer();
86
+ }
87
+ } else {
88
+ $this->_redirectReferer();
89
+ }
90
+ }
91
+
92
+ /**
93
+ * @return Mage_Catalog_Model_Resource_Setup
94
+ */
95
+ protected function _getSetup()
96
+ {
97
+ return Mage::getResourceModel('catalog/setup', 'catalog_setup');
98
+ }
99
+
100
+ protected function _isAllowed()
101
+ {
102
+ return Mage::getSingleton('admin/session')->isAllowed('system/nrapps_idealo/attributes');
103
+ }
104
+ }
app/code/community/NRApps/Idealo/controllers/Adminhtml/Idealo/SettingsController.php CHANGED
@@ -1,27 +1,27 @@
1
- <?php
2
- class NRApps_Idealo_Adminhtml_Idealo_SettingsController extends Mage_Adminhtml_Controller_Action
3
- {
4
- /**
5
- * Forward to config settings of idealo Connect
6
- */
7
- public function indexAction()
8
- {
9
- $this->_forward('edit', 'system_config', null, array('section' => 'nrapps_idealo'));
10
- }
11
-
12
- public function updateDeliveryTimeAction()
13
- {
14
- Mage::getSingleton('nrapps_idealo/deliveryTime')->update();
15
-
16
- Mage::getSingleton('adminhtml/session')->addSuccess(
17
- $this->__('Options have been updated.')
18
- );
19
-
20
- $this->_redirectReferer();
21
- }
22
-
23
- protected function _isAllowed()
24
- {
25
- return Mage::getSingleton('admin/session')->isAllowed('system/nrapps_idealo/settings');
26
- }
27
- }
1
+ <?php
2
+ class NRApps_Idealo_Adminhtml_Idealo_SettingsController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ /**
5
+ * Forward to config settings of idealo Connect
6
+ */
7
+ public function indexAction()
8
+ {
9
+ $this->_forward('edit', 'system_config', null, array('section' => 'nrapps_idealo'));
10
+ }
11
+
12
+ public function updateDeliveryTimeAction()
13
+ {
14
+ Mage::getSingleton('nrapps_idealo/deliveryTime')->update();
15
+
16
+ Mage::getSingleton('adminhtml/session')->addSuccess(
17
+ $this->__('Options have been updated.')
18
+ );
19
+
20
+ $this->_redirectReferer();
21
+ }
22
+
23
+ protected function _isAllowed()
24
+ {
25
+ return Mage::getSingleton('admin/session')->isAllowed('system/nrapps_idealo/settings');
26
+ }
27
+ }
app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-install-1.2.0.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
-
3
- /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
- $installer = $this;
5
-
6
- $installer->startSetup();
7
-
8
- if ($comment = Mage::getStoreConfig('nrapps_idealo/default_values/shipping_comment')) {
9
- $comments = array
10
- (
11
- '_1438596823621_621' => array
12
- (
13
- 'listing_at' => NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE,
14
- 'comment' => $comment
15
- )
16
-
17
- );
18
- $installer->setConfigData('nrapps_idealo/default_values/shipping_comment', null);
19
- $installer->setConfigData('nrapps_idealo/default_values/shipping_comments', serialize($comments));
20
- }
21
-
22
- Mage::getSingleton('nrapps_idealo/deliveryTime')->update();
23
-
24
  $installer->endSetup();
1
+ <?php
2
+
3
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ if ($comment = Mage::getStoreConfig('nrapps_idealo/default_values/shipping_comment')) {
9
+ $comments = array
10
+ (
11
+ '_1438596823621_621' => array
12
+ (
13
+ 'listing_at' => NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE,
14
+ 'comment' => $comment
15
+ )
16
+
17
+ );
18
+ $installer->setConfigData('nrapps_idealo/default_values/shipping_comment', null);
19
+ $installer->setConfigData('nrapps_idealo/default_values/shipping_comments', serialize($comments));
20
+ }
21
+
22
+ Mage::getSingleton('nrapps_idealo/deliveryTime')->update();
23
+
24
  $installer->endSetup();
app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-install-1.2.2.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
-
3
- /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
- $installer = $this;
5
-
6
- $installer->startSetup();
7
-
8
- if ($comment = Mage::getStoreConfig('nrapps_idealo/default_values/shipping_comment')) {
9
- $comments = array
10
- (
11
- '_1438596823621_621' => array
12
- (
13
- 'listing_at' => NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE,
14
- 'comment' => $comment
15
- )
16
-
17
- );
18
- $installer->setConfigData('nrapps_idealo/default_values/shipping_comment', null);
19
- $installer->setConfigData('nrapps_idealo/default_values/shipping_comments', serialize($comments));
20
- }
21
-
22
- Mage::getSingleton('nrapps_idealo/deliveryTime')->update();
23
-
24
  $installer->endSetup();
1
+ <?php
2
+
3
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ if ($comment = Mage::getStoreConfig('nrapps_idealo/default_values/shipping_comment')) {
9
+ $comments = array
10
+ (
11
+ '_1438596823621_621' => array
12
+ (
13
+ 'listing_at' => NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE,
14
+ 'comment' => $comment
15
+ )
16
+
17
+ );
18
+ $installer->setConfigData('nrapps_idealo/default_values/shipping_comment', null);
19
+ $installer->setConfigData('nrapps_idealo/default_values/shipping_comments', serialize($comments));
20
+ }
21
+
22
+ Mage::getSingleton('nrapps_idealo/deliveryTime')->update();
23
+
24
  $installer->endSetup();
app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-upgrade-1.0.0-1.1.0.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
-
3
- /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
- $installer = $this;
5
-
6
- $installer->startSetup();
7
-
8
- if ($comment = Mage::getStoreConfig('nrapps_idealo/default_values/shipping_comment')) {
9
- $comments = array
10
- (
11
- '_1438596823621_621' => array
12
- (
13
- 'listing_at' => NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE,
14
- 'comment' => $comment
15
- )
16
-
17
- );
18
- $installer->setConfigData('nrapps_idealo/default_values/shipping_comment', null);
19
- $installer->setConfigData('nrapps_idealo/default_values/shipping_comments', serialize($comments));
20
- }
21
-
22
- Mage::getSingleton('nrapps_idealo/deliveryTime')->update();
23
-
24
  $installer->endSetup();
1
+ <?php
2
+
3
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ if ($comment = Mage::getStoreConfig('nrapps_idealo/default_values/shipping_comment')) {
9
+ $comments = array
10
+ (
11
+ '_1438596823621_621' => array
12
+ (
13
+ 'listing_at' => NRApps_Idealo_Model_Source_ListingCountries::LISTING_COUNTRY_DE,
14
+ 'comment' => $comment
15
+ )
16
+
17
+ );
18
+ $installer->setConfigData('nrapps_idealo/default_values/shipping_comment', null);
19
+ $installer->setConfigData('nrapps_idealo/default_values/shipping_comments', serialize($comments));
20
+ }
21
+
22
+ Mage::getSingleton('nrapps_idealo/deliveryTime')->update();
23
+
24
  $installer->endSetup();
app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-upgrade-1.1.0-1.2.0.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
-
3
- /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
- $installer = $this;
5
-
6
- $installer->startSetup();
7
-
8
- // prevent deletion of existing orders on updating module
9
- $installer->setConfigData('nrapps_idealo/existing_offers_deleted', 1);
10
-
11
  $installer->endSetup();
1
+ <?php
2
+
3
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ // prevent deletion of existing orders on updating module
9
+ $installer->setConfigData('nrapps_idealo/existing_offers_deleted', 1);
10
+
11
  $installer->endSetup();
app/code/community/NRApps/Idealo/data/nrapps_idealo_setup/data-upgrade-1.2.1-1.2.2.php CHANGED
@@ -1,12 +1,12 @@
1
- <?php
2
-
3
- /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
- $installer = $this;
5
-
6
- $installer->startSetup();
7
-
8
- $attributeCode = 'is_ecommerce_checkout_approved';
9
- Mage::getSingleton('nrapps_idealo/attribute')->createAttribute($attributeCode, 'yesno');
10
- $installer->setConfigData('nrapps_idealo/attributes/' . $attributeCode, $attributeCode);
11
-
12
  $installer->endSetup();
1
+ <?php
2
+
3
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ $attributeCode = 'is_ecommerce_checkout_approved';
9
+ Mage::getSingleton('nrapps_idealo/attribute')->createAttribute($attributeCode, 'yesno');
10
+ $installer->setConfigData('nrapps_idealo/attributes/' . $attributeCode, $attributeCode);
11
+
12
  $installer->endSetup();
app/code/community/NRApps/Idealo/etc/adminhtml.xml CHANGED
@@ -1,59 +1,59 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <menu>
4
- <system>
5
- <children>
6
- <nrapps_idealo translate="title" module="nrapps_idealo">
7
- <title>idealo Connect</title>
8
- <sort_order>-1</sort_order>
9
- <children>
10
- <attributes translate="title" module="nrapps_idealo">
11
- <title>Manage Attributes</title>
12
- <sort_order>40</sort_order>
13
- <action>adminhtml/idealo_attributes</action>
14
- </attributes>
15
- <settings translate="title" module="nrapps_idealo">
16
- <title>Settings</title>
17
- <sort_order>50</sort_order>
18
- <action>adminhtml/idealo_settings</action>
19
- </settings>
20
- </children>
21
- </nrapps_idealo>
22
- </children>
23
- </system>
24
- </menu>
25
- <acl>
26
- <resources>
27
- <admin>
28
- <children>
29
- <system>
30
- <children>
31
- <nrapps_idealo translate="title">
32
- <title>idealo Connect</title>
33
- <sort_order>-1</sort_order>
34
- <children>
35
- <attributes translate="title" module="nrapps_idealo">
36
- <title>Manage Attributes</title>
37
- <sort_order>40</sort_order>
38
- </attributes>
39
- <settings translate="title" module="nrapps_idealo">
40
- <title>Settings</title>
41
- <sort_order>50</sort_order>
42
- </settings>
43
- </children>
44
- </nrapps_idealo>
45
- <config>
46
- <children>
47
- <nrapps_idealo>
48
- <title>idealo Connect</title>
49
- <sort_order>100</sort_order>
50
- </nrapps_idealo>
51
- </children>
52
- </config>
53
- </children>
54
- </system>
55
- </children>
56
- </admin>
57
- </resources>
58
- </acl>
59
- </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <menu>
4
+ <system>
5
+ <children>
6
+ <nrapps_idealo translate="title" module="nrapps_idealo">
7
+ <title>idealo Connect</title>
8
+ <sort_order>-1</sort_order>
9
+ <children>
10
+ <attributes translate="title" module="nrapps_idealo">
11
+ <title>Manage Attributes</title>
12
+ <sort_order>40</sort_order>
13
+ <action>adminhtml/idealo_attributes</action>
14
+ </attributes>
15
+ <settings translate="title" module="nrapps_idealo">
16
+ <title>Settings</title>
17
+ <sort_order>50</sort_order>
18
+ <action>adminhtml/idealo_settings</action>
19
+ </settings>
20
+ </children>
21
+ </nrapps_idealo>
22
+ </children>
23
+ </system>
24
+ </menu>
25
+ <acl>
26
+ <resources>
27
+ <admin>
28
+ <children>
29
+ <system>
30
+ <children>
31
+ <nrapps_idealo translate="title">
32
+ <title>idealo Connect</title>
33
+ <sort_order>-1</sort_order>
34
+ <children>
35
+ <attributes translate="title" module="nrapps_idealo">
36
+ <title>Manage Attributes</title>
37
+ <sort_order>40</sort_order>
38
+ </attributes>
39
+ <settings translate="title" module="nrapps_idealo">
40
+ <title>Settings</title>
41
+ <sort_order>50</sort_order>
42
+ </settings>
43
+ </children>
44
+ </nrapps_idealo>
45
+ <config>
46
+ <children>
47
+ <nrapps_idealo>
48
+ <title>idealo Connect</title>
49
+ <sort_order>100</sort_order>
50
+ </nrapps_idealo>
51
+ </children>
52
+ </config>
53
+ </children>
54
+ </system>
55
+ </children>
56
+ </admin>
57
+ </resources>
58
+ </acl>
59
+ </config>
app/code/community/NRApps/Idealo/etc/config.xml CHANGED
@@ -1,229 +1,229 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <NRApps_Idealo>
5
- <version>1.2.2</version>
6
- </NRApps_Idealo>
7
- </modules>
8
-
9
- <global>
10
- <models>
11
- <nrapps_idealo>
12
- <class>NRApps_Idealo_Model</class>
13
- <resourceModel>nrapps_idealo_resource</resourceModel>
14
- </nrapps_idealo>
15
-
16
- <nrapps_idealo_resource>
17
- <class>NRApps_Idealo_Model_Resource</class>
18
- <entities>
19
- <index>
20
- <table>nrapps_idealo_index</table>
21
- </index>
22
- </entities>
23
- </nrapps_idealo_resource>
24
- </models>
25
-
26
- <blocks>
27
- <nrapps_idealo>
28
- <class>NRApps_Idealo_Block</class>
29
- </nrapps_idealo>
30
- </blocks>
31
-
32
- <helpers>
33
- <nrapps_idealo>
34
- <class>NRApps_Idealo_Helper</class>
35
- </nrapps_idealo>
36
- </helpers>
37
-
38
- <resources>
39
- <nrapps_idealo_setup>
40
- <setup>
41
- <module>NRApps_Idealo</module>
42
- <class>Mage_Catalog_Model_Resource_Setup</class>
43
- </setup>
44
- </nrapps_idealo_setup>
45
- </resources>
46
-
47
- <index>
48
- <indexer>
49
- <nrapps_idealo>
50
- <model>nrapps_idealo/indexer</model>
51
- </nrapps_idealo>
52
- </indexer>
53
- </index>
54
- <template>
55
- <email>
56
- <nrapps_idealo_email_error_template translate="label" module="nrapps_idealo">
57
- <label>Error Messages: Template</label>
58
- <file>nrapps_idealo_error.html</file>
59
- <type>text</type>
60
- </nrapps_idealo_email_error_template>
61
- </email>
62
- </template>
63
- </global>
64
-
65
- <admin>
66
- <routers>
67
- <adminhtml>
68
- <args>
69
- <modules>
70
- <NRApps_Idealo after="Mage_Adminhtml">NRApps_Idealo_Adminhtml</NRApps_Idealo>
71
- </modules>
72
- </args>
73
- </adminhtml>
74
- </routers>
75
- </admin>
76
-
77
- <adminhtml>
78
- <translate>
79
- <modules>
80
- <NRApps_Idealo>
81
- <files>
82
- <default>NRApps_Idealo.csv</default>
83
- </files>
84
- </NRApps_Idealo>
85
- </modules>
86
- </translate>
87
- <layout>
88
- <updates>
89
- <nrapps_idealo>
90
- <file>nrapps/idealo.xml</file>
91
- </nrapps_idealo>
92
- </updates>
93
- </layout>
94
- <events>
95
- <controller_action_predispatch_adminhtml_idealo_attributes_index>
96
- <observers>
97
- <feedgenerator_install>
98
- <type>singleton</type>
99
- <class>nrapps_idealo/observer</class>
100
- <method>onAttributesControllerActionPredispatch</method>
101
- </feedgenerator_install>
102
- </observers>
103
- </controller_action_predispatch_adminhtml_idealo_attributes_index>
104
- <controller_action_predispatch_adminhtml_idealo_settings_index>
105
- <observers>
106
- <feedgenerator_install>
107
- <type>singleton</type>
108
- <class>nrapps_idealo/observer</class>
109
- <method>onConfigControllerActionPredispatch</method>
110
- </feedgenerator_install>
111
- </observers>
112
- </controller_action_predispatch_adminhtml_idealo_settings_index>
113
- <admin_session_user_login_success>
114
- <observers>
115
- <nrapps_idealo>
116
- <type>singleton</type>
117
- <class>nrapps_idealo/observer</class>
118
- <method>onAdminUserLoginSuccess</method>
119
- </nrapps_idealo>
120
- </observers>
121
- </admin_session_user_login_success>
122
- <controller_action_predispatch_adminhtml_system_config_save>
123
- <observers>
124
- <nrapps_idealo>
125
- <type>singleton</type>
126
- <class>nrapps_idealo/observer</class>
127
- <method>onConfigChange</method>
128
- </nrapps_idealo>
129
- </observers>
130
- </controller_action_predispatch_adminhtml_system_config_save>
131
- <controller_action_postdispatch_adminhtml_system_config_save>
132
- <observers>
133
- <nrapps_idealo>
134
- <type>singleton</type>
135
- <class>nrapps_idealo/observer</class>
136
- <method>afterConfigChange</method>
137
- </nrapps_idealo>
138
- </observers>
139
- </controller_action_postdispatch_adminhtml_system_config_save>
140
- </events>
141
- </adminhtml>
142
-
143
- <frontend>
144
- <translate>
145
- <modules>
146
- <NRApps_Idealo>
147
- <files>
148
- <default>NRApps_Idealo.csv</default>
149
- </files>
150
- </NRApps_Idealo>
151
- </modules>
152
- </translate>
153
- </frontend>
154
-
155
- <default>
156
- <nrapps_idealo>
157
- <existing_offers_deleted>0</existing_offers_deleted>
158
- <attributes>
159
- <manufacturer/>
160
- <delivery_time/>
161
- <shipping_cost/>
162
- <shipping_comment/>
163
- <oen/>
164
- <kba/>
165
- <ean/>
166
- <han/>
167
- <pzn/>
168
- <is_used/>
169
- <is_rebuild/>
170
- <has_contract/>
171
- <is_ecommerce_checkout_approved/>
172
- <merchant/>
173
- </attributes>
174
- <settings>
175
- <is_active>1</is_active>
176
- <test_mode>1</test_mode>
177
- <api_update_url>https://partner.idealo.de/partnerWs/v1/updateOffers</api_update_url>
178
- <api_get_url>https://partner.idealo.de/partnerWs/v1/getOffers</api_get_url>
179
- <disable_certificate_check>0</disable_certificate_check>
180
- <logging>1</logging>
181
- </settings>
182
- <product_options>
183
- <allowed_product_types>all</allowed_product_types>
184
- <allowed_attribute_sets>all</allowed_attribute_sets>
185
- <configurable_child_products_price>parent_without</configurable_child_products_price>
186
- <configurable_export_type>export_parent</configurable_export_type>
187
- <add_attributes_to_export>a:1:{s:18:"_1425401241417_417";a:1:{s:14:"attribute_code";s:5:"color";}}</add_attributes_to_export>
188
- <export_flexible_price_bundles>0</export_flexible_price_bundles>
189
- </product_options>
190
- <listing>
191
- <listing_at>DE</listing_at>
192
- </listing>
193
- <shipping>
194
- <shipping_costs_calculation_method>price</shipping_costs_calculation_method>
195
- <shipping_costs>a:1:{s:18:"_1425462208957_957";a:3:{s:5:"dummy";s:18:"custom_design_from";s:10:"from_price";s:1:"0";s:4:"cost";s:4:"4.90";}}</shipping_costs>
196
- <shipping_costs_by_weight>a:1:{s:18:"_1425469115961_961";a:3:{s:5:"dummy";s:18:"custom_design_from";s:11:"from_weight";s:1:"0";s:4:"cost";s:4:"3.50";}}</shipping_costs_by_weight>
197
- <payment_methods>a:3:{s:18:"_1237006651133_135";a:3:{s:14:"payment_method";s:7:"PREPAID";s:9:"surcharge";s:4:"0.00";s:19:"percental_surcharge";s:4:"0.00";}s:18:"_1367006661853_853";a:3:{s:14:"payment_method";s:3:"COD";s:9:"surcharge";s:4:"0.00";s:19:"percental_surcharge";s:4:"0.00";}s:18:"_1367006666619_619";a:3:{s:14:"payment_method";s:10:"CREDITCARD";s:9:"surcharge";s:4:"0.00";s:19:"percental_surcharge";s:4:"0.00";}}</payment_methods>
198
- <percental_surcharge_calculation_method>product</percental_surcharge_calculation_method>
199
- </shipping>
200
- <shipping_at>
201
- <shipping_costs_calculation_method>price</shipping_costs_calculation_method>
202
- <percental_surcharge_calculation_method>product</percental_surcharge_calculation_method>
203
- </shipping_at>
204
- <shipping_int>
205
- <shipping_costs_calculation_method>price</shipping_costs_calculation_method>
206
- <percental_surcharge_calculation_method>product</percental_surcharge_calculation_method>
207
- </shipping_int>
208
- <default_values>
209
- <is_ecommerce_checkout_approved>1</is_ecommerce_checkout_approved>
210
- </default_values>
211
- <minimum_order_weight_surcharge>
212
- <unit>kg</unit>
213
- </minimum_order_weight_surcharge>
214
- </nrapps_idealo>
215
- </default>
216
-
217
- <crontab>
218
- <jobs>
219
- <nrapps_idealo_transfer_all>
220
- <schedule>
221
- <cron_expr>*/5 * * * *</cron_expr>
222
- </schedule>
223
- <run>
224
- <model>nrapps_idealo/api::transferAll</model>
225
- </run>
226
- </nrapps_idealo_transfer_all>
227
- </jobs>
228
- </crontab>
229
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <NRApps_Idealo>
5
+ <version>1.2.3</version>
6
+ </NRApps_Idealo>
7
+ </modules>
8
+
9
+ <global>
10
+ <models>
11
+ <nrapps_idealo>
12
+ <class>NRApps_Idealo_Model</class>
13
+ <resourceModel>nrapps_idealo_resource</resourceModel>
14
+ </nrapps_idealo>
15
+
16
+ <nrapps_idealo_resource>
17
+ <class>NRApps_Idealo_Model_Resource</class>
18
+ <entities>
19
+ <index>
20
+ <table>nrapps_idealo_index</table>
21
+ </index>
22
+ </entities>
23
+ </nrapps_idealo_resource>
24
+ </models>
25
+
26
+ <blocks>
27
+ <nrapps_idealo>
28
+ <class>NRApps_Idealo_Block</class>
29
+ </nrapps_idealo>
30
+ </blocks>
31
+
32
+ <helpers>
33
+ <nrapps_idealo>
34
+ <class>NRApps_Idealo_Helper</class>
35
+ </nrapps_idealo>
36
+ </helpers>
37
+
38
+ <resources>
39
+ <nrapps_idealo_setup>
40
+ <setup>
41
+ <module>NRApps_Idealo</module>
42
+ <class>Mage_Catalog_Model_Resource_Setup</class>
43
+ </setup>
44
+ </nrapps_idealo_setup>
45
+ </resources>
46
+
47
+ <index>
48
+ <indexer>
49
+ <nrapps_idealo>
50
+ <model>nrapps_idealo/indexer</model>
51
+ </nrapps_idealo>
52
+ </indexer>
53
+ </index>
54
+ <template>
55
+ <email>
56
+ <nrapps_idealo_email_error_template translate="label" module="nrapps_idealo">
57
+ <label>Error Messages: Template</label>
58
+ <file>nrapps_idealo_error.html</file>
59
+ <type>text</type>
60
+ </nrapps_idealo_email_error_template>
61
+ </email>
62
+ </template>
63
+ </global>
64
+
65
+ <admin>
66
+ <routers>
67
+ <adminhtml>
68
+ <args>
69
+ <modules>
70
+ <NRApps_Idealo after="Mage_Adminhtml">NRApps_Idealo_Adminhtml</NRApps_Idealo>
71
+ </modules>
72
+ </args>
73
+ </adminhtml>
74
+ </routers>
75
+ </admin>
76
+
77
+ <adminhtml>
78
+ <translate>
79
+ <modules>
80
+ <NRApps_Idealo>
81
+ <files>
82
+ <default>NRApps_Idealo.csv</default>
83
+ </files>
84
+ </NRApps_Idealo>
85
+ </modules>
86
+ </translate>
87
+ <layout>
88
+ <updates>
89
+ <nrapps_idealo>
90
+ <file>nrapps/idealo.xml</file>
91
+ </nrapps_idealo>
92
+ </updates>
93
+ </layout>
94
+ <events>
95
+ <controller_action_predispatch_adminhtml_idealo_attributes_index>
96
+ <observers>
97
+ <feedgenerator_install>
98
+ <type>singleton</type>
99
+ <class>nrapps_idealo/observer</class>
100
+ <method>onAttributesControllerActionPredispatch</method>
101
+ </feedgenerator_install>
102
+ </observers>
103
+ </controller_action_predispatch_adminhtml_idealo_attributes_index>
104
+ <controller_action_predispatch_adminhtml_idealo_settings_index>
105
+ <observers>
106
+ <feedgenerator_install>
107
+ <type>singleton</type>
108
+ <class>nrapps_idealo/observer</class>
109
+ <method>onConfigControllerActionPredispatch</method>
110
+ </feedgenerator_install>
111
+ </observers>
112
+ </controller_action_predispatch_adminhtml_idealo_settings_index>
113
+ <admin_session_user_login_success>
114
+ <observers>
115
+ <nrapps_idealo>
116
+ <type>singleton</type>
117
+ <class>nrapps_idealo/observer</class>
118
+ <method>onAdminUserLoginSuccess</method>
119
+ </nrapps_idealo>
120
+ </observers>
121
+ </admin_session_user_login_success>
122
+ <controller_action_predispatch_adminhtml_system_config_save>
123
+ <observers>
124
+ <nrapps_idealo>
125
+ <type>singleton</type>
126
+ <class>nrapps_idealo/observer</class>
127
+ <method>onConfigChange</method>
128
+ </nrapps_idealo>
129
+ </observers>
130
+ </controller_action_predispatch_adminhtml_system_config_save>
131
+ <controller_action_postdispatch_adminhtml_system_config_save>
132
+ <observers>
133
+ <nrapps_idealo>
134
+ <type>singleton</type>
135
+ <class>nrapps_idealo/observer</class>
136
+ <method>afterConfigChange</method>
137
+ </nrapps_idealo>
138
+ </observers>
139
+ </controller_action_postdispatch_adminhtml_system_config_save>
140
+ </events>
141
+ </adminhtml>
142
+
143
+ <frontend>
144
+ <translate>
145
+ <modules>
146
+ <NRApps_Idealo>
147
+ <files>
148
+ <default>NRApps_Idealo.csv</default>
149
+ </files>
150
+ </NRApps_Idealo>
151
+ </modules>
152
+ </translate>
153
+ </frontend>
154
+
155
+ <default>
156
+ <nrapps_idealo>
157
+ <existing_offers_deleted>0</existing_offers_deleted>
158
+ <attributes>
159
+ <manufacturer/>
160
+ <delivery_time/>
161
+ <shipping_cost/>
162
+ <shipping_comment/>
163
+ <oen/>
164
+ <kba/>
165
+ <ean/>
166
+ <han/>
167
+ <pzn/>
168
+ <is_used/>
169
+ <is_rebuild/>
170
+ <has_contract/>
171
+ <is_ecommerce_checkout_approved/>
172
+ <merchant/>
173
+ </attributes>
174
+ <settings>
175
+ <is_active>1</is_active>
176
+ <test_mode>1</test_mode>
177
+ <api_update_url>https://partner.idealo.de/partnerWs/v1/updateOffers</api_update_url>
178
+ <api_get_url>https://partner.idealo.de/partnerWs/v1/getOffers</api_get_url>
179
+ <disable_certificate_check>0</disable_certificate_check>
180
+ <logging>1</logging>
181
+ </settings>
182
+ <product_options>
183
+ <allowed_product_types>all</allowed_product_types>
184
+ <allowed_attribute_sets>all</allowed_attribute_sets>
185
+ <configurable_child_products_price>parent_without</configurable_child_products_price>
186
+ <configurable_export_type>export_parent</configurable_export_type>
187
+ <add_attributes_to_export>a:1:{s:18:"_1425401241417_417";a:1:{s:14:"attribute_code";s:5:"color";}}</add_attributes_to_export>
188
+ <export_flexible_price_bundles>0</export_flexible_price_bundles>
189
+ </product_options>
190
+ <listing>
191
+ <listing_at>DE</listing_at>
192
+ </listing>
193
+ <shipping>
194
+ <shipping_costs_calculation_method>price</shipping_costs_calculation_method>
195
+ <shipping_costs>a:1:{s:18:"_1425462208957_957";a:3:{s:5:"dummy";s:18:"custom_design_from";s:10:"from_price";s:1:"0";s:4:"cost";s:4:"4.90";}}</shipping_costs>
196
+ <shipping_costs_by_weight>a:1:{s:18:"_1425469115961_961";a:3:{s:5:"dummy";s:18:"custom_design_from";s:11:"from_weight";s:1:"0";s:4:"cost";s:4:"3.50";}}</shipping_costs_by_weight>
197
+ <payment_methods>a:3:{s:18:"_1237006651133_135";a:3:{s:14:"payment_method";s:7:"PREPAID";s:9:"surcharge";s:4:"0.00";s:19:"percental_surcharge";s:4:"0.00";}s:18:"_1367006661853_853";a:3:{s:14:"payment_method";s:3:"COD";s:9:"surcharge";s:4:"0.00";s:19:"percental_surcharge";s:4:"0.00";}s:18:"_1367006666619_619";a:3:{s:14:"payment_method";s:10:"CREDITCARD";s:9:"surcharge";s:4:"0.00";s:19:"percental_surcharge";s:4:"0.00";}}</payment_methods>
198
+ <percental_surcharge_calculation_method>product</percental_surcharge_calculation_method>
199
+ </shipping>
200
+ <shipping_at>
201
+ <shipping_costs_calculation_method>price</shipping_costs_calculation_method>
202
+ <percental_surcharge_calculation_method>product</percental_surcharge_calculation_method>
203
+ </shipping_at>
204
+ <shipping_int>
205
+ <shipping_costs_calculation_method>price</shipping_costs_calculation_method>
206
+ <percental_surcharge_calculation_method>product</percental_surcharge_calculation_method>
207
+ </shipping_int>
208
+ <default_values>
209
+ <is_ecommerce_checkout_approved>1</is_ecommerce_checkout_approved>
210
+ </default_values>
211
+ <minimum_order_weight_surcharge>
212
+ <unit>kg</unit>
213
+ </minimum_order_weight_surcharge>
214
+ </nrapps_idealo>
215
+ </default>
216
+
217
+ <crontab>
218
+ <jobs>
219
+ <nrapps_idealo_transfer_all>
220
+ <schedule>
221
+ <cron_expr>*/5 * * * *</cron_expr>
222
+ </schedule>
223
+ <run>
224
+ <model>nrapps_idealo/api::transferAll</model>
225
+ </run>
226
+ </nrapps_idealo_transfer_all>
227
+ </jobs>
228
+ </crontab>
229
  </config>
app/code/community/NRApps/Idealo/etc/system.xml CHANGED
@@ -1,840 +1,840 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <nrapps_idealo translate="label" module="nrapps_idealo">
5
- <label>idealo Connect</label>
6
- <tab>catalog</tab>
7
- <sort_order>101</sort_order>
8
- <show_in_default>1</show_in_default>
9
- <show_in_website>1</show_in_website>
10
- <show_in_store>1</show_in_store>
11
- <groups>
12
- <settings translate="label">
13
- <label>Settings</label>
14
- <sort_order>10</sort_order>
15
- <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
- <show_in_store>1</show_in_store>
18
- <fields>
19
- <description translate="label">
20
- <label></label>
21
- <frontend_model>nrapps_idealo/config_description</frontend_model>
22
- <sort_order>5</sort_order>
23
- <show_in_default>1</show_in_default>
24
- <show_in_website>1</show_in_website>
25
- <show_in_store>1</show_in_store>
26
- </description>
27
- <is_active translate="label">
28
- <sort_order>10</sort_order>
29
- <label>idealo Connect is active</label>
30
- <frontend_type>select</frontend_type>
31
- <source_model>adminhtml/system_config_source_yesno</source_model>
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
- </is_active>
36
- <test_mode translate="label,comment">
37
- <sort_order>20</sort_order>
38
- <label>Test Mode</label>
39
- <comment>Only generation of files, no transfer</comment>
40
- <frontend_type>select</frontend_type>
41
- <source_model>adminhtml/system_config_source_yesno</source_model>
42
- <show_in_default>1</show_in_default>
43
- <show_in_website>1</show_in_website>
44
- <show_in_store>1</show_in_store>
45
- </test_mode>
46
- <shop_id translate="label,comment">
47
- <sort_order>40</sort_order>
48
- <label>idealo Shop ID</label>
49
- <comment>Contact csv@idealo.de to gain access.</comment>
50
- <frontend_type>text</frontend_type>
51
- <show_in_default>1</show_in_default>
52
- <show_in_website>1</show_in_website>
53
- <show_in_store>1</show_in_store>
54
- <depends><test_mode>0</test_mode></depends>
55
- </shop_id>
56
- <user translate="label">
57
- <sort_order>50</sort_order>
58
- <label>idealo User</label>
59
- <frontend_type>text</frontend_type>
60
- <show_in_default>1</show_in_default>
61
- <show_in_website>1</show_in_website>
62
- <show_in_store>1</show_in_store>
63
- <depends><test_mode>0</test_mode></depends>
64
- </user>
65
- <password translate="label">
66
- <sort_order>60</sort_order>
67
- <label>idealo Password</label>
68
- <frontend_type>text</frontend_type>
69
- <show_in_default>1</show_in_default>
70
- <show_in_website>1</show_in_website>
71
- <show_in_store>1</show_in_store>
72
- <depends><test_mode>0</test_mode></depends>
73
- </password>
74
- <api_update_url translate="label,comment">
75
- <sort_order>70</sort_order>
76
- <label>API URL for Update Requests</label>
77
- <frontend_type>text</frontend_type>
78
- <show_in_default>0</show_in_default>
79
- <show_in_website>0</show_in_website>
80
- <show_in_store>0</show_in_store>
81
- </api_update_url>
82
- <api_get_url translate="label,comment">
83
- <sort_order>75</sort_order>
84
- <label>API URL for Get Requests</label>
85
- <frontend_type>text</frontend_type>
86
- <show_in_default>0</show_in_default>
87
- <show_in_website>0</show_in_website>
88
- <show_in_store>0</show_in_store>
89
- </api_get_url>
90
- <disable_certificate_check translate="label,comment">
91
- <sort_order>80</sort_order>
92
- <label>Disable check of SSL certificate</label>
93
- <comment>In case you have problems with the connection</comment>
94
- <frontend_type>select</frontend_type>
95
- <source_model>adminhtml/system_config_source_yesno</source_model>
96
- <show_in_default>1</show_in_default>
97
- <show_in_website>1</show_in_website>
98
- <show_in_store>1</show_in_store>
99
- <depends><test_mode>0</test_mode></depends>
100
- </disable_certificate_check>
101
- <logging translate="label,comment">
102
- <sort_order>90</sort_order>
103
- <label>Activate logging for all requests</label>
104
- <comment>Logs can be found in media/nrapps_idealo/log/idealo_requests.txt</comment>
105
- <frontend_type>select</frontend_type>
106
- <source_model>adminhtml/system_config_source_yesno</source_model>
107
- <show_in_default>1</show_in_default>
108
- <show_in_website>0</show_in_website>
109
- <show_in_store>0</show_in_store>
110
- <depends><test_mode>0</test_mode></depends>
111
- </logging>
112
- </fields>
113
- </settings>
114
-
115
- <product_options>
116
- <label>Product Options</label>
117
- <sort_order>20</sort_order>
118
- <show_in_default>1</show_in_default>
119
- <show_in_website>1</show_in_website>
120
- <show_in_store>1</show_in_store>
121
- <fields>
122
- <allowed_product_types translate="label">
123
- <sort_order>10</sort_order>
124
- <label>Allowed Product Types</label>
125
- <frontend_type>multiselect</frontend_type>
126
- <source_model>nrapps_idealo/source_productTypes</source_model>
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
- </allowed_product_types>
131
- <allowed_attribute_sets translate="label">
132
- <sort_order>20</sort_order>
133
- <label>Allowed Attribute Sets</label>
134
- <frontend_type>multiselect</frontend_type>
135
- <source_model>nrapps_idealo/source_attributeSets</source_model>
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
- </allowed_attribute_sets>
140
- <configurable_export_type translate="label">
141
- <sort_order>30</sort_order>
142
- <label>Export Type for Configurable Products</label>
143
- <frontend_type>select</frontend_type>
144
- <source_model>nrapps_idealo/source_configurableTypes</source_model>
145
- <show_in_default>1</show_in_default>
146
- <show_in_website>1</show_in_website>
147
- <show_in_store>1</show_in_store>
148
- </configurable_export_type>
149
- <configurable_child_products_price translate="label,comment">
150
- <sort_order>40</sort_order>
151
- <label>Calculate price of configurable child products as</label>
152
- <comment>Use option "child product" or "parent product without modifications" for better performance. There can be memory leaks with the option "parent product &lt;strong&gt;with&lt;/strong&gt; modifications".</comment>
153
- <frontend_type>select</frontend_type>
154
- <source_model>nrapps_idealo/source_configurableChildProductsPriceType</source_model>
155
- <show_in_default>1</show_in_default>
156
- <show_in_website>1</show_in_website>
157
- <show_in_store>1</show_in_store>
158
- </configurable_child_products_price>
159
- <add_attributes_to_export translate="label">
160
- <sort_order>50</sort_order>
161
- <label>Add contents of the following attribute(s) to the export</label>
162
- <frontend_model>nrapps_idealo/config_attributesNoSortOrder</frontend_model>
163
- <backend_model>nrapps_idealo/backend_serialized_array</backend_model>
164
- <show_in_default>1</show_in_default>
165
- <show_in_website>1</show_in_website>
166
- <show_in_store>1</show_in_store>
167
- </add_attributes_to_export>
168
- <add_attribute_contents_to_name translate="label">
169
- <sort_order>60</sort_order>
170
- <label>Add contents of the following attribute(s) to product name</label>
171
- <frontend_model>nrapps_idealo/config_attributes</frontend_model>
172
- <backend_model>nrapps_idealo/backend_serialized_array</backend_model>
173
- <show_in_default>1</show_in_default>
174
- <show_in_website>1</show_in_website>
175
- <show_in_store>1</show_in_store>
176
- </add_attribute_contents_to_name>
177
- <export_flexible_price_bundles translate="label,comment">
178
- <sort_order>70</sort_order>
179
- <label>Export Bundle Products without a fixed price</label>
180
- <comment>No Price will be available for those products</comment>
181
- <frontend_type>select</frontend_type>
182
- <source_model>adminhtml/system_config_source_yesno</source_model>
183
- <show_in_default>0</show_in_default>
184
- <show_in_website>0</show_in_website>
185
- <show_in_store>0</show_in_store>
186
- </export_flexible_price_bundles>
187
- </fields>
188
- </product_options>
189
-
190
- <email>
191
- <label>Email Options</label>
192
- <sort_order>25</sort_order>
193
- <show_in_default>1</show_in_default>
194
- <show_in_website>1</show_in_website>
195
- <show_in_store>1</show_in_store>
196
- <fields>
197
- <error_recipient translate="label">
198
- <label>Error Messages: Recipient Email Address</label>
199
- <frontend_type>text</frontend_type>
200
- <sort_order>10</sort_order>
201
- <show_in_default>1</show_in_default>
202
- <show_in_website>0</show_in_website>
203
- <show_in_store>0</show_in_store>
204
- </error_recipient>
205
- <error_identity translate="label">
206
- <label>Error Messages: Identity</label>
207
- <frontend_type>select</frontend_type>
208
- <source_model>adminhtml/system_config_source_email_identity</source_model>
209
- <sort_order>14</sort_order>
210
- <show_in_default>1</show_in_default>
211
- <show_in_website>0</show_in_website>
212
- <show_in_store>0</show_in_store>
213
- </error_identity>
214
- <error_template translate="label">
215
- <label>Error Messages: Template</label>
216
- <frontend_type>select</frontend_type>
217
- <source_model>adminhtml/system_config_source_email_template</source_model>
218
- <sort_order>15</sort_order>
219
- <show_in_default>1</show_in_default>
220
- <show_in_website>0</show_in_website>
221
- <show_in_store>0</show_in_store>
222
- </error_template>
223
- </fields>
224
- </email>
225
-
226
- <listing translate="label">
227
- <label>Listing</label>
228
- <sort_order>30</sort_order>
229
- <show_in_default>1</show_in_default>
230
- <show_in_website>1</show_in_website>
231
- <show_in_store>1</show_in_store>
232
- <fields>
233
- <listing_at translate="label,comment">
234
- <sort_order>10</sort_order>
235
- <label>Listing at</label>
236
- <frontend_type>multiselect</frontend_type>
237
- <source_model>nrapps_idealo/source_listingCountries</source_model>
238
- <show_in_default>1</show_in_default>
239
- <show_in_website>1</show_in_website>
240
- <show_in_store>1</show_in_store>
241
- </listing_at>
242
- </fields>
243
- </listing>
244
-
245
- <delivery_times translate="label">
246
- <label>Delivery Times</label>
247
- <sort_order>35</sort_order>
248
- <show_in_default>1</show_in_default>
249
- <show_in_website>1</show_in_website>
250
- <show_in_store>1</show_in_store>
251
- <fields>
252
- <mapping translate="label,comment">
253
- <label>Mapping</label>
254
- <comment>If no country specific value is set, delivery time will not be exported.</comment>
255
- <frontend_model>nrapps_idealo/config_deliveryTimeMapping</frontend_model>
256
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
257
- <sort_order>10</sort_order>
258
- <show_in_default>1</show_in_default>
259
- <show_in_website>1</show_in_website>
260
- <show_in_store>1</show_in_store>
261
- </mapping>
262
- <button translate="label">
263
- <label></label>
264
- <frontend_model>nrapps_idealo/config_deliveryTimeUpdateButton</frontend_model>
265
- <sort_order>20</sort_order>
266
- <show_in_default>1</show_in_default>
267
- <show_in_website>1</show_in_website>
268
- <show_in_store>1</show_in_store>
269
- </button>
270
- </fields>
271
- </delivery_times>
272
-
273
- <shipping translate="label">
274
- <label>Shipping Cost idealo.de</label>
275
- <sort_order>40</sort_order>
276
- <show_in_default>1</show_in_default>
277
- <show_in_website>1</show_in_website>
278
- <show_in_store>1</show_in_store>
279
- <fields>
280
- <shipping_costs_calculation_method translate="label,comment">
281
- <sort_order>10</sort_order>
282
- <label>Shipping Costs Calculation Method</label>
283
- <frontend_type>select</frontend_type>
284
- <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
285
- <show_in_default>1</show_in_default>
286
- <show_in_website>1</show_in_website>
287
- <show_in_store>0</show_in_store>
288
- </shipping_costs_calculation_method>
289
- <shipping_costs translate="label,comment">
290
- <label>Shipping Cost based on Price</label>
291
- <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
292
- <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
293
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
294
- <sort_order>20</sort_order>
295
- <show_in_default>1</show_in_default>
296
- <show_in_website>1</show_in_website>
297
- <show_in_store>0</show_in_store>
298
- </shipping_costs>
299
- <shipping_costs_by_weight translate="label,comment">
300
- <label>Shipping Cost based on Weight</label>
301
- <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
302
- <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
303
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
304
- <sort_order>30</sort_order>
305
- <show_in_default>1</show_in_default>
306
- <show_in_website>1</show_in_website>
307
- <show_in_store>0</show_in_store>
308
- </shipping_costs_by_weight>
309
- <payment_methods translate="label">
310
- <label>Activated Payment Methods</label>
311
- <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
312
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
313
- <sort_order>50</sort_order>
314
- <show_in_default>1</show_in_default>
315
- <show_in_website>1</show_in_website>
316
- <show_in_store>0</show_in_store>
317
- </payment_methods>
318
- <percental_surcharge_calculation_method translate="label,comment">
319
- <sort_order>60</sort_order>
320
- <label>Percental Surcharge Calculation Method</label>
321
- <frontend_type>select</frontend_type>
322
- <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
323
- <show_in_default>1</show_in_default>
324
- <show_in_website>1</show_in_website>
325
- <show_in_store>0</show_in_store>
326
- </percental_surcharge_calculation_method>
327
- </fields>
328
- </shipping>
329
-
330
- <shipping_at translate="label">
331
- <label>Shipping Cost idealo.at</label>
332
- <sort_order>41</sort_order>
333
- <show_in_default>1</show_in_default>
334
- <show_in_website>1</show_in_website>
335
- <show_in_store>1</show_in_store>
336
- <fields>
337
- <shipping_costs_calculation_method translate="label,comment">
338
- <sort_order>10</sort_order>
339
- <label>Shipping Costs Calculation Method</label>
340
- <frontend_type>select</frontend_type>
341
- <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
342
- <show_in_default>1</show_in_default>
343
- <show_in_website>1</show_in_website>
344
- <show_in_store>0</show_in_store>
345
- </shipping_costs_calculation_method>
346
- <shipping_costs translate="label,comment">
347
- <label>Shipping Cost based on Price</label>
348
- <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
349
- <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
350
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
351
- <sort_order>20</sort_order>
352
- <show_in_default>1</show_in_default>
353
- <show_in_website>1</show_in_website>
354
- <show_in_store>0</show_in_store>
355
- </shipping_costs>
356
- <shipping_costs_by_weight translate="label,comment">
357
- <label>Shipping Cost based on Weight</label>
358
- <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
359
- <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
360
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
361
- <sort_order>30</sort_order>
362
- <show_in_default>1</show_in_default>
363
- <show_in_website>1</show_in_website>
364
- <show_in_store>0</show_in_store>
365
- </shipping_costs_by_weight>
366
- <payment_methods translate="label">
367
- <label>Activated Payment Methods</label>
368
- <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
369
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
370
- <sort_order>50</sort_order>
371
- <show_in_default>1</show_in_default>
372
- <show_in_website>1</show_in_website>
373
- <show_in_store>0</show_in_store>
374
- </payment_methods>
375
- <percental_surcharge_calculation_method translate="label,comment">
376
- <sort_order>60</sort_order>
377
- <label>Percental Surcharge Calculation Method</label>
378
- <frontend_type>select</frontend_type>
379
- <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
380
- <show_in_default>1</show_in_default>
381
- <show_in_website>1</show_in_website>
382
- <show_in_store>0</show_in_store>
383
- </percental_surcharge_calculation_method>
384
- </fields>
385
- </shipping_at>
386
-
387
- <shipping_uk translate="label">
388
- <label>Shipping Cost idealo.co.uk</label>
389
- <sort_order>42</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
- <fields>
394
- <shipping_costs_calculation_method translate="label,comment">
395
- <sort_order>10</sort_order>
396
- <label>Shipping Costs Calculation Method</label>
397
- <frontend_type>select</frontend_type>
398
- <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
399
- <show_in_default>1</show_in_default>
400
- <show_in_website>1</show_in_website>
401
- <show_in_store>0</show_in_store>
402
- </shipping_costs_calculation_method>
403
- <shipping_costs translate="label,comment">
404
- <label>Shipping Cost based on Price</label>
405
- <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
406
- <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
407
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
408
- <sort_order>20</sort_order>
409
- <show_in_default>1</show_in_default>
410
- <show_in_website>1</show_in_website>
411
- <show_in_store>0</show_in_store>
412
- </shipping_costs>
413
- <shipping_costs_by_weight translate="label,comment">
414
- <label>Shipping Cost based on Weight</label>
415
- <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
416
- <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
417
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
418
- <sort_order>30</sort_order>
419
- <show_in_default>1</show_in_default>
420
- <show_in_website>1</show_in_website>
421
- <show_in_store>0</show_in_store>
422
- </shipping_costs_by_weight>
423
- <payment_methods translate="label">
424
- <label>Activated Payment Methods</label>
425
- <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
426
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
427
- <sort_order>50</sort_order>
428
- <show_in_default>1</show_in_default>
429
- <show_in_website>1</show_in_website>
430
- <show_in_store>0</show_in_store>
431
- </payment_methods>
432
- <percental_surcharge_calculation_method translate="label,comment">
433
- <sort_order>60</sort_order>
434
- <label>Percental Surcharge Calculation Method</label>
435
- <frontend_type>select</frontend_type>
436
- <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
437
- <show_in_default>1</show_in_default>
438
- <show_in_website>1</show_in_website>
439
- <show_in_store>0</show_in_store>
440
- </percental_surcharge_calculation_method>
441
- </fields>
442
- </shipping_uk>
443
-
444
- <shipping_fr translate="label">
445
- <label>Shipping Cost idealo.fr</label>
446
- <sort_order>43</sort_order>
447
- <show_in_default>1</show_in_default>
448
- <show_in_website>1</show_in_website>
449
- <show_in_store>1</show_in_store>
450
- <fields>
451
- <shipping_costs_calculation_method translate="label,comment">
452
- <sort_order>10</sort_order>
453
- <label>Shipping Costs Calculation Method</label>
454
- <frontend_type>select</frontend_type>
455
- <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
456
- <show_in_default>1</show_in_default>
457
- <show_in_website>1</show_in_website>
458
- <show_in_store>0</show_in_store>
459
- </shipping_costs_calculation_method>
460
- <shipping_costs translate="label,comment">
461
- <label>Shipping Cost based on Price</label>
462
- <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
463
- <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
464
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
465
- <sort_order>20</sort_order>
466
- <show_in_default>1</show_in_default>
467
- <show_in_website>1</show_in_website>
468
- <show_in_store>0</show_in_store>
469
- </shipping_costs>
470
- <shipping_costs_by_weight translate="label,comment">
471
- <label>Shipping Cost based on Weight</label>
472
- <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
473
- <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
474
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
475
- <sort_order>30</sort_order>
476
- <show_in_default>1</show_in_default>
477
- <show_in_website>1</show_in_website>
478
- <show_in_store>0</show_in_store>
479
- </shipping_costs_by_weight>
480
- <payment_methods translate="label">
481
- <label>Activated Payment Methods</label>
482
- <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
483
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
484
- <sort_order>50</sort_order>
485
- <show_in_default>1</show_in_default>
486
- <show_in_website>1</show_in_website>
487
- <show_in_store>0</show_in_store>
488
- </payment_methods>
489
- <percental_surcharge_calculation_method translate="label,comment">
490
- <sort_order>60</sort_order>
491
- <label>Percental Surcharge Calculation Method</label>
492
- <frontend_type>select</frontend_type>
493
- <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
494
- <show_in_default>1</show_in_default>
495
- <show_in_website>1</show_in_website>
496
- <show_in_store>0</show_in_store>
497
- </percental_surcharge_calculation_method>
498
- </fields>
499
- </shipping_fr>
500
-
501
- <shipping_it translate="label">
502
- <label>Shipping Cost idealo.it</label>
503
- <sort_order>44</sort_order>
504
- <show_in_default>1</show_in_default>
505
- <show_in_website>1</show_in_website>
506
- <show_in_store>1</show_in_store>
507
- <fields>
508
- <shipping_costs_calculation_method translate="label,comment">
509
- <sort_order>10</sort_order>
510
- <label>Shipping Costs Calculation Method</label>
511
- <frontend_type>select</frontend_type>
512
- <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
513
- <show_in_default>1</show_in_default>
514
- <show_in_website>1</show_in_website>
515
- <show_in_store>0</show_in_store>
516
- </shipping_costs_calculation_method>
517
- <shipping_costs translate="label,comment">
518
- <label>Shipping Cost based on Price</label>
519
- <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
520
- <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
521
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
522
- <sort_order>20</sort_order>
523
- <show_in_default>1</show_in_default>
524
- <show_in_website>1</show_in_website>
525
- <show_in_store>0</show_in_store>
526
- </shipping_costs>
527
- <shipping_costs_by_weight translate="label,comment">
528
- <label>Shipping Cost based on Weight</label>
529
- <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
530
- <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
531
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
532
- <sort_order>30</sort_order>
533
- <show_in_default>1</show_in_default>
534
- <show_in_website>1</show_in_website>
535
- <show_in_store>0</show_in_store>
536
- </shipping_costs_by_weight>
537
- <payment_methods translate="label">
538
- <label>Activated Payment Methods</label>
539
- <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
540
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
541
- <sort_order>50</sort_order>
542
- <show_in_default>1</show_in_default>
543
- <show_in_website>1</show_in_website>
544
- <show_in_store>0</show_in_store>
545
- </payment_methods>
546
- <percental_surcharge_calculation_method translate="label,comment">
547
- <sort_order>60</sort_order>
548
- <label>Percental Surcharge Calculation Method</label>
549
- <frontend_type>select</frontend_type>
550
- <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
551
- <show_in_default>1</show_in_default>
552
- <show_in_website>1</show_in_website>
553
- <show_in_store>0</show_in_store>
554
- </percental_surcharge_calculation_method>
555
- </fields>
556
- </shipping_it>
557
-
558
- <shipping_es translate="label">
559
- <label>Shipping Cost idealo.es</label>
560
- <sort_order>45</sort_order>
561
- <show_in_default>1</show_in_default>
562
- <show_in_website>1</show_in_website>
563
- <show_in_store>1</show_in_store>
564
- <fields>
565
- <shipping_costs_calculation_method translate="label,comment">
566
- <sort_order>10</sort_order>
567
- <label>Shipping Costs Calculation Method</label>
568
- <frontend_type>select</frontend_type>
569
- <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
570
- <show_in_default>1</show_in_default>
571
- <show_in_website>1</show_in_website>
572
- <show_in_store>0</show_in_store>
573
- </shipping_costs_calculation_method>
574
- <shipping_costs translate="label,comment">
575
- <label>Shipping Cost based on Price</label>
576
- <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
577
- <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
578
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
579
- <sort_order>20</sort_order>
580
- <show_in_default>1</show_in_default>
581
- <show_in_website>1</show_in_website>
582
- <show_in_store>0</show_in_store>
583
- </shipping_costs>
584
- <shipping_costs_by_weight translate="label,comment">
585
- <label>Shipping Cost based on Weight</label>
586
- <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
587
- <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
588
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
589
- <sort_order>30</sort_order>
590
- <show_in_default>1</show_in_default>
591
- <show_in_website>1</show_in_website>
592
- <show_in_store>0</show_in_store>
593
- </shipping_costs_by_weight>
594
- <payment_methods translate="label">
595
- <label>Activated Payment Methods</label>
596
- <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
597
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
598
- <sort_order>50</sort_order>
599
- <show_in_default>1</show_in_default>
600
- <show_in_website>1</show_in_website>
601
- <show_in_store>0</show_in_store>
602
- </payment_methods>
603
- <percental_surcharge_calculation_method translate="label,comment">
604
- <sort_order>60</sort_order>
605
- <label>Percental Surcharge Calculation Method</label>
606
- <frontend_type>select</frontend_type>
607
- <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
608
- <show_in_default>1</show_in_default>
609
- <show_in_website>1</show_in_website>
610
- <show_in_store>0</show_in_store>
611
- </percental_surcharge_calculation_method>
612
- </fields>
613
- </shipping_es>
614
-
615
- <shipping_pl translate="label">
616
- <label>Shipping Cost idealo.pl</label>
617
- <sort_order>46</sort_order>
618
- <show_in_default>1</show_in_default>
619
- <show_in_website>1</show_in_website>
620
- <show_in_store>1</show_in_store>
621
- <fields>
622
- <shipping_costs_calculation_method translate="label,comment">
623
- <sort_order>10</sort_order>
624
- <label>Shipping Costs Calculation Method</label>
625
- <frontend_type>select</frontend_type>
626
- <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
627
- <show_in_default>1</show_in_default>
628
- <show_in_website>1</show_in_website>
629
- <show_in_store>0</show_in_store>
630
- </shipping_costs_calculation_method>
631
- <shipping_costs translate="label,comment">
632
- <label>Shipping Cost based on Price</label>
633
- <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
634
- <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
635
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
636
- <sort_order>20</sort_order>
637
- <show_in_default>1</show_in_default>
638
- <show_in_website>1</show_in_website>
639
- <show_in_store>0</show_in_store>
640
- </shipping_costs>
641
- <shipping_costs_by_weight translate="label,comment">
642
- <label>Shipping Cost based on Weight</label>
643
- <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
644
- <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
645
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
646
- <sort_order>30</sort_order>
647
- <show_in_default>1</show_in_default>
648
- <show_in_website>1</show_in_website>
649
- <show_in_store>0</show_in_store>
650
- </shipping_costs_by_weight>
651
- <payment_methods translate="label">
652
- <label>Activated Payment Methods</label>
653
- <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
654
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
655
- <sort_order>50</sort_order>
656
- <show_in_default>1</show_in_default>
657
- <show_in_website>1</show_in_website>
658
- <show_in_store>0</show_in_store>
659
- </payment_methods>
660
- <percental_surcharge_calculation_method translate="label,comment">
661
- <sort_order>60</sort_order>
662
- <label>Percental Surcharge Calculation Method</label>
663
- <frontend_type>select</frontend_type>
664
- <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
665
- <show_in_default>1</show_in_default>
666
- <show_in_website>1</show_in_website>
667
- <show_in_store>0</show_in_store>
668
- </percental_surcharge_calculation_method>
669
- </fields>
670
- </shipping_pl>
671
-
672
- <shipping_in translate="label">
673
- <label>Shipping Cost idealo.in</label>
674
- <sort_order>47</sort_order>
675
- <show_in_default>1</show_in_default>
676
- <show_in_website>1</show_in_website>
677
- <show_in_store>1</show_in_store>
678
- <fields>
679
- <shipping_costs_calculation_method translate="label,comment">
680
- <sort_order>10</sort_order>
681
- <label>Shipping Costs Calculation Method</label>
682
- <frontend_type>select</frontend_type>
683
- <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
684
- <show_in_default>1</show_in_default>
685
- <show_in_website>1</show_in_website>
686
- <show_in_store>0</show_in_store>
687
- </shipping_costs_calculation_method>
688
- <shipping_costs translate="label,comment">
689
- <label>Shipping Cost based on Price</label>
690
- <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
691
- <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
692
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
693
- <sort_order>20</sort_order>
694
- <show_in_default>1</show_in_default>
695
- <show_in_website>1</show_in_website>
696
- <show_in_store>0</show_in_store>
697
- </shipping_costs>
698
- <shipping_costs_by_weight translate="label,comment">
699
- <label>Shipping Cost based on Weight</label>
700
- <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
701
- <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
702
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
703
- <sort_order>30</sort_order>
704
- <show_in_default>1</show_in_default>
705
- <show_in_website>1</show_in_website>
706
- <show_in_store>0</show_in_store>
707
- </shipping_costs_by_weight>
708
- <payment_methods translate="label">
709
- <label>Activated Payment Methods</label>
710
- <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
711
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
712
- <sort_order>50</sort_order>
713
- <show_in_default>1</show_in_default>
714
- <show_in_website>1</show_in_website>
715
- <show_in_store>0</show_in_store>
716
- </payment_methods>
717
- <percental_surcharge_calculation_method translate="label,comment">
718
- <sort_order>60</sort_order>
719
- <label>Percental Surcharge Calculation Method</label>
720
- <frontend_type>select</frontend_type>
721
- <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
722
- <show_in_default>1</show_in_default>
723
- <show_in_website>1</show_in_website>
724
- <show_in_store>0</show_in_store>
725
- </percental_surcharge_calculation_method>
726
- </fields>
727
- </shipping_in>
728
-
729
- <default_values translate="label,comment">
730
- <label>Default Values</label>
731
- <comment><![CDATA[You can find the settings for the <strong>minimum order amount</strong> in System -> Configuration -> Sales]]></comment>
732
- <sort_order>50</sort_order>
733
- <show_in_default>1</show_in_default>
734
- <show_in_website>1</show_in_website>
735
- <show_in_store>1</show_in_store>
736
- <fields>
737
- <shipping_comments translate="label,comment">
738
- <label>Shipping Comments</label>
739
- <comment>max. 150 chars</comment>
740
- <frontend_model>nrapps_idealo/config_shippingComments</frontend_model>
741
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
742
- <sort_order>10</sort_order>
743
- <show_in_default>1</show_in_default>
744
- <show_in_website>1</show_in_website>
745
- <show_in_store>1</show_in_store>
746
- </shipping_comments>
747
- <is_ecommerce_checkout_approved translate="label,comment">
748
- <label>idealo direct sale allowed</label>
749
- <frontend_type>select</frontend_type>
750
- <source_model>adminhtml/system_config_source_yesno</source_model>
751
- <sort_order>20</sort_order>
752
- <show_in_default>1</show_in_default>
753
- <show_in_website>1</show_in_website>
754
- <show_in_store>1</show_in_store>
755
- </is_ecommerce_checkout_approved>
756
- </fields>
757
- </default_values>
758
-
759
- <minimum_order_surcharge translate="label">
760
- <label>Minimum Order Surcharge</label>
761
- <sort_order>60</sort_order>
762
- <show_in_default>1</show_in_default>
763
- <show_in_website>1</show_in_website>
764
- <show_in_store>1</show_in_store>
765
- <fields>
766
- <is_active translate="label">
767
- <label>Is Active</label>
768
- <frontend_type>select</frontend_type>
769
- <source_model>adminhtml/system_config_source_yesno</source_model>
770
- <sort_order>10</sort_order>
771
- <show_in_default>1</show_in_default>
772
- <show_in_website>1</show_in_website>
773
- <show_in_store>0</show_in_store>
774
- </is_active>
775
- <minimum_order_value translate="label">
776
- <label>Minimum Order Value</label>
777
- <frontend_type>text</frontend_type>
778
- <sort_order>20</sort_order>
779
- <show_in_default>1</show_in_default>
780
- <show_in_website>1</show_in_website>
781
- <show_in_store>0</show_in_store>
782
- </minimum_order_value>
783
- <surcharge translate="label">
784
- <label>Surcharge for Orders below Minimum Order Value</label>
785
- <frontend_type>text</frontend_type>
786
- <sort_order>30</sort_order>
787
- <show_in_default>1</show_in_default>
788
- <show_in_website>1</show_in_website>
789
- <show_in_store>0</show_in_store>
790
- </surcharge>
791
- </fields>
792
- </minimum_order_surcharge>
793
-
794
- <minimum_order_weight_surcharge translate="label">
795
- <label>Minimum Order Weight Surcharge</label>
796
- <sort_order>70</sort_order>
797
- <show_in_default>0</show_in_default>
798
- <show_in_website>0</show_in_website>
799
- <show_in_store>0</show_in_store>
800
- <fields>
801
- <is_active translate="label">
802
- <label>Is Active</label>
803
- <frontend_type>select</frontend_type>
804
- <source_model>adminhtml/system_config_source_yesno</source_model>
805
- <sort_order>10</sort_order>
806
- <show_in_default>1</show_in_default>
807
- <show_in_website>1</show_in_website>
808
- <show_in_store>0</show_in_store>
809
- </is_active>
810
- <minimum_order_weight translate="label">
811
- <label>Minimum Order Weight</label>
812
- <frontend_type>text</frontend_type>
813
- <sort_order>20</sort_order>
814
- <show_in_default>1</show_in_default>
815
- <show_in_website>1</show_in_website>
816
- <show_in_store>0</show_in_store>
817
- </minimum_order_weight>
818
- <surcharge translate="label">
819
- <label>Surcharge for Orders below Minimum Order Weight</label>
820
- <frontend_type>text</frontend_type>
821
- <sort_order>30</sort_order>
822
- <show_in_default>1</show_in_default>
823
- <show_in_website>1</show_in_website>
824
- <show_in_store>0</show_in_store>
825
- </surcharge>
826
- <unit translate="label,comment">
827
- <label>Unit for Weight</label>
828
- <comment>i.e. g, lb, kg</comment>
829
- <frontend_type>text</frontend_type>
830
- <sort_order>30</sort_order>
831
- <show_in_default>1</show_in_default>
832
- <show_in_website>1</show_in_website>
833
- <show_in_store>1</show_in_store>
834
- </unit>
835
- </fields>
836
- </minimum_order_weight_surcharge>
837
- </groups>
838
- </nrapps_idealo>
839
- </sections>
840
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <nrapps_idealo translate="label" module="nrapps_idealo">
5
+ <label>idealo Connect</label>
6
+ <tab>catalog</tab>
7
+ <sort_order>101</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+ <groups>
12
+ <settings translate="label">
13
+ <label>Settings</label>
14
+ <sort_order>10</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <fields>
19
+ <description translate="label">
20
+ <label></label>
21
+ <frontend_model>nrapps_idealo/config_description</frontend_model>
22
+ <sort_order>5</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ </description>
27
+ <is_active translate="label">
28
+ <sort_order>10</sort_order>
29
+ <label>idealo Connect is active</label>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
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
+ </is_active>
36
+ <test_mode translate="label,comment">
37
+ <sort_order>20</sort_order>
38
+ <label>Test Mode</label>
39
+ <comment>Only generation of files, no transfer</comment>
40
+ <frontend_type>select</frontend_type>
41
+ <source_model>adminhtml/system_config_source_yesno</source_model>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </test_mode>
46
+ <shop_id translate="label,comment">
47
+ <sort_order>40</sort_order>
48
+ <label>idealo Shop ID</label>
49
+ <comment>Contact csv@idealo.de to gain access.</comment>
50
+ <frontend_type>text</frontend_type>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ <depends><test_mode>0</test_mode></depends>
55
+ </shop_id>
56
+ <user translate="label">
57
+ <sort_order>50</sort_order>
58
+ <label>idealo User</label>
59
+ <frontend_type>text</frontend_type>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ <depends><test_mode>0</test_mode></depends>
64
+ </user>
65
+ <password translate="label">
66
+ <sort_order>60</sort_order>
67
+ <label>idealo Password</label>
68
+ <frontend_type>text</frontend_type>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ <depends><test_mode>0</test_mode></depends>
73
+ </password>
74
+ <api_update_url translate="label,comment">
75
+ <sort_order>70</sort_order>
76
+ <label>API URL for Update Requests</label>
77
+ <frontend_type>text</frontend_type>
78
+ <show_in_default>0</show_in_default>
79
+ <show_in_website>0</show_in_website>
80
+ <show_in_store>0</show_in_store>
81
+ </api_update_url>
82
+ <api_get_url translate="label,comment">
83
+ <sort_order>75</sort_order>
84
+ <label>API URL for Get Requests</label>
85
+ <frontend_type>text</frontend_type>
86
+ <show_in_default>0</show_in_default>
87
+ <show_in_website>0</show_in_website>
88
+ <show_in_store>0</show_in_store>
89
+ </api_get_url>
90
+ <disable_certificate_check translate="label,comment">
91
+ <sort_order>80</sort_order>
92
+ <label>Disable check of SSL certificate</label>
93
+ <comment>In case you have problems with the connection</comment>
94
+ <frontend_type>select</frontend_type>
95
+ <source_model>adminhtml/system_config_source_yesno</source_model>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <depends><test_mode>0</test_mode></depends>
100
+ </disable_certificate_check>
101
+ <logging translate="label,comment">
102
+ <sort_order>90</sort_order>
103
+ <label>Activate logging for all requests</label>
104
+ <comment>Logs can be found in media/nrapps_idealo/log/idealo_requests.txt</comment>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>adminhtml/system_config_source_yesno</source_model>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>0</show_in_website>
109
+ <show_in_store>0</show_in_store>
110
+ <depends><test_mode>0</test_mode></depends>
111
+ </logging>
112
+ </fields>
113
+ </settings>
114
+
115
+ <product_options>
116
+ <label>Product Options</label>
117
+ <sort_order>20</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ <fields>
122
+ <allowed_product_types translate="label">
123
+ <sort_order>10</sort_order>
124
+ <label>Allowed Product Types</label>
125
+ <frontend_type>multiselect</frontend_type>
126
+ <source_model>nrapps_idealo/source_productTypes</source_model>
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
+ </allowed_product_types>
131
+ <allowed_attribute_sets translate="label">
132
+ <sort_order>20</sort_order>
133
+ <label>Allowed Attribute Sets</label>
134
+ <frontend_type>multiselect</frontend_type>
135
+ <source_model>nrapps_idealo/source_attributeSets</source_model>
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
+ </allowed_attribute_sets>
140
+ <configurable_export_type translate="label">
141
+ <sort_order>30</sort_order>
142
+ <label>Export Type for Configurable Products</label>
143
+ <frontend_type>select</frontend_type>
144
+ <source_model>nrapps_idealo/source_configurableTypes</source_model>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ </configurable_export_type>
149
+ <configurable_child_products_price translate="label,comment">
150
+ <sort_order>40</sort_order>
151
+ <label>Calculate price of configurable child products as</label>
152
+ <comment>Use option "child product" or "parent product without modifications" for better performance. There can be memory leaks with the option "parent product &lt;strong&gt;with&lt;/strong&gt; modifications".</comment>
153
+ <frontend_type>select</frontend_type>
154
+ <source_model>nrapps_idealo/source_configurableChildProductsPriceType</source_model>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ </configurable_child_products_price>
159
+ <add_attributes_to_export translate="label">
160
+ <sort_order>50</sort_order>
161
+ <label>Add contents of the following attribute(s) to the export</label>
162
+ <frontend_model>nrapps_idealo/config_attributesNoSortOrder</frontend_model>
163
+ <backend_model>nrapps_idealo/backend_serialized_array</backend_model>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ </add_attributes_to_export>
168
+ <add_attribute_contents_to_name translate="label">
169
+ <sort_order>60</sort_order>
170
+ <label>Add contents of the following attribute(s) to product name</label>
171
+ <frontend_model>nrapps_idealo/config_attributes</frontend_model>
172
+ <backend_model>nrapps_idealo/backend_serialized_array</backend_model>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>1</show_in_store>
176
+ </add_attribute_contents_to_name>
177
+ <export_flexible_price_bundles translate="label,comment">
178
+ <sort_order>70</sort_order>
179
+ <label>Export Bundle Products without a fixed price</label>
180
+ <comment>No Price will be available for those products</comment>
181
+ <frontend_type>select</frontend_type>
182
+ <source_model>adminhtml/system_config_source_yesno</source_model>
183
+ <show_in_default>0</show_in_default>
184
+ <show_in_website>0</show_in_website>
185
+ <show_in_store>0</show_in_store>
186
+ </export_flexible_price_bundles>
187
+ </fields>
188
+ </product_options>
189
+
190
+ <email>
191
+ <label>Email Options</label>
192
+ <sort_order>25</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>1</show_in_website>
195
+ <show_in_store>1</show_in_store>
196
+ <fields>
197
+ <error_recipient translate="label">
198
+ <label>Error Messages: Recipient Email Address</label>
199
+ <frontend_type>text</frontend_type>
200
+ <sort_order>10</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>0</show_in_website>
203
+ <show_in_store>0</show_in_store>
204
+ </error_recipient>
205
+ <error_identity translate="label">
206
+ <label>Error Messages: Identity</label>
207
+ <frontend_type>select</frontend_type>
208
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
209
+ <sort_order>14</sort_order>
210
+ <show_in_default>1</show_in_default>
211
+ <show_in_website>0</show_in_website>
212
+ <show_in_store>0</show_in_store>
213
+ </error_identity>
214
+ <error_template translate="label">
215
+ <label>Error Messages: Template</label>
216
+ <frontend_type>select</frontend_type>
217
+ <source_model>adminhtml/system_config_source_email_template</source_model>
218
+ <sort_order>15</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>0</show_in_website>
221
+ <show_in_store>0</show_in_store>
222
+ </error_template>
223
+ </fields>
224
+ </email>
225
+
226
+ <listing translate="label">
227
+ <label>Listing</label>
228
+ <sort_order>30</sort_order>
229
+ <show_in_default>1</show_in_default>
230
+ <show_in_website>1</show_in_website>
231
+ <show_in_store>1</show_in_store>
232
+ <fields>
233
+ <listing_at translate="label,comment">
234
+ <sort_order>10</sort_order>
235
+ <label>Listing at</label>
236
+ <frontend_type>multiselect</frontend_type>
237
+ <source_model>nrapps_idealo/source_listingCountries</source_model>
238
+ <show_in_default>1</show_in_default>
239
+ <show_in_website>1</show_in_website>
240
+ <show_in_store>1</show_in_store>
241
+ </listing_at>
242
+ </fields>
243
+ </listing>
244
+
245
+ <delivery_times translate="label">
246
+ <label>Delivery Times</label>
247
+ <sort_order>35</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>1</show_in_store>
251
+ <fields>
252
+ <mapping translate="label,comment">
253
+ <label>Mapping</label>
254
+ <comment>If no country specific value is set, delivery time will not be exported.</comment>
255
+ <frontend_model>nrapps_idealo/config_deliveryTimeMapping</frontend_model>
256
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
257
+ <sort_order>10</sort_order>
258
+ <show_in_default>1</show_in_default>
259
+ <show_in_website>1</show_in_website>
260
+ <show_in_store>1</show_in_store>
261
+ </mapping>
262
+ <button translate="label">
263
+ <label></label>
264
+ <frontend_model>nrapps_idealo/config_deliveryTimeUpdateButton</frontend_model>
265
+ <sort_order>20</sort_order>
266
+ <show_in_default>1</show_in_default>
267
+ <show_in_website>1</show_in_website>
268
+ <show_in_store>1</show_in_store>
269
+ </button>
270
+ </fields>
271
+ </delivery_times>
272
+
273
+ <shipping translate="label">
274
+ <label>Shipping Cost idealo.de</label>
275
+ <sort_order>40</sort_order>
276
+ <show_in_default>1</show_in_default>
277
+ <show_in_website>1</show_in_website>
278
+ <show_in_store>1</show_in_store>
279
+ <fields>
280
+ <shipping_costs_calculation_method translate="label,comment">
281
+ <sort_order>10</sort_order>
282
+ <label>Shipping Costs Calculation Method</label>
283
+ <frontend_type>select</frontend_type>
284
+ <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>1</show_in_website>
287
+ <show_in_store>0</show_in_store>
288
+ </shipping_costs_calculation_method>
289
+ <shipping_costs translate="label,comment">
290
+ <label>Shipping Cost based on Price</label>
291
+ <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
292
+ <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
293
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
294
+ <sort_order>20</sort_order>
295
+ <show_in_default>1</show_in_default>
296
+ <show_in_website>1</show_in_website>
297
+ <show_in_store>0</show_in_store>
298
+ </shipping_costs>
299
+ <shipping_costs_by_weight translate="label,comment">
300
+ <label>Shipping Cost based on Weight</label>
301
+ <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
302
+ <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
303
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
304
+ <sort_order>30</sort_order>
305
+ <show_in_default>1</show_in_default>
306
+ <show_in_website>1</show_in_website>
307
+ <show_in_store>0</show_in_store>
308
+ </shipping_costs_by_weight>
309
+ <payment_methods translate="label">
310
+ <label>Activated Payment Methods</label>
311
+ <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
312
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
313
+ <sort_order>50</sort_order>
314
+ <show_in_default>1</show_in_default>
315
+ <show_in_website>1</show_in_website>
316
+ <show_in_store>0</show_in_store>
317
+ </payment_methods>
318
+ <percental_surcharge_calculation_method translate="label,comment">
319
+ <sort_order>60</sort_order>
320
+ <label>Percental Surcharge Calculation Method</label>
321
+ <frontend_type>select</frontend_type>
322
+ <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
323
+ <show_in_default>1</show_in_default>
324
+ <show_in_website>1</show_in_website>
325
+ <show_in_store>0</show_in_store>
326
+ </percental_surcharge_calculation_method>
327
+ </fields>
328
+ </shipping>
329
+
330
+ <shipping_at translate="label">
331
+ <label>Shipping Cost idealo.at</label>
332
+ <sort_order>41</sort_order>
333
+ <show_in_default>1</show_in_default>
334
+ <show_in_website>1</show_in_website>
335
+ <show_in_store>1</show_in_store>
336
+ <fields>
337
+ <shipping_costs_calculation_method translate="label,comment">
338
+ <sort_order>10</sort_order>
339
+ <label>Shipping Costs Calculation Method</label>
340
+ <frontend_type>select</frontend_type>
341
+ <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
342
+ <show_in_default>1</show_in_default>
343
+ <show_in_website>1</show_in_website>
344
+ <show_in_store>0</show_in_store>
345
+ </shipping_costs_calculation_method>
346
+ <shipping_costs translate="label,comment">
347
+ <label>Shipping Cost based on Price</label>
348
+ <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
349
+ <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
350
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
351
+ <sort_order>20</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>1</show_in_website>
354
+ <show_in_store>0</show_in_store>
355
+ </shipping_costs>
356
+ <shipping_costs_by_weight translate="label,comment">
357
+ <label>Shipping Cost based on Weight</label>
358
+ <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
359
+ <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
360
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
361
+ <sort_order>30</sort_order>
362
+ <show_in_default>1</show_in_default>
363
+ <show_in_website>1</show_in_website>
364
+ <show_in_store>0</show_in_store>
365
+ </shipping_costs_by_weight>
366
+ <payment_methods translate="label">
367
+ <label>Activated Payment Methods</label>
368
+ <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
369
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
370
+ <sort_order>50</sort_order>
371
+ <show_in_default>1</show_in_default>
372
+ <show_in_website>1</show_in_website>
373
+ <show_in_store>0</show_in_store>
374
+ </payment_methods>
375
+ <percental_surcharge_calculation_method translate="label,comment">
376
+ <sort_order>60</sort_order>
377
+ <label>Percental Surcharge Calculation Method</label>
378
+ <frontend_type>select</frontend_type>
379
+ <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
380
+ <show_in_default>1</show_in_default>
381
+ <show_in_website>1</show_in_website>
382
+ <show_in_store>0</show_in_store>
383
+ </percental_surcharge_calculation_method>
384
+ </fields>
385
+ </shipping_at>
386
+
387
+ <shipping_uk translate="label">
388
+ <label>Shipping Cost idealo.co.uk</label>
389
+ <sort_order>42</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
+ <fields>
394
+ <shipping_costs_calculation_method translate="label,comment">
395
+ <sort_order>10</sort_order>
396
+ <label>Shipping Costs Calculation Method</label>
397
+ <frontend_type>select</frontend_type>
398
+ <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
399
+ <show_in_default>1</show_in_default>
400
+ <show_in_website>1</show_in_website>
401
+ <show_in_store>0</show_in_store>
402
+ </shipping_costs_calculation_method>
403
+ <shipping_costs translate="label,comment">
404
+ <label>Shipping Cost based on Price</label>
405
+ <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
406
+ <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
407
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
408
+ <sort_order>20</sort_order>
409
+ <show_in_default>1</show_in_default>
410
+ <show_in_website>1</show_in_website>
411
+ <show_in_store>0</show_in_store>
412
+ </shipping_costs>
413
+ <shipping_costs_by_weight translate="label,comment">
414
+ <label>Shipping Cost based on Weight</label>
415
+ <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
416
+ <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
417
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
418
+ <sort_order>30</sort_order>
419
+ <show_in_default>1</show_in_default>
420
+ <show_in_website>1</show_in_website>
421
+ <show_in_store>0</show_in_store>
422
+ </shipping_costs_by_weight>
423
+ <payment_methods translate="label">
424
+ <label>Activated Payment Methods</label>
425
+ <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
426
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
427
+ <sort_order>50</sort_order>
428
+ <show_in_default>1</show_in_default>
429
+ <show_in_website>1</show_in_website>
430
+ <show_in_store>0</show_in_store>
431
+ </payment_methods>
432
+ <percental_surcharge_calculation_method translate="label,comment">
433
+ <sort_order>60</sort_order>
434
+ <label>Percental Surcharge Calculation Method</label>
435
+ <frontend_type>select</frontend_type>
436
+ <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
437
+ <show_in_default>1</show_in_default>
438
+ <show_in_website>1</show_in_website>
439
+ <show_in_store>0</show_in_store>
440
+ </percental_surcharge_calculation_method>
441
+ </fields>
442
+ </shipping_uk>
443
+
444
+ <shipping_fr translate="label">
445
+ <label>Shipping Cost idealo.fr</label>
446
+ <sort_order>43</sort_order>
447
+ <show_in_default>1</show_in_default>
448
+ <show_in_website>1</show_in_website>
449
+ <show_in_store>1</show_in_store>
450
+ <fields>
451
+ <shipping_costs_calculation_method translate="label,comment">
452
+ <sort_order>10</sort_order>
453
+ <label>Shipping Costs Calculation Method</label>
454
+ <frontend_type>select</frontend_type>
455
+ <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
456
+ <show_in_default>1</show_in_default>
457
+ <show_in_website>1</show_in_website>
458
+ <show_in_store>0</show_in_store>
459
+ </shipping_costs_calculation_method>
460
+ <shipping_costs translate="label,comment">
461
+ <label>Shipping Cost based on Price</label>
462
+ <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
463
+ <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
464
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
465
+ <sort_order>20</sort_order>
466
+ <show_in_default>1</show_in_default>
467
+ <show_in_website>1</show_in_website>
468
+ <show_in_store>0</show_in_store>
469
+ </shipping_costs>
470
+ <shipping_costs_by_weight translate="label,comment">
471
+ <label>Shipping Cost based on Weight</label>
472
+ <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
473
+ <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
474
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
475
+ <sort_order>30</sort_order>
476
+ <show_in_default>1</show_in_default>
477
+ <show_in_website>1</show_in_website>
478
+ <show_in_store>0</show_in_store>
479
+ </shipping_costs_by_weight>
480
+ <payment_methods translate="label">
481
+ <label>Activated Payment Methods</label>
482
+ <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
483
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
484
+ <sort_order>50</sort_order>
485
+ <show_in_default>1</show_in_default>
486
+ <show_in_website>1</show_in_website>
487
+ <show_in_store>0</show_in_store>
488
+ </payment_methods>
489
+ <percental_surcharge_calculation_method translate="label,comment">
490
+ <sort_order>60</sort_order>
491
+ <label>Percental Surcharge Calculation Method</label>
492
+ <frontend_type>select</frontend_type>
493
+ <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
494
+ <show_in_default>1</show_in_default>
495
+ <show_in_website>1</show_in_website>
496
+ <show_in_store>0</show_in_store>
497
+ </percental_surcharge_calculation_method>
498
+ </fields>
499
+ </shipping_fr>
500
+
501
+ <shipping_it translate="label">
502
+ <label>Shipping Cost idealo.it</label>
503
+ <sort_order>44</sort_order>
504
+ <show_in_default>1</show_in_default>
505
+ <show_in_website>1</show_in_website>
506
+ <show_in_store>1</show_in_store>
507
+ <fields>
508
+ <shipping_costs_calculation_method translate="label,comment">
509
+ <sort_order>10</sort_order>
510
+ <label>Shipping Costs Calculation Method</label>
511
+ <frontend_type>select</frontend_type>
512
+ <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
513
+ <show_in_default>1</show_in_default>
514
+ <show_in_website>1</show_in_website>
515
+ <show_in_store>0</show_in_store>
516
+ </shipping_costs_calculation_method>
517
+ <shipping_costs translate="label,comment">
518
+ <label>Shipping Cost based on Price</label>
519
+ <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
520
+ <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
521
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
522
+ <sort_order>20</sort_order>
523
+ <show_in_default>1</show_in_default>
524
+ <show_in_website>1</show_in_website>
525
+ <show_in_store>0</show_in_store>
526
+ </shipping_costs>
527
+ <shipping_costs_by_weight translate="label,comment">
528
+ <label>Shipping Cost based on Weight</label>
529
+ <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
530
+ <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
531
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
532
+ <sort_order>30</sort_order>
533
+ <show_in_default>1</show_in_default>
534
+ <show_in_website>1</show_in_website>
535
+ <show_in_store>0</show_in_store>
536
+ </shipping_costs_by_weight>
537
+ <payment_methods translate="label">
538
+ <label>Activated Payment Methods</label>
539
+ <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
540
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
541
+ <sort_order>50</sort_order>
542
+ <show_in_default>1</show_in_default>
543
+ <show_in_website>1</show_in_website>
544
+ <show_in_store>0</show_in_store>
545
+ </payment_methods>
546
+ <percental_surcharge_calculation_method translate="label,comment">
547
+ <sort_order>60</sort_order>
548
+ <label>Percental Surcharge Calculation Method</label>
549
+ <frontend_type>select</frontend_type>
550
+ <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
551
+ <show_in_default>1</show_in_default>
552
+ <show_in_website>1</show_in_website>
553
+ <show_in_store>0</show_in_store>
554
+ </percental_surcharge_calculation_method>
555
+ </fields>
556
+ </shipping_it>
557
+
558
+ <shipping_es translate="label">
559
+ <label>Shipping Cost idealo.es</label>
560
+ <sort_order>45</sort_order>
561
+ <show_in_default>1</show_in_default>
562
+ <show_in_website>1</show_in_website>
563
+ <show_in_store>1</show_in_store>
564
+ <fields>
565
+ <shipping_costs_calculation_method translate="label,comment">
566
+ <sort_order>10</sort_order>
567
+ <label>Shipping Costs Calculation Method</label>
568
+ <frontend_type>select</frontend_type>
569
+ <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
570
+ <show_in_default>1</show_in_default>
571
+ <show_in_website>1</show_in_website>
572
+ <show_in_store>0</show_in_store>
573
+ </shipping_costs_calculation_method>
574
+ <shipping_costs translate="label,comment">
575
+ <label>Shipping Cost based on Price</label>
576
+ <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
577
+ <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
578
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
579
+ <sort_order>20</sort_order>
580
+ <show_in_default>1</show_in_default>
581
+ <show_in_website>1</show_in_website>
582
+ <show_in_store>0</show_in_store>
583
+ </shipping_costs>
584
+ <shipping_costs_by_weight translate="label,comment">
585
+ <label>Shipping Cost based on Weight</label>
586
+ <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
587
+ <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
588
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
589
+ <sort_order>30</sort_order>
590
+ <show_in_default>1</show_in_default>
591
+ <show_in_website>1</show_in_website>
592
+ <show_in_store>0</show_in_store>
593
+ </shipping_costs_by_weight>
594
+ <payment_methods translate="label">
595
+ <label>Activated Payment Methods</label>
596
+ <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
597
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
598
+ <sort_order>50</sort_order>
599
+ <show_in_default>1</show_in_default>
600
+ <show_in_website>1</show_in_website>
601
+ <show_in_store>0</show_in_store>
602
+ </payment_methods>
603
+ <percental_surcharge_calculation_method translate="label,comment">
604
+ <sort_order>60</sort_order>
605
+ <label>Percental Surcharge Calculation Method</label>
606
+ <frontend_type>select</frontend_type>
607
+ <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
608
+ <show_in_default>1</show_in_default>
609
+ <show_in_website>1</show_in_website>
610
+ <show_in_store>0</show_in_store>
611
+ </percental_surcharge_calculation_method>
612
+ </fields>
613
+ </shipping_es>
614
+
615
+ <shipping_pl translate="label">
616
+ <label>Shipping Cost idealo.pl</label>
617
+ <sort_order>46</sort_order>
618
+ <show_in_default>1</show_in_default>
619
+ <show_in_website>1</show_in_website>
620
+ <show_in_store>1</show_in_store>
621
+ <fields>
622
+ <shipping_costs_calculation_method translate="label,comment">
623
+ <sort_order>10</sort_order>
624
+ <label>Shipping Costs Calculation Method</label>
625
+ <frontend_type>select</frontend_type>
626
+ <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
627
+ <show_in_default>1</show_in_default>
628
+ <show_in_website>1</show_in_website>
629
+ <show_in_store>0</show_in_store>
630
+ </shipping_costs_calculation_method>
631
+ <shipping_costs translate="label,comment">
632
+ <label>Shipping Cost based on Price</label>
633
+ <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
634
+ <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
635
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
636
+ <sort_order>20</sort_order>
637
+ <show_in_default>1</show_in_default>
638
+ <show_in_website>1</show_in_website>
639
+ <show_in_store>0</show_in_store>
640
+ </shipping_costs>
641
+ <shipping_costs_by_weight translate="label,comment">
642
+ <label>Shipping Cost based on Weight</label>
643
+ <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
644
+ <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
645
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
646
+ <sort_order>30</sort_order>
647
+ <show_in_default>1</show_in_default>
648
+ <show_in_website>1</show_in_website>
649
+ <show_in_store>0</show_in_store>
650
+ </shipping_costs_by_weight>
651
+ <payment_methods translate="label">
652
+ <label>Activated Payment Methods</label>
653
+ <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
654
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
655
+ <sort_order>50</sort_order>
656
+ <show_in_default>1</show_in_default>
657
+ <show_in_website>1</show_in_website>
658
+ <show_in_store>0</show_in_store>
659
+ </payment_methods>
660
+ <percental_surcharge_calculation_method translate="label,comment">
661
+ <sort_order>60</sort_order>
662
+ <label>Percental Surcharge Calculation Method</label>
663
+ <frontend_type>select</frontend_type>
664
+ <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
665
+ <show_in_default>1</show_in_default>
666
+ <show_in_website>1</show_in_website>
667
+ <show_in_store>0</show_in_store>
668
+ </percental_surcharge_calculation_method>
669
+ </fields>
670
+ </shipping_pl>
671
+
672
+ <shipping_in translate="label">
673
+ <label>Shipping Cost idealo.in</label>
674
+ <sort_order>47</sort_order>
675
+ <show_in_default>1</show_in_default>
676
+ <show_in_website>1</show_in_website>
677
+ <show_in_store>1</show_in_store>
678
+ <fields>
679
+ <shipping_costs_calculation_method translate="label,comment">
680
+ <sort_order>10</sort_order>
681
+ <label>Shipping Costs Calculation Method</label>
682
+ <frontend_type>select</frontend_type>
683
+ <source_model>nrapps_idealo/source_shippingCostsMethod</source_model>
684
+ <show_in_default>1</show_in_default>
685
+ <show_in_website>1</show_in_website>
686
+ <show_in_store>0</show_in_store>
687
+ </shipping_costs_calculation_method>
688
+ <shipping_costs translate="label,comment">
689
+ <label>Shipping Cost based on Price</label>
690
+ <comment>Only for Shipping Costs Calculation Method "Price" (see above)</comment>
691
+ <frontend_model>nrapps_idealo/config_shippingCosts</frontend_model>
692
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
693
+ <sort_order>20</sort_order>
694
+ <show_in_default>1</show_in_default>
695
+ <show_in_website>1</show_in_website>
696
+ <show_in_store>0</show_in_store>
697
+ </shipping_costs>
698
+ <shipping_costs_by_weight translate="label,comment">
699
+ <label>Shipping Cost based on Weight</label>
700
+ <comment><![CDATA[Only for Shipping Costs Calculation Method "Weight" (see above)<br />Product attribute "Weight" [weight] will be used to determine weight.]]></comment>
701
+ <frontend_model>nrapps_idealo/config_shippingCostsWeight</frontend_model>
702
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
703
+ <sort_order>30</sort_order>
704
+ <show_in_default>1</show_in_default>
705
+ <show_in_website>1</show_in_website>
706
+ <show_in_store>0</show_in_store>
707
+ </shipping_costs_by_weight>
708
+ <payment_methods translate="label">
709
+ <label>Activated Payment Methods</label>
710
+ <frontend_model>nrapps_idealo/config_paymentMethods</frontend_model>
711
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
712
+ <sort_order>50</sort_order>
713
+ <show_in_default>1</show_in_default>
714
+ <show_in_website>1</show_in_website>
715
+ <show_in_store>0</show_in_store>
716
+ </payment_methods>
717
+ <percental_surcharge_calculation_method translate="label,comment">
718
+ <sort_order>60</sort_order>
719
+ <label>Percental Surcharge Calculation Method</label>
720
+ <frontend_type>select</frontend_type>
721
+ <source_model>nrapps_idealo/source_percentalSurchargeCalculationMethod</source_model>
722
+ <show_in_default>1</show_in_default>
723
+ <show_in_website>1</show_in_website>
724
+ <show_in_store>0</show_in_store>
725
+ </percental_surcharge_calculation_method>
726
+ </fields>
727
+ </shipping_in>
728
+
729
+ <default_values translate="label,comment">
730
+ <label>Default Values</label>
731
+ <comment><![CDATA[You can find the settings for the <strong>minimum order amount</strong> in System -> Configuration -> Sales]]></comment>
732
+ <sort_order>50</sort_order>
733
+ <show_in_default>1</show_in_default>
734
+ <show_in_website>1</show_in_website>
735
+ <show_in_store>1</show_in_store>
736
+ <fields>
737
+ <shipping_comments translate="label,comment">
738
+ <label>Shipping Comments</label>
739
+ <comment>max. 150 chars</comment>
740
+ <frontend_model>nrapps_idealo/config_shippingComments</frontend_model>
741
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
742
+ <sort_order>10</sort_order>
743
+ <show_in_default>1</show_in_default>
744
+ <show_in_website>1</show_in_website>
745
+ <show_in_store>1</show_in_store>
746
+ </shipping_comments>
747
+ <is_ecommerce_checkout_approved translate="label,comment">
748
+ <label>idealo direct sale allowed</label>
749
+ <frontend_type>select</frontend_type>
750
+ <source_model>adminhtml/system_config_source_yesno</source_model>
751
+ <sort_order>20</sort_order>
752
+ <show_in_default>1</show_in_default>
753
+ <show_in_website>1</show_in_website>
754
+ <show_in_store>1</show_in_store>
755
+ </is_ecommerce_checkout_approved>
756
+ </fields>
757
+ </default_values>
758
+
759
+ <minimum_order_surcharge translate="label">
760
+ <label>Minimum Order Surcharge</label>
761
+ <sort_order>60</sort_order>
762
+ <show_in_default>1</show_in_default>
763
+ <show_in_website>1</show_in_website>
764
+ <show_in_store>1</show_in_store>
765
+ <fields>
766
+ <is_active translate="label">
767
+ <label>Is Active</label>
768
+ <frontend_type>select</frontend_type>
769
+ <source_model>adminhtml/system_config_source_yesno</source_model>
770
+ <sort_order>10</sort_order>
771
+ <show_in_default>1</show_in_default>
772
+ <show_in_website>1</show_in_website>
773
+ <show_in_store>0</show_in_store>
774
+ </is_active>
775
+ <minimum_order_value translate="label">
776
+ <label>Minimum Order Value</label>
777
+ <frontend_type>text</frontend_type>
778
+ <sort_order>20</sort_order>
779
+ <show_in_default>1</show_in_default>
780
+ <show_in_website>1</show_in_website>
781
+ <show_in_store>0</show_in_store>
782
+ </minimum_order_value>
783
+ <surcharge translate="label">
784
+ <label>Surcharge for Orders below Minimum Order Value</label>
785
+ <frontend_type>text</frontend_type>
786
+ <sort_order>30</sort_order>
787
+ <show_in_default>1</show_in_default>
788
+ <show_in_website>1</show_in_website>
789
+ <show_in_store>0</show_in_store>
790
+ </surcharge>
791
+ </fields>
792
+ </minimum_order_surcharge>
793
+
794
+ <minimum_order_weight_surcharge translate="label">
795
+ <label>Minimum Order Weight Surcharge</label>
796
+ <sort_order>70</sort_order>
797
+ <show_in_default>0</show_in_default>
798
+ <show_in_website>0</show_in_website>
799
+ <show_in_store>0</show_in_store>
800
+ <fields>
801
+ <is_active translate="label">
802
+ <label>Is Active</label>
803
+ <frontend_type>select</frontend_type>
804
+ <source_model>adminhtml/system_config_source_yesno</source_model>
805
+ <sort_order>10</sort_order>
806
+ <show_in_default>1</show_in_default>
807
+ <show_in_website>1</show_in_website>
808
+ <show_in_store>0</show_in_store>
809
+ </is_active>
810
+ <minimum_order_weight translate="label">
811
+ <label>Minimum Order Weight</label>
812
+ <frontend_type>text</frontend_type>
813
+ <sort_order>20</sort_order>
814
+ <show_in_default>1</show_in_default>
815
+ <show_in_website>1</show_in_website>
816
+ <show_in_store>0</show_in_store>
817
+ </minimum_order_weight>
818
+ <surcharge translate="label">
819
+ <label>Surcharge for Orders below Minimum Order Weight</label>
820
+ <frontend_type>text</frontend_type>
821
+ <sort_order>30</sort_order>
822
+ <show_in_default>1</show_in_default>
823
+ <show_in_website>1</show_in_website>
824
+ <show_in_store>0</show_in_store>
825
+ </surcharge>
826
+ <unit translate="label,comment">
827
+ <label>Unit for Weight</label>
828
+ <comment>i.e. g, lb, kg</comment>
829
+ <frontend_type>text</frontend_type>
830
+ <sort_order>30</sort_order>
831
+ <show_in_default>1</show_in_default>
832
+ <show_in_website>1</show_in_website>
833
+ <show_in_store>1</show_in_store>
834
+ </unit>
835
+ </fields>
836
+ </minimum_order_weight_surcharge>
837
+ </groups>
838
+ </nrapps_idealo>
839
+ </sections>
840
+ </config>
app/code/community/NRApps/Idealo/sql/nrapps_idealo_setup/install-1.0.0.php CHANGED
@@ -1,87 +1,87 @@
1
- <?php
2
-
3
- /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
- $installer = $this;
5
-
6
- $installer->startSetup();
7
-
8
- /**
9
- * Create table nrapps_idealo_index
10
- */
11
- $indexTableName = $installer->getTable('nrapps_idealo/index');
12
-
13
- if ($installer->getConnection()->isTableExists($indexTableName)) {
14
- $installer->getConnection()->dropTable($indexTableName);
15
- }
16
-
17
- $indexTable = $installer->getConnection()->newTable($indexTableName)
18
- ->addColumn('index_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
19
- 'unsigned' => true,
20
- 'nullable' => false,
21
- 'primary' => true,
22
- 'identity' => true,
23
- ), 'ID')
24
- ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
25
- ), 'Store ID')
26
- ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
27
- ), 'Product ID')
28
- ->addColumn('data', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
29
- ), 'Product Feed Data')
30
- ->addColumn('is_processed', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
31
- 'nullable' => false,
32
- 'default' => 0,
33
- ), 'Is transferred to idealo')
34
- ->addColumn('status', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
35
- ), 'Status from API')
36
- ->addColumn('feed_type', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
37
- ), 'Feed Type (xml or csv)')
38
- ->addColumn('status_message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
39
- ), 'Message for Status from API')
40
- ->addColumn('transfer_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
41
- ), 'Transfer Date')
42
-
43
- ->addIndex($installer->getIdxName('nrapps_idealo/index', array('store_id', 'product_id', 'feed_type'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
44
- array('store_id', 'product_id', 'feed_type'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
45
- ->addIndex($installer->getIdxName('nrapps_idealo/index', array('store_id', 'is_processed', 'feed_type'), Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX),
46
- array('store_id', 'is_processed', 'feed_type'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX))
47
-
48
- ->addForeignKey($installer->getFkName('nrapps_idealo/index', 'store_id', 'core/store', 'store_id'),
49
- 'store_id', $installer->getTable('core/store'), 'store_id',
50
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
51
-
52
- ->setComment('idealo Connect Index');
53
-
54
- $installer->getConnection()->createTable($indexTable);
55
-
56
-
57
- $installer->addAttribute('catalog_product', 'nrapps_idealo_exclude', array(
58
- 'type' => 'varchar',
59
- 'input' => 'select',
60
- 'source' => 'eav/entity_attribute_source_boolean',
61
- 'label' => Mage::helper('nrapps_idealo')->__('Exclude from idealo Connect'),
62
- 'required' => 0,
63
- 'user_defined' => 0,
64
- 'group' => 'idealo',
65
- 'global' => 0,
66
- 'visible' => 1,
67
- 'searchable' => 0,
68
- 'filterable' => 0,
69
- 'filterable_in_search' => 0,
70
- 'visible_on_front' => 0,
71
- 'is_configurable' => 0,
72
- ));
73
-
74
- $installer->addAttribute('catalog_category', 'nrapps_idealo_exclude', array(
75
- 'type' => 'int',
76
- 'input' => 'select',
77
- 'source' => 'eav/entity_attribute_source_boolean',
78
- 'label' => Mage::helper('nrapps_idealo')->__('Exclude from idealo Connect'),
79
- 'note' => Mage::helper('nrapps_idealo')->__('Exclude only Categories, not included Products'),
80
- 'required' => 0,
81
- 'user_defined' => 0,
82
- 'group' => 'idealo',
83
- 'global' => 0,
84
- 'visible' => 1,
85
- ));
86
-
87
  $installer->endSetup();
1
+ <?php
2
+
3
+ /** @var $installer Mage_Catalog_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ /**
9
+ * Create table nrapps_idealo_index
10
+ */
11
+ $indexTableName = $installer->getTable('nrapps_idealo/index');
12
+
13
+ if ($installer->getConnection()->isTableExists($indexTableName)) {
14
+ $installer->getConnection()->dropTable($indexTableName);
15
+ }
16
+
17
+ $indexTable = $installer->getConnection()->newTable($indexTableName)
18
+ ->addColumn('index_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
19
+ 'unsigned' => true,
20
+ 'nullable' => false,
21
+ 'primary' => true,
22
+ 'identity' => true,
23
+ ), 'ID')
24
+ ->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
25
+ ), 'Store ID')
26
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
27
+ ), 'Product ID')
28
+ ->addColumn('data', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
29
+ ), 'Product Feed Data')
30
+ ->addColumn('is_processed', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
31
+ 'nullable' => false,
32
+ 'default' => 0,
33
+ ), 'Is transferred to idealo')
34
+ ->addColumn('status', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
35
+ ), 'Status from API')
36
+ ->addColumn('feed_type', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
37
+ ), 'Feed Type (xml or csv)')
38
+ ->addColumn('status_message', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
39
+ ), 'Message for Status from API')
40
+ ->addColumn('transfer_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
41
+ ), 'Transfer Date')
42
+
43
+ ->addIndex($installer->getIdxName('nrapps_idealo/index', array('store_id', 'product_id', 'feed_type'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
44
+ array('store_id', 'product_id', 'feed_type'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
45
+ ->addIndex($installer->getIdxName('nrapps_idealo/index', array('store_id', 'is_processed', 'feed_type'), Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX),
46
+ array('store_id', 'is_processed', 'feed_type'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_INDEX))
47
+
48
+ ->addForeignKey($installer->getFkName('nrapps_idealo/index', 'store_id', 'core/store', 'store_id'),
49
+ 'store_id', $installer->getTable('core/store'), 'store_id',
50
+ Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
51
+
52
+ ->setComment('idealo Connect Index');
53
+
54
+ $installer->getConnection()->createTable($indexTable);
55
+
56
+
57
+ $installer->addAttribute('catalog_product', 'nrapps_idealo_exclude', array(
58
+ 'type' => 'varchar',
59
+ 'input' => 'select',
60
+ 'source' => 'eav/entity_attribute_source_boolean',
61
+ 'label' => Mage::helper('nrapps_idealo')->__('Exclude from idealo Connect'),
62
+ 'required' => 0,
63
+ 'user_defined' => 0,
64
+ 'group' => 'idealo',
65
+ 'global' => 0,
66
+ 'visible' => 1,
67
+ 'searchable' => 0,
68
+ 'filterable' => 0,
69
+ 'filterable_in_search' => 0,
70
+ 'visible_on_front' => 0,
71
+ 'is_configurable' => 0,
72
+ ));
73
+
74
+ $installer->addAttribute('catalog_category', 'nrapps_idealo_exclude', array(
75
+ 'type' => 'int',
76
+ 'input' => 'select',
77
+ 'source' => 'eav/entity_attribute_source_boolean',
78
+ 'label' => Mage::helper('nrapps_idealo')->__('Exclude from idealo Connect'),
79
+ 'note' => Mage::helper('nrapps_idealo')->__('Exclude only Categories, not included Products'),
80
+ 'required' => 0,
81
+ 'user_defined' => 0,
82
+ 'group' => 'idealo',
83
+ 'global' => 0,
84
+ 'visible' => 1,
85
+ ));
86
+
87
  $installer->endSetup();
app/design/adminhtml/default/default/layout/nrapps/idealo.xml CHANGED
@@ -1,8 +1,8 @@
1
- <?xml version="1.0"?>
2
- <layout>
3
- <default>
4
- <reference name="notifications">
5
- <block type="nrapps_idealo/adminhtml_notifications" name="nrapps_idealo_notifications" template="nrapps/idealo/notifications.phtml" after="*" />
6
- </reference>
7
- </default>
8
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="notifications">
5
+ <block type="nrapps_idealo/adminhtml_notifications" name="nrapps_idealo_notifications" template="nrapps/idealo/notifications.phtml" after="*" />
6
+ </reference>
7
+ </default>
8
  </layout>
app/design/adminhtml/default/default/template/nrapps/idealo/attributes.phtml CHANGED
@@ -1,143 +1,143 @@
1
- <?php
2
- /**
3
- * @see NRApps_Idealo_Block_Adminhtml_Attributes
4
- * @var $this NRApps_Idealo_Block_Adminhtml_Attributes
5
- */
6
- ?>
7
-
8
- <div class="content-header">
9
- <h3><?php echo $this->__('idealo Connect - Manage Attributes') ?></h3>
10
- <p class="form-buttons">
11
- <?php echo $this->getButtonHtml(Mage::helper('adminhtml')->__('Save'), 'attributesForm.submit();', 'save'); ?>
12
- </p>
13
- </div>
14
-
15
- <div class="entry-edit">
16
- <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="attributes_form">
17
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
18
-
19
- <?php foreach($this->getAttributeData() as $attribute): ?>
20
- <div class="entry-edit-head">
21
- <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $attribute->getLabel() ?></h4>
22
- <div class="form-buttons"></div>
23
- </div>
24
-
25
- <div class="fieldset" id="group_<?php echo $attribute->getCode() ?>">
26
- <?php if ($attribute->getNote()): ?>
27
- <div class="hor-scroll">
28
- <?php echo $attribute->getNote() ?>
29
- </div>
30
- <?php endif ?>
31
- <div class="hor-scroll">
32
- <table cellspacing="0" class="form-list">
33
- <colgroup>
34
- <col width="220" />
35
- <col width="300" />
36
- <col width="*" />
37
- </colgroup>
38
- <tbody>
39
- <?php Mage::log($attribute->getCode()); Mage::log($this->attributeExists($attribute)); ?>
40
- <?php if (!$this->attributeExists($attribute)): ?>
41
- <?php
42
- $types = $attribute->getType();
43
- if (!is_array($types)) {
44
- $types = array($types);
45
- }
46
- ?>
47
- <tr>
48
- <td class="value">
49
- <input
50
- type="radio"
51
- name="attribute[<?php echo $attribute->getCode() ?>]"
52
- id="attribute_<?php echo $attribute->getCode() ?>_create"
53
- class="radio" value="create"
54
- <?php if ($this->getSelectedAttributeCode($attribute)): ?>checked="checked"<?php endif ?>
55
- />
56
- <label for="attribute_<?php echo $attribute->getCode() ?>_create">
57
- <?php echo $this->__('Create new attribute') ?>:
58
- </label>
59
- </td>
60
- <td class="value">
61
- <?php if (sizeof($types) > 1): ?>
62
- <select class="new-attribute" name="new_attribute_type[<?php echo $attribute->getCode() ?>]">
63
- <?php foreach($types as $type): ?>
64
- <option value="<?php echo $type ?>"><?php echo $this->getAttributeTypeLabel($type) ?></option>
65
- <?php endforeach ?>
66
- </select>
67
- <?php else: ?>
68
- <?php echo $this->getAttributeTypeLabel(current($types)) ?>
69
- <input type="hidden" name="new_attribute_type[<?php echo $attribute->getCode() ?>]" value="<?php echo current($types) ?>" />
70
- <?php endif ?>
71
- </td>
72
- </tr>
73
- <?php endif ?>
74
-
75
- <tr>
76
- <td class="value">
77
- <input
78
- type="radio"
79
- name="attribute[<?php echo $attribute->getCode() ?>]"
80
- id="attribute_<?php echo $attribute->getCode() ?>_existing"
81
- class="radio" value="existing"
82
- <?php if ($this->attributeExists($attribute) || $this->getSelectedAttributeCode($attribute) != $attribute->getCode()): ?>checked="checked"<?php endif ?>
83
- />
84
- <label for="attribute_<?php echo $attribute->getCode() ?>_existing">
85
- <?php echo $this->__('Use existing attribute') ?>:
86
- </label>
87
- </td>
88
- <td class="value">
89
- <select class="existing-attribute" name="existing_attribute[<?php echo $attribute->getCode() ?>]">
90
- <?php foreach($this->getProductAttributes($attribute->getType()) as $productAttribute): ?>
91
- <option
92
- value="<?php echo $productAttribute->getAttributeCode() ?>"
93
- <?php if ($this->getSelectedAttributeCode($attribute) == $productAttribute->getAttributeCode()): ?> selected="selected"<?php endif ?>
94
- ><?php echo $productAttribute->getFrontendLabel() ?> [<?php echo $productAttribute->getAttributeCode() ?>]</option>
95
- <?php endforeach ?>
96
- </select>
97
- </td>
98
- </tr>
99
-
100
- <?php if (!$this->attributeExists($attribute)): ?>
101
- <tr>
102
- <td class="value" colspan="2">
103
- <input
104
- type="radio"
105
- name="attribute[<?php echo $attribute->getCode() ?>]"
106
- id="attribute_<?php echo $attribute->getCode() ?>_none"
107
- class="radio" value="none"
108
- <?php if ($this->isAttributeNone($attribute)): ?>checked="checked"<?php endif ?>
109
- />
110
- <label for="attribute_<?php echo $attribute->getCode() ?>_none">
111
- <?php echo $this->__('Do not use this attribute') ?>
112
- </label>
113
- </td>
114
- </tr>
115
- <?php endif ?>
116
- </tbody>
117
- </table>
118
- </div>
119
- </div>
120
- <?php endforeach ?>
121
- </form>
122
- </div>
123
- <script type="text/javascript">
124
- attributesForm = new varienForm('attributes_form', '');
125
-
126
- $$('.existing-attribute').each(function(element) {
127
- element.observe('change', function() {
128
-
129
- this.up().up().select('input.radio').each(function(radio) {
130
- radio.checked = 'checked';
131
- });
132
- });
133
- });
134
-
135
- $$('.new-attribute').each(function(element) {
136
- element.observe('change', function() {
137
-
138
- this.up().up().select('input.radio').each(function(radio) {
139
- radio.checked = 'checked';
140
- });
141
- });
142
- });
143
- </script>
1
+ <?php
2
+ /**
3
+ * @see NRApps_Idealo_Block_Adminhtml_Attributes
4
+ * @var $this NRApps_Idealo_Block_Adminhtml_Attributes
5
+ */
6
+ ?>
7
+
8
+ <div class="content-header">
9
+ <h3><?php echo $this->__('idealo Connect - Manage Attributes') ?></h3>
10
+ <p class="form-buttons">
11
+ <?php echo $this->getButtonHtml(Mage::helper('adminhtml')->__('Save'), 'attributesForm.submit();', 'save'); ?>
12
+ </p>
13
+ </div>
14
+
15
+ <div class="entry-edit">
16
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="attributes_form">
17
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
18
+
19
+ <?php foreach($this->getAttributeData() as $attribute): ?>
20
+ <div class="entry-edit-head">
21
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $attribute->getLabel() ?></h4>
22
+ <div class="form-buttons"></div>
23
+ </div>
24
+
25
+ <div class="fieldset" id="group_<?php echo $attribute->getCode() ?>">
26
+ <?php if ($attribute->getNote()): ?>
27
+ <div class="hor-scroll">
28
+ <?php echo $attribute->getNote() ?>
29
+ </div>
30
+ <?php endif ?>
31
+ <div class="hor-scroll">
32
+ <table cellspacing="0" class="form-list">
33
+ <colgroup>
34
+ <col width="220" />
35
+ <col width="300" />
36
+ <col width="*" />
37
+ </colgroup>
38
+ <tbody>
39
+ <?php Mage::log($attribute->getCode()); Mage::log($this->attributeExists($attribute)); ?>
40
+ <?php if (!$this->attributeExists($attribute)): ?>
41
+ <?php
42
+ $types = $attribute->getType();
43
+ if (!is_array($types)) {
44
+ $types = array($types);
45
+ }
46
+ ?>
47
+ <tr>
48
+ <td class="value">
49
+ <input
50
+ type="radio"
51
+ name="attribute[<?php echo $attribute->getCode() ?>]"
52
+ id="attribute_<?php echo $attribute->getCode() ?>_create"
53
+ class="radio" value="create"
54
+ <?php if ($this->getSelectedAttributeCode($attribute)): ?>checked="checked"<?php endif ?>
55
+ />
56
+ <label for="attribute_<?php echo $attribute->getCode() ?>_create">
57
+ <?php echo $this->__('Create new attribute') ?>:
58
+ </label>
59
+ </td>
60
+ <td class="value">
61
+ <?php if (sizeof($types) > 1): ?>
62
+ <select class="new-attribute" name="new_attribute_type[<?php echo $attribute->getCode() ?>]">
63
+ <?php foreach($types as $type): ?>
64
+ <option value="<?php echo $type ?>"><?php echo $this->getAttributeTypeLabel($type) ?></option>
65
+ <?php endforeach ?>
66
+ </select>
67
+ <?php else: ?>
68
+ <?php echo $this->getAttributeTypeLabel(current($types)) ?>
69
+ <input type="hidden" name="new_attribute_type[<?php echo $attribute->getCode() ?>]" value="<?php echo current($types) ?>" />
70
+ <?php endif ?>
71
+ </td>
72
+ </tr>
73
+ <?php endif ?>
74
+
75
+ <tr>
76
+ <td class="value">
77
+ <input
78
+ type="radio"
79
+ name="attribute[<?php echo $attribute->getCode() ?>]"
80
+ id="attribute_<?php echo $attribute->getCode() ?>_existing"
81
+ class="radio" value="existing"
82
+ <?php if ($this->attributeExists($attribute) || $this->getSelectedAttributeCode($attribute) != $attribute->getCode()): ?>checked="checked"<?php endif ?>
83
+ />
84
+ <label for="attribute_<?php echo $attribute->getCode() ?>_existing">
85
+ <?php echo $this->__('Use existing attribute') ?>:
86
+ </label>
87
+ </td>
88
+ <td class="value">
89
+ <select class="existing-attribute" name="existing_attribute[<?php echo $attribute->getCode() ?>]">
90
+ <?php foreach($this->getProductAttributes($attribute->getType()) as $productAttribute): ?>
91
+ <option
92
+ value="<?php echo $productAttribute->getAttributeCode() ?>"
93
+ <?php if ($this->getSelectedAttributeCode($attribute) == $productAttribute->getAttributeCode()): ?> selected="selected"<?php endif ?>
94
+ ><?php echo $productAttribute->getFrontendLabel() ?> [<?php echo $productAttribute->getAttributeCode() ?>]</option>
95
+ <?php endforeach ?>
96
+ </select>
97
+ </td>
98
+ </tr>
99
+
100
+ <?php if (!$this->attributeExists($attribute)): ?>
101
+ <tr>
102
+ <td class="value" colspan="2">
103
+ <input
104
+ type="radio"
105
+ name="attribute[<?php echo $attribute->getCode() ?>]"
106
+ id="attribute_<?php echo $attribute->getCode() ?>_none"
107
+ class="radio" value="none"
108
+ <?php if ($this->isAttributeNone($attribute)): ?>checked="checked"<?php endif ?>
109
+ />
110
+ <label for="attribute_<?php echo $attribute->getCode() ?>_none">
111
+ <?php echo $this->__('Do not use this attribute') ?>
112
+ </label>
113
+ </td>
114
+ </tr>
115
+ <?php endif ?>
116
+ </tbody>
117
+ </table>
118
+ </div>
119
+ </div>
120
+ <?php endforeach ?>
121
+ </form>
122
+ </div>
123
+ <script type="text/javascript">
124
+ attributesForm = new varienForm('attributes_form', '');
125
+
126
+ $$('.existing-attribute').each(function(element) {
127
+ element.observe('change', function() {
128
+
129
+ this.up().up().select('input.radio').each(function(radio) {
130
+ radio.checked = 'checked';
131
+ });
132
+ });
133
+ });
134
+
135
+ $$('.new-attribute').each(function(element) {
136
+ element.observe('change', function() {
137
+
138
+ this.up().up().select('input.radio').each(function(radio) {
139
+ radio.checked = 'checked';
140
+ });
141
+ });
142
+ });
143
+ </script>
app/design/adminhtml/default/default/template/nrapps/idealo/config.phtml CHANGED
@@ -1,15 +1,15 @@
1
- <?php /** @var Mage_Adminhtml_Block_Template $this */ ?>
2
-
3
- <p style="width: 100%; background: #0a3761; padding: 10px 10px 5px 10px;">
4
- <img src="<?php echo $this->getSkinUrl('images/nrapps_idealo/idealo_logo_header.png') ?>" alt="idealo" />
5
- </p>
6
- <p style="padding: 5px;">
7
- <?php echo $this->__('If you don\'t have access data yet, please activate the <strong>test mode</strong>.') ?><br />
8
- <?php echo $this->__('Please configure and save this page now and then update the <strong>idealo Connect Index</strong>.') ?><br />
9
- <?php echo $this->__('After that, you will find a <strong>CSV file</strong> in the <strong>%s</strong> directory of your shop.', '/media/nrapps_idealo/') ?><br />
10
- <?php echo $this->__('Please send that file to <strong>%s</strong> via email, including the URL and name of your shop and your contact data.', 'csv@idealo.de') ?>
11
- </p>
12
- <p style="padding: 5px;">
13
- <?php echo $this->__('Once you have receive access data by idealo, please fill them in here and deactivate the test mode.') ?><br />
14
- <?php echo $this->__('The product data will then be transferred to idealo automatically. For that, you need to have a <strong>cron job</strong> running on your shop.') ?><br />
15
  </p>
1
+ <?php /** @var Mage_Adminhtml_Block_Template $this */ ?>
2
+
3
+ <p style="width: 100%; background: #0a3761; padding: 10px 10px 5px 10px;">
4
+ <img src="<?php echo $this->getSkinUrl('images/nrapps_idealo/idealo_logo_header.png') ?>" alt="idealo" />
5
+ </p>
6
+ <p style="padding: 5px;">
7
+ <?php echo $this->__('If you don\'t have access data yet, please activate the <strong>test mode</strong>.') ?><br />
8
+ <?php echo $this->__('Please configure and save this page now and then update the <strong>idealo Connect Index</strong>.') ?><br />
9
+ <?php echo $this->__('After that, you will find a <strong>CSV file</strong> in the <strong>%s</strong> directory of your shop.', '/media/nrapps_idealo/') ?><br />
10
+ <?php echo $this->__('Please send that file to <strong>%s</strong> via email, including the URL and name of your shop and your contact data.', 'csv@idealo.de') ?>
11
+ </p>
12
+ <p style="padding: 5px;">
13
+ <?php echo $this->__('Once you have receive access data by idealo, please fill them in here and deactivate the test mode.') ?><br />
14
+ <?php echo $this->__('The product data will then be transferred to idealo automatically. For that, you need to have a <strong>cron job</strong> running on your shop.') ?><br />
15
  </p>
app/design/adminhtml/default/default/template/nrapps/idealo/delivery_time_update_button.phtml CHANGED
@@ -1,18 +1,18 @@
1
- <?php /** @var Mage_Adminhtml_Block_Template $this */ ?>
2
-
3
- <tr>
4
- <td class="label"></td>
5
- <td class="value">
6
- <div>
7
- <button type="button" class="button updateButton"
8
- onclick="window.location = '<?php echo $this->getUrl('adminhtml/idealo_settings/updateDeliveryTime') ?>';">
9
- <span><span><?php echo $this->__('Update Mapping with new Options') ?></span></span>
10
- </button>
11
- </div>
12
- <p class="note">
13
- <span><?php echo $this->__('Unsaved changes will be lost. Please save your changes before.') ?></span>
14
- </p>
15
- </td>
16
- <td class="scope-label"></td>
17
- <td class=""></td>
18
- </tr>
1
+ <?php /** @var Mage_Adminhtml_Block_Template $this */ ?>
2
+
3
+ <tr>
4
+ <td class="label"></td>
5
+ <td class="value">
6
+ <div>
7
+ <button type="button" class="button updateButton"
8
+ onclick="window.location = '<?php echo $this->getUrl('adminhtml/idealo_settings/updateDeliveryTime') ?>';">
9
+ <span><span><?php echo $this->__('Update Mapping with new Options') ?></span></span>
10
+ </button>
11
+ </div>
12
+ <p class="note">
13
+ <span><?php echo $this->__('Unsaved changes will be lost. Please save your changes before.') ?></span>
14
+ </p>
15
+ </td>
16
+ <td class="scope-label"></td>
17
+ <td class=""></td>
18
+ </tr>
app/design/adminhtml/default/default/template/nrapps/idealo/notifications.phtml CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
- /**
3
- * @see NRApps_Idealo_Block_Adminhtml_Notifications
4
- * @var $this NRApps_Idealo_Block_Adminhtml_Notifications
5
- */
6
- ?>
7
-
8
- <?php if ($message = $this->getMessage()) : ?>
9
- <div class="notification-global"><?php echo $message ?></div>
10
  <?php endif; ?>
1
+ <?php
2
+ /**
3
+ * @see NRApps_Idealo_Block_Adminhtml_Notifications
4
+ * @var $this NRApps_Idealo_Block_Adminhtml_Notifications
5
+ */
6
+ ?>
7
+
8
+ <?php if ($message = $this->getMessage()) : ?>
9
+ <div class="notification-global"><?php echo $message ?></div>
10
  <?php endif; ?>
app/etc/modules/NRApps_Idealo.xml CHANGED
@@ -1,13 +1,13 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <NRApps_Idealo>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <depends>
8
- <Mage_Catalog/>
9
-
10
- </depends>
11
- </NRApps_Idealo>
12
- </modules>
13
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <NRApps_Idealo>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Catalog/>
9
+
10
+ </depends>
11
+ </NRApps_Idealo>
12
+ </modules>
13
  </config>
app/locale/de_DE/NRApps_Idealo.csv CHANGED
@@ -1,181 +1,181 @@
1
- "idealo Connect","idealo Connect"
2
- "Settings","Einstellungen"
3
- "Directory ""%s"" does not exist. Installation of idealo Connect incomplete?","Das Verzeichnis ""%s"" existiert nicht. Ist die Installation von idealo Connect vollständig?"
4
- "Re-Generation necessary","Neugenerierung notwendig"
5
- "File <a href=""%s"" target=""_blank"">%s</a> was generated successfully","Die Datei <a href=""%s"" target=""_blank"">%s</a> wurde erfolgreich erstellt."
6
- "idealo Connect - Manage Attributes","idealo Connect - Attribute verwalten"
7
- "Manage Attributes","Attribute verwalten"
8
- "Feed Attributes","idealo-Attribute"
9
- "Create new attribute","Neues Attribut anlegen"
10
- "Use existing attribute","Existierendes Attribut verwenden"
11
- "Manufacturer","Hersteller"
12
- "Manufacturer SKU","Hersteller-Artikelnummer"
13
- "Delivery Time","Lieferzeit"
14
- "Delivery Times","Lieferzeiten"
15
- "Delivery Time (out of stock)","Lieferzeit (Artikel nicht auf Lager)"
16
- "Add","Hinzufügen"
17
- "Shipping Cost","Versandkosten"
18
- "Shipping Cost idealo.de","Versandkosten idealo.de"
19
- "Shipping Cost idealo.at","Versandkosten idealo.at"
20
- "Shipping Cost idealo.co.uk","Versandkosten idealo.co.uk"
21
- "Shipping Cost idealo.fr","Versandkosten idealo.fr"
22
- "Shipping Cost idealo.it","Versandkosten idealo.it"
23
- "Shipping Cost idealo.es","Versandkosten idealo.es"
24
- "Shipping Cost idealo.pl","Versandkosten idealo.pl"
25
- "Shipping Cost idealo.in","Versandkosten idealo.in"
26
- "Shipping Cost based on Price","Versandkosten basierend auf Preis"
27
- "Shipping Cost based on Weight","Versandkosten basierend auf Gewicht"
28
- "Shipping Comment","Versandkommentar"
29
- "Shipping Comments","Versandkommentare"
30
- "Comment on shipping of article or methods of payment offered","Kommentar über Versand des Artikels oder angebotene Zahlungsarten"
31
- "OEN","OEN"
32
- "Original replacement part number consisting of manufacturer's initials and identifier code, separated by a comma","Original Ersatzteilnummer, bestehend aus den Initialen des Herstellers und Identifizierungs-Code, getrennt durch Komma"
33
- "KBA","KBA"
34
- "Kraftfahrt-Bundesamt (KBA) number, i.e. German Federal Motor Transport Authority number, consisting of the 4 digits in the Manufacturer Key Number and the first 3 characters in the Type Key Number","Kraftfahrt-Bundesamt (KBA)-Nummer, bestehend aus den 4 Ziffern in der Herstellerschlüsselnummer und der ersten drei Zeichen in der Typschlüsselnummer"
35
- "EAN","EAN"
36
- "EAN/GTIN of the offer, improves allocation to product catalogue. ISBN numbers can also be given here","EAN/GTIN des Artikels, verbessert die Zuordnung zum Produktkatalog. ISBN-Nummer kann ebenfalls hier angegeben werden."
37
- "HAN","HAN"
38
- "Article number defined by manufacturer, improves allocation to product catalogue","Durch den Hersteller definierte Artikelnummer, verbessert die Zuordnung zum Produktkatalog."
39
- "PZN","PZN"
40
- "Central Pharmaceutical Number of offer (only for medical offers)","Pharmazeutische Zentralnummer (nur für medizinische Artikel)"
41
- "Is Used","Gebraucht"
42
- "Marks offers that are not new (e.g. returns, demonstration model, opened packaging, etc.)","Für Artikel, die nicht neu sind (z.B. Rücksendungen, Vorführmodelle, geöffnete Verpackung etc.)"
43
- "Is Rebuild","Ist Nachbau"
44
- "Marks offers that are a replica of products by another manufacturer. This mark-up is necessary if the original product comes up in the offer title (e.g. ""Quality battery compatible with Canon HK-2222"")","Für Replica von Artikeln anderer Hersteller. Notwendig, wenn der Original-Artikelname im Angebotstitel vorkommt (z.B. ""Qualitätsakku kompatibel mit Canon HK-2222"")"
45
- "Has Contract","Hat Vertrag"
46
- "Marks offers that can only be acquired through signing a contract (e.g. mobile phones)","Für Artikel, die nur durch den Abschluss eines Vertrags erworben werden können (z.B. Mobiltelefone)"
47
- "Voucher Code","Gutscheincode"
48
- "Voucher code plus description. Please be sure to stick to the format of the example! i.e. CODE (description)","Gutscheincode plus Beschreibung. Bitte halten Sie sich an das Beispielformat! Z.B. CODE (Beschreibung)"
49
- "Merchant","Verkäufer"
50
- "Merchant name (for resellers or marketplace merchants)","Händlername (für Reseller oder Marktplatz-Verkäufer"
51
- "The attributes have been assigned.","Die Attribute wurden zugeordnet."
52
- "The attributes have been assigned. Please choose the default settings now.","Die Attribute wurden zugeordnet. Bitte wählen Sie jetzt die Standardeinstellungen."
53
- "%s attributes have been created. You can fill them on the product edit page in the tab ""idealo"".","%s Attribute wurden angelegt. Sie können sie im Artikelformular im Tab ""idealo"" befüllen."
54
- "idealo Connect requires you to set up attributes. Click <a href=""%s"">here</a> to go to the attribute management.","Für den idealo Connect müssen Artikel-Attribute konfiguriert werden. Klicken Sie <a href=""%s"">hier</a>, um zur Attribut-Verwaltung zu gelangen."
55
- "Default Values","Standardwerte"
56
- "Export the following Product Types","Folgende Artikeltypen exportieren"
57
- "All","Alle"
58
- "Export Bundle Products without a fixed price","Bündelartikel ohne fixen Preis exportieren"
59
- "No Price will be available for those products","Für diese Artikel wird kein Preis verfügbar sein."
60
-
61
- "Use Default","Standard verwenden"
62
- "Calculate automatically","Automatisch bestimmen"
63
- "In Stock","Auf Lager"
64
- "Available for Order","Bestellbar"
65
- "Out of Stock","Vergriffen"
66
- "Export Parent Product","Elternartikel exportieren"
67
- "Export Children Products","Kindartikel exportieren"
68
- "Allowed Product Types","Erlaubte Artikeltypen"
69
- "Export Type for Configurable Products","Exporttyp für konfigurierbare Artikel"
70
- "No Export","Nicht exportieren"
71
- "Product Data","Artikeldaten"
72
- "Shipping Costs Calculation Method","Berechnungsmethode für Versandkosten"
73
- "From Price","Ab Preis"
74
- "Only for Shipping Costs Calculation Method ""Price"" (see above)","Nur für Berechnungsmethode ""Preis"" (siehe oben)"
75
- "Only for Shipping Costs Calculation Method ""Weight"" (see above)","Nur für Berechnungsmethode ""Gewicht"" (siehe oben)"
76
- "Only for Shipping Costs Calculation Method ""Weight"" (see above)<br />Product attribute ""Weight"" [weight] will be used to determine weight.","Nur für Berechnungsmethode ""Gewicht"" (siehe oben).<br />Für die Ermittlung des Gewichtes wird das Produktattribut ""Gewicht"" [weight] verwendet."
77
- "You can find the settings for the <strong>minimum order amount</strong> in System -> Configuration -> Sales","Sie finden die Einstellungen für den <strong>Mindestbestellwert</strong> unter System -> Konfiguration -> Verkäufe"
78
- "From Weight","Ab Gewicht"
79
- "Exclude from idealo Connect","Von idealo Connect ausnehmen"
80
- "Exclude only Categories, not included Products","Nur Kategorien, nicht beinhaltete Produkte ausnehmen"
81
- "Leave empty to use default","Leer lassen, um Standard zu verwenden"
82
- "Activated Payment Methods","Aktivierte Zahlungsarten"
83
- "Payment Method","Zahlungsart"
84
- "Surcharge","Aufpreis"
85
- "Invoice","Rechnung"
86
- "Credit Card","Kreditkarte"
87
- "Prepaid","Vorkasse"
88
- "PayPal","PayPal"
89
- "Debit Payment","Lastschrift"
90
- "Cash on Delivery","Nachnahme"
91
- "Bank transfer via Sofort","Sofortüberweisung"
92
- "Payment by post","Bezahlung per Post"
93
- "e-payment standard (Austria)","e-payment standard (Österreich)"
94
- "Attribute Sets","Attributsets"
95
- "Allowed Attribute Sets","Erlaubte Attributsets"
96
- "Calculate price of configurable child products as","Konfigurierbare Artikel: Preis von Kindartikeln berechnen als"
97
- "Price of parent product with modifications (Magento Default)","Preis des Elternartikels mit Anpassungen (Magento-Standard)"
98
- "Price of parent product without modifications","Preis des Elternartikels ohne Anpassungen"
99
- "Price of child product (i.e. with BCP, SCP)","Preis des Kindartikels (z.B. mit BCP, SCP)"
100
- "Use option ""child product"" or ""parent product without modifications"" for better performance. There can be memory leaks with the option ""parent product <strong>with</strong> modifications"".","Wählen Sie die Option ""Kindartikel"" oder ""Elternartikel ohne Anpassungen"" für bessere Performance. Bei der Option ""Elternartikels <strong>mit</strong> Anpassungen"" können Speicherprobleme auftreten."
101
- "Base Price","Basispreis"
102
- "The idealo Connect is now installed. <a href=""%s"">Click here to start the configuration process.</a>","Der idealo Connect ist jetzt installiert. <a href=""%s"">Klicken Sie hier, um die Konfiguration zu beginnen.</a>"
103
- "idealo Connect Setup Step 1/2: Attributes Setup","idealo Connect Setup Schritt 1/2: Attribut-Setup"
104
- "idealo Connect Setup Step 2/2: Configuration and Default Values","idealo Connect Setup Schritt 2/2: Konfiguration und Standardwerte"
105
- "If you see an error here, please logout and login again.","Sollten Sie hier eine Fehlermeldung erhalten, loggen Sie sich bitte aus und anschließend wieder ein."
106
- "<a href=""%s"" target=""_blank"">Possible Values</a>","<a href=""%s"" target=""_blank"">Mögliche Werte</a>"
107
- "Do not use this attribute","Attribut nicht verwenden"
108
- "Select field (dropdown)","Auswahlfeld (Dropdown)"
109
- "Select field (yes / no)","Auswahlfeld (Ja / Nein)"
110
- "Text field","Textfeld"
111
- "Text field (decimal value)","Textfeld (Dezimalwert)"
112
- "Text field (price)","Textfeld (Preis)"
113
- "Energy Efficiency Class","Energieeffizienzklasse"
114
- "Used in following feed templates","Verwendet in den folgenden Feed-Vorlagen"
115
- "Use Configuration Value","Konfigurationswert verwenden"
116
- "Yes","Ja"
117
- "No","Nein"
118
- "API URL for Update Requests","API-URL für Update-Requests"
119
- "idealo User","idealo Benutzername"
120
- "idealo Password","idealo Passwort"
121
- "Indexing of generated Product Data for idealo Connect","Indizierung von generierten Produktdaten für idealo-Export"
122
- "Contact csv@idealo.de to gain access.","Kontaktieren Sie csv@idealo.de, um diese Daten zu erhalten."
123
- "Activate logging for all requests","Logging für alle API-Requests aktivieren"
124
- "Logs can be found in media/nrapps_idealo/log/idealo_requests.txt","Die Logs befinden sich in media/nrapps_idealo/log/idealo_requests.txt"
125
- "Product Options","Produktoptionen"
126
- "idealo Connect is active","idealo-Export aktivieren"
127
- "Test Mode","Testmodus"
128
- "Only validity check, no processing","Nur Validierung, keine Verarbeitung"
129
- "In case you have problems with the connection","Falls Sie Probleme mit der Verbindung haben."
130
- "Connection to idealo API has failed, please check the credentials.","Verbindung zur idealo-API ist fehlgeschlagen. Bitte prüfen Sie die Zugangsdaten."
131
- "Connection to idealo API successful.","Verbindung zur idealo-API erfolgreich."
132
- "It seems you have no cronjobs running. They are needed for transferring data to idealo. We strongly suggest you setup cronjobs. See <a href=""http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job"" target=""_blank"">here</a> for details.","Anscheinend sind in Ihrem Shop keine Cronjobs aktiviert. Diese werden benötigt, um Produktdaten an idealo zu übermitteln. Wir empfehlen Ihnen dringend, Cronjobs aufzusetzen. Klicken Sie <a href=""http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job"" target=""_blank"">hier</a> für Details."
133
- "The idealo Connect module has been installed and configured. Please update the <a href=""%s"">idealo Connect Index</a> now.","Das idealo-Exportmodul wurde erfolgreich installiert und konfiguriert. Aktualisieren Sie bitte jetzt den <a href=""%s"">idealo Connect Index</a>."
134
- "Configuration data has been changed. Please update the <a href=""%s"">idealo Connect Index</a> now.","Konfigurationsdaten wurden geändert. Aktualisieren Sie bitte jetzt den <a href=""%s"">idealo Connect Index</a>."
135
- "Minimum order amount: %s","Der Mindestbestellwert beträgt: %s"
136
- "Minimum Order Surcharge","Mindermengenzuschlag"
137
- "Minimum Order Weight Surcharge","Mindergewichtszuschlag"
138
- "Minimum Order Value","Untergrenze Bestellsumme"
139
- "Minimum Order Weight","Untergrenze Bestellgewicht"
140
- "Surcharge for Orders below Minimum Order Value","Zuschlag für Bestellungen unter Untergrenze"
141
- "Surcharge for Orders below Minimum Order Weight","Zuschlag für Bestellungen unter Gewichts-Untergrenze"
142
- "Unit for Weight","Einheit für Gewicht"
143
- "i.e. g, lb, kg","z.B. g, kg"
144
- "Is Active","Ist aktiv"
145
- "For orders below %s, a surcharge of %s will be charged.","Für Bestellungen unter %s wird ein Aufschlag in Höhe von %s berechnet."
146
- "For orders below a weight of %s %s, a surcharge of %s will be charged.","Für Bestellungen unter einem Gewicht von %s %s wird ein Aufschlag in Höhe von %s berechnet."
147
- "Fixed Surcharge","Fixer Aufschlag in Euro"
148
- "Percental Surcharge","Prozentualer Aufschlag"
149
- "Percental Surcharge Calculation Method","Berechnungsmethode für Prozentualen Aufschlag"
150
- "Based on Product Price","Auf Basis des Produktpreises"
151
- "Based on Product Price plus Shipping Cost","Auf Basis von Produktpreis plus Versandkosten"
152
- "Disable check of SSL certificate","SSL-Zertifikatsprüfung deaktivieren"
153
- "Email Options","Email-Optionen"
154
- "Error Messages: Recipient Email Address","Fehlermeldungen: Empfänger Email-Adresse"
155
- "Error Messages: Identity","Fehlermeldungen: Absender"
156
- "Error Messages: Template","Fehlermeldungen: Email-Template"
157
- "Only generation of files, no transfer","Nur Generierung von Dateien, keine Übertragung"
158
-
159
- "If you don't have access data yet, please activate the <strong>test mode</strong>.","Wenn Sie noch keine Zugangsdaten haben, aktivieren Sie bitte den <strong>Testmodus</strong>."
160
- "Please configure and save this page now and then update the <strong>idealo Connect Index</strong>.","Bitte konfigurieren und speichern Sie jetzt diese Seite und aktualisieren den <strong>idealo Connect Index</strong>."
161
- "After that, you will find a <strong>CSV file</strong> in the <strong>%s</strong> directory of your shop.","Anschließend werden Sie eine <strong>CSV-Datei</strong> im Verzeichnis <strong>%s</strong> Ihres Shops vorfinden."
162
- "Please send that file to <strong>%s</strong> via email, including the URL and name of your shop and your contact data.","Bitte senden Sie diese Datei per Email an <strong>%s</strong>, einschließlich der URL und des Namens Ihres Shops sowie Ihren Kontaktdaten."
163
- "Once you have receive access data by idealo, please fill them in here and deactivate the test mode.","Sobald Sie Zugangsdaten von idealo erhalten haben, geben Sie sie bitte hier ein und deaktivieren den Testmodus."
164
- "The product data will then be transferred to idealo automatically. For that, you need to have a <strong>cron job</strong> running on your shop.","Die Produktdaten werden dann automatisch zu idealo übertragen. Dafür benötigen Sie einen eingerichteten <strong>Cronjob</strong> für Ihren Shop."
165
- "max. 150 chars","max. 150 Zeichen"
166
- "Add contents of the following attribute(s) to product name","Inhalt der folgenden Attribute an Produktnamen anhängen"
167
- "Add contents of the following attribute(s) to the export","Inhalt der folgenden Attribute zum Export hinzufügen"
168
- "Attribute","Attribut"
169
- "Sort Order","Sortierung"
170
- "Delete","Löschen"
171
- "Listing","Listung"
172
- "Listing at","Listung auf"
173
- "for listing at","für die Listung auf"
174
- "Mapping","Zuordnung"
175
- "Attribute value","Attributwert"
176
- "If no country specific value is set, delivery time will not be exported.","Wenn kein länderspezifischer Wert gesetzt ist, wird die Lieferzeit nicht exportiert."
177
- "Update Mapping with new Options","Zuordnung aktualisieren bei neuen Optionen"
178
- "Options have been updated.","Die Optionen wurden aktualisiert."
179
- "Unsaved changes will be lost. Please save your changes before.","Ungespeicherte Änderungen werden verloren gehen. Bitte speichern Sie vorher Ihre Änderungen."
180
- "idealo direct sale allowed","Direktkauf erlaubt"
181
  "Allow direct sale via idealo for this product","Direktkauf über idealo erlauben"
1
+ "idealo Connect","idealo Connect"
2
+ "Settings","Einstellungen"
3
+ "Directory ""%s"" does not exist. Installation of idealo Connect incomplete?","Das Verzeichnis ""%s"" existiert nicht. Ist die Installation von idealo Connect vollständig?"
4
+ "Re-Generation necessary","Neugenerierung notwendig"
5
+ "File <a href=""%s"" target=""_blank"">%s</a> was generated successfully","Die Datei <a href=""%s"" target=""_blank"">%s</a> wurde erfolgreich erstellt."
6
+ "idealo Connect - Manage Attributes","idealo Connect - Attribute verwalten"
7
+ "Manage Attributes","Attribute verwalten"
8
+ "Feed Attributes","idealo-Attribute"
9
+ "Create new attribute","Neues Attribut anlegen"
10
+ "Use existing attribute","Existierendes Attribut verwenden"
11
+ "Manufacturer","Hersteller"
12
+ "Manufacturer SKU","Hersteller-Artikelnummer"
13
+ "Delivery Time","Lieferzeit"
14
+ "Delivery Times","Lieferzeiten"
15
+ "Delivery Time (out of stock)","Lieferzeit (Artikel nicht auf Lager)"
16
+ "Add","Hinzufügen"
17
+ "Shipping Cost","Versandkosten"
18
+ "Shipping Cost idealo.de","Versandkosten idealo.de"
19
+ "Shipping Cost idealo.at","Versandkosten idealo.at"
20
+ "Shipping Cost idealo.co.uk","Versandkosten idealo.co.uk"
21
+ "Shipping Cost idealo.fr","Versandkosten idealo.fr"
22
+ "Shipping Cost idealo.it","Versandkosten idealo.it"
23
+ "Shipping Cost idealo.es","Versandkosten idealo.es"
24
+ "Shipping Cost idealo.pl","Versandkosten idealo.pl"
25
+ "Shipping Cost idealo.in","Versandkosten idealo.in"
26
+ "Shipping Cost based on Price","Versandkosten basierend auf Preis"
27
+ "Shipping Cost based on Weight","Versandkosten basierend auf Gewicht"
28
+ "Shipping Comment","Versandkommentar"
29
+ "Shipping Comments","Versandkommentare"
30
+ "Comment on shipping of article or methods of payment offered","Kommentar über Versand des Artikels oder angebotene Zahlungsarten"
31
+ "OEN","OEN"
32
+ "Original replacement part number consisting of manufacturer's initials and identifier code, separated by a comma","Original Ersatzteilnummer, bestehend aus den Initialen des Herstellers und Identifizierungs-Code, getrennt durch Komma"
33
+ "KBA","KBA"
34
+ "Kraftfahrt-Bundesamt (KBA) number, i.e. German Federal Motor Transport Authority number, consisting of the 4 digits in the Manufacturer Key Number and the first 3 characters in the Type Key Number","Kraftfahrt-Bundesamt (KBA)-Nummer, bestehend aus den 4 Ziffern in der Herstellerschlüsselnummer und der ersten drei Zeichen in der Typschlüsselnummer"
35
+ "EAN","EAN"
36
+ "EAN/GTIN of the offer, improves allocation to product catalogue. ISBN numbers can also be given here","EAN/GTIN des Artikels, verbessert die Zuordnung zum Produktkatalog. ISBN-Nummer kann ebenfalls hier angegeben werden."
37
+ "HAN","HAN"
38
+ "Article number defined by manufacturer, improves allocation to product catalogue","Durch den Hersteller definierte Artikelnummer, verbessert die Zuordnung zum Produktkatalog."
39
+ "PZN","PZN"
40
+ "Central Pharmaceutical Number of offer (only for medical offers)","Pharmazeutische Zentralnummer (nur für medizinische Artikel)"
41
+ "Is Used","Gebraucht"
42
+ "Marks offers that are not new (e.g. returns, demonstration model, opened packaging, etc.)","Für Artikel, die nicht neu sind (z.B. Rücksendungen, Vorführmodelle, geöffnete Verpackung etc.)"
43
+ "Is Rebuild","Ist Nachbau"
44
+ "Marks offers that are a replica of products by another manufacturer. This mark-up is necessary if the original product comes up in the offer title (e.g. ""Quality battery compatible with Canon HK-2222"")","Für Replica von Artikeln anderer Hersteller. Notwendig, wenn der Original-Artikelname im Angebotstitel vorkommt (z.B. ""Qualitätsakku kompatibel mit Canon HK-2222"")"
45
+ "Has Contract","Hat Vertrag"
46
+ "Marks offers that can only be acquired through signing a contract (e.g. mobile phones)","Für Artikel, die nur durch den Abschluss eines Vertrags erworben werden können (z.B. Mobiltelefone)"
47
+ "Voucher Code","Gutscheincode"
48
+ "Voucher code plus description. Please be sure to stick to the format of the example! i.e. CODE (description)","Gutscheincode plus Beschreibung. Bitte halten Sie sich an das Beispielformat! Z.B. CODE (Beschreibung)"
49
+ "Merchant","Verkäufer"
50
+ "Merchant name (for resellers or marketplace merchants)","Händlername (für Reseller oder Marktplatz-Verkäufer"
51
+ "The attributes have been assigned.","Die Attribute wurden zugeordnet."
52
+ "The attributes have been assigned. Please choose the default settings now.","Die Attribute wurden zugeordnet. Bitte wählen Sie jetzt die Standardeinstellungen."
53
+ "%s attributes have been created. You can fill them on the product edit page in the tab ""idealo"".","%s Attribute wurden angelegt. Sie können sie im Artikelformular im Tab ""idealo"" befüllen."
54
+ "idealo Connect requires you to set up attributes. Click <a href=""%s"">here</a> to go to the attribute management.","Für den idealo Connect müssen Artikel-Attribute konfiguriert werden. Klicken Sie <a href=""%s"">hier</a>, um zur Attribut-Verwaltung zu gelangen."
55
+ "Default Values","Standardwerte"
56
+ "Export the following Product Types","Folgende Artikeltypen exportieren"
57
+ "All","Alle"
58
+ "Export Bundle Products without a fixed price","Bündelartikel ohne fixen Preis exportieren"
59
+ "No Price will be available for those products","Für diese Artikel wird kein Preis verfügbar sein."
60
+
61
+ "Use Default","Standard verwenden"
62
+ "Calculate automatically","Automatisch bestimmen"
63
+ "In Stock","Auf Lager"
64
+ "Available for Order","Bestellbar"
65
+ "Out of Stock","Vergriffen"
66
+ "Export Parent Product","Elternartikel exportieren"
67
+ "Export Children Products","Kindartikel exportieren"
68
+ "Allowed Product Types","Erlaubte Artikeltypen"
69
+ "Export Type for Configurable Products","Exporttyp für konfigurierbare Artikel"
70
+ "No Export","Nicht exportieren"
71
+ "Product Data","Artikeldaten"
72
+ "Shipping Costs Calculation Method","Berechnungsmethode für Versandkosten"
73
+ "From Price","Ab Preis"
74
+ "Only for Shipping Costs Calculation Method ""Price"" (see above)","Nur für Berechnungsmethode ""Preis"" (siehe oben)"
75
+ "Only for Shipping Costs Calculation Method ""Weight"" (see above)","Nur für Berechnungsmethode ""Gewicht"" (siehe oben)"
76
+ "Only for Shipping Costs Calculation Method ""Weight"" (see above)<br />Product attribute ""Weight"" [weight] will be used to determine weight.","Nur für Berechnungsmethode ""Gewicht"" (siehe oben).<br />Für die Ermittlung des Gewichtes wird das Produktattribut ""Gewicht"" [weight] verwendet."
77
+ "You can find the settings for the <strong>minimum order amount</strong> in System -> Configuration -> Sales","Sie finden die Einstellungen für den <strong>Mindestbestellwert</strong> unter System -> Konfiguration -> Verkäufe"
78
+ "From Weight","Ab Gewicht"
79
+ "Exclude from idealo Connect","Von idealo Connect ausnehmen"
80
+ "Exclude only Categories, not included Products","Nur Kategorien, nicht beinhaltete Produkte ausnehmen"
81
+ "Leave empty to use default","Leer lassen, um Standard zu verwenden"
82
+ "Activated Payment Methods","Aktivierte Zahlungsarten"
83
+ "Payment Method","Zahlungsart"
84
+ "Surcharge","Aufpreis"
85
+ "Invoice","Rechnung"
86
+ "Credit Card","Kreditkarte"
87
+ "Prepaid","Vorkasse"
88
+ "PayPal","PayPal"
89
+ "Debit Payment","Lastschrift"
90
+ "Cash on Delivery","Nachnahme"
91
+ "Bank transfer via Sofort","Sofortüberweisung"
92
+ "Payment by post","Bezahlung per Post"
93
+ "e-payment standard (Austria)","e-payment standard (Österreich)"
94
+ "Attribute Sets","Attributsets"
95
+ "Allowed Attribute Sets","Erlaubte Attributsets"
96
+ "Calculate price of configurable child products as","Konfigurierbare Artikel: Preis von Kindartikeln berechnen als"
97
+ "Price of parent product with modifications (Magento Default)","Preis des Elternartikels mit Anpassungen (Magento-Standard)"
98
+ "Price of parent product without modifications","Preis des Elternartikels ohne Anpassungen"
99
+ "Price of child product (i.e. with BCP, SCP)","Preis des Kindartikels (z.B. mit BCP, SCP)"
100
+ "Use option ""child product"" or ""parent product without modifications"" for better performance. There can be memory leaks with the option ""parent product <strong>with</strong> modifications"".","Wählen Sie die Option ""Kindartikel"" oder ""Elternartikel ohne Anpassungen"" für bessere Performance. Bei der Option ""Elternartikels <strong>mit</strong> Anpassungen"" können Speicherprobleme auftreten."
101
+ "Base Price","Basispreis"
102
+ "The idealo Connect is now installed. <a href=""%s"">Click here to start the configuration process.</a>","Der idealo Connect ist jetzt installiert. <a href=""%s"">Klicken Sie hier, um die Konfiguration zu beginnen.</a>"
103
+ "idealo Connect Setup Step 1/2: Attributes Setup","idealo Connect Setup Schritt 1/2: Attribut-Setup"
104
+ "idealo Connect Setup Step 2/2: Configuration and Default Values","idealo Connect Setup Schritt 2/2: Konfiguration und Standardwerte"
105
+ "If you see an error here, please logout and login again.","Sollten Sie hier eine Fehlermeldung erhalten, loggen Sie sich bitte aus und anschließend wieder ein."
106
+ "<a href=""%s"" target=""_blank"">Possible Values</a>","<a href=""%s"" target=""_blank"">Mögliche Werte</a>"
107
+ "Do not use this attribute","Attribut nicht verwenden"
108
+ "Select field (dropdown)","Auswahlfeld (Dropdown)"
109
+ "Select field (yes / no)","Auswahlfeld (Ja / Nein)"
110
+ "Text field","Textfeld"
111
+ "Text field (decimal value)","Textfeld (Dezimalwert)"
112
+ "Text field (price)","Textfeld (Preis)"
113
+ "Energy Efficiency Class","Energieeffizienzklasse"
114
+ "Used in following feed templates","Verwendet in den folgenden Feed-Vorlagen"
115
+ "Use Configuration Value","Konfigurationswert verwenden"
116
+ "Yes","Ja"
117
+ "No","Nein"
118
+ "API URL for Update Requests","API-URL für Update-Requests"
119
+ "idealo User","idealo Benutzername"
120
+ "idealo Password","idealo Passwort"
121
+ "Indexing of generated Product Data for idealo Connect","Indizierung von generierten Produktdaten für idealo-Export"
122
+ "Contact csv@idealo.de to gain access.","Kontaktieren Sie csv@idealo.de, um diese Daten zu erhalten."
123
+ "Activate logging for all requests","Logging für alle API-Requests aktivieren"
124
+ "Logs can be found in media/nrapps_idealo/log/idealo_requests.txt","Die Logs befinden sich in media/nrapps_idealo/log/idealo_requests.txt"
125
+ "Product Options","Produktoptionen"
126
+ "idealo Connect is active","idealo-Export aktivieren"
127
+ "Test Mode","Testmodus"
128
+ "Only validity check, no processing","Nur Validierung, keine Verarbeitung"
129
+ "In case you have problems with the connection","Falls Sie Probleme mit der Verbindung haben."
130
+ "Connection to idealo API has failed, please check the credentials.","Verbindung zur idealo-API ist fehlgeschlagen. Bitte prüfen Sie die Zugangsdaten."
131
+ "Connection to idealo API successful.","Verbindung zur idealo-API erfolgreich."
132
+ "It seems you have no cronjobs running. They are needed for transferring data to idealo. We strongly suggest you setup cronjobs. See <a href=""http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job"" target=""_blank"">here</a> for details.","Anscheinend sind in Ihrem Shop keine Cronjobs aktiviert. Diese werden benötigt, um Produktdaten an idealo zu übermitteln. Wir empfehlen Ihnen dringend, Cronjobs aufzusetzen. Klicken Sie <a href=""http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job"" target=""_blank"">hier</a> für Details."
133
+ "The idealo Connect module has been installed and configured. Please update the <a href=""%s"">idealo Connect Index</a> now.","Das idealo-Exportmodul wurde erfolgreich installiert und konfiguriert. Aktualisieren Sie bitte jetzt den <a href=""%s"">idealo Connect Index</a>."
134
+ "Configuration data has been changed. Please update the <a href=""%s"">idealo Connect Index</a> now.","Konfigurationsdaten wurden geändert. Aktualisieren Sie bitte jetzt den <a href=""%s"">idealo Connect Index</a>."
135
+ "Minimum order amount: %s","Der Mindestbestellwert beträgt: %s"
136
+ "Minimum Order Surcharge","Mindermengenzuschlag"
137
+ "Minimum Order Weight Surcharge","Mindergewichtszuschlag"
138
+ "Minimum Order Value","Untergrenze Bestellsumme"
139
+ "Minimum Order Weight","Untergrenze Bestellgewicht"
140
+ "Surcharge for Orders below Minimum Order Value","Zuschlag für Bestellungen unter Untergrenze"
141
+ "Surcharge for Orders below Minimum Order Weight","Zuschlag für Bestellungen unter Gewichts-Untergrenze"
142
+ "Unit for Weight","Einheit für Gewicht"
143
+ "i.e. g, lb, kg","z.B. g, kg"
144
+ "Is Active","Ist aktiv"
145
+ "For orders below %s, a surcharge of %s will be charged.","Für Bestellungen unter %s wird ein Aufschlag in Höhe von %s berechnet."
146
+ "For orders below a weight of %s %s, a surcharge of %s will be charged.","Für Bestellungen unter einem Gewicht von %s %s wird ein Aufschlag in Höhe von %s berechnet."
147
+ "Fixed Surcharge","Fixer Aufschlag in Euro"
148
+ "Percental Surcharge","Prozentualer Aufschlag"
149
+ "Percental Surcharge Calculation Method","Berechnungsmethode für Prozentualen Aufschlag"
150
+ "Based on Product Price","Auf Basis des Produktpreises"
151
+ "Based on Product Price plus Shipping Cost","Auf Basis von Produktpreis plus Versandkosten"
152
+ "Disable check of SSL certificate","SSL-Zertifikatsprüfung deaktivieren"
153
+ "Email Options","Email-Optionen"
154
+ "Error Messages: Recipient Email Address","Fehlermeldungen: Empfänger Email-Adresse"
155
+ "Error Messages: Identity","Fehlermeldungen: Absender"
156
+ "Error Messages: Template","Fehlermeldungen: Email-Template"
157
+ "Only generation of files, no transfer","Nur Generierung von Dateien, keine Übertragung"
158
+
159
+ "If you don't have access data yet, please activate the <strong>test mode</strong>.","Wenn Sie noch keine Zugangsdaten haben, aktivieren Sie bitte den <strong>Testmodus</strong>."
160
+ "Please configure and save this page now and then update the <strong>idealo Connect Index</strong>.","Bitte konfigurieren und speichern Sie jetzt diese Seite und aktualisieren den <strong>idealo Connect Index</strong>."
161
+ "After that, you will find a <strong>CSV file</strong> in the <strong>%s</strong> directory of your shop.","Anschließend werden Sie eine <strong>CSV-Datei</strong> im Verzeichnis <strong>%s</strong> Ihres Shops vorfinden."
162
+ "Please send that file to <strong>%s</strong> via email, including the URL and name of your shop and your contact data.","Bitte senden Sie diese Datei per Email an <strong>%s</strong>, einschließlich der URL und des Namens Ihres Shops sowie Ihren Kontaktdaten."
163
+ "Once you have receive access data by idealo, please fill them in here and deactivate the test mode.","Sobald Sie Zugangsdaten von idealo erhalten haben, geben Sie sie bitte hier ein und deaktivieren den Testmodus."
164
+ "The product data will then be transferred to idealo automatically. For that, you need to have a <strong>cron job</strong> running on your shop.","Die Produktdaten werden dann automatisch zu idealo übertragen. Dafür benötigen Sie einen eingerichteten <strong>Cronjob</strong> für Ihren Shop."
165
+ "max. 150 chars","max. 150 Zeichen"
166
+ "Add contents of the following attribute(s) to product name","Inhalt der folgenden Attribute an Produktnamen anhängen"
167
+ "Add contents of the following attribute(s) to the export","Inhalt der folgenden Attribute zum Export hinzufügen"
168
+ "Attribute","Attribut"
169
+ "Sort Order","Sortierung"
170
+ "Delete","Löschen"
171
+ "Listing","Listung"
172
+ "Listing at","Listung auf"
173
+ "for listing at","für die Listung auf"
174
+ "Mapping","Zuordnung"
175
+ "Attribute value","Attributwert"
176
+ "If no country specific value is set, delivery time will not be exported.","Wenn kein länderspezifischer Wert gesetzt ist, wird die Lieferzeit nicht exportiert."
177
+ "Update Mapping with new Options","Zuordnung aktualisieren bei neuen Optionen"
178
+ "Options have been updated.","Die Optionen wurden aktualisiert."
179
+ "Unsaved changes will be lost. Please save your changes before.","Ungespeicherte Änderungen werden verloren gehen. Bitte speichern Sie vorher Ihre Änderungen."
180
+ "idealo direct sale allowed","Direktkauf erlaubt"
181
  "Allow direct sale via idealo for this product","Direktkauf über idealo erlauben"
app/locale/de_DE/template/email/nrapps_idealo_error.html CHANGED
@@ -1,14 +1,14 @@
1
- <!--@subject Idealo Schnittstelle Fehlermeldung @-->
2
-
3
- Bei der Übertragung der Daten von Ihrem Shop zu Idealo ist ein Fehler aufgetreten. Die Fehlerbeschreibung finden Sie weiter unten.
4
-
5
- Sollten Sie das Problem anhand der Fehlermeldung nicht selbst beheben können, leiten Sie diese Email bitte an exportmodule@idealo.de weiter.
6
-
7
- =======================================
8
- {{var message}}
9
-
10
- =======================================
11
- Shop Domain: {{var domain}}
12
- Idealo Username: {{var idealo_username}}
13
- Shopsystem: Magento {{var magento_version}}
14
- Idealo Modulversion: {{var module_version}}
1
+ <!--@subject Idealo Schnittstelle Fehlermeldung @-->
2
+
3
+ Bei der Übertragung der Daten von Ihrem Shop zu Idealo ist ein Fehler aufgetreten. Die Fehlerbeschreibung finden Sie weiter unten.
4
+
5
+ Sollten Sie das Problem anhand der Fehlermeldung nicht selbst beheben können, leiten Sie diese Email bitte an exportmodule@idealo.de weiter.
6
+
7
+ =======================================
8
+ {{var message}}
9
+
10
+ =======================================
11
+ Shop Domain: {{var domain}}
12
+ Idealo Username: {{var idealo_username}}
13
+ Shopsystem: Magento {{var magento_version}}
14
+ Idealo Modulversion: {{var module_version}}
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>idealoConnect</name>
4
- <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
@@ -44,16 +44,13 @@
44
  &lt;h1&gt;&amp;#xDC;ber idealo&lt;/h1&gt;&amp;#xD;&#xD;
45
  &lt;p&gt;idealo ist Deutschlands &lt;b&gt;gr&amp;#xF6;&amp;#xDF;ter Online-Preisvergleich.&lt;/b&gt; &amp;#xDC;ber 190 Millionen Angebote von rund 35,000 Onlineshops werden t&amp;#xE4;glich von bis zu 12 Millionen Verbrauchern verglichen &amp;#x2013; zu Hause und unterwegs. So k&amp;#xF6;nnen H&amp;#xE4;ndler den &lt;b&gt;Preisvergleich als zus&amp;#xE4;tzlichen Absatzkanal&lt;/b&gt; nutzen und ihren Umsatz ankurbeln. Denn: Ein Gro&amp;#xDF;teil der Verbraucher nutzt Preisvergleiche, um das f&amp;#xFC;r sie beste Kaufangebot zu finden.&lt;/p&gt;</description>
46
  <notes>&lt;ul&gt;&#xD;
47
- &lt;li&gt;direct sales on idealo&lt;/li&gt;&#xD;
48
- &lt;li&gt;export for bundle products&lt;/li&gt;&#xD;
49
- &lt;li&gt;more options for price calculation of configurable products&lt;/li&gt;&#xD;
50
- &lt;li&gt;minor bugfixes for test mode&lt;/li&gt;&#xD;
51
  &lt;/ul&gt;&#xD;
52
  </notes>
53
  <authors><author><name>idealo</name><user>idealo</user><email>exportmodule@idealo.de</email></author></authors>
54
- <date>2016-06-03</date>
55
- <time>11:03:24</time>
56
- <contents><target name="magecommunity"><dir name="NRApps"><dir name="Idealo"><dir name="Block"><dir name="Adminhtml"><file name="Attributes.php" hash="1e3a59137536f266df78d40c869cfe72"/><file name="Notifications.php" hash="5dc6a5baf4049e03328af5d0d5612714"/></dir><dir name="Config"><dir name="Adminhtml"><dir name="Form"><dir name="Field"><file name="Attributes.php" hash="833a6a9e639a3337968522c130284e35"/><file name="Dummy.php" hash="18a72fc95c3fe8f9095d656952ba6e0c"/><file name="Listings.php" hash="a2da8527178bc627caa4d0e53c65b66e"/><file name="PaymentMethods.php" hash="516615bbdc1a919abe409bce91c2a624"/></dir></dir></dir><file name="Attributes.php" hash="1ea19bca746cc0533c890c2a5c05713b"/><file name="AttributesNoSortOrder.php" hash="e16a302a29e7be610380f2550dfac5b9"/><file name="DeliveryTimeMapping.php" hash="a59d7883a556fe56524fb186bde662f6"/><file name="DeliveryTimeUpdateButton.php" hash="105b67e147dd094272eaf5cb3dd4bc33"/><file name="Description.php" hash="c4083f8d1fd665d9c9f4ae8b0700e3ad"/><file name="PaymentMethods.php" hash="30fd73fdd0f14c9a22a15e1c9a55e737"/><file name="ShippingComments.php" hash="f353b3cb302fce00957f866e6c3b903c"/><file name="ShippingCosts.php" hash="10c7883356a03134001279006149c7ce"/><file name="ShippingCostsWeight.php" hash="4adc54d2652f99ab677a2d7ce71ea2b3"/></dir></dir><dir name="Helper"><file name="Data.php" hash="cc1979d6c3f999b2a529d209dfbaac2e"/></dir><dir name="Model"><file name="Api.php" hash="8c45828051c530b6ba727aa93fde0c60"/><file name="Attribute.php" hash="4115f7c6d68ed2be69f94ec543840b35"/><dir name="Backend"><dir name="Serialized"><file name="Array.php" hash="6aab53651212b62c2410e7cb47700205"/></dir></dir><dir name="Csv"><file name="Feed.php" hash="649c66924fbc5aedd0be61646fe00f42"/><file name="Generator.php" hash="9ced38cdd65dd74ff3ec32e738e88cc6"/></dir><file name="DeliveryTime.php" hash="0ed25e3386836236113a2f63277d6f73"/><file name="Feed.php" hash="20d8dcfe27ea5a3d5313c5a3b33a94c7"/><file name="Filter.php" hash="f780eee10aa9da2489f3e497535aa23e"/><file name="Generator.php" hash="fe50ac6ff2fdfb6b2d5ab872af40f577"/><file name="Indexer.php" hash="387c24499d729b114fb4c63582609f47"/><file name="Observer.php" hash="5a08365712b3dc2df7ca8e71cf76ada5"/><dir name="Resource"><file name="Indexer.php" hash="d5f032f6055b3b506dfcd4e3f2c61c37"/></dir><dir name="Source"><file name="AttributeSets.php" hash="417974244d8e8bdab0e9b9469fb7dcf7"/><file name="ConfigurableChildProductsPriceType.php" hash="62908be23678262d3b42dc9ae9dab160"/><file name="ConfigurableTypes.php" hash="de42edc463d4d02708f1f61b5f27f062"/><file name="FeedAttributes.php" hash="5d6061f9c146d9abdacba6d12750a2b6"/><file name="ListingCountries.php" hash="967ad6ebae1a806f087d2fe536cceb68"/><file name="PaymentMethods.php" hash="4884a62966821c2e7c42131591966219"/><file name="PercentalSurchargeCalculationMethod.php" hash="e497c6410caec571254c00544e46572d"/><file name="ProductAttributes.php" hash="4492afc116a479c63edee7fa63919ad0"/><file name="ProductTypes.php" hash="ed8342eb5a829e841b31c594c14163d1"/><file name="ShippingCostsMethod.php" hash="30c14985e83d007cf2aa4ee6e0c1d8f8"/><file name="Store.php" hash="99085a206498a0147361621d50371181"/><file name="YesNoDefault.php" hash="f1830dce13573700594a442125a22474"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Idealo"><file name="AttributesController.php" hash="8d9678a32c74a5d80a5734566d81e29c"/><file name="SettingsController.php" hash="22bfddc9618f8ae7312abda209b6a48a"/></dir></dir></dir><dir name="data"><dir name="nrapps_idealo_setup"><file name="data-install-1.2.0.php" hash="d4e62aa356298d5627a32bf1dc7071c9"/><file name="data-install-1.2.2.php" hash="d4e62aa356298d5627a32bf1dc7071c9"/><file name="data-upgrade-1.0.0-1.1.0.php" hash="d4e62aa356298d5627a32bf1dc7071c9"/><file name="data-upgrade-1.1.0-1.2.0.php" hash="76e669cdb3d875368866b855508712ac"/><file name="data-upgrade-1.2.1-1.2.2.php" hash="cd902575c794459b6ad61f8ed411af06"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="828ea187ce7497855350108ed015666d"/><file name="config.xml" hash="8bdabf8b9699f1f5b4a064fa0ab2509f"/><file name="system.xml" hash="e23e991148ba491d787fb70f06f806a6"/></dir><dir name="sql"><dir name="nrapps_idealo_setup"><file name="install-1.0.0.php" hash="f961cdc1bf769d5ad28ce4d4877e009e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="nrapps"><file name="idealo.xml" hash="5352e5ccd93586f013b905cea07f7f58"/></dir></dir><dir name="template"><dir name="nrapps"><dir name="idealo"><file name="attributes.phtml" hash="a429ae24c663ede361f797ec218e0309"/><file name="config.phtml" hash="3b1852d77574d5e760ac84003a2ea69f"/><file name="delivery_time_update_button.phtml" hash="b1e69f0e71a8eeb7d0a003d0083e623d"/><file name="notifications.phtml" hash="1b9b3025d32d171315044419ea774157"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NRApps_Idealo.xml" hash="ec1c5e630f80f1052af9849a89eaaf72"/></dir></target><target name="magelocale"><dir name="de_DE"><dir name="template"><dir name="email"><file name="nrapps_idealo_error.html" hash="bb4434f984dc2ddd448c9ae40c753015"/></dir></dir><file name="NRApps_Idealo.csv" hash="d4ce4cdd16011aff3e64f7014dbc23f4"/></dir></target><target name="mage"><dir name="shell"><file name="idealo_delete_existing_offers.php" hash="7a74850c855eaa6b066644f01f4a8f62"/><file name="idealo_export.php" hash="2d40bf42e64eca4add5a76d383738c56"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="nrapps_idealo"><file name="idealo_logo_header.png" hash="abf9a22585a31d96df73fabb72df47bd"/></dir></dir></dir></dir></dir></target></contents>
57
  <compatible/>
58
  <dependencies><required><php><min>5.2.0</min><max>7.9.9</max></php></required></dependencies>
59
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>idealoConnect</name>
4
+ <version>1.2.3</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
44
  &lt;h1&gt;&amp;#xDC;ber idealo&lt;/h1&gt;&amp;#xD;&#xD;
45
  &lt;p&gt;idealo ist Deutschlands &lt;b&gt;gr&amp;#xF6;&amp;#xDF;ter Online-Preisvergleich.&lt;/b&gt; &amp;#xDC;ber 190 Millionen Angebote von rund 35,000 Onlineshops werden t&amp;#xE4;glich von bis zu 12 Millionen Verbrauchern verglichen &amp;#x2013; zu Hause und unterwegs. So k&amp;#xF6;nnen H&amp;#xE4;ndler den &lt;b&gt;Preisvergleich als zus&amp;#xE4;tzlichen Absatzkanal&lt;/b&gt; nutzen und ihren Umsatz ankurbeln. Denn: Ein Gro&amp;#xDF;teil der Verbraucher nutzt Preisvergleiche, um das f&amp;#xFC;r sie beste Kaufangebot zu finden.&lt;/p&gt;</description>
46
  <notes>&lt;ul&gt;&#xD;
47
+ &lt;li&gt;fix for price calculation of configurable products&lt;/li&gt;&#xD;
 
 
 
48
  &lt;/ul&gt;&#xD;
49
  </notes>
50
  <authors><author><name>idealo</name><user>idealo</user><email>exportmodule@idealo.de</email></author></authors>
51
+ <date>2016-08-16</date>
52
+ <time>08:29:15</time>
53
+ <contents><target name="magecommunity"><dir name="NRApps"><dir name="Idealo"><dir name="Block"><dir name="Adminhtml"><file name="Attributes.php" hash="829a29fd192bbadc6d49dc465331d417"/><file name="Notifications.php" hash="144356733852e634bc0578e44b683f3e"/></dir><dir name="Config"><dir name="Adminhtml"><dir name="Form"><dir name="Field"><file name="Attributes.php" hash="ebf4389055b09cadd9a5a7e9d7e1675e"/><file name="Dummy.php" hash="fc36fe1737472b1dd4f1f3d7514a4975"/><file name="Listings.php" hash="826c236bd91aa21cf8f41dfbe0722334"/><file name="PaymentMethods.php" hash="327fef840a50c663452df8f7daea24c3"/></dir></dir></dir><file name="Attributes.php" hash="9a9d1dc6cea05bdba3993ae3c2210944"/><file name="AttributesNoSortOrder.php" hash="bb840399b96e83ba9ead6798d69700c3"/><file name="DeliveryTimeMapping.php" hash="daa3ea4f6a43a521eb3f9570357a2774"/><file name="DeliveryTimeUpdateButton.php" hash="3e3390752444ca7adea01b891bd19692"/><file name="Description.php" hash="c97fd45180ee1d97e1056c5b7f0f9dcd"/><file name="PaymentMethods.php" hash="3913980d2cc3376a835d45a8c6aff9b4"/><file name="ShippingComments.php" hash="13b392b64060a534572835ad79fcd6fb"/><file name="ShippingCosts.php" hash="ab5d71b79d52d32d6d981ce82c245fc4"/><file name="ShippingCostsWeight.php" hash="006eaf0b745db10a51b058e9bab20350"/></dir></dir><dir name="Helper"><file name="Data.php" hash="caf6b8e6d7de4e70a6ef68f96382763e"/></dir><dir name="Model"><file name="Api.php" hash="da44c16ff2d4e3af6322a6be87e0e103"/><file name="Attribute.php" hash="5331d1dc3dc41c7a8f0930377e9f4229"/><dir name="Backend"><dir name="Serialized"><file name="Array.php" hash="5956b3751aa662fcae910ca9a1ab714a"/></dir></dir><dir name="Csv"><file name="Feed.php" hash="7ec2a049b45cfd3b2da29b04265fd54e"/><file name="Generator.php" hash="f0d1d9b7a8a8f2ec5c6bb1b1f6040580"/></dir><file name="DeliveryTime.php" hash="0de919b834af2a29189d472562d93f29"/><file name="Feed.php" hash="d6f55fbb5d91856c9d2adaf16f0c5aa3"/><file name="Filter.php" hash="afb0ba0dda7ade75283538be9992a39a"/><file name="Generator.php" hash="9006d58368bfc7a5900753e8fed26a5f"/><file name="Indexer.php" hash="485c66898052d0522c6bdf0f0c95d812"/><file name="Observer.php" hash="0d68e09386611c14be6f08bd30a3c004"/><dir name="Resource"><file name="Indexer.php" hash="1ecb2d752835f73db1928986b0ec7ded"/></dir><dir name="Source"><file name="AttributeSets.php" hash="21e4bab9a7f5857543f5cb53c10a7922"/><file name="ConfigurableChildProductsPriceType.php" hash="7c2459bc75d64f9a48296983c7ae9c8a"/><file name="ConfigurableTypes.php" hash="9d02e57a7d1535a54f2e6eaf82223f36"/><file name="FeedAttributes.php" hash="66d437a2a2937b1d22c527414643b489"/><file name="ListingCountries.php" hash="56f325eabf1efcfff44e46f34c345062"/><file name="PaymentMethods.php" hash="2bca6ad28ea50aef1e653ab509f72e8a"/><file name="PercentalSurchargeCalculationMethod.php" hash="f714036ffebb263a27bfd306ed9f7ed3"/><file name="ProductAttributes.php" hash="ee9aaa9e8d39d9a1cb374be83dc3f21a"/><file name="ProductTypes.php" hash="c941433f80603eab559f35d9d842af03"/><file name="ShippingCostsMethod.php" hash="e7dda57e648ef724e4a4083120fc2921"/><file name="Store.php" hash="4185b8c91d16a883460ddad6b5a5f6d6"/><file name="YesNoDefault.php" hash="60b0b42bc99a90544c680be9a7034ea3"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Idealo"><file name="AttributesController.php" hash="e97a3f71a0cec2abdd4fc91ab9e892d1"/><file name="SettingsController.php" hash="9291d5e470e579e818c0a8dac694b935"/></dir></dir></dir><dir name="data"><dir name="nrapps_idealo_setup"><file name="data-install-1.2.0.php" hash="f19e96b8a23f105db88d24f5d77d6a99"/><file name="data-install-1.2.2.php" hash="f19e96b8a23f105db88d24f5d77d6a99"/><file name="data-upgrade-1.0.0-1.1.0.php" hash="f19e96b8a23f105db88d24f5d77d6a99"/><file name="data-upgrade-1.1.0-1.2.0.php" hash="b471b1d7a2f8b3f60e9e2d80bdb4cfc5"/><file name="data-upgrade-1.2.1-1.2.2.php" hash="8171dc9f74a7a278855b4ac4e1d778d6"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="3dbc186188b5516efaa7983669d859d9"/><file name="config.xml" hash="c66b92cf7cea5cd3b2dbc7cc2ebd4119"/><file name="system.xml" hash="6aeb8f6901ab85ee827bcc168787fb0f"/></dir><dir name="sql"><dir name="nrapps_idealo_setup"><file name="install-1.0.0.php" hash="d5be6440c40aeb74abaf1f55dcaadf28"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="nrapps"><file name="idealo.xml" hash="c4f3f391fe4c6930254c313a4da65026"/></dir></dir><dir name="template"><dir name="nrapps"><dir name="idealo"><file name="attributes.phtml" hash="657a04568ecd2bfc59df9b691d6c6be9"/><file name="config.phtml" hash="4c1602350cbaab527ae431a3c30b3771"/><file name="delivery_time_update_button.phtml" hash="a09da370ea7f3f9430a607d4529dcba2"/><file name="notifications.phtml" hash="a46dfe5c3b97dcc8b12e6f0c4a75316e"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NRApps_Idealo.xml" hash="fecc34ed94e8c4409927383be4f8f07b"/></dir></target><target name="magelocale"><dir name="de_DE"><dir name="template"><dir name="email"><file name="nrapps_idealo_error.html" hash="363050d8a22c18f9d213eb56707103b8"/></dir></dir><file name="NRApps_Idealo.csv" hash="fdcb04240e5b3765d04cde3496b39ead"/></dir></target><target name="mage"><dir name="shell"><file name="idealo_delete_existing_offers.php" hash="10558d29c0bf116297b34b2b512f2638"/><file name="idealo_export.php" hash="785aca56bf2722047387e30f30ea2042"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="nrapps_idealo"><file name="idealo_logo_header.png" hash="abf9a22585a31d96df73fabb72df47bd"/></dir></dir></dir></dir></dir></target></contents>
54
  <compatible/>
55
  <dependencies><required><php><min>5.2.0</min><max>7.9.9</max></php></required></dependencies>
56
  </package>
shell/idealo_delete_existing_offers.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
-
3
- require_once 'abstract.php';
4
-
5
- class NRApps_Idealo_Shell_DeleteExistingOffers extends Mage_Shell_Abstract
6
- {
7
- public function run()
8
- {
9
- Mage::getSingleton('nrapps_idealo/api')->deleteExistingOffersOnFirstRun();
10
- }
11
- }
12
-
13
- $shell = new NRApps_Idealo_Shell_DeleteExistingOffers();
14
- $shell->run();
1
+ <?php
2
+
3
+ require_once 'abstract.php';
4
+
5
+ class NRApps_Idealo_Shell_DeleteExistingOffers extends Mage_Shell_Abstract
6
+ {
7
+ public function run()
8
+ {
9
+ Mage::getSingleton('nrapps_idealo/api')->deleteExistingOffersOnFirstRun();
10
+ }
11
+ }
12
+
13
+ $shell = new NRApps_Idealo_Shell_DeleteExistingOffers();
14
+ $shell->run();
shell/idealo_export.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
-
3
- require_once 'abstract.php';
4
-
5
- class NRApps_Idealo_Shell_Export extends Mage_Shell_Abstract
6
- {
7
- public function run()
8
- {
9
- Mage::getSingleton('nrapps_idealo/api')->transferAll();
10
- }
11
- }
12
-
13
- $shell = new NRApps_Idealo_Shell_Export();
14
- $shell->run();
1
+ <?php
2
+
3
+ require_once 'abstract.php';
4
+
5
+ class NRApps_Idealo_Shell_Export extends Mage_Shell_Abstract
6
+ {
7
+ public function run()
8
+ {
9
+ Mage::getSingleton('nrapps_idealo/api')->transferAll();
10
+ }
11
+ }
12
+
13
+ $shell = new NRApps_Idealo_Shell_Export();
14
+ $shell->run();