Nostress_Aukro - Version 1.0.0.0

Version Notes

Aukro Conector 1.0.0.0 for Magento 1.5+

Download this release

Release Info

Developer Tomas Friedrich
Extension Nostress_Aukro
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

Files changed (158) hide show
  1. app/code/community/Nostress/Aukro/Block/Adminhtml/Activation.php +44 -0
  2. app/code/community/Nostress/Aukro/Block/Adminhtml/Activation/Form.php +85 -0
  3. app/code/community/Nostress/Aukro/Block/Adminhtml/Catalog/Category/Tab/Aukro.php +119 -0
  4. app/code/community/Nostress/Aukro/Block/Adminhtml/Catalog/Category/Tab/Aukro/Field.php +31 -0
  5. app/code/community/Nostress/Aukro/Block/Adminhtml/Catalog/Category/Tabs.php +42 -0
  6. app/code/community/Nostress/Aukro/Block/Adminhtml/Log.php +38 -0
  7. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes.php +73 -0
  8. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form.php +77 -0
  9. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form/Attributeselect.php +117 -0
  10. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form/Element.php +330 -0
  11. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form/Renderer/Fieldset/Element.php +40 -0
  12. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form/Translate.php +124 -0
  13. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Grid.php +70 -0
  14. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Categories.php +48 -0
  15. app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Categories/Grid.php +101 -0
  16. app/code/community/Nostress/Aukro/Block/Adminhtml/Orders.php +48 -0
  17. app/code/community/Nostress/Aukro/Block/Adminhtml/Orders/Grid.php +133 -0
  18. app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Display.php +66 -0
  19. app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Display/Grid.php +277 -0
  20. app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Display/Renderer/Status.php +72 -0
  21. app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Displayed.php +46 -0
  22. app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Displayed/Grid.php +53 -0
  23. app/code/community/Nostress/Aukro/Block/Adminhtml/Sales/Order/Grid.php +229 -0
  24. app/code/community/Nostress/Aukro/Block/Adminhtml/System/Config/Form/Field/Shipping.php +78 -0
  25. app/code/community/Nostress/Aukro/Block/Payment/Info.php +9 -0
  26. app/code/community/Nostress/Aukro/Helper/Data.php +1275 -0
  27. app/code/community/Nostress/Aukro/Helper/Data/Client.php +403 -0
  28. app/code/community/Nostress/Aukro/Helper/Data/Feed.php +262 -0
  29. app/code/community/Nostress/Aukro/Helper/Data/Feed/Description.php +221 -0
  30. app/code/community/Nostress/Aukro/Helper/Data/Loader.php +237 -0
  31. app/code/community/Nostress/Aukro/Helper/Data/Product.php +180 -0
  32. app/code/community/Nostress/Aukro/Helper/Data/Profile.php +83 -0
  33. app/code/community/Nostress/Aukro/Helper/Data/Source.php +82 -0
  34. app/code/community/Nostress/Aukro/Helper/Mapping.php +30 -0
  35. app/code/community/Nostress/Aukro/Helper/Version.php +2 -0
  36. app/code/community/Nostress/Aukro/Model/Abstract.php +139 -0
  37. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Form/Shipping.php +66 -0
  38. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Abstract.php +50 -0
  39. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Autodisplay.php +40 -0
  40. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Baseunit.php +40 -0
  41. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Country.php +50 -0
  42. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Deluxeoptions.php +41 -0
  43. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Duration.php +48 -0
  44. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Freeshipping.php +38 -0
  45. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Paymentmethods.php +46 -0
  46. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Paymenttype.php +36 -0
  47. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Productnewused.php +39 -0
  48. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Region.php +44 -0
  49. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Shippingconditions.php +38 -0
  50. app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Shippingpayer.php +38 -0
  51. app/code/community/Nostress/Aukro/Model/Cache.php +42 -0
  52. app/code/community/Nostress/Aukro/Model/Cache/Categories.php +34 -0
  53. app/code/community/Nostress/Aukro/Model/Cache/Categorypath.php +34 -0
  54. app/code/community/Nostress/Aukro/Model/Cache/Mediagallery.php +34 -0
  55. app/code/community/Nostress/Aukro/Model/Cache/Superattributes.php +34 -0
  56. app/code/community/Nostress/Aukro/Model/Cache/Tax.php +34 -0
  57. app/code/community/Nostress/Aukro/Model/Categoryproducts.php +258 -0
  58. app/code/community/Nostress/Aukro/Model/Config/Source/Datetimeformat.php +159 -0
  59. app/code/community/Nostress/Aukro/Model/Config/Source/Encoding.php +115 -0
  60. app/code/community/Nostress/Aukro/Model/Config/Source/Parentschilds.php +42 -0
  61. app/code/community/Nostress/Aukro/Model/Config/Source/Priceformat.php +46 -0
  62. app/code/community/Nostress/Aukro/Model/Config/Source/Productgroupsize.php +51 -0
  63. app/code/community/Nostress/Aukro/Model/Config/Source/Stockdependence.php +42 -0
  64. app/code/community/Nostress/Aukro/Model/Data/Loader.php +79 -0
  65. app/code/community/Nostress/Aukro/Model/Data/Loader/Product.php +211 -0
  66. app/code/community/Nostress/Aukro/Model/Data/Loader/Product/Aukro.php +95 -0
  67. app/code/community/Nostress/Aukro/Model/Data/Reader.php +141 -0
  68. app/code/community/Nostress/Aukro/Model/Data/Reader/Abstract.php +64 -0
  69. app/code/community/Nostress/Aukro/Model/Data/Reader/Abstract/Csv.php +51 -0
  70. app/code/community/Nostress/Aukro/Model/Data/Reader/Abstract/Text.php +28 -0
  71. app/code/community/Nostress/Aukro/Model/Data/Transformation.php +57 -0
  72. app/code/community/Nostress/Aukro/Model/Data/Transformation/Xml.php +723 -0
  73. app/code/community/Nostress/Aukro/Model/Data/Transformation/Xml/Array.php +83 -0
  74. app/code/community/Nostress/Aukro/Model/Data/Transformation/Xslt.php +285 -0
  75. app/code/community/Nostress/Aukro/Model/Data/Writer.php +72 -0
  76. app/code/community/Nostress/Aukro/Model/Feed.php +249 -0
  77. app/code/community/Nostress/Aukro/Model/Mapping/Attribute.php +140 -0
  78. app/code/community/Nostress/Aukro/Model/Mapping/Category.php +87 -0
  79. app/code/community/Nostress/Aukro/Model/Mysql4/Abstract.php +55 -0
  80. app/code/community/Nostress/Aukro/Model/Mysql4/Cache.php +64 -0
  81. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Categories.php +122 -0
  82. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Categories/Collection.php +34 -0
  83. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Categorypath.php +132 -0
  84. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Categorypath/Collection.php +34 -0
  85. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Mediagallery.php +119 -0
  86. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Mediagallery/Collection.php +34 -0
  87. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Superattributes.php +180 -0
  88. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Superattributes/Collection.php +34 -0
  89. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Tax.php +73 -0
  90. app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Tax/Collection.php +34 -0
  91. app/code/community/Nostress/Aukro/Model/Mysql4/Categoryproducts.php +141 -0
  92. app/code/community/Nostress/Aukro/Model/Mysql4/Data/Loader.php +566 -0
  93. app/code/community/Nostress/Aukro/Model/Mysql4/Data/Loader/Product.php +639 -0
  94. app/code/community/Nostress/Aukro/Model/Mysql4/Data/Loader/Product/Aukro.php +210 -0
  95. app/code/community/Nostress/Aukro/Model/Mysql4/Data/Loader/Product/Aukro/Collection.php +91 -0
  96. app/code/community/Nostress/Aukro/Model/Mysql4/Enginecategory.php +112 -0
  97. app/code/community/Nostress/Aukro/Model/Mysql4/Mapping/Attribute.php +38 -0
  98. app/code/community/Nostress/Aukro/Model/Mysql4/Mapping/Attribute/Collection.php +32 -0
  99. app/code/community/Nostress/Aukro/Model/Mysql4/Mapping/Category.php +36 -0
  100. app/code/community/Nostress/Aukro/Model/Mysql4/Mapping/Category/Collection.php +32 -0
  101. app/code/community/Nostress/Aukro/Model/Mysql4/Product.php +31 -0
  102. app/code/community/Nostress/Aukro/Model/Mysql4/Product/Collection.php +32 -0
  103. app/code/community/Nostress/Aukro/Model/Mysql4/Shipping/Pricing.php +38 -0
  104. app/code/community/Nostress/Aukro/Model/Mysql4/Shipping/Pricing/Collection.php +32 -0
  105. app/code/community/Nostress/Aukro/Model/Observer.php +84 -0
  106. app/code/community/Nostress/Aukro/Model/Payment.php +11 -0
  107. app/code/community/Nostress/Aukro/Model/Product.php +49 -0
  108. app/code/community/Nostress/Aukro/Model/Profile.php +519 -0
  109. app/code/community/Nostress/Aukro/Model/Shipping/Carrier/Aukro.php +52 -0
  110. app/code/community/Nostress/Aukro/Model/Shipping/Pricing.php +32 -0
  111. app/code/community/Nostress/Aukro/Model/Status.php +39 -0
  112. app/code/community/Nostress/Aukro/Model/Taxonomy.php +328 -0
  113. app/code/community/Nostress/Aukro/Model/Unit.php +106 -0
  114. app/code/community/Nostress/Aukro/Model/Unit/Control.php +110 -0
  115. app/code/community/Nostress/Aukro/Model/Webapi/Abstract.php +225 -0
  116. app/code/community/Nostress/Aukro/Model/Webapi/Config.php +48 -0
  117. app/code/community/Nostress/Aukro/Model/Webapi/Order.php +642 -0
  118. app/code/community/Nostress/Aukro/Model/Webapi/Product.php +722 -0
  119. app/code/community/Nostress/Aukro/controllers/Adminhtml/ActivationController.php +81 -0
  120. app/code/community/Nostress/Aukro/controllers/Adminhtml/LogController.php +49 -0
  121. app/code/community/Nostress/Aukro/controllers/Adminhtml/Map/AttributesController.php +116 -0
  122. app/code/community/Nostress/Aukro/controllers/Adminhtml/Map/CategoriesController.php +158 -0
  123. app/code/community/Nostress/Aukro/controllers/Adminhtml/OrdersController.php +67 -0
  124. app/code/community/Nostress/Aukro/controllers/Adminhtml/Products/DisplayController.php +181 -0
  125. app/code/community/Nostress/Aukro/etc/config.xml +264 -0
  126. app/code/community/Nostress/Aukro/etc/system.xml +384 -0
  127. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-install-0.1.0.php +45 -0
  128. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.1.0-0.2.0.php +57 -0
  129. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.2.0-0.3.0.php +45 -0
  130. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.3.0-0.4.0.php +72 -0
  131. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.4.0-0.5.0.php +36 -0
  132. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.0-0.5.1.php +40 -0
  133. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.1-0.5.2.php +36 -0
  134. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.2-0.5.3.php +43 -0
  135. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.3-0.5.4.php +93 -0
  136. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.4-0.5.5.php +38 -0
  137. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.6.0-0.6.1.php +34 -0
  138. app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.6.1-0.6.2.php +57 -0
  139. app/design/adminhtml/default/default/layout/nostress_aukro.xml +61 -0
  140. app/design/adminhtml/default/default/template/nostress_aukro/activation.phtml +62 -0
  141. app/design/adminhtml/default/default/template/nostress_aukro/form.phtml +7 -0
  142. app/design/adminhtml/default/default/template/nostress_aukro/grid/container.phtml +80 -0
  143. app/design/adminhtml/default/default/template/nostress_aukro/payment/info.phtml +24 -0
  144. app/design/adminhtml/default/default/template/nostress_aukro/product.phtml +45 -0
  145. app/design/adminhtml/default/default/template/nostress_aukro/translate_array.phtml +168 -0
  146. app/design/adminhtml/default/default/template/nostress_aukro/widget/form/config/shipping.phtml +61 -0
  147. app/design/adminhtml/default/default/template/nostress_aukro/widget/form/renderer/element.phtml +20 -0
  148. app/design/adminhtml/default/default/template/nostress_aukro/widget/form/shipping/element.phtml +60 -0
  149. app/etc/modules/Nostress_Aukro.xml +10 -0
  150. app/locale/cs_CZ/Nostress_Aukro.csv +303 -0
  151. app/locale/en_US/Nostress_Aukro.csv +251 -0
  152. js/nostress/aukro/aukro.js +11 -0
  153. package.xml +18 -0
  154. skin/adminhtml/default/default/aukro.css +338 -0
  155. skin/adminhtml/default/default/images/aukro/aukro_logo.png +0 -0
  156. skin/adminhtml/default/default/images/aukro/box_top.png +0 -0
  157. skin/adminhtml/default/default/images/aukro/close.png +0 -0
  158. skin/adminhtml/default/default/images/aukro/preload.gif +0 -0
app/code/community/Nostress/Aukro/Block/Adminhtml/Activation.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * @category Nostress
21
+ * @package Nostress_Aukro
22
+ */
23
+
24
+ class Nostress_Aukro_Block_Adminhtml_Activation extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ public function __construct()
27
+ {
28
+ $this->_objectId = 'id';
29
+ $this->_controller = 'adminhtml';
30
+ $this->_blockGroup = 'aukro';
31
+ $this->_mode = 'activation';
32
+
33
+ parent::__construct();
34
+
35
+ $this->_removeButton('reset');
36
+ $this->_removeButton('save');
37
+ $this->_removeButton('back');
38
+ }
39
+
40
+ public function getHeaderText()
41
+ {
42
+ return Mage::helper('aukro')->__('Aukro Connector')." - ".Mage::helper('aukro')->__('Activation');
43
+ }
44
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Activation/Form.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * @category Nostress
21
+ * @package Nostress_Aukro
22
+ */
23
+
24
+ class Nostress_Aukro_Block_Adminhtml_Activation_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ protected function _prepareForm()
27
+ {
28
+ $form = new Varien_Data_Form(array(
29
+ 'id' => 'edit_form',
30
+ 'action' => $this->getUrl("*/*/activate"),
31
+ 'method' => 'post',
32
+ 'enctype' => 'multipart/form-data',
33
+ ));
34
+
35
+ $form->setUseContainer(true);
36
+ $this->setForm($form);
37
+
38
+ $fieldset = $form->addFieldset('activation_form', array(
39
+ 'legend' => Mage::helper('aukro')->__('Activation Form')
40
+ ));
41
+
42
+ $fieldset->addField('code', 'hidden', array(
43
+ 'name' => 'code',
44
+ 'value' => 'AC4M',
45
+ ));
46
+
47
+ $fieldset->addField('name', 'text', array(
48
+ 'label' => $this->__('Name:'),
49
+ 'class' => 'required-entry',
50
+ 'required' => true,
51
+ 'name' => 'name'
52
+ ));
53
+
54
+ $fieldset->addField('email', 'text', array(
55
+ 'label' => $this->__('Email:'),
56
+ 'class' => 'required-entry validate-email',
57
+ 'required' => true,
58
+ 'name' => 'email'
59
+ ));
60
+
61
+ $helper = Mage::helper( 'aukro');
62
+
63
+ $licenseConditionsLink = $helper->getHelpUrl(Nostress_Aukro_Helper_Data::HELP_LICENSE_CONDITIONS);
64
+ $fieldset->addField('accept_license_conditions', 'checkbox', array(
65
+ 'label' => $this->__('I accept Aukro Connector License Conditions'),
66
+ 'note' => $this->__('See').' <a href="'.$licenseConditionsLink.'" target="_blank">'.$this->__('Aukro Connector License Condtions').'</a>',
67
+ 'name' => 'accept_license_conditions',
68
+ 'value' => 0,
69
+ //'checked' => 'false',
70
+ 'onclick' => 'this.value = this.checked ? 1 : 0;',
71
+ 'disabled' => false,
72
+ 'readonly' => false,
73
+ 'required' => true,
74
+ ));
75
+
76
+ $fieldset->addField('submit_and_activate', 'button', array(
77
+ 'label' => "",
78
+ 'onclick' => 'if(editForm.submit()){addOverlay();document.getElementById(\'loading-mask\').style.display = \'block\';}',
79
+ 'class' => 'btn-koongo-submit-orange',
80
+ 'value' => $this->__( 'Activate Aukro Connector'),
81
+ ));
82
+
83
+ return parent::_prepareForm();
84
+ }
85
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Catalog/Category/Tab/Aukro.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Catalog_Category_Tab_Aukro extends Mage_Adminhtml_Block_Catalog_Form {
26
+
27
+ protected $_aukrocategory = 0;
28
+ protected $_aukroattributes;
29
+
30
+ public function _construct()
31
+ {
32
+ parent::_construct ();
33
+ $this->setTemplate('nostress_aukro/form.phtml');
34
+ }
35
+
36
+
37
+ public function _prepareLayout() {
38
+ $aukroWebApi = Mage::getModel('aukro/webapi_abstract');
39
+ parent::_prepareLayout();
40
+ $form = new Varien_Data_Form();
41
+ $form->setHtmlIdPrefix('aukro_');
42
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('aukro')->__('Aukro'), 'class' => "collapseable"));
43
+
44
+ $categoryId = Mage::registry('current_category')->getId();
45
+ $aukroValues = Mage::getModel('aukro/mapping_category')->getCollection()->addFieldToFilter('category',$categoryId)->getFirstItem();
46
+ $this->_aukrocategory = $aukroValues->getAukrocategory();
47
+ $this->_aukroattributes = $aukroValues->getAttributes();
48
+
49
+ $categories = $aukroWebApi->getCategoryData();
50
+ $fieldset->addField('category', 'select', array(
51
+ 'label' => Mage::helper('aukro')->__("Aukro category:"),
52
+ 'name' => "aukro_category",
53
+ 'onchange' => "reloadAukroAttributes(this.options[this.selectedIndex].value,'".$this->getUrl('aukro/adminhtml_map_categories/getAukroCategoryAttributes')."')",
54
+ 'values' => Mage::helper('aukro')->formatAukroCategories($categories),
55
+ 'value' => $aukroValues->getAukrocategory(),
56
+ ));
57
+
58
+ $fieldset->addField('connection_name', 'text', array(
59
+ 'label' => Mage::helper('aukro')->__("Connection Name:"),
60
+ 'name' => "aukro_connection_name",
61
+ 'value' => $aukroValues->getConnectionName(),
62
+ ));
63
+
64
+ $fieldset->addField('aukro_display_duration', 'select', array(
65
+ 'label' => Mage::helper('aukro')->__("Display Duration:"),
66
+ 'name' => "aukro_display_duration",
67
+ 'values' => Mage::getModel('aukro/adminhtml_system_config_source_duration')->toOptionArray(),
68
+ 'value' => $this->_getValue($aukroValues->getDisplayDuration())
69
+ ));
70
+
71
+ $fieldset->addField('aukro_base_unit', 'select', array(
72
+ 'label' => Mage::helper('aukro')->__("Base Unit:"),
73
+ 'name' => "aukro_base_unit",
74
+ 'values' => Mage::getModel('aukro/adminhtml_system_config_source_baseunit')->toOptionArray(),
75
+ 'value' => $this->_getValue( $aukroValues->getBaseUnit()),
76
+ ));
77
+
78
+ $fieldset->addField('aukro_auto_display', 'select', array(
79
+ 'label' => Mage::helper('aukro')->__("Auto Display Setting:"),
80
+ 'name' => "aukro_auto_display",
81
+ 'values' => Mage::getModel('aukro/adminhtml_system_config_source_autodisplay')->toOptionArray(),
82
+ 'value' => $this->_getValue($aukroValues->getAutoDisplay()),
83
+ ));
84
+
85
+ $shipmentData = $aukroWebApi->getShipmentData();
86
+
87
+ $fieldset->addField('aukro_shipping_payment', 'text', array(
88
+ 'label' => Mage::helper('aukro')->__("Shipping and Payment Setting:"),
89
+ 'name' => "aukro_shipping_payment",
90
+ 'defaultvalues' => unserialize($aukroValues->getShippingPayment()),
91
+ 'shipment' => $shipmentData['shipmentDataList']['item'],
92
+ ))->setRenderer($this->getLayout()->createBlock('aukro/adminhtml_catalog_category_tab_aukro_field'));
93
+
94
+ $aukroAttributesFieldset = $form->addFieldset('aukro_attributes_fieldset', array('legend' => Mage::helper('aukro')->__('Aukro Category Attributes'), 'class' => "collapseable"));
95
+
96
+ $form->setFieldNameSuffix('general[aukro]');
97
+ $this->setForm($form);
98
+ }
99
+
100
+ public function getAukroCategory() {
101
+ if ($this->_aukrocategory == 0 || $this->_aukrocategory == null)
102
+ return (-1);
103
+ return $this->_aukrocategory;
104
+ }
105
+
106
+ public function getAukroAttributes() {
107
+ return $this->_aukroattributes;
108
+ }
109
+
110
+ protected function _getValue( $value) {
111
+ if( $value === null) {
112
+ return -1;
113
+ } else {
114
+ return $value;
115
+ }
116
+ }
117
+
118
+
119
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Catalog/Category/Tab/Aukro/Field.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Catalog_Category_Tab_Aukro_Field extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element implements Varien_Data_Form_Element_Renderer_Interface {
26
+
27
+ public function _construct() {
28
+ $this->setTemplate('nostress_aukro/widget/form/shipping/element.phtml');
29
+ }
30
+
31
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Catalog/Category/Tabs.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Catalog_Category_Tabs extends Mage_Adminhtml_Block_Catalog_Category_Tabs {
26
+
27
+ protected function _prepareLayout()
28
+ {
29
+ parent::_prepareLayout();
30
+
31
+ $this->addTab('aukro', array(
32
+ 'label' => Mage::helper('catalog')->__('Aukro'),
33
+ 'content' => $this->getLayout()->createBlock(
34
+ 'aukro/adminhtml_catalog_category_tab_aukro',
35
+ 'category.aukro.settings'
36
+ )->toHtml(),
37
+ ));
38
+
39
+ return $this;
40
+ }
41
+
42
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Log.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Grid_Container {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_controller = 'adminhtml_log';
30
+ $this->_blockGroup = 'aukro';
31
+ $this->_headerText = Mage::helper('aukro')->__('Log');
32
+
33
+ parent::__construct();
34
+
35
+ $this->removeButton('add');
36
+ }
37
+
38
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Map_Attributes extends Mage_Adminhtml_Block_Widget_Form_Container {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_controller = 'adminhtml_map_attributes';
30
+ $this->_blockGroup = 'aukro';
31
+ $this->_headerText = Mage::helper('aukro')->__('Mapped attributes');
32
+
33
+ parent::__construct();
34
+
35
+ $this->addClearAttributesButton();
36
+ $this->addReloadAttributesButton();
37
+ $this->addCustomSaveButton();
38
+
39
+
40
+ $this->removeButton('back');
41
+ $this->removeButton('save');
42
+ }
43
+
44
+ public function getFormHtml()
45
+ {
46
+ return $this->getLayout()->createBlock('aukro/adminhtml_map_attributes_form')->toHtml();
47
+ }
48
+
49
+ protected function addReloadAttributesButton() {
50
+ $this->_addButton('reload_attributes', array(
51
+ 'label' => Mage::helper('aukro')->__('Load Attributes'),
52
+ 'onclick' => "setLocation('".$this->getUrl("*/*/reloadattributes")."');",
53
+ 'class' => 'reload',
54
+ ), -100);
55
+ }
56
+
57
+ protected function addClearAttributesButton() {
58
+ $this->_addButton('clear_attributes', array(
59
+ 'label' => Mage::helper('aukro')->__('Remove All Attributes'),
60
+ 'onclick' => "setLocation('".$this->getUrl("*/*/clearattributes")."');",
61
+ 'class' => 'reload',
62
+ ), -50);
63
+ }
64
+
65
+ protected function addCustomSaveButton() {
66
+ $this->_addButton('custom_save', array(
67
+ 'label' => Mage::helper('aukro')->__('Save'),
68
+ 'onclick' => "saveAttributeMapping();",
69
+ 'class' => 'save',
70
+ ), -100);
71
+ }
72
+
73
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Map_Attributes_Form extends Mage_Adminhtml_Block_Widget_Form {
26
+
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+ $this->setShowGlobalIcon(true);
31
+ }
32
+
33
+ public function _prepareLayout() {
34
+ parent::_prepareLayout();
35
+ $this->setChild('save_button',
36
+ $this->getLayout()->createBlock('adminhtml/widget_button')
37
+ ->setData(array(
38
+ 'label' => Mage::helper('aukro')->__('Save Mapping'),
39
+ 'onclick' => "updateOutput();",
40
+ 'class' => 'save'
41
+ ))
42
+ );
43
+ $form = new Varien_Data_Form();
44
+ $fieldset = $form->addFieldset('aukro_attributes_map_fieldset', array('legend' => Mage::helper('aukro')->__('Attributes Mapping Table')));
45
+
46
+ $fieldset->addType('attributes','Nostress_Aukro_Block_Adminhtml_Map_Attributes_Form_Element');
47
+
48
+ $attributesCollection = Mage::getModel('aukro/mapping_attribute')->getCollection();
49
+ $attributes = array();
50
+ foreach ($attributesCollection as $item) {
51
+ $attributes[] = array (
52
+ 'code' => $item->getCode(),
53
+ 'label' => $item->getLabel(),
54
+ 'magento' => $item->getMagento(),
55
+ 'type' => $item->getType(),
56
+ 'limit' => $item->getLimit(),
57
+ 'postproc' => $item->getPostproc(),
58
+ 'path' => $item->getPath(),
59
+ 'description' => unserialize($item->getDescription()),
60
+ 'prefix' => $item->getPrefix(),
61
+ 'constant' => $item->getConstant(),
62
+ 'translate' => unserialize($item->getTranslate()),
63
+ 'suffix' => $item->getSuffix(),
64
+ 'eppav' => $item->getEppav(),
65
+ );
66
+ }
67
+
68
+ $fieldset->addField('aukro_attributes_map', 'attributes', array(
69
+ 'values' => array("attribute" => $attributes),
70
+ 'file' => 'xml',
71
+ 'submit_url' => $this->getUrl("*/*/saveAttributeMapping"),
72
+ 'store_id' => 1,
73
+ 'allow_custom_attributes' => 0
74
+ ), 'frontend_class')->setRenderer($this->getLayout()->createBlock('aukro/adminhtml_map_attributes_form_renderer_fieldset_element'));
75
+ $this->setForm($form);
76
+ }
77
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form/Attributeselect.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Varien
22
+ * @package Varien_Data
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Form select element
29
+ *
30
+ * @category Varien
31
+ * @package Varien_Data
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Nostress_Aukro_Block_Adminhtml_Map_Attributes_Form_Attributeselect extends Varien_Data_Form_Element_Select
35
+ {
36
+ const WARNING_IMAGE_PATH = "adminhtml/default/default/images/error_msg_icon.gif";
37
+
38
+ protected function _optionToHtml($option, $selected)
39
+ {
40
+ if (is_array($option['value'])) {
41
+ $html ='<optgroup label="'.$option['label'].'">'."\n";
42
+ foreach ($option['value'] as $groupItem) {
43
+ $html .= $this->_optionToHtml($groupItem, $selected);
44
+ }
45
+ $html .='</optgroup>'."\n";
46
+ }
47
+ else {
48
+ if (isset($option['disabled'])) {
49
+ $style = 'style=""';
50
+ } else {
51
+ $style = 'style="color: black;"';
52
+ }
53
+ $html = '<option value="'.$this->_escape($option['value']).'"';
54
+ $html.= isset($option['title']) ? 'title="'.$this->_escape($option['title']).'"' : '';
55
+ $html.= isset($option['style']) ? 'style="'.$option['style'].'"' : '';
56
+ $html.= (isset($option['red']) && $option['red'] == 1) ? 'style="color: red;" class="warning"' : $style;
57
+ $html.= isset($option['disabled']) ? 'disabled="disabled"' : '';
58
+ if (in_array($option['value'], $selected)) {
59
+ $html.= ' selected="selected"';
60
+ }
61
+ $html.= '>'.$this->_escape($option['label']). '</option>'."\n";
62
+ }
63
+ return $html;
64
+ }
65
+
66
+ public function getElementHtml() {
67
+ $this->addClass('select');
68
+ $value = $this->getValue();
69
+ if (!is_array($value)) {
70
+ $value = array($value);
71
+ }
72
+ $display = 'display:none;';
73
+ if ($values = $this->getValues()) {
74
+ foreach ($values as $option) {
75
+ if (is_array($option) && !is_array($option['value'])) {
76
+ if ($option['red'] == 1 && in_array($option['value'], $value)) {
77
+ $display = 'display:block;';
78
+ }
79
+ }
80
+ }
81
+ }
82
+
83
+ $html = '<select id="'.$this->getHtmlId().'" name="'.$this->getName().'" '.$this->serialize($this->getHtmlAttributes()).'>'."\n";
84
+
85
+
86
+ if ($values) {
87
+ foreach ($values as $key => $option) {
88
+ if (!is_array($option)) {
89
+ $html.= $this->_optionToHtml(array(
90
+ 'value' => $key,
91
+ 'label' => $option),
92
+ $value
93
+ );
94
+ }
95
+ elseif (is_array($option['value'])) {
96
+ $html.='<optgroup label="'.$option['label'].'">'."\n";
97
+ foreach ($option['value'] as $groupItem) {
98
+ $html.= $this->_optionToHtml($groupItem, $value);
99
+ }
100
+ $html.='</optgroup>'."\n";
101
+ }
102
+ else {
103
+ $html.= $this->_optionToHtml($option, $value);
104
+ }
105
+ }
106
+ }
107
+
108
+ $html.= '</select>'."\n";
109
+ $html.= $this->getAfterElementHtml();
110
+
111
+ $html = str_replace('TO_BE_REPLACED_WITH_ID', $this->getHtmlId(), $html);
112
+
113
+ $html = '<div id="'.$this->getHtmlId().'_warning" style=" '.$display.'float:left;"><img src="'.Mage::getBaseUrl('skin').self::WARNING_IMAGE_PATH.'"></div>'.$html;
114
+ return $html;
115
+ }
116
+
117
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form/Element.php ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * @category Nostress
21
+ * @package Nostress_Aukro
22
+ */
23
+
24
+ class Nostress_Aukro_Block_Adminhtml_Map_Attributes_Form_Element extends Varien_Data_Form_Element_Abstract
25
+ {
26
+ const ATTRIBUTE_ARRAY_PATH = "attributes[attribute]";
27
+ const ATTRIBUTE_ARRAY_PATH_FULL = "attributes[attribute]";
28
+ const CUSTOM_ATTRIBUTE_ARRAY_PATH = "custom_attributes[attribute]";
29
+ const CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL = "custom_attributes[attribute]";
30
+ const DESCRIPTION_OPTIONS_DELIMITER = "\n\t* ";
31
+ const DESCRIPTION_RECORD_DELIMITER = "\n";
32
+ const INFO_IMAGE_PATH = "adminhtml/default/default/images/note_msg_icon.gif";
33
+
34
+ protected $_rowIndex = 0;
35
+
36
+ public function getElementHtml() {
37
+ $elementAttributeHtml = '';
38
+ $form = $this->getForm();
39
+
40
+ $addButton = $form->getParent()->getLayout()->createBlock('adminhtml/widget_button')
41
+ ->setData(array(
42
+ 'label' => Mage::helper('aukro')->__('Add new attribute'),
43
+ 'onclick' => "addAttribute()",
44
+ 'class' => 'add addAttributeButton'
45
+ ));
46
+ $removeButton = $form->getParent()->getLayout()->createBlock('adminhtml/widget_button')
47
+ ->setData(array(
48
+ 'label' => Mage::helper('aukro')->__('Remove last added attribute'),
49
+ 'onclick' => "removeCustomAttribute()",
50
+ 'class' => 'delete',
51
+ 'style' => 'margin-right: 10px;'
52
+ ));
53
+
54
+ $addButtonHtml = "";
55
+ $actionColumnHtml = "";
56
+ if($this->getAllowCustomAttributes() == "1")
57
+ {
58
+ $addButtonHtml = $addButton->toHtml();
59
+ $actionColumnHtml = '<th>'.Mage::helper('aukro')->__('Action').'</th>';
60
+ }
61
+
62
+ $html = '
63
+ <div class="grid" ><div class="hor-scroll">
64
+ <script type="text/javascript">
65
+ function showWarning(selectId,resize) {
66
+ var selectedIndex = document.getElementById(selectId).selectedIndex;
67
+ if (document.getElementById(selectId).options[selectedIndex].className == "warning") {
68
+ document.getElementById(selectId+"_warning").style.display="block";
69
+ document.getElementById(selectId).style.color="red";
70
+ if (resize) {
71
+ document.getElementById(selectId).style.width="90%";
72
+ }
73
+ } else {
74
+ document.getElementById(selectId+"_warning").style.display="none";
75
+ document.getElementById(selectId).style.color="black";
76
+ if (resize) {
77
+ document.getElementById(selectId).style.width="100%";
78
+ }
79
+ }
80
+ }
81
+ function saveAttributeMapping() {
82
+ document.forms["attribute_mapping"].submit();
83
+ }
84
+
85
+ </script>
86
+ <form id="attribute_mapping" action="'.$this->getSubmitUrl().'" method="post">
87
+ <input name="form_key" type="hidden" value="'.Mage::getSingleton('core/session')->getFormKey().'" />
88
+ <table class="data" cellspacing="0" id="tempshutdown_container">
89
+ <thead>
90
+ <tr class="headings">
91
+ <th>'.Mage::helper('aukro')->__('#').'</th>
92
+ <th>'.Mage::helper('aukro')->__('Attribute').'</th>
93
+ <th>'.Mage::helper('aukro')->__('Prefix').'</th>
94
+ <th>'.Mage::helper('aukro')->__('Constant value').'</th>
95
+ <th>'.Mage::helper('aukro')->__('Magento attribute').'</th>
96
+ <th>'.Mage::helper('aukro')->__('Translate attribute').'</th>
97
+ <th>'.Mage::helper('aukro')->__('Suffix').'</th>
98
+ <th>'.Mage::helper('aukro')->__('Export parent product<br> attribute value').'</th>
99
+ <th>'.Mage::helper('aukro')->__('Chars limit').'</th>
100
+ <th>'.Mage::helper('aukro')->__('Post-process value').'</th>
101
+ '.$actionColumnHtml.'
102
+ </tr>
103
+ </thead>
104
+ <tbody>
105
+ '.$this->getRows().'
106
+ </tbody>
107
+ </table>
108
+ </div></div>
109
+ <div class="addAttributeButton">
110
+ './*$removeButton->toHtml().*/'
111
+ '.$addButtonHtml.'
112
+ </div></form>';
113
+
114
+ return $html;
115
+ }
116
+
117
+ public function getRows() {
118
+ $html = "";
119
+ $values = $this->getValues();
120
+ $attributes = $values["attribute"];
121
+ $custom = 0;
122
+
123
+ //echo "<pre>".print_r($this->getValues(), 1)."</pre>";
124
+
125
+ $index = 1;
126
+ if (!empty($attributes)) {
127
+ foreach ($attributes as $key => $attribute) {
128
+ $custom = 0;
129
+ if ($attribute["code"] == "custom_attribute") {
130
+ $custom = 1;
131
+ }
132
+ $html .= $this->_getRowTemplateHtml($attribute, $index, $custom);
133
+ $index++;
134
+ }
135
+ }
136
+ return $html;
137
+ }
138
+
139
+ protected function _getRowTemplateHtml($attribute, $key, $custom = 0) {
140
+ $index = $this->_rowIndex;
141
+ $this->_rowIndex++;
142
+ $disabled = "";
143
+ $disabledBool = 0;
144
+ $disabledHtml = "";
145
+
146
+ $removeElementButton = $this->getForm()->getParent()->getLayout()->createBlock('adminhtml/widget_button')
147
+ ->setData(array(
148
+ 'label' => Mage::helper('aukro')->__('Delete'),
149
+ 'onclick' => "removeCustomAttributeElement(".$key.")",
150
+ 'class' => 'delete'
151
+ ));
152
+
153
+ if ($this->attribute($attribute, "type") == "disabled") {
154
+ $disabled = "disabled";
155
+ $disabledBool = 1;
156
+ $disabledHtml = " disabled=\"disabled\"";
157
+ }
158
+
159
+ $attributesValues = Mage::helper('aukro/data_feed')->getAttributeOptions($this->getStoreId());
160
+ $attributesValue = $this->attribute($attribute, "magento");
161
+ $attributesStyle = 'width:100%;';
162
+ if ($attributesValues) {
163
+ foreach ($attributesValues as $option) {
164
+ if (is_array($option) && !is_array($option['value'])) {
165
+ if (isset($option['red']) && $option['red'] == 1 && $option['value'] == $attributesValue) {
166
+ $attributesStyle = 'width:90%;color:red';
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ $attributesConfig = array(
173
+ "id" => "aukro_magentoattribute",
174
+ "name" => (($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH : self::ATTRIBUTE_ARRAY_PATH)."[".$index."][magento".(($disabledBool == 1) ? "_disabled" : "")."]",
175
+ "style" => $attributesStyle,
176
+ "values" => $attributesValues,
177
+ "value" => $attributesValue,
178
+ "html_id" => '_'.$index,
179
+ 'onchange' => 'showWarning(\'TO_BE_REPLACED_WITH_ID\',true);',
180
+ "disabled" => $disabled
181
+ );
182
+
183
+ $attributesSelect = new Nostress_Aukro_Block_Adminhtml_Map_Attributes_Form_Attributeselect($attributesConfig);
184
+ $attributesSelect->setForm($this->getForm());
185
+
186
+ $translateGrid = $this->getForm()->getParent()->getLayout()->createBlock('aukro/adminhtml_map_attributes_form_translate');
187
+ if ($custom == 1)
188
+ $attributeArrayPathFull = self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL;
189
+ else
190
+ $attributeArrayPathFull = self::ATTRIBUTE_ARRAY_PATH_FULL;
191
+ $translateGrid->setData(array(
192
+ 'values' => $attribute['translate'],
193
+ 'row_index' => $index,
194
+ 'custom_attribute_array_path_full' => self::ATTRIBUTE_ARRAY_PATH_FULL,
195
+ 'isDisabled' => $disabledBool,
196
+ 'attribute' => 'translate'
197
+
198
+ ));
199
+ $translateGrid->setElement($this->getForm());
200
+ $translateGridHtml = $translateGrid->toHtml();
201
+
202
+
203
+ $attributesConfig["name"] = (($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH : self::ATTRIBUTE_ARRAY_PATH)."[".$index."][magento]";
204
+ $attributesConfig["disabled"] = "";
205
+ $attributesConfig["style"] = "display: none;";
206
+
207
+ $attributesHiddenSelect = new Varien_Data_Form_Element_Select($attributesConfig);
208
+ $attributesHiddenSelect->setForm($this->getForm());
209
+
210
+ $parentConfig = array(
211
+ "id" => "aukro_parentconfig",
212
+ "name" => (($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH : self::ATTRIBUTE_ARRAY_PATH)."[".$index."][eppav".(($disabledBool == 1) ? "_disabled" : "")."]",
213
+ "style" => "width: 100%;",
214
+ "values" => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
215
+ "value" => $this->attribute($attribute, "eppav", false),
216
+ "disabled" => $disabled
217
+ );
218
+
219
+ $parentSelect = new Varien_Data_Form_Element_Select($parentConfig);
220
+ $parentSelect->setForm($this->getForm());
221
+
222
+ $parentConfig["name"] = (($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH : self::ATTRIBUTE_ARRAY_PATH)."[".$index."][eppav]";
223
+ $parentConfig["disabled"] = "";
224
+ $parentConfig["style"] = "display: none;";
225
+
226
+ $parentHiddenSelect = new Varien_Data_Form_Element_Select($parentConfig);
227
+ $parentHiddenSelect->setForm($this->getForm());
228
+
229
+ $postConfig = array(
230
+ "id" => "aukro_postconfig",
231
+ "name" => (($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH : self::ATTRIBUTE_ARRAY_PATH)."[".$index."][postproc".(($disabledBool == 1) ? "_disabled" : "")."][]",
232
+ "style" => "width: 200px;",
233
+ "values" => Mage::helper('aukro/data_feed')->getPostProcessFunctionOptions($this->getFile()),
234
+ "value" => $this->attribute($attribute, "postproc", false),
235
+ "disabled" => $disabled
236
+ );
237
+
238
+ $postSelect = new Varien_Data_Form_Element_Multiselect($postConfig);
239
+ $postSelect->setSize(3);
240
+ $postSelect->setForm($this->getForm());
241
+
242
+ $postConfig["name"] = (($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH : self::ATTRIBUTE_ARRAY_PATH)."[".$index."][postproc][]";
243
+ $postConfig["disabled"] = "";
244
+ $postConfig["style"] = "display: none;";
245
+
246
+ $postHiddenSelect = new Varien_Data_Form_Element_Multiselect($postConfig);
247
+ $postHiddenSelect->setForm($this->getForm());
248
+
249
+ $description = $this->attribute($attribute, "description", null);
250
+ if (isset($description)) {
251
+ $description = $this->processDescription($description);
252
+ }
253
+
254
+ $pathColumn = "";
255
+ if ($this->getFile() == "xml") {
256
+ $pathColumn .= "<td style=\"display: table-cell;\">";
257
+ if ($custom == 1) {
258
+ $pathColumn .= "<input type=\"hidden\" name=\"".self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL."[".$index."][path]\" value=\"".$this->attribute($attribute, "path")."\" />".$this->attribute($attribute, "path");
259
+ }
260
+ else {
261
+ $pathColumn .= $this->attribute($attribute, "path");
262
+ }
263
+ $pathColumn .= "</td>";
264
+ }
265
+
266
+ $html = '
267
+ <tr class="'.$disabled.'" '.(($custom == 1) ? "id=\"custom_".$key."\"" : "").'>
268
+ <td style="display: table-cell;">'.$key.'</td>
269
+ <td style="display: table-cell;">';
270
+ if ($custom == 1) {
271
+ $html .= "<input type=\"text\" name=\"".self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL."[".$index."][label]\" value=\"".$this->attribute($attribute, "label")."\" style=\"width: 95%;\" /><input type=\"hidden\" name=\"".self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL."[".$index."][delete]\" value=\"0\" id=\"customdelete".$key."\" />";
272
+ }
273
+ else {
274
+ $html .= $this->attribute($attribute, "label").'<img style="cursor: help;" alt="'.$description.'" title="'.$description.'" src="'.Mage::getBaseUrl('skin').self::INFO_IMAGE_PATH.'">';
275
+ }
276
+ $html .= '</td>
277
+ <td style="display: table-cell;"><input type="text" value="'.$this->attribute($attribute, "prefix").'" name="'.(($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL : self::ATTRIBUTE_ARRAY_PATH_FULL).'['.$index.'][prefix'.(($disabledBool == 1) ? "_disabled" : "").']" style="width: 95%;"'.$disabledHtml.' />'.(($disabledBool == 1) ? "<input type=\"hidden\" value=\"".$this->attribute($attribute, "prefix")."\" name=\"".(($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL : self::ATTRIBUTE_ARRAY_PATH_FULL)."[".$index."][prefix]\" />" : "").'</td>
278
+ <td style="display: table-cell;"><input type="text" value="'.$this->attribute($attribute, "constant").'" name="'.(($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL : self::ATTRIBUTE_ARRAY_PATH_FULL).'['.$index.'][constant'.(($disabledBool == 1) ? "_disabled" : "").']" style="width: 95%;"'.$disabledHtml.' />'.(($disabledBool == 1) ? "<input type=\"hidden\" value=\"".$this->attribute($attribute, "constant")."\" name=\"".(($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL : self::ATTRIBUTE_ARRAY_PATH_FULL)."[".$index."][constant]\" />" : "").'</td>
279
+ <td style="display: table-cell;">'.$attributesSelect->getElementHtml().(($disabledBool == 1) ? $attributesHiddenSelect->getElementHtml() : "" ).'</td>
280
+ <td style="display: table-cell;">'.$translateGridHtml.'</td>
281
+ <td style="display: table-cell;"><input type="text" value="'.$this->attribute($attribute, "suffix").'" name="'.(($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL : self::ATTRIBUTE_ARRAY_PATH_FULL).'['.$index.'][suffix'.(($disabledBool == 1) ? "_disabled" : "").']" style="width: 95%;"'.$disabledHtml.' />'.(($disabledBool == 1) ? "<input type=\"hidden\" value=\"".$this->attribute($attribute, "suffix")."\" name=\"".(($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL : self::ATTRIBUTE_ARRAY_PATH_FULL)."[".$index."][suffix]\" />" : "").'</td>
282
+ <td style="display: table-cell;">'.$parentSelect->getElementHtml().(($disabledBool == 1) ? $parentHiddenSelect->getElementHtml() : "" ).'</td>
283
+ <td style="display: table-cell;"><input type="text" value="'.$this->attribute($attribute, "limit").'" name="'.(($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL : self::ATTRIBUTE_ARRAY_PATH_FULL).'['.$index.'][limit'.(($disabledBool == 1) ? "_disabled" : "").']" style="width: 95%;"'.$disabledHtml.' />'.(($disabledBool == 1) ? "<input type=\"hidden\" value=\"".$this->attribute($attribute, "limit")."\" name=\"".(($custom == 1) ? self::CUSTOM_ATTRIBUTE_ARRAY_PATH_FULL : self::ATTRIBUTE_ARRAY_PATH_FULL)."[".$index."][limit]\" />" : "").'</td>
284
+ <td style="display: table-cell;">'.$postSelect->getElementHtml().(($disabledBool == 1) ? $postHiddenSelect->getElementHtml() : "" ).'<input type="hidden" name="'.self::ATTRIBUTE_ARRAY_PATH_FULL.'['.$index.'][code]" value="'.$this->attribute($attribute, "code").'" /></td>
285
+ '.(($custom == 1) ? "<td>".$removeElementButton->toHtml()."</td>" : "").'
286
+ </tr>';
287
+
288
+ return $html;
289
+ }
290
+
291
+ protected function attribute($attributeArray, $index, $default = "") {
292
+ if (isset($attributeArray[$index])) {
293
+ return $attributeArray[$index];
294
+ }
295
+ else {
296
+ return $default;
297
+ }
298
+ }
299
+
300
+ protected function processDescription($description)
301
+ {
302
+ $descriptionText = $this->attribute($description,"text",null);
303
+ $example = $this->attribute($description,"example",null);
304
+ if(isset($example) && !empty($example))
305
+ {
306
+ $descriptionText.= self::DESCRIPTION_RECORD_DELIMITER.Mage::helper('Aukro')->__('Example: ').$example;
307
+ }
308
+
309
+ $options = $this->attribute($description,"options",null);
310
+ if(isset($options) && !empty($options))
311
+ {
312
+ $options = self::DESCRIPTION_OPTIONS_DELIMITER.str_replace(";",self::DESCRIPTION_OPTIONS_DELIMITER,$options);
313
+ $descriptionText.= self::DESCRIPTION_RECORD_DELIMITER.Mage::helper('Aukro')->__('Options: ').$options;
314
+ }
315
+ $descriptionText = ucfirst($descriptionText);
316
+ return $descriptionText;
317
+ }
318
+ /**
319
+ * Dublicate interface of Varien_Data_Form_Element_Abstract::setReadonly
320
+ *
321
+ * @param bool $readonly
322
+ * @param bool $useDisabled
323
+ * @return Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Apply
324
+ */
325
+ public function setReadonly($readonly, $useDisabled = false) {
326
+ $this->setData('readonly', $readonly);
327
+ $this->setData('disabled', $useDisabled);
328
+ return $this;
329
+ }
330
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form/Renderer/Fieldset/Element.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Fieldset element renderer
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Nostress_Aukro_Block_Adminhtml_Map_Attributes_Form_Renderer_Fieldset_Element extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element implements Varien_Data_Form_Element_Renderer_Interface
35
+ {
36
+ protected function _construct()
37
+ {
38
+ $this->setTemplate('nostress_aukro/widget/form/renderer/element.phtml');
39
+ }
40
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Form/Translate.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * @category Nostress
21
+ * @package Nostress_Aukro
22
+ */
23
+
24
+ class Nostress_Aukro_Block_Adminhtml_Map_Attributes_Form_Translate extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
25
+ {
26
+ protected $_selected = ' selected="selected" ';
27
+
28
+ public function __construct()
29
+ {
30
+ $this->setTemplate('nostress_aukro/translate_array.phtml');
31
+ $this->addColumn('from', array(
32
+ 'label' => Mage::helper('aukro')->__('From'),
33
+ 'style' => 'width:60px',
34
+ 'class' => 'option-control',
35
+ 'type' => 'text',
36
+ ));
37
+ $this->addColumn('to', array(
38
+ 'label' => Mage::helper('aukro')->__('To'),
39
+ 'style' => 'width:60px',
40
+ 'class' => 'option-control',
41
+ 'type' => 'text',
42
+ ));
43
+ $this->_addAfter = false;
44
+ parent::__construct();
45
+ }
46
+
47
+
48
+ protected function _renderCellTemplate($columnName)
49
+ {
50
+ if (empty($this->_columns[$columnName])) {
51
+ throw new Exception('Wrong column name specified.');
52
+ }
53
+
54
+ $rowIndex = $this->getData('row_index');
55
+ $attributePath = $this->getData('custom_attribute_array_path_full');
56
+ $isDisabled = $this->getData('isDisabled');
57
+ $attributeName = $this->getData('attribute');
58
+
59
+ if ($isDisabled == true)
60
+ $disabled = 'disabled="disabled"';
61
+ else
62
+ $disabled = null;
63
+ $column = $this->_columns[$columnName];
64
+ $inputName = $attributePath.'['.$rowIndex.']['.$attributeName.'][#{_id}][' . $columnName . ']';
65
+
66
+ if ($column['renderer']) {
67
+ return $column['renderer']->setInputName($inputName)->setColumnName($columnName)->setColumn($column)
68
+ ->toHtml();
69
+ }
70
+
71
+ return '<input type="text" '.$disabled.' name="' . $inputName . '" value="#{' . $columnName . '}" ' .
72
+ ($column['size'] ? 'size="' . $column['size'] . '"' : '') . ' class="' .
73
+ (isset($column['class']) ? $column['class'] : 'input-text') . '"'.
74
+ (isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '/>';
75
+ }
76
+
77
+ public function addColumn($name, $params)
78
+ {
79
+ $this->_columns[$name] = array(
80
+ 'label' => empty($params['label']) ? 'Column' : $params['label'],
81
+ 'size' => empty($params['size']) ? false : $params['size'],
82
+ 'style' => empty($params['style']) ? null : $params['style'],
83
+ 'class' => empty($params['class']) ? null : $params['class'],
84
+ 'type' => empty($params['type']) ? null : $params['type'],
85
+ 'renderer' => false,
86
+ );
87
+ if ((!empty($params['renderer'])) && ($params['renderer'] instanceof Mage_Core_Block_Abstract)) {
88
+ $this->_columns[$name]['renderer'] = $params['renderer'];
89
+ }
90
+ }
91
+
92
+ public function rowDisabled() {
93
+ return $this->getData('isDisabled');
94
+ }
95
+
96
+ public function getArrayRows()
97
+ {
98
+ if (null !== $this->_arrayRowsCache)
99
+ {
100
+ return $this->_arrayRowsCache;
101
+ }
102
+
103
+ $result = array();
104
+
105
+ $values = $this->getData('values');
106
+
107
+ if ($values != null) {
108
+ foreach ($values as $key => $value) {
109
+ $row = array(
110
+ '_id' => $key,
111
+ 'from' => $value['from'],
112
+ 'to' => $value['to']
113
+ );
114
+ $result[$key] = new Varien_Object($row);
115
+ }
116
+ }
117
+
118
+ $this->_arrayRowsCache = $result;
119
+ return $this->_arrayRowsCache;
120
+
121
+ }
122
+
123
+
124
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Attributes/Grid.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Map_Attributes_Grid extends Mage_Adminhtml_Block_Widget_Grid {
26
+
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+ $this->setId('aukroMappedAttributes');
31
+ $this->setDefaultSort('category_id');
32
+ $this->setDefaultDir('ASC');
33
+ $this->setSaveParametersInSession(true);
34
+ }
35
+
36
+ protected function _prepareCollection()
37
+ {
38
+ $collection = new Varien_Data_Collection(); // TODO nacitavanie objednavok z aukra
39
+ $this->setCollection($collection);
40
+ return parent::_prepareCollection();
41
+ }
42
+
43
+ protected function _prepareColumns()
44
+ {
45
+ // TODO definovat stlpce, ktore sa budu realne pouzivat
46
+ $this->addColumn('real_order_id', array(
47
+ 'header'=> Mage::helper('sales')->__('Attribute #'),
48
+ 'width' => '80px',
49
+ 'type' => 'text',
50
+ 'index' => 'increment_id',
51
+ ));
52
+
53
+ $this->addColumn('magento_category_name', array(
54
+ 'header'=> Mage::helper('sales')->__('Magento Attribute Name'),
55
+ 'type' => 'text',
56
+ 'index' => 'increment_id',
57
+ ));
58
+
59
+ $this->addColumn('aukro_category_name', array(
60
+ 'header' => Mage::helper('sales')->__('Aukro Attribute Name'),
61
+ 'type' => 'text',
62
+ 'index' => 'increment_id',
63
+ ));
64
+
65
+ return parent::_prepareColumns();
66
+ }
67
+
68
+
69
+
70
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Categories.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Map_Categories extends Mage_Adminhtml_Block_Widget_Grid_Container {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_controller = 'adminhtml_map_categories';
30
+ $this->_blockGroup = 'aukro';
31
+ $this->_headerText = Mage::helper('aukro')->__('Mapped Categories');
32
+
33
+ parent::__construct();
34
+
35
+ $this->addCheckMappingButton();
36
+
37
+ $this->removeButton('add');
38
+ }
39
+
40
+ protected function addCheckMappingButton() {
41
+ $this->_addButton('check_mapping', array(
42
+ 'label' => Mage::helper('aukro')->__('Check Mapping'),
43
+ 'onclick' => "setLocation('".$this->getUrl("*/*/checkmapping")."');",
44
+ 'class' => 'reload',
45
+ ), -100);
46
+ }
47
+
48
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Map/Categories/Grid.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Map_Categories_Grid extends Mage_Adminhtml_Block_Widget_Grid {
26
+
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+ $this->setId('aukroMappedCategories');
31
+ $this->setDefaultSort('category_id');
32
+ $this->setDefaultDir('ASC');
33
+ $this->setSaveParametersInSession(true);
34
+ }
35
+
36
+ protected function _prepareCollection()
37
+ {
38
+ $collection = Mage::getModel('aukro/mapping_category')->getCollection();
39
+ $this->setCollection($collection);
40
+ return parent::_prepareCollection();
41
+ }
42
+
43
+ protected function _prepareColumns()
44
+ {
45
+
46
+ $this->addColumn('mapping_id', array(
47
+ 'header'=> Mage::helper('aukro')->__('#'),
48
+ 'width' => '80px',
49
+ 'type' => 'text',
50
+ 'index' => 'mapping_id',
51
+ ));
52
+
53
+ $category = Mage::getModel('catalog/category');
54
+ $tree = $category->getTreeModel();
55
+ $tree->load();
56
+ $ids = $tree->getCollection()->getAllIds();
57
+ $arr = array();
58
+ foreach ($ids as $id) {
59
+ $category->load($id);
60
+ $arr[$id] = $category->getName();
61
+ }
62
+ asort($arr);
63
+
64
+ $this->addColumn('category', array(
65
+ 'header'=> Mage::helper('aukro')->__('Magento Category'),
66
+ 'type' => 'options',
67
+ 'index' => 'category',
68
+ 'options' => $arr,
69
+ ));
70
+
71
+ $categoryDataResponse = Mage::getModel('aukro/webapi_abstract')->getCategoryData();
72
+ $this->addColumn('aukrocategory', array(
73
+ 'header'=> Mage::helper('aukro')->__('Aukro Category'),
74
+ 'type' => 'options',
75
+ 'index' => 'aukrocategory',
76
+ 'options' => Mage::helper('aukro')->formatAukroCategories($categoryDataResponse),
77
+ ));
78
+
79
+ $this->addColumn('connection_name', array(
80
+ 'header'=> Mage::helper('aukro')->__('Connection Name'),
81
+ 'type' => 'text',
82
+ 'index' => 'connection_name',
83
+ ));
84
+
85
+ $this->addColumn('display_duration', array(
86
+ 'header'=> Mage::helper('aukro')->__('Display Duration'),
87
+ 'type' => 'options',
88
+ 'index' => 'display_duration',
89
+ 'options' => Mage::getModel('aukro/adminhtml_system_config_source_duration')->getOptions(),
90
+ ));
91
+
92
+ $this->addColumn('auto_display', array(
93
+ 'header'=> Mage::helper('aukro')->__('Auto Display'),
94
+ 'type' => 'options',
95
+ 'index' => 'auto_display',
96
+ 'options' => Mage::getModel('aukro/adminhtml_system_config_source_autodisplay')->getOptions(),
97
+ ));
98
+
99
+ return parent::_prepareColumns();
100
+ }
101
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Orders.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Orders extends Mage_Adminhtml_Block_Widget_Grid_Container {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_controller = 'adminhtml_orders';
30
+ $this->_blockGroup = 'aukro';
31
+ $this->_headerText = Mage::helper('aukro')->__('Aukro orders');
32
+
33
+ parent::__construct();
34
+
35
+ $this->_addRefreshOrdersButton();
36
+
37
+ $this->removeButton('add');
38
+ }
39
+
40
+ protected function _addRefreshOrdersButton() {
41
+ $this->_addButton('refresh_orders', array(
42
+ 'label' => Mage::helper('aukro')->__('Refresh Orders'),
43
+ 'onclick' => "setLocation('".$this->getUrl("*/*/refreshOrders")."');",
44
+ 'class' => 'reload',
45
+ ), -100);
46
+ }
47
+
48
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Orders/Grid.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid {
26
+
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+ $this->setId('aukroOrders');
31
+ $this->setDefaultSort('aukro_order_id');
32
+ $this->setDefaultDir('ASC');
33
+ $this->setSaveParametersInSession(true);
34
+ }
35
+
36
+ protected function _getCollectionClass()
37
+ {
38
+ return 'sales/order_grid_collection';
39
+ }
40
+
41
+ protected function _prepareCollection()
42
+ {
43
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
44
+ $collection
45
+ ->addFieldToFilter( 'aukro_order_id', array( 'notnull'=>true))
46
+ ->getSelect()
47
+ ->join( array('so' => 'sales_flat_order'), 'main_table.entity_id = so.entity_id', 'aukro_order_id')
48
+ ;
49
+
50
+ $this->setCollection($collection);
51
+ return parent::_prepareCollection();
52
+ }
53
+
54
+ protected function _prepareColumns()
55
+ {
56
+ $this->addColumn('real_order_id', array(
57
+ 'header'=> Mage::helper('sales')->__('Order #'),
58
+ 'width' => '80px',
59
+ 'type' => 'text',
60
+ 'index' => 'increment_id',
61
+ ));
62
+ $this->addColumn('created_at', array(
63
+ 'header' => Mage::helper('sales')->__('Purchased On'),
64
+ 'index' => 'created_at',
65
+ 'type' => 'datetime',
66
+ 'width' => '100px',
67
+ ));
68
+
69
+ $this->addColumn('billing_name', array(
70
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
71
+ 'index' => 'billing_name',
72
+ ));
73
+
74
+ $this->addColumn('shipping_name', array(
75
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
76
+ 'index' => 'shipping_name',
77
+ ));
78
+
79
+ $this->addColumn('base_grand_total', array(
80
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
81
+ 'index' => 'base_grand_total',
82
+ 'type' => 'currency',
83
+ 'currency' => 'base_currency_code',
84
+ ));
85
+
86
+ $this->addColumn('grand_total', array(
87
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
88
+ 'index' => 'grand_total',
89
+ 'type' => 'currency',
90
+ 'currency' => 'order_currency_code',
91
+ ));
92
+
93
+ $this->addColumn('status', array(
94
+ 'header' => Mage::helper('sales')->__('Status'),
95
+ 'index' => 'status',
96
+ 'type' => 'options',
97
+ 'width' => '70px',
98
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
99
+ ));
100
+
101
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
102
+ $this->addColumn('action',
103
+ array(
104
+ 'header' => Mage::helper('sales')->__('Action'),
105
+ 'width' => '50px',
106
+ 'type' => 'action',
107
+ 'getter' => 'getId',
108
+ 'actions' => array(
109
+ array(
110
+ 'caption' => Mage::helper('sales')->__('View'),
111
+ 'url' => array('base'=>'adminhtml/sales_order/view'),
112
+ 'field' => 'order_id'
113
+ )
114
+ ),
115
+ 'filter' => false,
116
+ 'sortable' => false,
117
+ 'index' => 'stores',
118
+ 'is_system' => true,
119
+ ));
120
+ }
121
+
122
+ return parent::_prepareColumns();
123
+ }
124
+
125
+ public function getRowUrl($row)
126
+ {
127
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
128
+ return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
129
+ }
130
+ return false;
131
+ }
132
+
133
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Display.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Products_Display extends Mage_Adminhtml_Block_Widget_Grid_Container {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_controller = 'adminhtml_products_display';
30
+ $this->_blockGroup = 'aukro';
31
+ $this->_headerText = Mage::helper('aukro')->__('Products Exposure');
32
+ parent::__construct();
33
+
34
+ $this->setTemplate('nostress_aukro/product.phtml');
35
+ $this->removeButton('add');
36
+
37
+ $this->_addRefreshButton();
38
+ }
39
+
40
+ protected function _addRefreshButton() {
41
+ $this->_addButton('refresh', array(
42
+ 'label' => Mage::helper('aukro')->__('Refresh Auctions'),
43
+ 'onclick' => "setLocation('".$this->getUrl("*/*/refresh")."');",
44
+ 'class' => 'reload',
45
+ ), -100);
46
+ }
47
+
48
+ /**
49
+ * Prepare button and grid
50
+ *
51
+ * @return Mage_Adminhtml_Block_Catalog_Product
52
+ */
53
+ protected function _prepareLayout()
54
+ {
55
+ $this->setChild('store_switcher',
56
+ $this->getLayout()->createBlock('adminhtml/store_switcher')
57
+ ->setUseConfirm(false)
58
+ ->setSwitchUrl($this->getUrl('*/*/*', array('store'=>null)))
59
+ ->setTemplate('store/switcher.phtml')
60
+ );
61
+
62
+ $this->setChild('grid', $this->getLayout()->createBlock('aukro/adminhtml_products_display_grid', 'products_display.grid'));
63
+ return parent::_prepareLayout();
64
+ }
65
+
66
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Display/Grid.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Products_Display_Grid extends Mage_Adminhtml_Block_Widget_Grid
26
+ {
27
+ protected $_helper;
28
+ const DEF_STORE_ID = 1;
29
+ const ATTRIBUTES = 'attributes';
30
+
31
+ public function __construct()
32
+ {
33
+ parent::__construct();
34
+ $this->setId('aukroDisplayProducts');
35
+ $this->setDefaultSort('id');
36
+ $this->setDefaultDir('ASC');
37
+ $this->setStoreSwitcherVisibility();
38
+ $this->setSaveParametersInSession(true);
39
+ }
40
+
41
+ protected function _addColumnFilterToCollection($column)
42
+ {
43
+ return $this;
44
+ }
45
+
46
+ protected function getFilterData($data,$storeId)
47
+ {
48
+ $conditions = array();
49
+
50
+ if(!isset($data))
51
+ return $conditions;
52
+
53
+ $data = Mage::helper('adminhtml')->prepareFilterString($data);
54
+ foreach ($this->getColumns() as $columnId => $column)
55
+ {
56
+ if (isset($data[$columnId])
57
+ && (!empty($data[$columnId]) || strlen($data[$columnId]) > 0)
58
+ && $column->getFilter()
59
+ ) {
60
+
61
+ $column->getFilter()->setValue($data[$columnId]);
62
+ $field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
63
+ if($columnId == "price")
64
+ $column->setCurrencyCode($this->myHelper()->getStoreCurrency($storeId));
65
+ $cond = $column->getFilter()->getCondition();
66
+
67
+ if ($field && isset($cond))
68
+ $conditions[$field] = $cond;
69
+ }
70
+ }
71
+ return $conditions;
72
+ }
73
+
74
+ protected function getGridParams()
75
+ {
76
+ $params = array();
77
+ $params[$this->getVarNameLimit()] = $this->getParam($this->getVarNameLimit(), $this->_defaultLimit);
78
+ $params[$this->getVarNamePage()] = $this->getParam($this->getVarNamePage(), $this->_defaultPage);
79
+ $params[$this->getVarNameSort()] = $this->getParam($this->getVarNameSort(), $this->_defaultSort);
80
+ $params[$this->getVarNameDir()] = $this->getParam($this->getVarNameDir(), $this->_defaultDir);
81
+ $params["store_id"] = (int) $this->getRequest()->getParam('store', self::DEF_STORE_ID);
82
+ $params[$this->getVarNameFilter()] = $this->getFilterData($this->getParam($this->getVarNameFilter(), null),$params["store_id"]);
83
+ $params[self::ATTRIBUTES] = $this->getColumnCodes();
84
+
85
+ return $params;
86
+ }
87
+
88
+ protected function getColumnCodes()
89
+ {
90
+ $columns = $this->getColumns();
91
+ $codes = array( 'aukro_product_id');
92
+ foreach($columns as $code => $column)
93
+ {
94
+ if($code == "massaction" || $code == "action")
95
+ continue;
96
+
97
+ $codes[] = $code;
98
+ }
99
+ return $codes;
100
+ }
101
+
102
+ protected function _loadCollection() {
103
+
104
+ $collection = Mage::getModel('aukro/data_loader_product_aukro')->getGridCollection($this->getGridParams());
105
+ $collection->getSelect()->where( 'aukro_product_id IS NULL');
106
+ $this->setCollection($collection);
107
+ $collection->load();
108
+ }
109
+
110
+ protected function _prepareCollection()
111
+ {
112
+ $this->_loadCollection();
113
+
114
+ parent::_prepareCollection();
115
+ return $this;
116
+ }
117
+
118
+
119
+ protected function _prepareColumns()
120
+ {
121
+ $this->addColumn('id',
122
+ array(
123
+ 'header'=> Mage::helper('catalog')->__('ID'),
124
+ 'width' => '50px',
125
+ 'type' => 'number',
126
+ 'index' => 'id',
127
+ ));
128
+ $this->addColumn('name',
129
+ array(
130
+ 'header'=> Mage::helper('catalog')->__('Name'),
131
+ 'index' => 'name',
132
+ ));
133
+
134
+ $this->addColumn('type',
135
+ array(
136
+ 'header'=> Mage::helper('catalog')->__('Type'),
137
+ 'width' => '60px',
138
+ 'index' => 'type',
139
+ 'type' => 'options',
140
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
141
+ ));
142
+
143
+ $this->addColumn('sku',
144
+ array(
145
+ 'header'=> Mage::helper('catalog')->__('SKU'),
146
+ 'width' => '80px',
147
+ 'index' => 'sku',
148
+ ));
149
+
150
+ $this->addColumn('price_final_include_tax',
151
+ array(
152
+ 'header'=> Mage::helper('catalog')->__('Price final include tax'),
153
+ 'type' => 'number',
154
+ 'index' => 'price_final_include_tax',
155
+ ));
156
+
157
+ if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
158
+ $this->addColumn('qty',
159
+ array(
160
+ 'header'=> Mage::helper('catalog')->__('Qty'),
161
+ 'width' => '100px',
162
+ 'type' => 'number',
163
+ 'index' => 'qty',
164
+ ));
165
+ }
166
+
167
+ // $this->addColumn('visibility',
168
+ // array(
169
+ // 'header'=> Mage::helper('catalog')->__('Visibility'),
170
+ // 'width' => '70px',
171
+ // 'index' => 'visibility',
172
+ // 'type' => 'options',
173
+ // 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
174
+ // ));
175
+
176
+ $this->addColumn('category_name',
177
+ array(
178
+ 'header'=> Mage::helper('aukro')->__('Category name'),
179
+ 'width' => '70px',
180
+ 'index' => 'category_name',
181
+ 'type' => 'text',
182
+ ));
183
+ $this->addColumn('aukrocategory_id',
184
+ array(
185
+ 'header'=> Mage::helper('aukro')->__('Aukrocategory id'),
186
+ 'width' => '70px',
187
+ 'index' => 'aukrocategory_id',
188
+ 'type' => 'text',
189
+ ));
190
+
191
+ // $this->addColumn('aukro_product_id',
192
+ // array(
193
+ // 'header'=> Mage::helper('aukro')->__('Aukro ID'),
194
+ // 'width' => '70px',
195
+ // 'index' => 'aukro_product_id',
196
+ // 'type' => 'text',
197
+ // ));
198
+
199
+ $this->addColumn('stock_status',
200
+ array(
201
+ 'header'=> Mage::helper('aukro')->__('Status'),
202
+ 'type' => 'text',
203
+ 'index' => 'stock_status',
204
+ 'renderer' => 'aukro/adminhtml_products_display_renderer_status',
205
+ 'filter' => false,
206
+ 'sortable' => false,
207
+ 'width' => '300px',
208
+ ));
209
+
210
+ $this->addColumn('action',
211
+ array(
212
+ 'header' => Mage::helper('catalog')->__('Action'),
213
+ 'width' => '50px',
214
+ 'type' => 'action',
215
+ 'getter' => 'getId',
216
+ 'actions' => array(
217
+ array(
218
+ 'caption' => Mage::helper('catalog')->__('Edit'),
219
+ 'url' => array(
220
+ 'base'=>'adminhtml/catalog_product/edit',
221
+ 'params'=>array('store'=>$this->getRequest()->getParam('store'))
222
+ ),
223
+ 'field' => 'id'
224
+ )
225
+ ),
226
+ 'filter' => false,
227
+ 'sortable' => false,
228
+ 'index' => 'stores',
229
+ ));
230
+
231
+ return parent::_prepareColumns();
232
+ }
233
+
234
+ protected function myHelper()
235
+ {
236
+ if (!isset($this->_helper))
237
+ $this->_helper = Mage::helper('aukro');
238
+ return $this->_helper;
239
+ }
240
+
241
+ protected function _prepareMassaction()
242
+ {
243
+ $this->setMassactionIdField('id');
244
+ $this->getMassactionBlock()->setFormFieldName('productIds');
245
+
246
+ $this->getMassactionBlock()->addItem('aukro_upload', array(
247
+ 'label'=> Mage::helper('aukro')->__('Expose'),
248
+ 'url' => $this->getUrl('*/*/massAukroUpload')
249
+ ));
250
+
251
+ $this->getMassactionBlock()->addItem('aukro_upload_test', array(
252
+ 'label'=> Mage::helper('aukro')->__('Verify Exposure'),
253
+ 'url' => $this->getUrl('*/*/massAukroUpload', array( 'dryrun'=>true))
254
+ ));
255
+
256
+ return $this;
257
+ }
258
+
259
+ public function getRowUrl($row)
260
+ {
261
+ return $this->getUrl('adminhtml/catalog_product/edit', array(
262
+ 'store'=>$this->getRequest()->getParam('store'),
263
+ 'id'=>$row->getId())
264
+ );
265
+ }
266
+
267
+
268
+ /**
269
+ * Render grid
270
+ *
271
+ * @return string
272
+ */
273
+ public function getGridHtml()
274
+ {
275
+ return $this->getChildHtml('grid');
276
+ }
277
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Display/Renderer/Status.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Products_Display_Renderer_Status extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
26
+ {
27
+ const STATUS_CLASS_COLOR_GREEN = 'grid-severity-notice';
28
+ const STATUS_CLASS_COLOR_ORANGE = 'grid-severity-major';
29
+ const STATUS_CLASS_COLOR_RED= 'grid-severity-critical';
30
+
31
+ protected function getStatusHtml($class,$value)
32
+ {
33
+ $value = $this->__($value);
34
+ return '<span class="'.$class.'"><span>'.$value.'</span></span>';
35
+ }
36
+
37
+ /**
38
+ * Prepare link to display in grid
39
+ *
40
+ * @param Varien_Object $row
41
+ * @return string
42
+ */
43
+ public function render(Varien_Object $row)
44
+ {
45
+ $class = self::STATUS_CLASS_COLOR_RED;
46
+ $message = "";
47
+ if( $row->aukrocategory_id <= 0) {
48
+ $message .= Mage::helper('aukro')->__("Specify aukrocategory")."! <br />";
49
+ }
50
+ if( $row->qty <= 0) {
51
+ $message .= Mage::helper('aukro')->__("No items in stock")."! <br />";
52
+ }
53
+ if( $row->stock_status == 0) {
54
+ $message .= Mage::helper('aukro')->__("Out of stock")."! <br />";
55
+ }
56
+ if( $row->price_final_include_tax < 1) {
57
+ $message .= Mage::helper('aukro')->__("Price must be higher than 1 Kč")."! <br />";;
58
+ }
59
+
60
+ if( empty( $message)) {
61
+ $aukroID = $row->getAukroProductId();
62
+ if( empty($aukroID)) {
63
+ $message = Mage::helper('aukro')->__("Ready for exposing");
64
+ } else {
65
+ $message = Mage::helper('aukro')->__("Exposed on Aukro");
66
+ }
67
+ $class = self::STATUS_CLASS_COLOR_GREEN;
68
+ }
69
+ return $this->getStatusHtml( $class, $message);
70
+ }
71
+
72
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Displayed.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Products_Displayed extends Mage_Adminhtml_Block_Widget_Grid_Container {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_controller = 'adminhtml_products_displayed';
30
+ $this->_blockGroup = 'aukro';
31
+ $this->_headerText = Mage::helper('aukro')->__('Exposed Products');
32
+
33
+ parent::__construct();
34
+
35
+ $this->removeButton('add');
36
+ $this->_addRefreshButton();
37
+ }
38
+
39
+ protected function _addRefreshButton() {
40
+ $this->_addButton('refresh', array(
41
+ 'label' => Mage::helper('aukro')->__('Refresh Auctions'),
42
+ 'onclick' => "setLocation('".$this->getUrl("*/*/refresh")."');",
43
+ 'class' => 'reload',
44
+ ), -100);
45
+ }
46
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Products/Displayed/Grid.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Block_Adminhtml_Products_Displayed_Grid extends Nostress_Aukro_Block_Adminhtml_Products_Display_Grid
26
+ {
27
+
28
+ protected function _loadCollection() {
29
+
30
+ $collection = Mage::getModel('aukro/data_loader_product_aukro')->getGridCollection($this->getGridParams());
31
+ $collection->getSelect()->where( 'aukro_product_id IS NOT NULL');
32
+ $this->setCollection($collection);
33
+ $collection->load();
34
+ }
35
+
36
+ protected function _prepareMassaction() {
37
+
38
+ $this->setMassactionIdField('id');
39
+ $this->getMassactionBlock()->setFormFieldName('productIds');
40
+
41
+ $this->getMassactionBlock()->addItem('aukro_update', array(
42
+ 'label'=> Mage::helper('aukro')->__('Aukro Update'),
43
+ 'url' => $this->getUrl('*/*/massAukroUpdate')
44
+ ));
45
+
46
+ $this->getMassactionBlock()->addItem('aukro_remove', array(
47
+ 'label'=> Mage::helper('aukro')->__('Remove'),
48
+ 'url' => $this->getUrl('*/*/massAukroRemove')
49
+ ));
50
+
51
+ return $this;
52
+ }
53
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/Sales/Order/Grid.php ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * OVERRIDE sales order grid - shows non-aukro orders
29
+ *
30
+ * Adminhtml sales orders grid
31
+ *
32
+ * @category Mage
33
+ * @package Mage_Adminhtml
34
+ * @author Magento Core Team <core@magentocommerce.com>
35
+ */
36
+ class Nostress_Aukro_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
37
+ {
38
+
39
+ public function __construct()
40
+ {
41
+ parent::__construct();
42
+ $this->setId('sales_order_grid');
43
+ $this->setUseAjax(true);
44
+ $this->setDefaultSort('created_at');
45
+ $this->setDefaultDir('DESC');
46
+ $this->setSaveParametersInSession(true);
47
+ }
48
+
49
+ /**
50
+ * Retrieve collection class
51
+ *
52
+ * @return string
53
+ */
54
+ protected function _getCollectionClass()
55
+ {
56
+ return 'sales/order_grid_collection';
57
+ }
58
+
59
+ protected function _prepareCollection()
60
+ {
61
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
62
+ $collection
63
+ ->addFieldToFilter( 'aukro_order_id', array( 'null'=>true))
64
+ ->getSelect()
65
+ ->join( array('so' => 'sales_flat_order'), 'main_table.entity_id = so.entity_id', 'aukro_order_id')
66
+ ;
67
+ $this->setCollection($collection);
68
+ return parent::_prepareCollection();
69
+ }
70
+
71
+ protected function _prepareColumns()
72
+ {
73
+
74
+ $this->addColumn('real_order_id', array(
75
+ 'header'=> Mage::helper('sales')->__('Order #'),
76
+ 'width' => '80px',
77
+ 'type' => 'text',
78
+ 'index' => 'increment_id',
79
+ ));
80
+
81
+ if (!Mage::app()->isSingleStoreMode()) {
82
+ $this->addColumn('store_id', array(
83
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
84
+ 'index' => 'store_id',
85
+ 'type' => 'store',
86
+ 'store_view'=> true,
87
+ 'display_deleted' => true,
88
+ ));
89
+ }
90
+
91
+ $this->addColumn('created_at', array(
92
+ 'header' => Mage::helper('sales')->__('Purchased On'),
93
+ 'index' => 'created_at',
94
+ 'type' => 'datetime',
95
+ 'width' => '100px',
96
+ ));
97
+
98
+ $this->addColumn('billing_name', array(
99
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
100
+ 'index' => 'billing_name',
101
+ ));
102
+
103
+ $this->addColumn('shipping_name', array(
104
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
105
+ 'index' => 'shipping_name',
106
+ ));
107
+
108
+ $this->addColumn('base_grand_total', array(
109
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
110
+ 'index' => 'base_grand_total',
111
+ 'type' => 'currency',
112
+ 'currency' => 'base_currency_code',
113
+ ));
114
+
115
+ $this->addColumn('grand_total', array(
116
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
117
+ 'index' => 'grand_total',
118
+ 'type' => 'currency',
119
+ 'currency' => 'order_currency_code',
120
+ ));
121
+
122
+ $this->addColumn('status', array(
123
+ 'header' => Mage::helper('sales')->__('Status'),
124
+ 'index' => 'status',
125
+ 'type' => 'options',
126
+ 'width' => '70px',
127
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
128
+ ));
129
+
130
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
131
+ $this->addColumn('action',
132
+ array(
133
+ 'header' => Mage::helper('sales')->__('Action'),
134
+ 'width' => '50px',
135
+ 'type' => 'action',
136
+ 'getter' => 'getId',
137
+ 'actions' => array(
138
+ array(
139
+ 'caption' => Mage::helper('sales')->__('View'),
140
+ 'url' => array('base'=>'*/sales_order/view'),
141
+ 'field' => 'order_id'
142
+ )
143
+ ),
144
+ 'filter' => false,
145
+ 'sortable' => false,
146
+ 'index' => 'stores',
147
+ 'is_system' => true,
148
+ ));
149
+ }
150
+ $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
151
+
152
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
153
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
154
+
155
+ return parent::_prepareColumns();
156
+ }
157
+
158
+ protected function _prepareMassaction()
159
+ {
160
+ $this->setMassactionIdField('entity_id');
161
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
162
+ $this->getMassactionBlock()->setUseSelectAll(false);
163
+
164
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
165
+ $this->getMassactionBlock()->addItem('cancel_order', array(
166
+ 'label'=> Mage::helper('sales')->__('Cancel'),
167
+ 'url' => $this->getUrl('*/sales_order/massCancel'),
168
+ ));
169
+ }
170
+
171
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
172
+ $this->getMassactionBlock()->addItem('hold_order', array(
173
+ 'label'=> Mage::helper('sales')->__('Hold'),
174
+ 'url' => $this->getUrl('*/sales_order/massHold'),
175
+ ));
176
+ }
177
+
178
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
179
+ $this->getMassactionBlock()->addItem('unhold_order', array(
180
+ 'label'=> Mage::helper('sales')->__('Unhold'),
181
+ 'url' => $this->getUrl('*/sales_order/massUnhold'),
182
+ ));
183
+ }
184
+
185
+ $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
186
+ 'label'=> Mage::helper('sales')->__('Print Invoices'),
187
+ 'url' => $this->getUrl('*/sales_order/pdfinvoices'),
188
+ ));
189
+
190
+ $this->getMassactionBlock()->addItem('pdfshipments_order', array(
191
+ 'label'=> Mage::helper('sales')->__('Print Packingslips'),
192
+ 'url' => $this->getUrl('*/sales_order/pdfshipments'),
193
+ ));
194
+
195
+ $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
196
+ 'label'=> Mage::helper('sales')->__('Print Credit Memos'),
197
+ 'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
198
+ ));
199
+
200
+ $this->getMassactionBlock()->addItem('pdfdocs_order', array(
201
+ 'label'=> Mage::helper('sales')->__('Print All'),
202
+ 'url' => $this->getUrl('*/sales_order/pdfdocs'),
203
+ ));
204
+
205
+ $this->getMassactionBlock()->addItem('print_shipping_label', array(
206
+ 'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
207
+ 'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
208
+ ));
209
+
210
+ return $this;
211
+ }
212
+
213
+ public function getRowUrl($row)
214
+ {
215
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
216
+ return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
217
+ }
218
+ return false;
219
+ }
220
+
221
+ public function getGridUrl()
222
+ {
223
+ return $this->getUrl('*/*/grid', array('_current'=>true));
224
+ }
225
+
226
+
227
+
228
+
229
+ }
app/code/community/Nostress/Aukro/Block/Adminhtml/System/Config/Form/Field/Shipping.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Block for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Pdfprintouts
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Block_Adminhtml_System_Config_Form_Field_Shipping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
28
+ {
29
+ public function __construct()
30
+ {
31
+ $this->addColumn('first', array(
32
+ 'label' => Mage::helper('aukro')->__('First Item'),
33
+ 'style' => 'width:60px',
34
+ 'class' => 'option-control',
35
+ 'type' => 'select',
36
+ ));
37
+ $this->addColumn('next', array(
38
+ 'label' => Mage::helper('aukro')->__('Next Item'),
39
+ 'style' => 'width:60px',
40
+ 'class' => 'option-control',
41
+ 'type' => 'select',
42
+ ));
43
+ $this->addColumn('amount', array(
44
+ 'label' => Mage::helper('aukro')->__('Package Quantity'),
45
+ 'style' => 'width:60px',
46
+ 'class' => 'option-control',
47
+ 'type' => 'select',
48
+ ));
49
+ $this->_addAfter = false;
50
+ $_mandatoryAttributes=array();
51
+ $this->setTemplate('nostress_aukro/widget/form/config/shipping.phtml');
52
+ parent::__construct();
53
+ }
54
+
55
+ public function getSavedValues() {
56
+ $collection = Mage::getModel('aukro/shipping_pricing')->getCollection();
57
+
58
+ $aukroWebApi = Mage::getModel('aukro/webapi_abstract');
59
+ $shipmentData = $aukroWebApi->getShipmentData();
60
+ $shipmentData = $shipmentData['shipmentDataList']['item'];
61
+ $values = array();
62
+ foreach ($shipmentData as $shipment) {
63
+ $values[$shipment['shipmentId']]['name'] = $shipment['shipmentName'];
64
+ }
65
+
66
+ foreach ($collection as $item) {
67
+ if (isset($values[$item->getId()])) {
68
+ $values[$item->getId()]['first'] = $item->getFirst();
69
+ $values[$item->getId()]['next'] = $item->getNext();
70
+ $values[$item->getId()]['amount'] = $item->getAmount();
71
+ }
72
+ }
73
+
74
+ return $values;
75
+ }
76
+
77
+
78
+ }
app/code/community/Nostress/Aukro/Block/Payment/Info.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Nostress_Aukro_Block_Payment_Info extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('nostress_aukro/payment/info.phtml');
8
+ }
9
+ }
app/code/community/Nostress/Aukro/Helper/Data.php ADDED
@@ -0,0 +1,1275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Helper_Data extends Mage_Core_Helper_Abstract
26
+ {
27
+ const STATUS_ACTIVE = 1; //active products
28
+ const NO_VISIBLE = 1; //Visible NOWHERE
29
+ const PATH_DELIMITER = '/';
30
+ const DEF_PERMISSION = 0777;
31
+ const CUSTOM_ATTRIBUTE_ROW_INDEX_OFFSET = 1000;
32
+ const LANGUAGE_CODE_LENGTH = 2;
33
+ const CATALOG_CATEGORY_FLAT_PROCESS_CODE = "catalog_category_flat";
34
+
35
+ const LOG_FILE = "aukro-connector.txt";
36
+ const EVENT_LOG_FILE = "aukro.log";
37
+ const LC_TIMESTAMP = 'timestamp';
38
+ const LC_NOP = 'nop';
39
+ const LC_DELIMITER = ";";
40
+ protected $_eventLogTemplate = array(self::LC_TIMESTAMP => "", self::LC_NOP => "");
41
+
42
+ //config paths
43
+ const PATH_GENERAL = 'aukro/general/';
44
+ const PATH_ENGINES_CONFIG = 'default/aukro/engine';
45
+ const PATH_STORE_LOCALE = 'general/locale/code';
46
+ const PATH_STORE_COUNTRY = 'general/country/default';
47
+ const PATH_HELP = 'aukro/help/';
48
+
49
+ //config params
50
+ const PARAM_ADD_PRODUCTS = 'add_products';
51
+ const PARAM_URL_STORE = 'url_store';
52
+ const PARAM_URL_CATEGORY = 'url_category';
53
+ const PARAM_FILE_SUFFIX_SHOW = 'suffix_show';
54
+ const PARAM_EXPORT_META = 'export_meta';
55
+ const PARAM_EXPORT_OUT_OF_STOCK = 'export_out_of_stock_products';
56
+ const PARAM_CRON_PERIOD = 'cron_run_period';
57
+ const PARAM_ATTRIBUTE_CODES = 'common_attribute_codes';
58
+ const PARAM_DELIMITER = 'delimiter';
59
+ const PARAM_TAXONOMY = 'taxonomy';
60
+ const PARAM_NAME = 'name';
61
+ const PARAM_FILEPATH = 'filepath';
62
+ const PARAM_TEMP_PREFIX = 'temp_file_prefix';
63
+ const PARAM_TAXONOMY_SOURCE_URL = 'taxonomy_source_url';
64
+ const PARAM_MEDIA_GALLERY = 'media_gallery_attribute_code';
65
+ const PARAM_REVIEW_URL = 'review_url';
66
+ const PARAM_IMAGE_FOLDER = 'image_folder';
67
+ const PARAM_BATCH_SIZE = 'batch_size';
68
+ const PARAM_DEBUG_MODE = 'debug_mode';
69
+ const PARAM_CONNECTORS_JSON_URL = 'connectors_json_url';
70
+
71
+ const PARAM_LOG_EVENTS = 'log_events';
72
+ const PARAM_LOG_LIMIT = 'log_limit';
73
+ const PARAM_LOG_REST = 'log_rest';
74
+
75
+ const CODE = 'code';
76
+ const TYPE = 'type';
77
+ const VALUE = 'value';
78
+ const LABEL = 'label';
79
+ const XML = 'xml';
80
+ const CSV = 'csv';
81
+ const CDATA = 'cdata';
82
+ const TYPE_SELECT = 'select';
83
+ const TYPE_MULTISELECT = 'multiselect';
84
+
85
+ const ENTITY_PRODUCT = 'product';
86
+ const ENTITY_CATEGORY = 'category';
87
+
88
+ const CATEGORY_ATTRIBUTE_PREFIX = 'nsc_taxonomy_';
89
+ const NOSTRESSDOC_TAG = "nscdoc";
90
+
91
+ const FILE_TYPE_XML = "xml";
92
+ const FILE_TYPE_CSV = "csv";
93
+ const FILE_TYPE_ZIP = "zip";
94
+ const FILE_TYPE_TXT = "txt";
95
+ const FILE_TYPE_HTML = "html";
96
+ protected $_fileTypes = array(self::FILE_TYPE_CSV, self::FILE_TYPE_XML, self::FILE_TYPE_ZIP,self::FILE_TYPE_HTML,self::FILE_TYPE_TXT);
97
+
98
+ //time
99
+ const TIME_HOURS_PER_DAY = 24;
100
+ const TIME_SECONDS_PER_HOUR = 3600;
101
+ const TIME_SECONDS_PER_MINUTE = 60;
102
+ const TIME_SECONDS_PER_DAY = 60;
103
+ const TIME_DELIMITER = ":";
104
+ protected $_attributeCodes;
105
+
106
+ const HELP_LICENSE_CONDITIONS = "license_conditions";
107
+
108
+ protected function _getConfig($path, $flag=false,$asArray=false,$storeId = null)
109
+ {
110
+ $result = null;
111
+ if ($flag)
112
+ $result = Mage::getStoreConfigFlag($path,$storeId);
113
+ else
114
+ $result = Mage::getStoreConfig($path,$storeId);
115
+
116
+ if($asArray)
117
+ $result = explode(",",$result);
118
+ return $result;
119
+ }
120
+
121
+ //***************************** COMMON *******************************************
122
+ public function isDebugMode() {
123
+ return $this->getGeneralConfig(self::PARAM_DEBUG_MODE) ? true:false;
124
+ }
125
+
126
+ public function getAttributeLabel($attribute,$storeId)
127
+ {
128
+ $labels = $attribute->getStoreLabels();
129
+ $label = $attribute->getFrontendLabel();
130
+ if(array_key_exists($storeId,$labels))
131
+ $label = $labels[$storeId];
132
+ return $label;
133
+ }
134
+
135
+ public function getCdataString($input)
136
+ {
137
+ return "<![CDATA[{$input}]]>";
138
+ }
139
+
140
+ //***************************** CURRENCY *****************************************
141
+ public function getStoreCurrency($storeId, $symbol = false) {
142
+ $currency = Mage::app()->getStore($storeId)->getDefaultCurrencyCode();
143
+ if (!$symbol)
144
+ return $currency;
145
+
146
+ return Mage::app()->getLocale()->currency($currency)->getSymbol();
147
+ }
148
+
149
+ //***************************** FLAT CATALOG **************************************************
150
+
151
+ public function getFlatHelper($type)
152
+ {
153
+ return Mage::helper("catalog/{$type}_flat");
154
+ }
155
+
156
+ public function isEnabledFlat($storeId,$type = 'product')
157
+ {
158
+ return $this->getFlatHelper($type)->isEnabled($storeId);
159
+ }
160
+
161
+ //*****************************XML READ FUNCTIONS***********************************************
162
+ public function log($message)
163
+ {
164
+ Mage::log($message,Zend_Log::DEBUG,self::LOG_FILE);
165
+ }
166
+
167
+ protected function getEventLogTemplate()
168
+ {
169
+ $template = $this->_eventLogTemplate;
170
+ $template[self::LC_TIMESTAMP] = $this->getDateTime();
171
+ return $template;
172
+ }
173
+
174
+ public function logProductsRefreshEvent($count)
175
+ {
176
+ $template = $this->getEventLogTemplate();
177
+ $template[self::LC_NOP] = $count;
178
+ $this->logEvent($template);
179
+ }
180
+
181
+ protected function logEvent($message)
182
+ {
183
+ if($this->getGeneralConfig(self::PARAM_LOG_EVENTS) == "0")
184
+ return;
185
+
186
+ try
187
+ {
188
+ if(is_array($message))
189
+ $message = implode(self::LC_DELIMITER,$message);
190
+
191
+ $file = $this->getFullFilePath(self::EVENT_LOG_FILE,null);
192
+ $dir = $this->getFullFilePath("",null);
193
+ $this->createDirectory($dir);
194
+
195
+ if(file_exists($file))
196
+ {
197
+ $this->checkFile($file);
198
+ $message = PHP_EOL.$message;
199
+ file_put_contents($file,$message,FILE_APPEND);
200
+ }
201
+ else
202
+ $this->createFile($file,$message);
203
+ }
204
+ catch(Exception $e)
205
+ {
206
+ $this->log("Event log failed.".$e->getMessage());
207
+ }
208
+ }
209
+
210
+ protected function checkFile($file)
211
+ {
212
+ $limit = (int)$this->getGeneralConfig(self::PARAM_LOG_LIMIT);
213
+
214
+ $lines = file($file);
215
+ if(count($lines) >= $limit)
216
+ {
217
+ $recordsLeft = (int)$this->getGeneralConfig(self::PARAM_LOG_REST);
218
+ $recordsToRemove = $limit-$recordsLeft;
219
+
220
+ $content = file_get_contents($file);
221
+ $content = preg_replace("/^(.*".PHP_EOL."){{$recordsToRemove}}/", "", $content);
222
+ file_put_contents($file,$content);
223
+ }
224
+ }
225
+
226
+ public function createFile($file,$content)
227
+ {
228
+ if (!file_exists($file))
229
+ {
230
+ file_put_contents($file, $content);
231
+ chmod($file, self::DEF_PERMISSION);
232
+ }
233
+ }
234
+
235
+ public function stringToXml($input)
236
+ {
237
+ //return new SimpleXMLElement($input,LIBXML_NOCDATA);
238
+ return simplexml_load_string($input);
239
+ }
240
+
241
+ public function importDom($simplexml)
242
+ {
243
+ return dom_import_simplexml($simplexml);
244
+ }
245
+
246
+ public function XMLnodeToArray($node)
247
+ {
248
+ $result = array();
249
+ if(count($node[0]->children())==0)
250
+ {
251
+ return (string)$node[0];
252
+ }
253
+
254
+ $isArray = false;
255
+ foreach ($node[0]->children() as $child)
256
+ {
257
+ if(!isset($result[$child->getName()]))
258
+ $result[$child->getName()] = self::XMLnodeToArray($child);
259
+ else if(!$isArray)
260
+ {
261
+ $oldValue = $result[$child->getName()];
262
+ unset($result[$child->getName()]);
263
+ $result[$child->getName()] = array();
264
+
265
+ $result[$child->getName()][] = $oldValue;
266
+ $result[$child->getName()][] = self::XMLnodeToArray($child);
267
+ $isArray = true;
268
+ }
269
+ else if($isArray)
270
+ $result[$child->getName()][] = self::XMLnodeToArray($child);
271
+
272
+ }
273
+ return $result;
274
+ }
275
+
276
+ //*********************** CONFIG - START**********************************
277
+
278
+ /**
279
+ * Return store config value for key
280
+ *
281
+ * @param string $key
282
+ * @return string
283
+ */
284
+ public function getGoogleanalyticsConfig ($key, $flag=false)
285
+ {
286
+ $path = self::PATH_GOOGLEANALYTICS . $key;
287
+ if ($flag) {
288
+ return Mage::getStoreConfigFlag($path);
289
+ } else {
290
+ return Mage::getStoreConfig($path);
291
+ }
292
+ }
293
+
294
+ /**
295
+ * Return store config value for key
296
+ *
297
+ * @param string $key
298
+ * @return string
299
+ */
300
+ public function getGeneralConfig ($key, $flag=false,$asArray=false)
301
+ {
302
+ $path = self::PATH_GENERAL.$key;
303
+ $result = null;
304
+ if ($flag) {
305
+ $result = Mage::getStoreConfigFlag($path);
306
+ } else {
307
+ $result = Mage::getStoreConfig($path);
308
+ }
309
+ if($asArray)
310
+ $result = explode(",",$result);
311
+ return $result;
312
+ }
313
+
314
+ public function setGeneralConfig ($key, $value)
315
+ {
316
+ $path = self::PATH_GENERAL.$key;
317
+ return $this->_setConfig($path,$value);
318
+ }
319
+
320
+ protected function _setConfig($path,$value)
321
+ {
322
+ Mage::getModel('core/config')->saveConfig($path,$value);
323
+ Mage::getConfig()->reinit();
324
+ Mage::app()->reinitStores();
325
+ }
326
+
327
+
328
+ protected function getConfig($configPath) {
329
+ return Mage::getConfig ()->getNode ($configPath);
330
+ }
331
+
332
+ public function getMerchantName($engineName)
333
+ {
334
+ return ( string ) $this->getConfig ('default/aukro/merchant/'.$engineName.'_username' );
335
+ }
336
+
337
+ //********************************************************************************************************************************************
338
+ //********************************************************************************************************************************************
339
+ public function getAppProductTypes()
340
+ {
341
+ $types = Mage::getModel('catalog/product_type')->getTypes();
342
+ return array_keys($types);
343
+ }
344
+
345
+
346
+ public function getEngineConfig($engine = null,$param = null,$asArray = false)
347
+ {
348
+ $path = self::PATH_ENGINES_CONFIG;
349
+ if(isset($engine))
350
+ $path .= self::PATH_DELIMITER.strtolower($engine);
351
+ if(isset($param))
352
+ $path .= self::PATH_DELIMITER.$param;
353
+ return $this->getNode($path,$asArray);
354
+ }
355
+
356
+ protected function getNode($path,$asArray = false)
357
+ {
358
+ $node = Mage::getConfig()->getNode($path);
359
+ if(empty($node))
360
+ return null;
361
+ if($asArray)
362
+ $node = $node->asArray();
363
+ return $node;
364
+ }
365
+
366
+ public function getEntityType($entity)
367
+ {
368
+ return Mage::getModel("catalog/{$entity}")->getResource()->getEntityType();
369
+ }
370
+
371
+ /**
372
+ * Returns product or category attributes sets
373
+ * @param $product
374
+ */
375
+ public function getAttributeSets($entity = self::ENTITY_PRODUCT)
376
+ {
377
+ $entityType = self::getEntityType($entity);
378
+
379
+ return Mage::getResourceModel('eav/entity_attribute_set_collection')
380
+ ->setEntityTypeFilter($entityType->getId())
381
+ ->distinct('attribute_set_id');
382
+ }
383
+
384
+ protected function getAttributesCollection($attributeSetId)
385
+ {
386
+ return Mage::getResourceModel('catalog/product_attribute_collection')
387
+ ->setAttributeSetFilter($attributeSetId)
388
+ ->load();
389
+ }
390
+
391
+ protected function getAttributeCodes()
392
+ {
393
+ if(!isset($this->_attributeCodes))
394
+ $this->_attributeCodes = $this->getGeneralConfig(self::PARAM_ATTRIBUTE_CODES,false,true);
395
+ return $this->_attributeCodes;
396
+ }
397
+
398
+ protected function getAttributeCommonCode($attributeCode,$setName)
399
+ {
400
+ $attributeCodes = $this->getAttributeCodes();
401
+ foreach($attributeCodes as $code)
402
+ {
403
+ if($this->cmpAttributeCodes($attributeCode,$code))
404
+ return $code;
405
+ }
406
+ return false;
407
+ }
408
+
409
+ protected function cmpAttributeCodes($srcCode,$dstCode)
410
+ {
411
+ if(strpos($srcCode,$dstCode)!== false)
412
+ return true;
413
+ else
414
+ return false;
415
+ }
416
+
417
+ public function getAttributSetMap() {
418
+ $attributeSetMap = array();
419
+ $attributeSets = $this->getAttributeSets();
420
+
421
+ foreach ($attributeSets as $id => $set) {
422
+ $name = $set->getAttributeSetName();
423
+ $attributeCollection = $this->getAttributesCollection($id);
424
+
425
+ $attributes = array();
426
+ foreach ($attributeCollection as $atrId => $attribute) {
427
+ $atrCode = $attribute->getAttributeCode();
428
+ $commonCode = $this->getAttributeCommonCode($atrCode,$name);
429
+ if ($commonCode != false) {
430
+ $attributes[$commonCode] = array(self::CODE => $atrCode,self::TYPE=> $attribute->getFrontendInput());
431
+ }
432
+ }
433
+ $attributeSetMap[$id] = $attributes;
434
+ }
435
+ return $attributeSetMap;
436
+ }
437
+
438
+ public function getAttributeInfo($attributeCode) {
439
+ $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
440
+ ->setCodeFilter($attributeCode)
441
+ ->getFirstItem();
442
+ return $attributeInfo;
443
+ }
444
+
445
+ public function getVisibleProductAttributes($asArray = false)
446
+ {
447
+ $collection = Mage::getResourceModel('catalog/product_attribute_collection')
448
+ ->addVisibleFilter();
449
+ $collection->load();
450
+ if(!$asArray)
451
+ return $collection;
452
+ else
453
+ {
454
+ $attributes = array();
455
+ foreach($collection as $atrId => $attribute)
456
+ {
457
+ $atrCode = $attribute->getAttributeCode();
458
+ $attributes[$atrCode] = $attribute;
459
+ }
460
+ return $attributes;
461
+ }
462
+ }
463
+
464
+ public function getAllStoresLocale()
465
+ {
466
+ $allStores = Mage::app()->getStores();
467
+ $localeArray = array();
468
+ foreach ($allStores as $_eachStoreId => $store)
469
+ {
470
+ $locale = $this->getStoreLocale($store);
471
+ if(!in_array($locale,$localeArray))
472
+ $localeArray[] = $locale;
473
+ }
474
+ return $localeArray;
475
+ }
476
+
477
+ public function getStoreLocale($store) {
478
+ return $store->getConfig(self::PATH_STORE_LOCALE);
479
+ }
480
+
481
+ public function getStoreLanguage($store)
482
+ {
483
+ $locale = $this->getStoreLocale($store);
484
+ if(empty($locale))
485
+ return "";
486
+ $lang = substr($locale,0,self::LANGUAGE_CODE_LENGTH);
487
+ $lang = strtoupper($lang);
488
+ return $lang;
489
+ }
490
+
491
+ public function getStoreCountry($store) {
492
+ return $store->getConfig(self::PATH_STORE_COUNTRY);
493
+ }
494
+
495
+ public function changeEncoding($dstEnc,$input,$srcEnc=null) {
496
+ if ($srcEnc == $dstEnc)
497
+ return $input;
498
+
499
+ if (!is_array($input))
500
+ return $this->_changeEncoding($dstEnc,$input,$srcEnc);
501
+
502
+ $result = array();
503
+ foreach ($input as $key => $item) {
504
+ $result[$key] = $this->_changeEncoding($dstEnc,$item,$srcEnc);
505
+ }
506
+ return $result;
507
+ }
508
+
509
+ /*
510
+ * Returns encoded string.
511
+ */
512
+ protected function _changeEncoding($dstEnc,$input,$srcEnc=null)
513
+ {
514
+ if(!isset($input) || empty($input))
515
+ return $input;
516
+
517
+ $extension = "mbstring";
518
+
519
+ if(!isset($srcEnc))
520
+ {
521
+ if(!extension_loaded($extension))
522
+ {
523
+ throw new Exception(Mage::helper('aukro')->__('PHP Extension "%s" must be loaded', $extension).'.');
524
+ }
525
+ else
526
+ $srcEnc = mb_detect_encoding($input);
527
+ }
528
+ try
529
+ {
530
+ $input = iconv($srcEnc, $dstEnc.'//TRANSLIT', $input);
531
+ }
532
+ catch(Exception $e)
533
+ {
534
+ try
535
+ {
536
+ $input = iconv($srcEnc, $dstEnc.'//IGNORE', $input);
537
+ //$input = mb_convert_encoding($input,$dstEnc,$srcEnc);
538
+ }
539
+ catch(Exception $e)
540
+ {
541
+ //echo $input;
542
+ throw $e;
543
+ }
544
+ }
545
+ if($input == false)
546
+ throw new Exception('Conversion from encoding '.$srcEnc.' to '.$dstEnc.' failure. Following string can not be converted:<BR>'.$input);
547
+
548
+ return $input;
549
+ }
550
+
551
+ public function createCategoryAttributeCode($name)
552
+ {
553
+ $name = self::CATEGORY_ATTRIBUTE_PREFIX.$name;
554
+ return $name;
555
+ }
556
+
557
+ public function createTaxonomyCodeFromAttributeCode($attributeCode)
558
+ {
559
+ $taxonomyCode = str_replace(self::CATEGORY_ATTRIBUTE_PREFIX,"",$attributeCode);
560
+ return $taxonomyCode;
561
+ }
562
+
563
+ public function getTaxonomyEngineNames()
564
+ {
565
+ $names = array();
566
+ $engCollection = $this->getEngineConfig(null,null,true);
567
+ foreach($engCollection as $key => $engine)
568
+ {
569
+ if(isset($engine[self::PARAM_TAXONOMY]))
570
+ {
571
+ $names[] = $engine[self::PARAM_NAME];
572
+ }
573
+ }
574
+ return $names;
575
+ }
576
+
577
+ public function createCode($input,$delimiter = '_')
578
+ {
579
+ $input = $this->removeDiacritic($input);
580
+ $input = strtolower($input);
581
+
582
+ //replace characters which are not number or letters by space
583
+ $input = preg_replace('/[^0-9a-zA-Z]/',' ', $input);
584
+ $input = trim($input);
585
+ //replace one or more spaces by delimiter
586
+ $input = preg_replace('/\s+/', $delimiter, $input);
587
+
588
+ return $input;
589
+ }
590
+
591
+ public function codeToLabel($input,$delimiter = '_')
592
+ {
593
+ $input = str_replace($delimiter," ",$input);
594
+ $input = ucfirst($input);
595
+ return $input;
596
+ }
597
+
598
+ protected function removeDiacritic($input)
599
+ {
600
+ $transTable = Array(
601
+ 'ä'=>'a',
602
+ 'Ä'=>'A',
603
+ 'á'=>'a',
604
+ 'Á'=>'A',
605
+ 'à'=>'a',
606
+ 'À'=>'A',
607
+ 'ã'=>'a',
608
+ 'Ã'=>'A',
609
+ 'â'=>'a',
610
+ 'Â'=>'A',
611
+ 'č'=>'c',
612
+ 'Č'=>'C',
613
+ 'ć'=>'c',
614
+ 'Ć'=>'C',
615
+ 'ď'=>'d',
616
+ 'Ď'=>'D',
617
+ 'ě'=>'e',
618
+ 'Ě'=>'E',
619
+ 'é'=>'e',
620
+ 'É'=>'E',
621
+ 'ë'=>'e',
622
+ 'Ë'=>'E',
623
+ 'è'=>'e',
624
+ 'È'=>'E',
625
+ 'ê'=>'e',
626
+ 'Ê'=>'E',
627
+ 'í'=>'i',
628
+ 'Í'=>'I',
629
+ 'ï'=>'i',
630
+ 'Ï'=>'I',
631
+ 'ì'=>'i',
632
+ 'Ì'=>'I',
633
+ 'î'=>'i',
634
+ 'Î'=>'I',
635
+ 'ľ'=>'l',
636
+ 'Ľ'=>'L',
637
+ 'ĺ'=>'l',
638
+ 'Ĺ'=>'L',
639
+ 'ń'=>'n',
640
+ 'Ń'=>'N',
641
+ 'ň'=>'n',
642
+ 'Ň'=>'N',
643
+ 'ñ'=>'n',
644
+ 'Ñ'=>'N',
645
+ 'ó'=>'o',
646
+ 'Ó'=>'O',
647
+ 'ö'=>'o',
648
+ 'Ö'=>'O',
649
+ 'ô'=>'o',
650
+ 'Ô'=>'O',
651
+ 'ò'=>'o',
652
+ 'Ò'=>'O',
653
+ 'õ'=>'o',
654
+ 'Õ'=>'O',
655
+ 'ő'=>'o',
656
+ 'Ő'=>'O',
657
+ 'ř'=>'r',
658
+ 'Ř'=>'R',
659
+ 'ŕ'=>'r',
660
+ 'Ŕ'=>'R',
661
+ 'š'=>'s',
662
+ 'Š'=>'S',
663
+ 'ś'=>'s',
664
+ 'Ś'=>'S',
665
+ 'ť'=>'t',
666
+ 'Ť'=>'T',
667
+ 'ú'=>'u',
668
+ 'Ú'=>'U',
669
+ 'ů'=>'u',
670
+ 'Ů'=>'U',
671
+ 'ü'=>'u',
672
+ 'Ü'=>'U',
673
+ 'ù'=>'u',
674
+ 'Ù'=>'U',
675
+ 'ũ'=>'u',
676
+ 'Ũ'=>'U',
677
+ 'û'=>'u',
678
+ 'Û'=>'U',
679
+ 'ý'=>'y',
680
+ 'Ý'=>'Y',
681
+ 'ž'=>'z',
682
+ 'Ž'=>'Z',
683
+ 'ź'=>'z',
684
+ 'Ź'=>'Z'
685
+ );
686
+ return strtr($input, $transTable);
687
+ }
688
+
689
+ public function updateArray($src,$dst,$force = true)
690
+ {
691
+ if(!isset($dst))
692
+ $dst = array();
693
+
694
+ if(!is_array($src))
695
+ return $dst;
696
+ foreach($src as $key => $node)
697
+ {
698
+ if(!is_array($node))
699
+ {
700
+ if($force || $node != "" || !array_key_exists($key,$dst))
701
+ $dst[$key] = $node;
702
+ }
703
+ else
704
+ {
705
+ $tmpDst = null;
706
+ if(isset($dst[$key]))
707
+ $tmpDst = $dst[$key];
708
+ $res = $this->updateArray($node,$tmpDst,$force);
709
+ $dst[$key] = $res;
710
+ }
711
+ }
712
+ return $dst;
713
+ }
714
+
715
+ public function getRootCategory($path,$delimiter)
716
+ {
717
+ $delimiter = trim($delimiter);
718
+ $index = strpos($path,$delimiter);
719
+ if($index === false)
720
+ return $path;
721
+ else
722
+ {
723
+ $root = trim(substr($path,0,$index));
724
+ return $root;
725
+ }
726
+ }
727
+
728
+
729
+ //*****************************TIME FUNCTIONS***********************************************
730
+
731
+ public function convertTimeToSeconds($hours,$minutes,$seconds)
732
+ {
733
+ return ($hours*self::TIME_SECONDS_PER_HOUR) + ($minutes*self::TIME_SECONDS_PER_MINUTE) + $seconds;
734
+ }
735
+
736
+ public function getTime($timeString = null,$format = false)
737
+ {
738
+ $time = $this->_getDateTime($timeString);
739
+ if($format)
740
+ $time = $this->formatTimestemp($time,$format);
741
+
742
+ return $time;
743
+ }
744
+
745
+ public function getDate($timeString = null, $format = false) {
746
+ $time = $this->_getDateTime($timeString);
747
+ if ($format)
748
+ $time = $this->formatDatestemp($time,$format);
749
+
750
+ return $time;
751
+ }
752
+
753
+ public function getDateTime($timeString = null, $format = false) {
754
+ $dateTime = $this->_getDateTime($timeString);
755
+
756
+ if ($format)
757
+ $dateTime = $this->formatDatetimestemp($dateTime,$format);
758
+
759
+ return $dateTime;
760
+ }
761
+
762
+ protected function _getDateTime($timeString = null) {
763
+ $time = null;
764
+ if (!isset($timeString))
765
+ $time = time();
766
+ else
767
+ $time = strtotime($timeString);
768
+
769
+ //get time zone time
770
+ return Mage::getModel('core/date')->timestamp($time);
771
+ }
772
+
773
+ public function getProcessorTime()
774
+ {
775
+ $mtime = microtime();
776
+ $mtime = explode(" ",$mtime);
777
+ $mtime = $mtime[1] + $mtime[0];
778
+ return $mtime;
779
+ }
780
+
781
+ /*
782
+ * Returns true if it is possible to generate XML.
783
+ */
784
+ public function allowGenerate($profile)
785
+ {
786
+ if(!$profile->getEnabled()) //disabled to generate XML
787
+ return false;
788
+
789
+ $updateTime = $profile->getUpdateTime();
790
+ if($updateTime == null)
791
+ return true;
792
+
793
+ $frequencyDaily = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_DAILY;
794
+ $frequencyWeekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
795
+ $frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
796
+
797
+ $frequency = $profile->getFrequency();
798
+ $testTime = null;
799
+ switch($frequency)
800
+ {
801
+ case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_DAILY:
802
+ $minutes = $this->getGeneralConfig(self::PARAM_CRON_PERIOD);
803
+ $testTime = $this->getTime("-{$minutes} minutes");
804
+ break;
805
+ case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY:
806
+ $testTime = $this->getTime("-1 week");//time before week
807
+ break;
808
+ case Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY:
809
+ $testTime = $this->getTime("-1 month"); //time before month
810
+ break;
811
+ default:
812
+ $testTime = null;
813
+ }
814
+ if(!isset($testTime))
815
+ return false;
816
+
817
+ $lastGenerationTime = strtotime($updateTime);
818
+ if($lastGenerationTime <= $testTime)
819
+ {
820
+ return true;
821
+ }
822
+ else
823
+ {
824
+ return false;
825
+ }
826
+ }
827
+
828
+ public function formatDatetimestemp($timestemp,$format)
829
+ {
830
+ return $this->datetimeModel()->formatDatetime($timestemp,$format);
831
+ }
832
+
833
+ public function formatDatestemp($timestemp,$format)
834
+ {
835
+ return $this->datetimeModel()->formatDate($timestemp,$format);
836
+ }
837
+
838
+ public function formatTimestemp($timestemp,$format)
839
+ {
840
+ return $this->datetimeModel()->formatTime($timestemp,$format);
841
+ }
842
+
843
+ protected function datetimeModel()
844
+ {
845
+ return Mage::getModel("aukro/config_source_datetimeformat");
846
+ }
847
+
848
+ //*******************************TIME FUNCTIONS - END ********************************************
849
+
850
+ //*********************** FILE FUNCTIONS******************************
851
+
852
+ public function createDirectory($dir)
853
+ {
854
+ if(!is_dir($dir))
855
+ mkdir($dir,self::DEF_PERMISSION,true);
856
+ }
857
+
858
+ public function downloadFile($fileUrl, $localFilename)
859
+ {
860
+ $err_msg = '';
861
+
862
+ $out = fopen($localFilename,"wb");
863
+ if (!$out)
864
+ {
865
+ $message = $this->__("Can't open file %s for writing",$localFilename);
866
+ Mage::throwException($message);
867
+ }
868
+
869
+ $ch = curl_init();
870
+
871
+ curl_setopt($ch, CURLOPT_FILE, $out);
872
+ curl_setopt($ch, CURLOPT_HEADER, 0);
873
+ curl_setopt($ch, CURLOPT_URL, $fileUrl);
874
+
875
+ curl_exec($ch);
876
+ $error = curl_error ( $ch);
877
+ if(!empty($error))
878
+ {
879
+ $message = $this->__("Can't download file %s",$fileUrl);
880
+ Mage::throwException($message);
881
+ }
882
+
883
+ curl_close($ch);
884
+ fclose($out);
885
+
886
+ }//end function
887
+
888
+ /* creates a compressed zip file */
889
+ public function createZip($files = array(), $destination = '', $overwrite = false) {
890
+ //if the zip file already exists and overwrite is false, return false
891
+ if (file_exists($destination) && !$overwrite) {
892
+ return false;
893
+ }
894
+ //vars
895
+ $valid_files = array();
896
+ //if files were passed in...
897
+ if (is_array($files)) {
898
+ //cycle through each file
899
+ foreach ($files as $localName => $file) {
900
+ //make sure the file exists
901
+ if (file_exists($file)) {
902
+ $valid_files[$localName] = $file;
903
+ }
904
+ }
905
+ }
906
+ //if we have good files...
907
+ if (count($valid_files)) {
908
+ //create the archive
909
+ $zip = new ZipArchive();
910
+ if ($zip->open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) {
911
+ return false;
912
+ }
913
+
914
+ //add the files
915
+ foreach ($valid_files as $localName => $file) {
916
+ if (is_numeric($localName))
917
+ $localName = $file;
918
+ $zip->addFile($file,$localName);
919
+ }
920
+ //debug
921
+ //echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status;
922
+
923
+ //close the zip -- done!
924
+ $zip->close();
925
+
926
+ //check to make sure the file exists
927
+ return file_exists($destination);
928
+ }
929
+ else {
930
+ return false;
931
+ }
932
+ }
933
+
934
+ public function getDefaultDirectoryName() {
935
+ return (string)$this->getGeneralConfig(self::PARAM_FILEPATH);
936
+ }
937
+
938
+ public function addTempPrefix($filename)
939
+ {
940
+ $tempPrefix = (string)$this->getGeneralConfig(self::PARAM_TEMP_PREFIX);
941
+ return $tempPrefix.$filename;
942
+ }
943
+
944
+ public function getFeedDirectoryName($feed)
945
+ {
946
+ $index = strpos($feed,"_");
947
+ if($index !== FALSE)
948
+ $feed = substr($feed,0,$index);
949
+ return $feed;
950
+ }
951
+
952
+ /*
953
+ * Returns xml files url path.
954
+ */
955
+ public function getFileUrl($fileName,$feedDir)
956
+ {
957
+ $path = $this->getDefaultDirectoryName();
958
+ $path = str_replace('/media/','',$path);
959
+ $url = Mage::getBaseUrl('media').$path.$feedDir.self::PATH_DELIMITER.$fileName;
960
+ return $url;
961
+ }
962
+
963
+ /*
964
+ * Return full file path.
965
+ */
966
+ public function getFullFilePath($fileName,$feedDir) {
967
+ $file = str_replace('//', self::PATH_DELIMITER, Mage::getBaseDir() . $this->getDefaultDirectoryName().self::PATH_DELIMITER.$feedDir.self::PATH_DELIMITER.$fileName);
968
+ return $file;
969
+ }
970
+
971
+ public function removeFileSuffix($filename) {
972
+ $filename = str_ireplace(".".self::FILE_TYPE_XML,"",$filename);
973
+ $filename = str_ireplace(".".self::FILE_TYPE_CSV,"",$filename);
974
+ return $filename;
975
+ }
976
+
977
+ public function addFileSuffix($filename,$feed) {
978
+ $feedData = Mage::getModel('aukro/feed')->getFeedByCode($feed);
979
+ if (isset($feedData))
980
+ $filename .= ".".$feedData->getFileType();
981
+ return $filename;
982
+ }
983
+
984
+ /**
985
+ * Renamse feed files.
986
+ * @param $oldFileName
987
+ * @param $newFileName
988
+ */
989
+ public function renameFile($originalFile,$newFile) {
990
+ //rename file
991
+ if (is_file($originalFile)) {
992
+ rename($originalFile,$newFile);
993
+ }
994
+ }
995
+
996
+ /*
997
+ * Deletes specified xml file.
998
+ */
999
+ public function deleteFile($file)
1000
+ {
1001
+ if($file == null || $file === '')
1002
+ return;
1003
+
1004
+ if (file_exists($file))
1005
+ {
1006
+ unlink($file);
1007
+ }
1008
+ }
1009
+
1010
+ public function changeFileSuffix($filename, $suffix = self::FILE_TYPE_ZIP) {
1011
+
1012
+ if(isset($suffix) && !empty($suffix))
1013
+ $newSuffix = ".".$suffix;
1014
+ else
1015
+ $newSuffix = $suffix;
1016
+
1017
+ foreach ($this->_fileTypes as $type) {
1018
+ $oldSuffix = ".".$type;
1019
+ if (strpos($filename,$oldSuffix) !== false) {
1020
+ $filename = str_replace($oldSuffix,$newSuffix,$filename);
1021
+ return $filename;
1022
+ }
1023
+ }
1024
+ return $filename;
1025
+ }
1026
+
1027
+ /**
1028
+ * Returns opened file.
1029
+ *
1030
+ * @param profile $model
1031
+ * @param Boolean $fileExists
1032
+ * @return Opened file for writeing.
1033
+ */
1034
+ public function openFile($fileName,$mode)
1035
+ {
1036
+ $io = new Varien_Io_File();
1037
+ $io->setAllowCreateFolders(true);
1038
+
1039
+ $index = strrpos($fileName,self::PATH_DELIMITER)+1;
1040
+ $path = substr($fileName,0,$index);
1041
+ $name = substr($fileName,$index);
1042
+ $io->open(array('path' => $path));
1043
+
1044
+ try
1045
+ {
1046
+ $io->streamOpen($name,$mode);
1047
+ }
1048
+ catch (Exception $e)
1049
+ {
1050
+ throw $e;
1051
+ }
1052
+ return $io;
1053
+ }
1054
+
1055
+
1056
+ //*********************** CRON TABLE**********************************
1057
+ /**
1058
+ *
1059
+ * @param Mage_Cron_Model_Schedule $schedule
1060
+ * @return Varien_Object
1061
+ */
1062
+ public function getRuntime(Mage_Cron_Model_Schedule $schedule)
1063
+ {
1064
+ $execTime = $schedule->getExecutedAt();
1065
+ $stopTime = $schedule->getFinishedAt();
1066
+ if($execTime == '0000-00-00 00:00:00') {
1067
+ $runtime = new Varien_Object();
1068
+ $runtime->setIsPending(1);
1069
+ $runtime->setHours(0);
1070
+ $runtime->setMinutes(0);
1071
+ $runtime->setSeconds(0);
1072
+ $runtime->setToString('0h 0m 0s');
1073
+ return $runtime;
1074
+ }
1075
+
1076
+ if($stopTime == '0000-00-00 00:00:00') {
1077
+ $stopTime = now();
1078
+ }
1079
+
1080
+ $runtime = strtotime($stopTime) - strtotime($execTime);
1081
+ $runtimeSec = $runtime % self::TIME_SECONDS_PER_MINUTE;
1082
+ $runtimeMin = (int) ($runtime / self::TIME_SECONDS_PER_MINUTE) % self::TIME_SECONDS_PER_MINUTE;
1083
+ $runtimeHour = (int) ($runtime / self::TIME_SECONDS_PER_HOUR);
1084
+
1085
+ $runtime = new Varien_Object();
1086
+ $runtime->setIsPending(0);
1087
+ $runtime->setHours($runtimeHour);
1088
+ $runtime->setMinutes($runtimeMin);
1089
+ $runtime->setSeconds($runtimeSec);
1090
+ $runtime->setToString($runtimeHour . 'h ' . $runtimeMin . 'm ' . $runtimeSec . 's');
1091
+ return $runtime;
1092
+ }
1093
+
1094
+ /**
1095
+ * @todo render as Column in Grid
1096
+ * @todo unterscheiden zwischen überfällig Rot normal schwarz
1097
+ *
1098
+ * @param Mage_Cron_Model_Schedule $schedule
1099
+ * @return Varien_Object
1100
+ */
1101
+ public function getStartingIn(Mage_Cron_Model_Schedule $schedule)
1102
+ {
1103
+ $schedTime = $schedule->getScheduledAt();
1104
+
1105
+ if($schedTime == '0000-00-00 00:00:00' or $schedTime == '')
1106
+ {
1107
+ $runtime = new Varien_Object();
1108
+ $runtime->setHours(0);
1109
+ $runtime->setMinutes(0);
1110
+ $runtime->setSeconds(0);
1111
+ $runtime->setToString('0h 0m 0s');
1112
+ return $runtime;
1113
+ }
1114
+
1115
+ // Calc Time interval till Exec
1116
+ $starttime = strtotime($schedTime) - strtotime(now());
1117
+ $prefix = '+';
1118
+ if($starttime < 0) {
1119
+ $prefix = '-';
1120
+ $starttime *= - 1;
1121
+ }
1122
+ $runtimeSec = $starttime % self::TIME_SECONDS_PER_MINUTE;
1123
+ $runtimeMin = (int) ($starttime / self::TIME_SECONDS_PER_MINUTE) % self::TIME_SECONDS_PER_MINUTE;
1124
+ $runtimeHour = (int) ($starttime / self::TIME_SECONDS_PER_HOUR);
1125
+
1126
+ $runtime = new Varien_Object();
1127
+ $runtime->setHours($runtimeHour);
1128
+ $runtime->setMinutes($runtimeMin);
1129
+ $runtime->setSeconds($runtimeSec);
1130
+ $runtime->setPrefix($prefix);
1131
+ $runtime->setToString($runtimeHour . 'h ' . $runtimeMin . 'm ' . $runtimeSec . 's');
1132
+
1133
+ return $runtime;
1134
+ }
1135
+
1136
+ public function dS($input)
1137
+ {
1138
+ return base64_decode($input);
1139
+ }
1140
+
1141
+ /**
1142
+ *
1143
+ * @return
1144
+ */
1145
+ public function getAvailableJobCodes()
1146
+ {
1147
+ return Mage::getConfig()->getNode('crontab/jobs');
1148
+ }
1149
+
1150
+ /**
1151
+ * Transforms a datetime string into a DateTime object in the UTC (GMT) timezone
1152
+ * (Assumes that $datetime_string is currently in the timezone set in the Magento config)
1153
+ * @param $datetime_string
1154
+ * @return DateTime
1155
+ */
1156
+ public function dateCorrectTimeZoneForDb($datetime_string)
1157
+ {
1158
+ $timezone_mage = new DateTimeZone(Mage::getStoreConfig('general/locale/timezone'));
1159
+
1160
+ //$timezone_php = date_default_timezone_get();
1161
+ $datetime_mage = new DateTime($datetime_string, $timezone_mage);
1162
+ $datetime_offset = $datetime_mage->getOffset(); // offset in seconds, including daylight savings time
1163
+ $datetime_mage->modify('-'.$datetime_offset.' seconds');
1164
+
1165
+ return $datetime_mage;
1166
+ }
1167
+
1168
+ public function getHelpUrl($helpPath)
1169
+ {
1170
+ $path = self::PATH_HELP.$helpPath;
1171
+ return $this->_getConfig($path);
1172
+ }
1173
+
1174
+ //*********************** CRON TABLE - END**********************************
1175
+
1176
+ public function array_unique_tree($array_tree) {
1177
+ $temp = array();
1178
+ $result = array();
1179
+ $labels = array();
1180
+ foreach ($array_tree as $key => $array) {
1181
+ if (!in_array($array["label"], $temp))
1182
+ {
1183
+ $labels[] = $array["label"];
1184
+ $temp[$key] = $array["label"];
1185
+ $result[] = $array;
1186
+ }
1187
+ }
1188
+ array_multisort($labels,SORT_ASC,SORT_REGULAR,$result);
1189
+ return $result;
1190
+ }
1191
+
1192
+ public function updateCategoryProducts($profileId,$categoryproducts,$storeId)
1193
+ {
1194
+ $catProdModel = Mage::getModel('aukro/categoryproducts');
1195
+ $catProdModel->updateCategoryProducts($profileId,$categoryproducts,$storeId);
1196
+ Mage::getSingleton('adminhtml/session')->addSuccess(
1197
+ Mage::helper('aukro')->__('The export profile-product relations has been updated.')
1198
+ );
1199
+ }
1200
+
1201
+ public function getAukroLoginData() {
1202
+
1203
+ $storeId = Mage::app()->getStore()->getId();
1204
+ $data = array();
1205
+ $data['username'] = (string) Mage::getStoreConfig ( 'aukro/connection_settings/username', $storeId);
1206
+ $data['password'] = (string) Mage::getStoreConfig ( 'aukro/connection_settings/password', $storeId);
1207
+ $data['webapi_key'] = (string) Mage::getStoreConfig ( 'aukro/connection_settings/webapi_key', $storeId);
1208
+ return $data;
1209
+ }
1210
+
1211
+ public function getDefaultConfig() {
1212
+
1213
+ $storeId = Mage::app()->getStore()->getId();
1214
+ $data = array();
1215
+ $config = Mage::getStoreConfig ( 'aukro', $storeId);
1216
+ foreach( $config as $section) {
1217
+ foreach( $section as $key => $value) {
1218
+ $data[$key] = $value;
1219
+ }
1220
+ }
1221
+ unset( $data['username'], $data['password'], $data['webapi_key'], $data['wire_transfer'], $data['collect_on_delivery']);
1222
+ return $data;
1223
+ }
1224
+
1225
+ public function getAukroWebApiKey() {
1226
+ return (string) Mage::getStoreConfig ( 'aukro/connection_settings/webapi_key');
1227
+ }
1228
+
1229
+ public function formatAukroCategories($categories) {
1230
+
1231
+ $output = array('0' => 'None');
1232
+ $groupedCategories = array();
1233
+
1234
+ foreach ($categories['catsList']['item'] as $params) {
1235
+ $groupedCategories[$params['catParent']][$params['catId']] = $params['catName'];
1236
+ }
1237
+
1238
+ $output = $output + $this->getSubCategories($groupedCategories, 0);
1239
+
1240
+ return $output;
1241
+
1242
+ }
1243
+
1244
+ public function getSubCategories($groupedCategories, $id, $parentName = '') {
1245
+ $output = array();
1246
+ if (strlen($parentName) == 0) {
1247
+ $prefix = '';
1248
+ } else {
1249
+ $prefix = $parentName.' > ';
1250
+ }
1251
+ if (array_key_exists($id, $groupedCategories)) {
1252
+ foreach ($groupedCategories[$id] as $key => $name) {
1253
+ $output[$key] = $prefix.$name;
1254
+ $output = $output + $this->getSubCategories($groupedCategories, $key, $prefix.$name );
1255
+ }
1256
+ }
1257
+
1258
+ return $output;
1259
+ }
1260
+
1261
+ function formatData( $data) {
1262
+
1263
+ if( is_array( $data)) {
1264
+ if( key( $data) !== 0) {
1265
+ $tempData = array();
1266
+ $tempData[] = $data;
1267
+ $data = $tempData;
1268
+ }
1269
+ return $data;
1270
+ } else {
1271
+ return array( $data);
1272
+ }
1273
+ }
1274
+ }
1275
+
app/code/community/Nostress/Aukro/Helper/Data/Client.php ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Helper.
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Helper_Data_Client extends Nostress_Aukro_Helper_Data
28
+ {
29
+ protected $_versionHelper;
30
+
31
+ const RESPONSE_FEED = 'feed';
32
+ const RESPONSE_TAXONOMY = 'taxonomy';
33
+ const RESPONSE_ERROR = 'error';
34
+ const RESPONSE_ERRORS = 'errors';
35
+ const RESPONSE_INFO = 'info';
36
+ const RESPONSE_MODULE = 'module';
37
+ const RESPONSE_PLUGIN = 'plugin';
38
+ const RESPONSE_LICENSE = 'license';
39
+ const RESPONSE_VALIDITY = 'validity';
40
+ const RESPONSE_KEY = 'key';
41
+ const RESPONSE_COLLECTION = 'collection';
42
+
43
+ const PARAM_LICENSE = 'license';
44
+ const PARAM_SERVER = 'server';
45
+ const PARAM_SERVER_ID = 'server_id';
46
+ const PARAM_SIGN = 'sign';
47
+ const PARAM_LINK = 'link';
48
+ const PARAM_FILE_TYPE = 'file_type';
49
+ const PARAM_PLUGINS = 'plugins';
50
+ const PARAM_REQUEST_TYPE = 'request_type';
51
+
52
+ const TYPE_FEEDS_AND_TAXONOMIES = "feeds_and_taxonomies";
53
+ const TYPE_PLUGINS = "plugins";
54
+ const TYPE_LICENSE = "license";
55
+
56
+ const PARAM_CP_URL_SECURE = 'server_url_secure';
57
+ const PARAM_CP_URL_UNSECURE = 'server_url_unsecure';
58
+ const PARAM_API_URL_SECURE = 'koongo_api_url_secure';
59
+ const PARAM_API_URL_UNSECURE = 'koongo_api_url_unsecure';
60
+
61
+ const API_FUNCTION_CREATE_LICENSE = 'createAukroLicense';
62
+
63
+ const CACHE_KEY_AVAILABLE_COLLECTIONS = 'koongo_available_collections';
64
+ const CACHE_KEY_CONNECTORS_INFO = 'koongo_connectors_info';
65
+
66
+ const LICENSE_NOT_VALID = "License invalid";
67
+
68
+ public function getConnectorInfoByCode($code)
69
+ {
70
+ $info = $this->getConnectorsInfo();
71
+ foreach ($info as $item)
72
+ {
73
+ if(!empty($item[self::CODE]))
74
+ {
75
+ if(empty($code))
76
+ return $item;
77
+ if($item[self::CODE] == $code)
78
+ return $item;
79
+ }
80
+ }
81
+ if(!empty($info['custom']) && is_array($info['custom']))
82
+ {
83
+ $customConnectors = $info['custom'];
84
+ foreach ($customConnectors as $item)
85
+ {
86
+ if(!empty($item[self::CODE]))
87
+ {
88
+ if($item[self::CODE] == $code)
89
+ return $item;
90
+ }
91
+ }
92
+ }
93
+ return false;
94
+ }
95
+
96
+ public function getConnectorsInfo()
97
+ {
98
+ return $this->getInfoData(self::PARAM_CONNECTORS_JSON_URL,self::CACHE_KEY_CONNECTORS_INFO);
99
+ }
100
+
101
+ public function getAvailableCollections()
102
+ {
103
+ return $this->getInfoData(self::PARAM_COLLECTIONS_JSON_URL,self::CACHE_KEY_AVAILABLE_COLLECTIONS);
104
+ }
105
+
106
+ public function getUniversityInfo()
107
+ {
108
+ return $this->_getInfoData(self::PARAM_UNIVERSITY_JSON_URL, true);
109
+ }
110
+
111
+ public function getAvailableCollectionsAsOptionArray($isMultiselect = false)
112
+ {
113
+ $collections = $this->getAvailableCollections();
114
+ $result = array();
115
+
116
+ if(empty($collections) || !is_array($collections))
117
+ return $result;
118
+ foreach($collections as $item)
119
+ {
120
+ $result[$item["address"]] = array("label" => $item["address"],"value" => $item["code"]);
121
+ }
122
+ sort($result);
123
+
124
+ if(!$isMultiselect)
125
+ array_unshift($result, array("label" => $this->__("-- Please Select --"), "value" => ""));
126
+ return $result;
127
+ }
128
+
129
+ /** API functions */
130
+
131
+ public function createLicenseKey($params)
132
+ {
133
+ $params[self::PARAM_SERVER_ID] = $this->getServerId();
134
+ $response = $this->postApiRequest($params,self::API_FUNCTION_CREATE_LICENSE);
135
+ $response = $this->processResponse($response);
136
+ if(empty($response[self::RESPONSE_KEY]))
137
+ {
138
+ throw new Exception($this->__("Server response is missing the license key."));
139
+ }
140
+
141
+ $this->versionHelper()->saveLicenseKey($response[self::RESPONSE_KEY]);
142
+ return $response;
143
+ }
144
+
145
+ /** Server funcitons */
146
+
147
+ public function updateFeeds()
148
+ {
149
+ $this->checkLicense();
150
+ //1.send request
151
+ $response = $this->sendServerRequest(self::TYPE_FEEDS_AND_TAXONOMIES);
152
+ //2.process response
153
+ $response = $this->processResponse($response);
154
+ //3.check response data
155
+ if(!isset($response[self::RESPONSE_FEED]) || !isset($response[self::RESPONSE_TAXONOMY]))
156
+ {
157
+ throw new Exception($this->__("Missing feeds and taxonomy data in response"));
158
+ }
159
+
160
+ //4.update tables
161
+ return $this->updateConfig($response[self::RESPONSE_FEED],$response[self::RESPONSE_TAXONOMY]);
162
+ }
163
+
164
+ public function updatePlugins()
165
+ {
166
+ $response = $this->sendServerRequest(self::TYPE_PLUGINS);
167
+ $response = $this->processResponse($response);
168
+
169
+ if(isset($response[self::RESPONSE_INFO]))
170
+ $this->updateInfo($response[self::RESPONSE_INFO]);
171
+ return true;
172
+ }
173
+
174
+ public function updateLicense()
175
+ {
176
+ if(Mage::helper('aukro/version')->isLicenseKeyT())
177
+ return false;
178
+ $response = $this->sendServerRequest(self::TYPE_LICENSE);
179
+ $response = $this->processResponse($response);
180
+
181
+ if(isset($response[self::RESPONSE_LICENSE]))
182
+ $this->updateLicenseData($response[self::RESPONSE_LICENSE]);
183
+ return true;
184
+ }
185
+
186
+ protected function sendServerRequest($type="")
187
+ {
188
+ $server = $this->getServerName();
189
+ $license = $this->versionHelper()->getLicenseKey();
190
+
191
+ $sign = $this->getSign($server,$license);
192
+ $params = array();
193
+ $params[self::PARAM_SIGN]= $sign;
194
+ $params[self::PARAM_LICENSE] = $license;
195
+ $params[self::PARAM_SERVER] = $server;
196
+ $params[self::PARAM_REQUEST_TYPE] = $type;
197
+ return $this->postServerRequest($params);
198
+ }
199
+
200
+ protected function postServerRequest($params)
201
+ {
202
+ try
203
+ {
204
+ $response = $this->postUrlRequest($this->getNosressServerUrl(),$params);
205
+ }
206
+ catch (Exception $e)
207
+ {
208
+ $response = $this->postUrlRequest($this->getNosressServerUrl(false),$params);
209
+ }
210
+ return $response;
211
+ }
212
+
213
+ protected function postApiRequest($params,$apiFunction)
214
+ {
215
+ try
216
+ {
217
+ $response = $this->postJsonUrlRequest($this->getKoongoApiUrl().$apiFunction,$params);
218
+ }
219
+ catch (Exception $e)
220
+ {
221
+ $response = $this->postJsonUrlRequest($this->getKoongoApiUrl(false).$apiFunction,$params);
222
+ }
223
+ return $response;
224
+ }
225
+
226
+ protected function processResponse($response)
227
+ {
228
+ $response = $this->decodeResponse($response);
229
+ $this->checkResponseContent($response);
230
+ return $response;
231
+ }
232
+
233
+ protected function updateConfig($feedConfig,$taxonomyConfig)
234
+ {
235
+ if(empty($feedConfig))
236
+ throw new Exception($this->__("Feeds configuration empty"));
237
+
238
+ // call model and update tables
239
+ Mage::getSingleton('aukro/feed')->updateFeeds($feedConfig);
240
+ Mage::getSingleton('aukro/taxonomy_setup')->updateTaxonomies($taxonomyConfig);
241
+ Mage::helper('aukro/data_profile')->updateProfilesFeedConfig();
242
+ return $this->getLinks($feedConfig);
243
+ }
244
+
245
+ protected function updateInfo($info)
246
+ {
247
+ if(empty($info))
248
+ return;
249
+
250
+ $pluginInfo = array();
251
+ if(isset($info[self::RESPONSE_PLUGIN]))
252
+ $pluginInfo = $info[self::RESPONSE_PLUGIN];
253
+
254
+ $moduleInfo = array();
255
+ if(isset($info[self::RESPONSE_MODULE]))
256
+ $moduleInfo = $info[self::RESPONSE_MODULE];
257
+
258
+ Mage::getSingleton('aukro/plugin')->updatePluginInfo($pluginInfo);
259
+ Mage::helper('aukro/version')->processModuleInfo($moduleInfo);
260
+ return;
261
+ }
262
+
263
+ protected function updateLicenseData($lincenseData)
264
+ {
265
+ if(empty($lincenseData))
266
+ return;
267
+ Mage::helper('aukro/version')->processLicenseData($lincenseData);
268
+ }
269
+
270
+ protected function checkResponseContent($response)
271
+ {
272
+ $error = "";
273
+ if(!empty($response[self::RESPONSE_ERROR]))
274
+ {
275
+ throw new Exception($response[self::RESPONSE_ERROR]);
276
+ }
277
+ else if(!empty($response[self::RESPONSE_ERRORS]))
278
+ {
279
+ throw new Exception(implode(", ", $response[self::RESPONSE_ERRORS]));
280
+ }
281
+ }
282
+
283
+ protected $_xdfsdfskltyllk = "du45itg6df4kguyk";
284
+
285
+ protected function checkResponseEmpty($response,$error)
286
+ {
287
+ if(!isset($response) || empty($response))
288
+ {
289
+ throw new Exception($this->__("Invalid or empty server response.").$this->__("Curl error: ").$error);
290
+ }
291
+ }
292
+
293
+ protected function getLinks($feedConfig)
294
+ {
295
+ $links = array();
296
+ foreach($feedConfig as $config)
297
+ {
298
+ if(isset($config[self::PARAM_LINK]) && !in_array($config[self::PARAM_LINK],$links))
299
+ $links[] = $config[self::PARAM_LINK];
300
+ }
301
+ return $links;
302
+ }
303
+
304
+ protected $_xdfsdfskmfowlt54b4 = "kd6fg54";
305
+
306
+ protected function decodeResponse($response)
307
+ {
308
+ $response = json_decode($response,true);
309
+ return $response;
310
+ }
311
+
312
+ protected function getServerName()
313
+ {
314
+ return $this->versionHelper()->getServerName();
315
+ }
316
+
317
+ protected function getServerId()
318
+ {
319
+ return $this->versionHelper()->getServerId();
320
+ }
321
+
322
+ protected function checkLicense()
323
+ {
324
+ if(!$this->versionHelper()->isLicenseValid())
325
+ {
326
+ throw new Exception($this->__('Your License is not valid'));
327
+ }
328
+ }
329
+
330
+ protected function getSign($server,$license)
331
+ {
332
+ return md5(sha1($this->_xdfsdfskltyllk.$server.$license."\$this->_xdfsdfskmfowlt54b4"));
333
+ }
334
+
335
+ protected function getNosressServerUrl($secured = true)
336
+ {
337
+ if($secured)
338
+ return $this->getGeneralConfig(self::PARAM_CP_URL_SECURE);
339
+ else
340
+ return $this->getGeneralConfig(self::PARAM_CP_URL_UNSECURE);
341
+ }
342
+
343
+ protected function getKoongoApiUrl($secured = true)
344
+ {
345
+ if($secured)
346
+ return $this->getGeneralConfig(self::PARAM_API_URL_SECURE);
347
+ else
348
+ return $this->getGeneralConfig(self::PARAM_API_URL_UNSECURE);
349
+ }
350
+
351
+ protected function postUrlRequest($request_url,$post_params)
352
+ {
353
+ $ch = curl_init();
354
+ curl_setopt($ch, CURLOPT_URL, $request_url);
355
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
356
+ curl_setopt($ch, CURLOPT_POST, true);
357
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
358
+ $result = curl_exec($ch);
359
+ $this->checkResponseEmpty($result, curl_error($ch));
360
+ curl_close($ch);
361
+
362
+ return $result;
363
+ }
364
+
365
+ protected function postJsonUrlRequest($request_url,$post_params)
366
+ {
367
+ $post_params = json_encode($post_params);
368
+ return $this->postUrlRequest($request_url,$post_params);
369
+ }
370
+
371
+ protected function versionHelper()
372
+ {
373
+ if(!isset($this->_versionHelper))
374
+ {
375
+ $this->_versionHelper = Mage::helper('aukro/version');
376
+ }
377
+ return $this->_versionHelper;
378
+ }
379
+
380
+ protected function getInfoData($type,$cacheKey)
381
+ {
382
+ $cache = Mage::app()->getCache();
383
+ $json = $cache->load($cacheKey);
384
+ if(empty($json))
385
+ {
386
+ $json = $this->_getInfoData($type);
387
+ if(!empty($json))
388
+ $cache->save($json, $cacheKey);
389
+ }
390
+ $collections = $this->decodeResponse($json);
391
+ return $collections;
392
+ }
393
+
394
+ protected function _getInfoData($type,$decode = false)
395
+ {
396
+ $url = $this->getGeneralConfig($type);
397
+ $data = Mage::getModel('aukro/data_reader')->getRemoteFileContent($url);
398
+
399
+ if($decode)
400
+ $data = $this->decodeResponse($data);
401
+ return $data;
402
+ }
403
+ }
app/code/community/Nostress/Aukro/Helper/Data/Feed.php ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Helper.
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Helper_Data_Feed extends Nostress_Aukro_Helper_Data
28
+ {
29
+ const INTERNATIONAL_CODE = 'INTERNATIONAL';
30
+ const INTERNATIONAL_LABEL = 'International';
31
+ const LABEL = 'label';
32
+ const VALUE = 'value';
33
+ const RED = 'red';
34
+
35
+ public function getAdapter($feedCode,$storeId) {
36
+ $feed = Mage::getModel('aukro/feed')->getFeedByCode($feedCode);
37
+ if (!isset($feed) || !$feed->hasFileType())
38
+ return null;
39
+
40
+ $fileType = $feed->getFileType();
41
+ $adapter = Mage::getModel('aukro/engine_abstract_'.$fileType)->InitData($feed->getData(),$storeId);
42
+ return $adapter;
43
+ }
44
+
45
+ public function getFeedOptions($enabled = null, $addFileType = null, $isMultiselect = null) {
46
+ return Mage::getSingleton('aukro/feed')->toOptionArray($enabled, $addFileType, $isMultiselect);
47
+ }
48
+
49
+ public function getOptions($type,$gridOptions = false,$enabled = null,$addCounty = false)
50
+ {
51
+ $dataArray = array();
52
+ $feedLink = "";
53
+ $feeds = Mage::getModel('aukro/feed')->getCollection();
54
+
55
+ if(isset($enabled))
56
+ $feeds->addFieldToFilter('enabled', $enabled);
57
+ $feeds->load();
58
+
59
+ foreach ($feeds as $feed)
60
+ {
61
+ $data = $feed->getData($type);
62
+ if(!in_array($data, $dataArray))
63
+ {
64
+ $dataArray[$data] = array("label" => $data, "value" => $data);
65
+ if($addCounty)
66
+ $dataArray[$data]["country"] = $feed->getCountry();
67
+ }
68
+ }
69
+
70
+ if($gridOptions)
71
+ $dataArray = $this-> optionsArrayToGrid($dataArray);
72
+ ksort($dataArray);
73
+ return $dataArray;
74
+ }
75
+
76
+ public function getTypeOptions($feed = null) {
77
+ $feedLinks = null;
78
+ $typeArray = array();
79
+ $helperArray = array();
80
+ $feedLink = "";
81
+ $feedLinks = Mage::getModel('aukro/feed')->getCollection()
82
+ ->addFieldToFilter('code', $feed)
83
+ ->addFieldToFilter('enabled', true)
84
+ ->load();
85
+ foreach ($feedLinks as $feedLink) {
86
+ $feedLink = $feedLink->getLink();
87
+ }
88
+ $types = Mage::getModel('aukro/feed')->getCollection()
89
+ ->addFieldToFilter('link', $feedLink)
90
+ ->addFieldToFilter('enabled', true)
91
+ ->load();
92
+
93
+ foreach ($types as $type) {
94
+ if (!in_array($type->type, $helperArray)) {
95
+ $typeArray[] = array("label" => $type->type, "value" => $type->code);
96
+ $helperArray[] = $type->type;
97
+ }
98
+ }
99
+
100
+ return $typeArray;
101
+ }
102
+
103
+ public function getFileOptions($type = null, $feed = null) {
104
+ $fileArray = array();
105
+ $helperArray = array();
106
+ $feedLink = "";
107
+ $files = Mage::getModel('aukro/feed')->getCollection()
108
+ ->addFieldToFilter('enabled', true);
109
+ if (isset($type)) {
110
+ $feedTypes = Mage::getModel('aukro/feed')->getCollection()
111
+ ->addFieldToFilter('code', $type)
112
+ ->addFieldToFilter('enabled', true)
113
+ ->load();
114
+ foreach ($feedTypes as $feedType) {
115
+ $feedType = $feedType->getType();
116
+ }
117
+ $files->addFieldToFilter('type', $feedType);
118
+ }
119
+ if (isset($feed)) {
120
+ $feedLinks = Mage::getModel('aukro/feed')->getCollection()
121
+ ->addFieldToFilter('code', $feed)
122
+ ->addFieldToFilter('enabled', true)
123
+ ->load();
124
+ foreach ($feedLinks as $feedLink) {
125
+ $feedLink = $feedLink->getLink();
126
+ }
127
+ $files->addFieldToFilter('link', $feedLink);
128
+ }
129
+ //Mage::log("Feed: ".$feed);
130
+ $files->load();
131
+
132
+ foreach ($files as $file) {
133
+ if (!in_array($file->file_type, $helperArray)) {
134
+ $fileArray[] = array("label" => $file->file_type, "value" => $file->code);
135
+ $helperArray[] = $file->file_type;
136
+ }
137
+ }
138
+ return $fileArray;
139
+ }
140
+
141
+ public function getAttributeOptions($storeId = 0)
142
+ {
143
+ $attributes = $this->_getAttributeOptions($storeId);
144
+ array_unshift($attributes,array(self::LABEL => $this->__("Please select"),self::VALUE=>""));
145
+ return $attributes;
146
+ }
147
+
148
+ protected function _getAttributeOptions($storeId = 0)
149
+ {
150
+ $attributes = Mage::helper('aukro/data_loader')->getLoaderAttributes();
151
+
152
+ $productAttributes = $this->_getVisibleProductAttributes($storeId,true);
153
+ $attributes = array_merge($productAttributes,$attributes);
154
+
155
+ $labels = array();
156
+ foreach ($attributes as $key => $attribute)
157
+ {
158
+ $labels[] = ucfirst($attribute[self::LABEL]);
159
+ }
160
+ array_multisort($labels,$attributes);
161
+
162
+ return $attributes;
163
+ }
164
+
165
+ protected function _getVisibleProductAttributes($storeId,$asOptionArray = false)
166
+ {
167
+ $collection = $this->getVisibleProductAttributes();
168
+ if(!$asOptionArray)
169
+ return $collection;
170
+
171
+ $flatColumns = Mage::helper('aukro/data_loader')->getProductFlatColumns($storeId);
172
+
173
+ $attributes = array();
174
+ foreach ($collection as $item)
175
+ {
176
+ $attribute = array();
177
+ $code = $item->getAttributeCode();
178
+ $attribute[self::VALUE] = $code;
179
+ $attribute[self::LABEL] = $this->getAttributeLabel($item,$storeId);
180
+ if(!in_array($code,$flatColumns))
181
+ $attribute[self::RED] = 1;
182
+ $attributes[$attribute[self::VALUE]] = $attribute;
183
+ }
184
+ return $attributes;
185
+ }
186
+
187
+ public function getPostProcessFunctionOptions($type = self::XML)
188
+ {
189
+ $functions = Mage::getModel('aukro/data_transformation_xml')->getPostProcessFunctions();
190
+ ksort($functions);
191
+
192
+ if($type != self::XML)
193
+ unset($functions[self::CDATA]);
194
+
195
+ $result = array();
196
+ foreach ($functions as $code => $label)
197
+ {
198
+ $function = array();
199
+ $function[self::LABEL] = $label;
200
+ $function[self::VALUE] = $code;
201
+ $result[] = $function;
202
+ }
203
+ return $result;
204
+ }
205
+
206
+ public function getCountryOptions($isMultiselect = false) {
207
+ $options = Mage::getSingleton('adminhtml/system_config_source_country')->toOptionArray($isMultiselect);
208
+
209
+ $tmp = array_shift($options);
210
+ array_unshift($options,$this->getOption(self::INTERNATIONAL_LABEL,self::INTERNATIONAL_CODE));
211
+
212
+ if (!$isMultiselect)
213
+ array_unshift($options,$tmp);
214
+
215
+ return $options;
216
+ }
217
+
218
+ protected function getOption($label, $value = null) {
219
+ if (!isset($value))
220
+ $value = $label;
221
+ return array(
222
+ self::VALUE => $value,
223
+ self::LABEL => $label
224
+ );
225
+ }
226
+
227
+ public function optionsArrayToGrid($array) {
228
+ $result = array();
229
+ foreach ($array as $item) {
230
+ $result[$item[self::VALUE]] = $item[self::LABEL];
231
+ }
232
+ return $result;
233
+ }
234
+
235
+ public function getAttributesSetup($layout, $asArray = true) {
236
+ $pattern = $this->getDocPattern();
237
+ $numberOfMatches = preg_match($pattern, $layout, $setup);
238
+ if (!$numberOfMatches) {
239
+ return false;
240
+ }
241
+ else
242
+ $setup = $setup[0];
243
+ if (!$asArray)
244
+ return $setup;
245
+
246
+ //transform to array
247
+ $xml = $this->stringToXml($setup);
248
+ $setup = $this->XMLnodeToArray($xml);
249
+
250
+ return $setup;
251
+ }
252
+
253
+ public function getTrnasformationXslt($layout) {
254
+ $pattern = $this->getDocPattern();
255
+ $xlst = preg_replace($pattern, "", $layout);
256
+ return $xlst;
257
+ }
258
+
259
+ protected function getDocPattern() {
260
+ return "#\<".self::NOSTRESSDOC_TAG."\>(.+?)\<\/".self::NOSTRESSDOC_TAG."\>#s";
261
+ }
262
+ }
app/code/community/Nostress/Aukro/Helper/Data/Feed/Description.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Helper.
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Helper_Data_Feed_Description extends Nostress_Aukro_Helper_Data_Feed
28
+ {
29
+ const TEXT = "text";
30
+ const EXAMPLE = "example";
31
+ const OPTIONS = "options";
32
+ const FORMAT = "format";
33
+ const DESCRIPTION = "description";
34
+
35
+ protected $_initialized = false;
36
+ protected $_defaultDescription = array(
37
+ "text" => "",
38
+ "example" => "",
39
+ "options" => "",
40
+ "format" => "text"
41
+ );
42
+
43
+ protected $_attributeDescription = array();
44
+
45
+ public function getAttributeDescription($code)
46
+ {
47
+ $this->init();
48
+ $description = $this->_getAttributeDescription($code);
49
+ return array(self::DESCRIPTION => $description);
50
+ }
51
+
52
+ protected function _getAttributeDescription($code)
53
+ {
54
+ $description = $this->_defaultDescription;
55
+ if(array_key_exists($code,$this->_attributeDescription))
56
+ $description = $this->updateArray($this->_attributeDescription[$code],$description);
57
+ return $description;
58
+ }
59
+
60
+ protected function init()
61
+ {
62
+ if($this->_initialized)
63
+ return;
64
+ $this->defineAttributeDescriptions();
65
+ $this->_initialized = true;
66
+ return;
67
+ }
68
+
69
+ protected function addDesc($code,$desc)
70
+ {
71
+ foreach ($desc as $index => $value)
72
+ {
73
+ $desc[$index] = $this->__($value);
74
+ }
75
+
76
+ $this->_attributeDescription[$code] = $desc;
77
+ }
78
+
79
+
80
+ protected function defineAttributeDescriptions()
81
+ {
82
+ $this->addDesc("short_description", array(self::TEXT => "Short description of the item.",
83
+ self::EXAMPLE =>""
84
+ ));
85
+
86
+ $this->addDesc("description", array(self::TEXT => "Description of the item. Include only information relevant to the item. Do not include any promotional text.",
87
+ self::EXAMPLE =>"This teddy bear is fuzzy and cuddly. The bear is yellow with with white paws and stuffed with high quality hypoallergenic synthetic cotton."
88
+ ));
89
+ $this->addDesc("name", array(self::TEXT => "Title of the item. We recommend you include characteristics such as color or brand in the title which differentiates the item from other products.",
90
+ self::EXAMPLE =>"Mens Pique Polo Shirt"
91
+ ));
92
+ $this->addDesc("image", array(self::TEXT => "URL of an image of the item",
93
+ self::EXAMPLE =>"http://www.example.com/image1.jpg"
94
+ ));
95
+ $this->addDesc("url", array(self::TEXT => "URL directly linking to your item's page on your website",
96
+ self::EXAMPLE =>"http://www.example.com/asp/sp.asp?cat=12&id=1030"
97
+ ));
98
+ $this->addDesc("price_final_include_tax", array(self::TEXT => "Advertised sale price of the item with tax.",
99
+ self::EXAMPLE =>""
100
+ ));
101
+ $this->addDesc("price_final_exclude_tax", array(self::TEXT => "Advertised sale price of the item without tax.",
102
+ self::EXAMPLE =>""
103
+ ));
104
+ $this->addDesc("price_original_include_tax", array(self::TEXT => "Original price of the item with tax.",
105
+ self::EXAMPLE =>""
106
+ ));
107
+ $this->addDesc("price_original_exclude_tax", array(self::TEXT => "Original price of the item without tax.",
108
+ self::EXAMPLE =>""
109
+ ));
110
+ $this->addDesc("gtin", array(self::TEXT => "Global Trade Item Number (GTIN) of the item. These identifiers include UPC (in North America), EAN (in Europe), JAN (in Japan), and ISBN (for books).",
111
+ self::EXAMPLE =>""
112
+ ));
113
+ $this->addDesc("upc", array(self::TEXT => "The Universal Product Code (UPC). A barcode symbology, that is widely used in North America, and in countries including the UK, Australia, and New Zealand for tracking trade items.",
114
+ self::EXAMPLE =>"123456789999"
115
+ ));
116
+ $this->addDesc("ean", array(self::TEXT => "International Article Number(EAN). 13 digit barcode.",
117
+ self::EXAMPLE =>"5901234123457"
118
+ ));
119
+ $this->addDesc("isbn", array(self::TEXT => "International Standard Book Number(ISBN). Unique numeric commercial book identifier.",
120
+ self::EXAMPLE => "978-3-16-148410-0"
121
+ ));
122
+ $this->addDesc("jan", array(self::TEXT => "Japanese Article Number (JAN) is a barcode standard compatible with the European Article Number scheme",
123
+ self::EXAMPLE =>""
124
+ ));
125
+ $this->addDesc("mpn", array(self::TEXT => "Manufacturer Part Number (MPN) of the item. Code uniquely identifies the product to its manufacturer.",
126
+ self::EXAMPLE =>"GO12345OOGLE"
127
+ ));
128
+ $this->addDesc("manufacturer", array(self::TEXT => "Brand of the item.",
129
+ self::EXAMPLE =>"Sony"
130
+ ));
131
+ $this->addDesc("size", array(self::TEXT => "Size of item.",
132
+ self::EXAMPLE =>"XL"
133
+ ));
134
+ $this->addDesc("color", array(self::TEXT => "Color of the item.",
135
+ self::EXAMPLE =>"Red"
136
+ ));
137
+ $this->addDesc("gender", array(self::TEXT => "Gender of the item.",
138
+ self::EXAMPLE =>"Female"
139
+ ));
140
+ $this->addDesc("weight", array(self::TEXT => "Weight of the item.",
141
+ self::EXAMPLE =>"1.2"
142
+ ));
143
+ $this->addDesc("age_group", array(self::TEXT => "Age group of the item.",
144
+ self::EXAMPLE =>"Adults"
145
+ ));
146
+ $this->addDesc("tax_percent", array(self::TEXT => "Item tax rate.",
147
+ self::EXAMPLE =>"20"
148
+ ));
149
+ $this->addDesc("shipping_method_price", array(self::TEXT => "Fixed delivery price.",
150
+ self::EXAMPLE =>""
151
+ ));
152
+ $this->addDesc("shipping_method_name", array(self::TEXT => "Name of shipping method.",
153
+ self::EXAMPLE =>""
154
+ ));
155
+ $this->addDesc("delivery_time", array(self::TEXT => "Delivery time - period to deliver item to a customer.",
156
+ self::EXAMPLE => "Within 2-3 days"
157
+ ));
158
+ $this->addDesc("stock_status", array(self::TEXT => "Availability of item in stock.",
159
+ self::EXAMPLE =>"In stock, On request"
160
+ ));
161
+ $this->addDesc("category_name", array(self::TEXT => "Name of the lowest category, where the product is located.",
162
+ self::EXAMPLE => ""
163
+ ));
164
+ $this->addDesc("category_id", array(self::TEXT => "Id of the lowest category, where the product is located.",
165
+ self::EXAMPLE => ""
166
+ ));
167
+ $this->addDesc("category_parent_name", array(self::TEXT => "Name of the second lowest category, where the product is located.",
168
+ self::EXAMPLE => ""
169
+ ));
170
+ $this->addDesc("category_parent_id", array(self::TEXT => "Id of the second lowest category, where the product is located.",
171
+ self::EXAMPLE => ""
172
+ ));
173
+ $this->addDesc("category_path", array(self::TEXT => "Path of the category, where the product is located.",
174
+ self::EXAMPLE => ""
175
+ ));
176
+ $this->addDesc("taxonomy_name", array(self::TEXT => "Name of the lowest taxonomy category, where the product is located.",
177
+ self::EXAMPLE => ""
178
+ ));
179
+ $this->addDesc("taxonomy_id", array(self::TEXT => "Id of the lowest taxonomy category, where the product is located.",
180
+ self::EXAMPLE => ""
181
+ ));
182
+ $this->addDesc("taxonomy_path", array(self::TEXT => "Path of the taxonomy, where the product is located.",
183
+ self::EXAMPLE => ""
184
+ ));
185
+ $this->addDesc("qty", array(self::TEXT => "Number of products in stock",
186
+ self::EXAMPLE =>"50"
187
+ ));
188
+ $this->addDesc("currency", array(self::TEXT => "Currency for item prices.",
189
+ self::EXAMPLE =>"USD"
190
+ ));
191
+ $this->addDesc("sku", array(self::TEXT => "Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased in business.",
192
+ self::EXAMPLE =>""
193
+ ));
194
+ $this->addDesc("reviews_count", array(self::TEXT => "The number of participants in discussion about one item.",
195
+ self::EXAMPLE =>""
196
+ ));
197
+ $this->addDesc("reviews_url", array(self::TEXT => "Url link to product discussion.",
198
+ self::EXAMPLE =>""
199
+ ));
200
+ $this->addDesc("condition", array(self::TEXT => "Item condition.",
201
+ self::EXAMPLE =>"new,"
202
+ ));
203
+ $this->addDesc("group_id", array(self::TEXT => "Items group id. Based on parent product id.",
204
+ self::EXAMPLE =>""
205
+ ));
206
+ $this->addDesc("id", array(self::TEXT => "Unique item id.",
207
+ self::EXAMPLE =>""
208
+ ));
209
+ $this->addDesc("last_update_date", array(self::TEXT => "Last product update date.",
210
+ self::EXAMPLE =>""
211
+ ));
212
+ $this->addDesc("last_update_datetime", array(self::TEXT => "Last product update date.",
213
+ self::EXAMPLE =>""
214
+ ));
215
+ $this->addDesc("last_update_time", array(self::TEXT => "Last product update time.",
216
+ self::EXAMPLE =>""
217
+ ));
218
+
219
+ }
220
+ }
221
+
app/code/community/Nostress/Aukro/Helper/Data/Loader.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Helper.
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Helper_Data_Loader extends Nostress_Aukro_Helper_Data
28
+ {
29
+ const FLAT_CATALOG_ERROR = 1004;
30
+
31
+ const GROUP_ROW_SEPARATOR = ";;";
32
+ const GROUP_ROW_ITEM_SEPARATOR = "||";
33
+ const GROUP_CONCAT = "GROUP_CONCAT";
34
+ const GROUP_SEPARATOR = "SEPARATOR";
35
+ const GROUPED_COLUMN_ALIAS = "concat_colum";
36
+
37
+ const COLUMN_CATEGORIES_DATA = "ccd";
38
+
39
+ const CONDITION_EXPORT_OUT_OF_STOCK = 'export_out_of_stock';
40
+ const CONDITION_PARENTS_CHILDS = 'parents_childs';
41
+ const CONDITION_TYPES = 'types';
42
+ const CONDITION_PRODUCT_IDS = 'product_ids';
43
+ const DISABLED = "disabled";
44
+
45
+ public function getCommonParameters()
46
+ {
47
+ $params = array();
48
+
49
+ $params[self::PARAM_REVIEW_URL] = $this->getGeneralConfig(self::PARAM_REVIEW_URL);
50
+ $params[self::PARAM_IMAGE_FOLDER] = $this->getGeneralConfig(self::PARAM_IMAGE_FOLDER);
51
+
52
+ return $params;
53
+ }
54
+
55
+ public function groupConcatColumns($columns)
56
+ {
57
+ $res = self::GROUP_CONCAT . "(";
58
+ $columnValues = array_values($columns);
59
+
60
+ $columnString = "";
61
+ $separator = $this->getGroupRowItemSeparator();
62
+ foreach ($columnValues as $value)
63
+ {
64
+ if(empty($columnString))
65
+ $columnString = $value;
66
+ else
67
+ $columnString .= ",'{$separator}',".$value;
68
+ }
69
+ $res .= $columnString." ".self::GROUP_SEPARATOR." '{$this->getGroupRowSeparator()}'";
70
+
71
+ $res .= ") as ".self::GROUPED_COLUMN_ALIAS;
72
+ return $res;
73
+ }
74
+
75
+ protected function getGroupRowSeparator()
76
+ {
77
+ return self::GROUP_ROW_SEPARATOR;
78
+ }
79
+
80
+ protected function getGroupRowItemSeparator()
81
+ {
82
+ return self::GROUP_ROW_ITEM_SEPARATOR;
83
+ }
84
+
85
+ public function getPriceColumnFormat($columnName, $taxRateColumnName,$currencyRate = null, $originalPriceIncludeTax=false,$calcPriceIncludeTax = true, $round=true)
86
+ {
87
+
88
+ $resSql = $columnName;
89
+
90
+ if(isset($currencyRate) && is_numeric($currencyRate))
91
+ {
92
+ $resSql .= "*".$currencyRate;
93
+ }
94
+
95
+ if(!$originalPriceIncludeTax && $calcPriceIncludeTax)
96
+ {
97
+ $resSql .= "*(1+ IFNULL(".$taxRateColumnName.",0))";
98
+ }
99
+ else if($originalPriceIncludeTax && !$calcPriceIncludeTax)
100
+ {
101
+ $resSql .= "*(1/(1+ IFNULL(".$taxRateColumnName.",0)))";
102
+ }
103
+
104
+ if ($round) {
105
+ $resSql = $this->getRoundSql($resSql);
106
+ }
107
+
108
+ return $resSql;
109
+ }
110
+
111
+ public function getRoundSql($column,$decimalPlaces = 2)
112
+ {
113
+ return "ROUND(".$column.",{$decimalPlaces})";
114
+ }
115
+
116
+ public function getStoreCurrencyRate($store)
117
+ {
118
+ $from = Mage::app()->getBaseCurrencyCode();
119
+ $to = $store->getCurrentCurrencyCode();
120
+
121
+ if($from == $to)
122
+ return null;
123
+ else
124
+ return $this->getCurrencyRate($from,$to);
125
+ }
126
+
127
+ protected function getCurrencyRate($from,$to)
128
+ {
129
+ return Mage::getModel('directory/currency')->load($from)->getRate($to);
130
+ }
131
+
132
+ public function getProductFlatColumns($storeId)
133
+ {
134
+ $productFlatResource = Mage::getResourceModel('catalog/product_flat')->setStoreId($storeId);
135
+ return $productFlatResource->getAllTableColumns();
136
+ }
137
+
138
+ public function getCategoryFlatColumns($storeId)
139
+ {
140
+ $flatResource = Mage::getResourceModel('catalog/category_flat')->setStoreId($storeId);
141
+ $describe = Mage::getSingleton('core/resource')->getConnection('core_write')->describeTable($flatResource->getMainTable());
142
+ return array_keys($describe);
143
+ }
144
+
145
+ public function getFlatCatalogErrorCode() {
146
+ return self::FLAT_CATALOG_ERROR;
147
+ }
148
+
149
+ public function getLoaderAttributes()
150
+ {
151
+ $resource = Mage::getResourceModel('aukro/data_loader_product_aukro');
152
+
153
+ $columns = $resource->getAllColumns();
154
+ $staticColumns = $resource->getStaticColumns();
155
+ $staticColumns = array_combine($staticColumns, $staticColumns);
156
+ $columns = array_merge($columns,$staticColumns);
157
+ $multiColumns = $resource->getMultiColumns();
158
+
159
+ ksort($columns);
160
+ $attributes = array();
161
+ foreach ($columns as $alias => $column)
162
+ {
163
+ $attribute = array();
164
+ $attribute[self::VALUE] = $alias;
165
+ $attribute[self::LABEL] = $this->codeToLabel($alias);
166
+ if(in_array($alias,$multiColumns))
167
+ $attribute[self::DISABLED] = "1";
168
+ $attributes[$attribute[self::VALUE]] = $attribute;
169
+ }
170
+ return $attributes;
171
+ }
172
+
173
+ /**
174
+ * Retrieve adminhtml session model object
175
+ *
176
+ * @return Mage_Adminhtml_Model_Session
177
+ */
178
+ protected function _getSession()
179
+ {
180
+ return Mage::getSingleton('adminhtml/session');
181
+ }
182
+
183
+ public function reindexFlatCatalogs() {
184
+
185
+ $this->_reindexFlatCatalogCategoryIndex();
186
+ $this->_reindexFlatCatalogProductIndex();
187
+ $this->_cacheFlushAll();
188
+ }
189
+
190
+ protected function _reindexFlatCatalogCategoryIndex()
191
+ {
192
+ $process = Mage::getModel('index/process')->load(Nostress_Aukro_Helper_Data::CATALOG_CATEGORY_FLAT_PROCESS_CODE, 'indexer_code');
193
+ $this->_reindexProcess($process);
194
+ }
195
+
196
+ protected function _reindexFlatCatalogProductIndex()
197
+ {
198
+ $process = Mage::helper('catalog/product_flat')->getProcess();
199
+ $this->_reindexProcess($process);
200
+ }
201
+
202
+ protected function _reindexProcess($process)
203
+ {
204
+ if ($process)
205
+ {
206
+ try
207
+ {
208
+ $process->reindexEverything();
209
+ $this->_getSession()->addSuccess(
210
+ Mage::helper('index')->__('%s index was rebuilt.', $process->getIndexer()->getName())
211
+ );
212
+ } catch (Mage_Core_Exception $e) {
213
+ $this->_getSession()->addError($e->getMessage());
214
+ } catch (Exception $e) {
215
+ $this->_getSession()->addException($e,
216
+ Mage::helper('index')->__('There was a problem with reindexing process.')
217
+ );
218
+ }
219
+ }
220
+ else
221
+ {
222
+ $this->_getSession()->addError(
223
+ Mage::helper('index')->__('Cannot initialize the indexer process.')
224
+ );
225
+ }
226
+ }
227
+
228
+ /**
229
+ * Flush cache storage
230
+ */
231
+ protected function _cacheFlushAll()
232
+ {
233
+ Mage::dispatchEvent('adminhtml_cache_flush_all');
234
+ Mage::app()->getCacheInstance()->flush();
235
+ $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The cache storage has been flushed."));
236
+ }
237
+ }
app/code/community/Nostress/Aukro/Helper/Data/Product.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Helper.
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Helper_Data_Product extends Nostress_Aukro_Helper_Data
28
+ {
29
+ const CODE = 'code';
30
+ const LABEL = 'label';
31
+
32
+ public function getSubProducts($product)
33
+ {
34
+ if(!isset($product))
35
+ return null;
36
+
37
+ $products = false;
38
+ $copyUrl = false;
39
+ switch($product->getTypeId())
40
+ {
41
+ case Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE:
42
+ $products = $this->getConfigurableSubProducts($product);
43
+ $copyUrl = true;
44
+ break;
45
+ case Mage_Catalog_Model_Product_Type::TYPE_GROUPED:
46
+ $products = $this->getGroupedSubProducts($product);
47
+ break;
48
+ case Mage_Catalog_Model_Product_Type::TYPE_BUNDLE:
49
+ $products = $this->getBundleSubProducts($product);
50
+ break;
51
+ default:
52
+ break;
53
+ }
54
+ $products = $this->addParentAttributes($product,$products,$copyUrl);
55
+ return $products;
56
+
57
+ }
58
+
59
+ public function getConfigurableAttributes($product,$format = false)
60
+ {
61
+ $attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
62
+ $attributes = Mage::helper('core')->decorateArray($attributes);
63
+ if(!$format)
64
+ return $attributes;
65
+ else
66
+ {
67
+ $result = array();
68
+ foreach($attributes as $attribute)
69
+ {
70
+ $productAttribute = $attribute->getProductAttribute();
71
+ if(!isset($productAttribute))
72
+ {
73
+ $this->log("Missing product attribute, product id: {$product->getId()}");
74
+ continue;
75
+ }
76
+ $code = $productAttribute->getAttributeCode();
77
+ $label = $attribute->getLabel();
78
+ $result[] = array(self::CODE => $code,self::LABEL=>$label);
79
+ }
80
+ return $result;
81
+ }
82
+ }
83
+
84
+
85
+ protected function getConfigurableSubProducts($product)
86
+ {
87
+ //$subProduct->isSealable()
88
+ return $product->getTypeInstance(true)->getUsedProducts(null, $product);
89
+ }
90
+
91
+ protected function getBundleSubProducts($product)
92
+ {
93
+ return $this->getProductsToPurchase($product);
94
+ }
95
+
96
+ protected function getGroupedSubProducts($product)
97
+ {
98
+ return $product->getTypeInstance(true)->getAssociatedProducts($product);
99
+ }
100
+
101
+ protected function addParentAttributes($parent,$childs,$copyUrl=false)
102
+ {
103
+ if(!isset($childs) || !is_array($childs))
104
+ return $childs;
105
+
106
+ $parentId = $parent->getId();
107
+ $parentSku = $parent->getSku();
108
+ $parentName = $parent->getName();
109
+
110
+ $parentUrl = null;
111
+ if($copyUrl)
112
+ $parentUrl = $parent->getUrl();
113
+
114
+ $i = 0;
115
+ foreach ($childs as $p)
116
+ {
117
+ $p->setParentId($parentId);
118
+ $p->setParentSku($parentSku);
119
+ $p->setParentName($parentName);
120
+ if(isset($parentUrl))
121
+ {
122
+ $i++;
123
+ $p->setUrl($parentUrl."#{$i}");
124
+ }
125
+ }
126
+ return $childs;
127
+ }
128
+
129
+ /**
130
+ * Retrieve products divided into groups required to purchase
131
+ * At least one product in each group has to be purchased
132
+ *
133
+ * @param Mage_Catalog_Model_Product $product
134
+ * @return array
135
+ */
136
+ protected function getProductsToPurchase($product = null)
137
+ {
138
+ $bundle = $product->getTypeInstance(true);
139
+ $product = $bundle->getProduct($product);
140
+ $allProducts = array();
141
+
142
+ foreach ($bundle->getOptions($product) as $option)
143
+ {
144
+ $groupProducts = array();
145
+ foreach ($bundle->getSelectionsCollection(array($option->getId()), $product) as $childProduct)
146
+ {
147
+ $allProducts[] = $childProduct;
148
+ }
149
+ }
150
+ return $allProducts;
151
+ }
152
+
153
+ //*********************** CATEGORY PRODUCTS - START**********************************
154
+
155
+ public function prepareCategoryProductCollection($store, $category) {
156
+ $collection = Mage::getModel('catalog/product')->getCollection()
157
+ ->addAttributeToSelect('sku')
158
+ ->addAttributeToSelect('name')
159
+ ->addAttributeToSelect('attribute_set_id')
160
+ ->addAttributeToSelect('type_id')
161
+ ->addAttributeToSelect('category_id')
162
+ ->addStoreFilter($store)
163
+ ->joinField('position',
164
+ 'catalog/category_product',
165
+ 'position',
166
+ 'product_id=entity_id',
167
+ 'category_id='.$category->getId(),
168
+ 'left')
169
+ ->joinField('qty',
170
+ 'cataloginventory/stock_item',
171
+ 'qty',
172
+ 'product_id=entity_id',
173
+ '{{table}}.stock_id=1',
174
+ 'left');
175
+ $collection->addCategoryFilter($category, true);
176
+ $collection->setStoreId($store->getId());
177
+ return $collection;
178
+ }
179
+ //*********************** CATEGORY PRODUCTS - END**********************************
180
+ }
app/code/community/Nostress/Aukro/Helper/Data/Profile.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Helper.
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Helper_Data_Profile extends Nostress_Aukro_Helper_Data
28
+ {
29
+ public function run($profileIds = null, $stopIfRunning=true)
30
+ {
31
+ Mage::helper('aukro/version')->validateLicenceBackend();
32
+ if(is_array($profileIds))
33
+ {
34
+ foreach ($profileIds as $profileId)
35
+ {
36
+ $this->_run($profileId);
37
+ }
38
+ }
39
+ else
40
+ $this->_run($profileIds);
41
+
42
+ return true;
43
+ }
44
+
45
+ protected function _run($profileId = null, $stopIfRunning=true)
46
+ {
47
+ $profile = Mage::getModel('aukro/profile');
48
+ if(!isset($profileId))
49
+ {
50
+ $profile = $profile->getAllProfiles();
51
+ }
52
+ else if (is_numeric($profileId)) {
53
+ $profile->load($profileId);
54
+ } else {
55
+ $profile = $profile->getProfilesByName($profileId);
56
+ }
57
+
58
+ $this->runProfile($profile);
59
+ return $profile;
60
+ }
61
+
62
+ protected function runProfile($profile)
63
+ {
64
+ if(is_array($profile))
65
+ {
66
+ foreach ($profile as $item)
67
+ {
68
+ $this->_runProfile($item);
69
+ }
70
+ }
71
+ else
72
+ $this->_runProfile($profile);
73
+ }
74
+
75
+ protected function _runProfile($profile)
76
+ {
77
+ if (!$profile->getId()) {
78
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Invalid Profile ID'));
79
+ }
80
+ $controlUnit = Mage::getModel('aukro/unit_control')->run($profile);
81
+
82
+ }
83
+ }
app/code/community/Nostress/Aukro/Helper/Data/Source.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Helper.
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Helper_Data_Source extends Nostress_Aukro_Helper_Data
28
+ {
29
+ protected function toOptionArray($input)
30
+ {
31
+ foreach ($input as $key => $data) {
32
+ $return[] = array('label' => $data, 'value' => $key);
33
+ }
34
+ return $return;
35
+ }
36
+
37
+ public function getDelimitersOptionArray() {
38
+ $return = array();
39
+ $delimiters = array("." => $this->__("Dot")." - ( . )",
40
+ "," => $this->__("Comma")." - ( , )");
41
+ natsort($delimiters);
42
+ return $this->toOptionArray($delimiters);
43
+ }
44
+
45
+ public function getEnclosureOptionArray() {
46
+ $return = array();
47
+ $enclosures = array('"' => $this->__("Double quotes").' - ( " )',
48
+ "'" => $this->__("Quotes")." - ( ' )",
49
+ "" => $this->__("Empty - no enclosure"));
50
+ return $this->toOptionArray($enclosures);
51
+ }
52
+
53
+ public function getColumnDelimiterOptionArray() {
54
+ $return = array();
55
+ $delimiters = array("|" => $this->__("Pipe")." - ( | )",
56
+ "," => $this->__("Comma")." - ( , )",
57
+ "\t" => $this->__("Tab")." - ( \\t )",
58
+ " " => $this->__("Space")." - ( ' ' )",
59
+ ";" => $this->__("Semicolon")." - ( ; )",
60
+ "/" => $this->__("Slash")." - ( / )",
61
+ "-" => $this->__("Dash")." - ( - )",
62
+ "*" => $this->__("Star")." - ( * )",
63
+ '\\' => $this->__("Backslash")." - ( \\ )",
64
+ ":" => $this->__("Colon")." - ( : )",
65
+ "#" => $this->__("Grid")." - ( # )",
66
+ "&" => $this->__("Ampersand")." - ( & )"
67
+ );
68
+
69
+ return $this->toOptionArray($delimiters);
70
+ }
71
+
72
+ public function getNewlineDelimiterOptionArray() {
73
+ $return = array();
74
+ $delimiters = array("\r\n" => "CR+LF - ( \\r\\n )",
75
+ "\n\r" => "LF+CR - ( \\n\\r )",
76
+ "\n" => "LF - ( \\n )",
77
+ "\r" => "CR - ( \\r )"
78
+ );
79
+
80
+ return $this->toOptionArray($delimiters);
81
+ }
82
+ }
app/code/community/Nostress/Aukro/Helper/Mapping.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Helper_Mapping extends Mage_Core_Helper_Abstract
26
+ {
27
+
28
+
29
+ }
30
+
app/code/community/Nostress/Aukro/Helper/Version.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php ${"\x47\x4cO\x42A\x4cS"}["\x6ace\x6cl\x68\x70\x6a\x78\x6ev"]="\x64\x61\x74\x65\x53\x74\x72i\x6e\x67";${"GL\x4fBA\x4cS"}["\x75v\x74d\x79\x7ai\x69"]="\x69\x6e\x64\x65x";${"\x47LO\x42A\x4c\x53"}["\x76\x63\x64\x76\x68l"]="\x73e\x72\x76\x65r\x4e\x61\x6de";${"\x47\x4cOBA\x4c\x53"}["t\x78x\x70\x61c\x66r"]="p\x6f\x72tD\x65\x6c\x69\x6d\x69\x74e\x72\x49nd\x65\x78";${"\x47\x4cO\x42AL\x53"}["\x64b\x6b\x63\x79\x79\x66\x6c\x6d"]="\x6b\x65\x79\x31";${"\x47L\x4f\x42ALS"}["nq\x6d\x62u\x74z\x66\x6b\x70z"]="\x75\x72\x6c";${"\x47\x4cOB\x41\x4c\x53"}["\x68gnw\x6c\x62\x61\x7a\x76\x71"]="cu\x72\x72\x65n\x74V\x65\x72sion";${"\x47L\x4f\x42A\x4cS"}["r\x6c\x79\x77\x68\x61n"]="u\x70\x64\x61\x74\x65Ur\x6c";${"\x47LO\x42\x41L\x53"}["\x65\x7a\x6bci\x6a\x6c\x63k\x6e"]="l\x61\x74\x65\x73\x74\x56e\x72\x73\x69\x6f\x6e";${"\x47\x4c\x4f\x42\x41LS"}["\x68k\x6a\x67\x63\x6ap\x70\x68"]="\x69d";${"\x47\x4c\x4f\x42\x41L\x53"}["\x74b\x6b\x6d\x69\x70i\x77\x69k"]="n\x61\x6d\x65";${"\x47L\x4f\x42\x41\x4c\x53"}["\x69\x61\x63\x79c\x65l\x74\x77l\x67\x63"]="r\x64";${"\x47\x4c\x4fBAL\x53"}["m\x65\x62\x79\x79\x66r\x62"]="i\x6epu\x74\x4c\x65ng\x74\x68";${"\x47\x4c\x4f\x42\x41L\x53"}["\x77\x62\x6cv\x6e\x72"]="\x69";${"\x47L\x4f\x42\x41\x4c\x53"}["e\x68\x77\x76in\x6ed\x6a\x72\x6d"]="\x70";${"G\x4cO\x42\x41\x4c\x53"}["\x71j\x61\x65an\x61\x6cr\x70"]="co\x6ef\x69g";${"GLO\x42\x41LS"}["\x62\x75n\x6ct\x76\x77v\x72\x79\x69\x6e"]="\x76\x61\x6c\x69d\x69\x74\x79";${"\x47L\x4fBA\x4cS"}["fa\x65\x63\x75ku\x79op\x72"]="\x6c\x64";${"GLO\x42\x41\x4c\x53"}["\x73\x74\x6e\x6ck\x61"]="t\x44a\x74\x65";${"G\x4c\x4f\x42A\x4c\x53"}["sjnierlm"]="\x64\x61\x74\x65";${"\x47LOB\x41\x4c\x53"}["\x67\x71a\x66\x71h\x6d\x68p"]="\x63\x68\x61\x72";${"\x47L\x4f\x42\x41L\x53"}["\x79\x6f\x6dfj\x77\x71\x63\x75fg"]="in\x70\x75\x74";${"\x47\x4c\x4f\x42\x41LS"}["o\x6ato\x76\x78\x68q"]="\x61\x64d\x43\x68";${"G\x4cO\x42AL\x53"}["\x75\x76\x65bu\x6f\x66\x71\x77f"]="\x72\x65\x73\x75\x6ct";${"G\x4c\x4fB\x41\x4c\x53"}["\x75n\x6b\x67j\x66\x66"]="\x6b\x65\x79\x32";${"\x47\x4cO\x42\x41L\x53"}["ov\x68or\x6c"]="le\x6e\x67\x74\x68";${"GL\x4fB\x41\x4cS"}["or\x7a\x72\x6b\x77h\x79a\x6ep\x70"]="\x62b";${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x79\x6e\x64f\x6c\x67c\x76\x64y"]="\x61";${"\x47\x4c\x4f\x42\x41L\x53"}["\x6d\x78\x6cm\x63m\x75"]="\x67e\x6e\x4b\x65\x79";${"\x47\x4c\x4f\x42AL\x53"}["\x69q\x6a\x71\x66\x69"]="s\x74ore\x4b\x65\x79";${"\x47L\x4f\x42A\x4c\x53"}["\x6a\x63ww\x65y\x6c"]="c\x68\x61c\x6b\x44at\x65";${"\x47\x4c\x4fB\x41\x4c\x53"}["\x6b\x62\x72\x61\x6d\x62\x70\x62"]="\x6c\x69\x63\x65n\x73\x65\x4b\x65y";${"\x47L\x4f\x42A\x4c\x53"}["\x6ez\x6djego\x67\x6c\x68\x70"]="\x6ci\x6ec\x65\x6e\x73\x65\x44a\x74\x61";${"\x47\x4cO\x42A\x4c\x53"}["e\x76\x61\x6f\x70qcu\x62"]="\x63u\x72\x56\x65\x72\x73\x69\x6fn";${"GLOB\x41\x4c\x53"}["j\x63\x64\x67ilo"]="\x6d\x61\x74\x63\x68";${"\x47\x4cO\x42\x41\x4c\x53"}["\x69r\x6b\x62\x63d\x6c\x71ya\x76"]="l\x61\x62\x65\x6c";${"GLOBA\x4c\x53"}["mn\x79\x63\x74\x6b\x69\x70\x76\x65"]="\x6c\x69c\x65ns\x65\x55\x72\x6c";${"\x47\x4c\x4fBA\x4c\x53"}["\x74\x67\x79\x73i\x64\x75\x64s\x63\x71\x79"]="\x72e\x6ew\x4c\x69\x63\x65\x6e\x73\x65\x55r\x6c";${"\x47L\x4fBA\x4c\x53"}["\x6cpd\x72ksw"]="m\x65\x73\x73a\x67\x65";class Nostress_Aukro_Helper_Version extends Mage_Core_Helper_Abstract{const HTTPS="h\x74t\x70s://";const HTTP="\x68ttp://";const URL_DELIMITER="/";const PORT_DELIMITER=":";const VRE="/[\x30-\x39]+.[0-\x39]+/";const NEW_LICENSE_URL="\x68tt\x70\x73://store.\x6bo\x6f\x6e\x67o\x2eco\x6d/\x6bo\x6f\x6eg\x6f-co\x6e\x6e\x65\x63to\x72-\x66\x6fr-\x6d\x61ge\x6e\x74o.h\x74\x6d\x6c";const RENEW_LICENSE_URL="h\x74tps://\x73t\x6f\x72e.k\x6fon\x67o.\x63om/chec\x6bout/ca\x72t/\x61\x64\x64";const RENEW_LICENSE_SUFFIX="?\x72etu\x72\x6e_url=/\x6f\x6ees\x74\x65p\x63\x68e\x63\x6bout&pro\x64\x75c\x74\x3d\x34\x328&\x71ty=1\x26o\x70tions[\x34\x386]\x3d{{li\x63\x65ns\x65\x5fk\x65y}}\x26\x6fp\x74io\x6es[\x3483]=1\x32\x303";const LATEST_VERSION="l\x61t\x65st_v\x65\x72\x73\x69\x6fn";const LICENSE_VALIDITY="\x6c\x69c\x65\x6ese\x5fva\x6cidi\x74\x79";const VALIDITY="valid\x69ty";protected$_moduleLabel='Aukro';protected$_ts="l41rt";protected$_validForVersion='1.4+';protected$_s='mage547nostress123';const TD="2\x38-02-2\x30\x313";const STEP=2;const ENDL=7;const DL=6;const SHF=5;const DDLM="-";const ASX=2;const AEH=4;const YR=20;const TP="\x74r14l";protected$_setupName="aukro_setup";const MODULE_UPDATE_LINK="\x6do\x64ul\x65\x5fu\x70d\x61\x74\x65_lin\x6b";const PLUGIN_UPDATE_LINK="p\x6c\x75\x67i\x6e_\x75\x70\x64\x61\x74\x65_l\x69\x6ek";const PLUGIN_LIST_LINK="\x70\x6cu\x67\x69\x6e\x5fli\x73\x74_l\x69\x6ek";const LICENSE_NOT_VALID="\x4c\x69c\x65\x6e\x73e inv\x61lid";const PATH_LICENSE_KEY="\x61\x75\x6b\x72\x6f/\x61\x63t\x69v\x61t\x69on/l\x69c\x65ns\x65\x5fk\x65\x79";public function getModuleStatusHtml(){if($this->isVersionValid()){return"<\x73p\x61\x6e\x20\x73\x74yl\x65=\x27\x63olo\x72:g\x72\x65en\x3b\x66\x6fn\x74-we\x69\x67\x68t:b\x6fld'>".$this->__("\x4f\x4b")."</span>";}else{return"<\x73pa\x6e \x73tyl\x65\x3d'col\x6f\x72:\x72\x65d;\x66\x6f\x6e\x74-weig\x68t:\x62o\x6cd\x27>".$this->__("\x4eot\x20V\x61l\x69d")." -\x20\x3c\x61 \x68\x72\x65\x66\x3d\"".$this->__(self::LICENSE_URL)."\x22>".$this->__("\x42\x75y\x20\x4ee\x77 Lic\x65\x6e\x73\x65")."</\x61\x3e\x3c/\x73pan>";}}public function getLicenseKeyStatusHtml(){if(!$this->getLicenseKey()){return$this->getLicenseHtml("B\x75y \x4ee\x77 L\x69\x63\x65\x6e\x73\x65",$this->__("P\x6c\x65\x61se\x20e\x6ete\x72\x20th\x65\x20Lic\x65ns\x65\x20\x6b\x65y"));}${${"\x47\x4cO\x42\x41L\x53"}["\x6c\x70\x64r\x6b\x73w"]}="";$tfyffifoh="\x6de\x73\x73a\x67\x65";$riptbno="me\x73s\x61\x67\x65";if(!$this->isLicenseKeyValid()){${"\x47L\x4fBAL\x53"}["\x77w\x66wm\x67ib"]="\x6de\x73s\x61\x67\x65";${"G\x4c\x4f\x42\x41\x4c\x53"}["\x74\x69ns\x76\x69\x77\x6a\x6eg"]="me\x73\x73a\x67\x65";${"G\x4c\x4fB\x41\x4cS"}["\x72\x67\x79\x76\x6f\x75\x6f\x63\x64c\x70\x63"]="\x6des\x73\x61g\x65";${${"\x47\x4c\x4f\x42\x41L\x53"}["wwf\x77\x6dgi\x62"]}.=$this->__("N\x6ft Val\x69d");if($this->isLicenseKeyT())${${"\x47\x4c\x4fB\x41\x4cS"}["\x72g\x79\x76o\x75ocd\x63\x70\x63"]}.="\x20-\x20".$this->__("T\x72\x69a\x6c \x70\x65\x72i\x6f\x64\x20ex\x70\x69r\x65d\x20o\x6e\x20%s\x2e",$this->gLD())." ";${${"GLO\x42A\x4c\x53"}["\x74\x69\x6e\x73\x76i\x77j\x6eg"]}=$this->getLicenseHtml("B\x75y \x4ee\x77 \x4cicens\x65",${${"\x47L\x4f\x42A\x4c\x53"}["\x6cp\x64\x72\x6bsw"]},self::NEW_LICENSE_URL);}else if(!$this->isDateValid()){$rsgosied="m\x65\x73\x73ag\x65";${$rsgosied}.=$this->__("\x4d\x6f\x64\x75l\x65\x20S\x75\x70por\x74 & Up\x64a\x74e\x73 \x70\x65\x72iod \x65\x78\x70ired on\x20%s ",$this->gLD());${${"GLO\x42AL\x53"}["\x74g\x79\x73\x69\x64\x75d\x73c\x71y"]}=$this->getRenewLicenseUrl($this->getLicenseKey());${${"\x47\x4cO\x42\x41LS"}["\x6c\x70\x64\x72k\x73\x77"]}=$this->getLicenseHtml("Rene\x77 S\x75p\x70\x6f\x72t\x20\x26\x20\x55p\x64\x61tes",${${"\x47LOBA\x4cS"}["\x6c\x70dr\x6b\x73w"]},${${"GL\x4f\x42\x41\x4cS"}["\x74\x67\x79\x73i\x64\x75\x64\x73\x63\x71\x79"]});}if(empty(${$tfyffifoh})){$cbeqlvbey="\x6d\x65\x73\x73\x61\x67\x65";$dyiotxgq="\x6d\x65\x73sa\x67\x65";${$cbeqlvbey}=$this->__("\x4fK")."\x20- ".$this->__("M\x6fd\x75le\x20Su\x70\x70o\x72t\x20&\x20U\x70\x64\x61te\x73 per\x69o\x64\x20e\x78pires \x6fn %\x73\x20",$this->gLD());$pawqllhvog="me\x73\x73\x61ge";${$dyiotxgq}="\x3c\x73pa\x6e\x20sty\x6ce\x3d'co\x6c\x6fr:\x67r\x65e\x6e\x3bfont-\x77e\x69\x67\x68t:bo\x6cd\x27>".${$pawqllhvog}."\x3c/s\x70an\x3e";}return${$riptbno};}protected function getLicenseHtml($label,$message,$licenseUrl=self::NEW_LICENSE_URL,$params=""){${"\x47\x4c\x4f\x42\x41\x4c\x53"}["f\x6c\x6eza\x6c\x77\x6d\x66"]="p\x61\x72a\x6ds";${"GL\x4f\x42ALS"}["\x75\x79\x77iw\x73e\x71\x70\x77"]="\x6d\x65\x73\x73\x61g\x65";${"G\x4c\x4fB\x41\x4cS"}["\x74\x66\x79xc\x6cy"]="mess\x61\x67\x65";${${"GL\x4fB\x41\x4c\x53"}["\x75\x79\x77\x69\x77\x73\x65q\x70\x77"]}.=" -\x20<\x61\x20\x74\x61rg\x65t=\x22_\x62\x6ca\x6e\x6b\x22\x20\x68\x72\x65\x66\x3d\"".$this->__(${${"\x47\x4c\x4fB\x41L\x53"}["\x6d\x6ey\x63t\x6bi\x70ve"]}).${${"\x47L\x4f\x42A\x4c\x53"}["\x66\x6c\x6ez\x61l\x77\x6d\x66"]}."\x22\x3e".$this->__(${${"GLO\x42\x41\x4c\x53"}["\x69r\x6b\x62c\x64\x6cq\x79\x61\x76"]})."\x3c/\x61\x3e";${"\x47L\x4fBAL\x53"}["\x71rtd\x7ap\x6bc\x70\x6c"]="\x6dessa\x67e";${${"G\x4c\x4fB\x41\x4c\x53"}["t\x66yx\x63\x6c\x79"]}="\x3c\x73pan\x20\x73\x74y\x6c\x65\x3d\x27color:red;\x66o\x6et-\x77\x65\x69gh\x74:bold\x27>".${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["l\x70\x64\x72k\x73\x77"]}."\x3c/\x73\x70an>";return${${"GL\x4fB\x41\x4c\x53"}["\x71rtd\x7a\x70k\x63\x70\x6c"]};}public function isModuleValid(){return$this->isVersionValid()&&$this->isLicenseValid();}public function isVersionValid(){$lffokehteu="\x63\x75\x72\x56\x65\x72\x73i\x6f\x6e";${"G\x4c\x4f\x42\x41L\x53"}["\x63\x64rllh\x62j"]="\x6dat\x63\x68";${$lffokehteu}=substr($this->getMagentoVersion(),2,1);$woqgowvmrey="mat\x63h";${"GL\x4f\x42\x41\x4c\x53"}["\x69\x69\x6c\x6a\x6d\x77\x61hsc"]="cu\x72Ve\x72s\x69\x6f\x6e";${"\x47\x4c\x4f\x42\x41LS"}["\x68v\x79mdu\x74\x6f"]="\x63\x75\x72\x56\x65r\x73io\x6e";${${"G\x4cOBAL\x53"}["j\x63\x64\x67\x69\x6c\x6f"]}=array();if(preg_match(self::VRE,Mage::getVersion(),${${"G\x4c\x4f\x42AL\x53"}["\x6ac\x64g\x69\x6co"]}))${${"\x47\x4c\x4f\x42\x41L\x53"}["\x6a\x63\x64\x67\x69l\x6f"]}=explode("\x2e",${${"\x47\x4c\x4f\x42A\x4cS"}["\x6a\x63\x64\x67\x69lo"]}[0]);if(isset(${${"\x47L\x4fB\x41LS"}["\x6a\x63dgi\x6c\x6f"]}[0])&&${$woqgowvmrey}[0]<1)return false;if(isset(${${"\x47\x4cO\x42A\x4c\x53"}["\x63\x64\x72\x6cl\x68\x62j"]}[1]))${${"GL\x4f\x42AL\x53"}["i\x69\x6c\x6a\x6d\x77a\x68s\x63"]}=${${"\x47\x4cO\x42\x41\x4cS"}["\x6a\x63\x64\x67il\x6f"]}[1];switch($this->_validForVersion){case"3":return${${"\x47\x4c\x4f\x42AL\x53"}["\x68\x76\x79\x6d\x64\x75t\x6f"]}==$this->_validForVersion;break;default:if((float)${${"\x47LOBAL\x53"}["\x65v\x61o\x70q\x63\x75\x62"]}>=(float)"4")return true;break;}return false;}public function getMagentoVersion(){return Mage::getVersion();}public function processModuleInfo($info){$lxodwbfvpnpg="i\x6ef\x6f";if(isset(${$lxodwbfvpnpg}[self::LATEST_VERSION])){${"\x47L\x4fB\x41\x4cS"}["\x6bo\x74\x61\x65gt\x62j"]="in\x66\x6f";Mage::helper("auk\x72o")->setGeneralConfig(self::LATEST_VERSION,trim(${${"\x47\x4cO\x42A\x4cS"}["k\x6f\x74\x61\x65\x67\x74\x62j"]}[self::LATEST_VERSION]));}}public function processLicenseData($lincenseData){$bjcedhf="\x6c\x69n\x63\x65nse\x44\x61\x74\x61";$uhrbll="l\x69\x6ec\x65n\x73e\x44\x61\x74a";if(isset(${$bjcedhf}[self::VALIDITY])&&${$uhrbll}[self::VALIDITY]!=self::LICENSE_NOT_VALID){Mage::helper("\x61\x75\x6br\x6f")->setGeneralConfig(self::LICENSE_VALIDITY,trim(${${"\x47\x4cO\x42A\x4c\x53"}["\x6e\x7a\x6d\x6a\x65go\x67\x6c\x68p"]}[self::VALIDITY]));}}public function isLicenseEmpty(){${${"G\x4cO\x42\x41\x4c\x53"}["k\x62\x72a\x6db\x70\x62"]}=$this->getLicenseKey();if(empty(${${"G\x4c\x4f\x42A\x4cS"}["k\x62\x72amb\x70\x62"]}))return true;else return false;}public function isLicenseValid($chackDate=false){$ixddcyn="c\x68\x61\x63\x6b\x44a\x74\x65";if(${${"GL\x4f\x42A\x4c\x53"}["\x6acww\x65yl"]}&&$this->isLicenseKeyValid()&&$this->isDateValid()){return true;}else if(!${$ixddcyn}&&$this->isLicenseKeyValid())return true;return false;}protected function isLicenseKeyValid(){${${"G\x4c\x4fB\x41\x4c\x53"}["i\x71\x6aq\x66i"]}=$this->getLicenseKey();${${"GLO\x42\x41L\x53"}["\x6dxlm\x63mu"]}=$this->generateLicenseKey();${"\x47\x4c\x4f\x42A\x4c\x53"}["\x6apg\x72\x61t\x6f"]="\x62\x62";$jpmwkqxjm="g\x65\x6e\x4b\x65\x79";$rmiudytirrq="st\x6f\x72\x65\x4be\x79";if(${${"\x47\x4cO\x42\x41\x4c\x53"}["ynd\x66\x6c\x67\x63\x76\x64\x79"]}=$this->cmpKeyz(${${"GLO\x42\x41\x4c\x53"}["\x6dx\x6c\x6d\x63m\x75"]},${$rmiudytirrq})&&($this->isDateValid()||!$this->isDateT()))return${${"\x47\x4cOB\x41\x4c\x53"}["\x79\x6e\x64\x66\x6c\x67c\x76\x64\x79"]};${$jpmwkqxjm}=$this->generateLicenseKey(true);if((${${"G\x4cO\x42\x41L\x53"}["\x6apgra\x74\x6f"]}=$this->cmpKeyz(${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x6dxl\x6dc\x6d\x75"]},${${"\x47\x4c\x4fBA\x4c\x53"}["\x69\x71\x6a\x71f\x69"]}))&&$this->isDateValid())return${${"\x47\x4c\x4f\x42A\x4c\x53"}["\x6f\x72\x7ar\x6b\x77h\x79an\x70p"]};return false;}protected function cmpKeys($key1,$key2){$vuyzoycq="i";$nnjbrip="\x6b\x65y\x31";${"\x47\x4cOB\x41LS"}["xc\x74\x7a\x73\x71\x69y\x76"]="\x6b\x65\x79\x31";$xfcnhx="le\x6e\x67\x74\x68";${"GLOB\x41\x4c\x53"}["f\x79\x78\x6e\x72\x71"]="ke\x791";${"\x47L\x4f\x42\x41LS"}["b\x6e\x6as\x68\x63\x6c\x6b"]="\x69";$bnslhhzzqd="i";${"\x47\x4cOBA\x4c\x53"}["\x71pb\x64\x6c\x74\x69"]="\x6be\x79\x32";if(!isset(${${"\x47L\x4fB\x41\x4c\x53"}["\x66\x79\x78nr\x71"]})||!isset(${${"\x47L\x4fB\x41\x4c\x53"}["\x71p\x62\x64l\x74i"]})||empty(${${"G\x4c\x4f\x42AL\x53"}["\x78ctz\x73\x71\x69\x79\x76"]}))return false;${$xfcnhx}=strlen(${$nnjbrip});if(${${"\x47L\x4f\x42\x41\x4c\x53"}["\x6fv\x68\x6f\x72\x6c"]}!=strlen(${${"G\x4c\x4fB\x41L\x53"}["u\x6e\x6bg\x6af\x66"]})){return false;}for(${${"\x47L\x4fB\x41L\x53"}["\x62\x6e\x6a\x73h\x63\x6c\x6b"]}=1;${$bnslhhzzqd}<${${"GL\x4fBA\x4c\x53"}["\x6f\x76\x68\x6f\x72\x6c"]};${$vuyzoycq}+=self::STEP){$hlgxmufskuee="\x6be\x791";${"\x47L\x4f\x42\x41L\x53"}["hyi\x68\x6ds\x71\x61\x6bg\x61s"]="\x69";$jhooqeb="\x69";if(${$hlgxmufskuee}[${$jhooqeb}]!=${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x75\x6e\x6b\x67j\x66\x66"]}[${${"\x47\x4c\x4f\x42ALS"}["hy\x69\x68ms\x71ak\x67\x61\x73"]}])return false;}return true;}protected function getEvenChars($input){${"G\x4c\x4f\x42A\x4c\x53"}["irr\x6c\x77\x69u\x79vn"]="re\x73ul\x74";${${"\x47\x4c\x4f\x42\x41L\x53"}["\x75\x76e\x62u\x6f\x66q\x77\x66"]}="";${${"\x47\x4cO\x42A\x4cS"}["\x6f\x6at\x6f\x76\x78\x68q"]}=true;foreach(${${"\x47LO\x42\x41\x4c\x53"}["y\x6fmfj\x77q\x63\x75fg"]} as${${"\x47L\x4f\x42\x41\x4c\x53"}["gq\x61\x66q\x68\x6d\x68\x70"]}){${"\x47L\x4f\x42A\x4cS"}["\x63\x66l\x67i\x6e\x6b\x79\x79"]="\x61\x64\x64C\x68";${"GLO\x42AL\x53"}["l\x6f\x7akltt\x6dc\x6d\x6d"]="\x61\x64\x64\x43\x68";$zeiwkup="\x63\x68ar";$qlspwedpon="\x72\x65s\x75l\x74";if(${${"\x47\x4cOB\x41L\x53"}["\x6f\x6at\x6fv\x78\x68q"]})${$qlspwedpon}.=${$zeiwkup};${${"\x47L\x4fB\x41\x4c\x53"}["\x6c\x6f\x7a\x6b\x6ct\x74\x6d\x63\x6dm"]}=!${${"\x47\x4c\x4f\x42\x41LS"}["\x63\x66l\x67\x69n\x6b\x79\x79"]};}return${${"\x47\x4c\x4f\x42\x41L\x53"}["i\x72r\x6c\x77i\x75\x79\x76\x6e"]};}public function isDateT(){$blrnmlqwrfm="\x6c\x64";$tpuphhh="\x64a\x74e";$dyuevmwm="l\x64";${$tpuphhh}=$this->gLD();${$blrnmlqwrfm}=Mage::helper("aukr\x6f")->getDateTime(${${"GL\x4f\x42\x41\x4c\x53"}["sj\x6e\x69e\x72\x6c\x6d"]});${"G\x4c\x4f\x42A\x4cS"}["suk\x78d\x76\x62\x66"]="tD\x61t\x65";${${"G\x4cO\x42\x41\x4cS"}["\x73t\x6elk\x61"]}=Mage::helper("auk\x72o")->getDateTime(self::TD);if(${${"G\x4c\x4f\x42\x41\x4cS"}["s\x75\x6b\x78dv\x62\x66"]}>=${$dyuevmwm})return true;else return false;}public function isDateValid(){$neeenppywkv="d\x61te";${"\x47\x4c\x4f\x42A\x4cS"}["\x79d\x6b\x6e\x6d\x6b\x65\x6fgc"]="\x64\x61t\x65";$elbcnwy="now";${$neeenppywkv}=$this->gLD();${${"\x47L\x4fB\x41\x4c\x53"}["fa\x65\x63\x75\x6b\x75\x79o\x70\x72"]}=Mage::helper("\x61u\x6br\x6f")->getDateTime(${${"\x47\x4cOBA\x4cS"}["\x79d\x6b\x6e\x6dk\x65\x6f\x67c"]});$balnexu="\x6e\x6f\x77";${$balnexu}=Mage::helper("\x61u\x6b\x72\x6f")->getDateTime("\x74\x6f\x64\x61\x79");if(${${"G\x4c\x4fB\x41LS"}["fa\x65c\x75\x6b\x75\x79\x6f\x70r"]}>=${$elbcnwy})return true;else return false;}public function isLicenseKeyT(){$yarhmsptrr="\x73t\x6f\x72e\x4bey";${$yarhmsptrr}=$this->getLicenseKey();$nejfhlnt="s\x74\x6f\x72\x65\x4b\x65\x79";${${"\x47L\x4f\x42\x41L\x53"}["\x6dx\x6c\x6d\x63\x6d\x75"]}=$this->generateLicenseKey(true);if((${${"\x47\x4cOB\x41\x4cS"}["\x6f\x72\x7a\x72kwh\x79\x61\x6e\x70\x70"]}=$this->cmpKeyz(${${"G\x4c\x4f\x42AL\x53"}["\x6dxlmcmu"]},${$nejfhlnt})))return${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["o\x72\x7a\x72\x6b\x77h\x79a\x6e\x70\x70"]};return false;}public function gLD(){${${"\x47\x4c\x4f\x42\x41\x4cS"}["b\x75\x6e\x6c\x74\x76\x77\x76\x72\x79in"]}=Mage::helper("aukr\x6f")->getGeneralConfig(self::LICENSE_VALIDITY);if(empty(${${"G\x4c\x4f\x42\x41\x4c\x53"}["b\x75n\x6c\x74v\x77\x76\x72\x79\x69\x6e"]})||$this->isLicenseKeyT())${${"\x47\x4c\x4f\x42\x41L\x53"}["bu\x6elt\x76\x77\x76\x72yin"]}=$this->dtProcess($this->getLicenseKey());return${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x62\x75\x6el\x74\x76\x77v\x72\x79\x69n"]};}public function getLicenseKey(){$mngfuxdt="\x6c\x69\x63\x65\x6e\x73\x65\x4be\x79";${${"\x47\x4c\x4fBA\x4cS"}["\x6b\x62r\x61\x6d\x62\x70\x62"]}=Mage::getStoreConfig(self::PATH_LICENSE_KEY);return${$mngfuxdt};}public function saveLicenseKey($key){$jmkmwjslj="\x70\x61t\x68";${"\x47\x4c\x4fB\x41L\x53"}["\x62\x66\x67wnb\x79p\x73\x65\x68"]="\x6b\x65\x79";${"GLO\x42A\x4c\x53"}["\x70\x79as\x68\x62\x78\x73\x6d"]="p\x61t\x68";${${"\x47\x4cO\x42A\x4cS"}["\x70\x79\x61\x73\x68\x62xs\x6d"]}=self::PATH_LICENSE_KEY;Mage::helper("au\x6b\x72\x6f")->setGeneralConfig(self::LICENSE_VALIDITY,"");${${"G\x4c\x4fB\x41\x4c\x53"}["\x71\x6a\x61e\x61n\x61\x6c\x72p"]}=Mage::getConfig();$config->saveConfig(${$jmkmwjslj},${${"G\x4cO\x42\x41\x4cS"}["\x62\x66gw\x6e\x62\x79\x70\x73e\x68"]});$config->cleanCache();$config->reinit();}public function resetLicenseDate(){$vfeomdk="\x63o\x6e\x66i\x67";${${"GL\x4f\x42\x41\x4cS"}["bu\x6el\x74\x76w\x76\x72y\x69\x6e"]}=Mage::helper("\x61\x75kro")->getGeneralConfig(self::LICENSE_VALIDITY);if(!isset(${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["b\x75\x6eltv\x77\x76r\x79\x69n"]}))return;Mage::helper("aukro")->setGeneralConfig(self::LICENSE_VALIDITY,"");${$vfeomdk}=Mage::getConfig();$config->cleanCache();$config->reinit();}public function generateLicenseKey($t=false){$ukcjkokmx="\x73er\x76\x65\x72Na\x6d\x65";${"\x47\x4cO\x42\x41\x4cS"}["\x6fs\x74l\x66\x62sj\x67\x6ec"]="t";$dtwapis="s\x65\x72\x76\x65\x72\x4e\x61\x6d\x65";$mlkkpgdsjm="\x73";${$ukcjkokmx}=$this->getServerName();${${"GLOB\x41L\x53"}["ehwv\x69\x6e\x6ed\x6a\x72\x6d"]}=self::TP;${$mlkkpgdsjm}=$this->_ts;$nscleletlqv="\x73";if(!${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x6f\x73t\x6cfb\x73\x6a\x67\x6e\x63"]}){$gjdtckmu="s";$swyjwdgi="\x70";${$swyjwdgi}=${$gjdtckmu}="";}return md5(sha1(${${"G\x4c\x4f\x42A\x4cS"}["\x65\x68\x77\x76i\x6e\x6e\x64\x6ar\x6d"]}.${$dtwapis}.$this->_getModuleName().$this->_s.${$nscleletlqv}));}protected function dtProcess($input){$mxhhnhtgoysw="d\x61\x74\x65";${"G\x4c\x4fB\x41\x4c\x53"}["\x77z\x78p\x63\x79"]="d\x61\x74e";$gphrpkfgcje="d\x61\x74\x65";${$mxhhnhtgoysw}="";$pfthuqvii="\x69\x6e\x70u\x74\x4ceng\x74\x68";${"G\x4c\x4f\x42A\x4cS"}["p\x6dgn\x65\x6a\x76"]="\x64\x61\x74e";${${"G\x4c\x4f\x42\x41L\x53"}["o\x6a\x74ov\x78\x68\x71"]}=true;${$pfthuqvii}=strlen(${${"GL\x4f\x42\x41\x4c\x53"}["\x79o\x6d\x66j\x77\x71\x63\x75\x66\x67"]});${"G\x4cO\x42ALS"}["x\x68\x6a\x73\x69\x6f\x6ap\x77t\x6b"]="\x69";${"G\x4c\x4f\x42\x41L\x53"}["\x63i\x6e\x79e\x62\x73l\x69\x6ec"]="d\x61\x74\x65";for(${${"\x47LO\x42\x41\x4cS"}["\x77\x62l\x76\x6e\x72"]}=1;${${"GL\x4f\x42\x41L\x53"}["\x78\x68\x6a\x73\x69\x6fj\x70wt\x6b"]}<=${${"\x47LO\x42\x41\x4c\x53"}["m\x65\x62\x79\x79\x66\x72\x62"]};${${"\x47LO\x42A\x4cS"}["\x77b\x6c\x76\x6er"]}+=2){$lpfnjdlsg="\x69\x6e\x70\x75t";${${"GLO\x42AL\x53"}["\x73\x6a\x6e\x69\x65r\x6c\x6d"]}.=${$lpfnjdlsg}[${${"\x47L\x4f\x42\x41LS"}["wb\x6c\x76n\x72"]}];if(strlen(${${"G\x4cO\x42\x41L\x53"}["\x73\x6anie\x72\x6cm"]})>=self::ENDL)break;}${$gphrpkfgcje}=${${"\x47\x4c\x4f\x42A\x4c\x53"}["\x63\x69n\x79\x65b\x73\x6c\x69nc"]}>>self::SHF;${${"\x47\x4cOB\x41L\x53"}["\x70\x6dg\x6e\x65j\x76"]}=$this->addZeros(${${"GL\x4f\x42\x41\x4c\x53"}["\x73\x6ani\x65r\x6c\x6d"]},self::DL);${${"\x47L\x4f\x42A\x4c\x53"}["\x73\x6a\x6eierl\x6d"]}=$this->frD(${${"\x47L\x4fB\x41\x4c\x53"}["\x77\x7axpc\x79"]});return${${"\x47\x4cO\x42\x41\x4cS"}["s\x6anie\x72\x6c\x6d"]};}protected function frD($date){${"GL\x4f\x42AL\x53"}["v\x6b\x65\x76\x6don\x6d\x76e"]="\x64ate";${"\x47L\x4fB\x41\x4cS"}["\x6a\x67\x6d\x75\x71\x6c\x75"]="\x72\x64";${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["v\x6bev\x6d\x6f\x6em\x76\x65"]}=(string)${${"\x47\x4cO\x42AL\x53"}["s\x6a\x6e\x69e\x72l\x6d"]};${${"\x47\x4c\x4fB\x41\x4c\x53"}["\x69\x61\x63yc\x65lt\x77\x6c\x67\x63"]}="";for(${${"GL\x4f\x42\x41\x4c\x53"}["w\x62\x6cv\x6er"]}=0;${${"\x47\x4c\x4f\x42\x41L\x53"}["\x77\x62\x6c\x76\x6e\x72"]}<self::DL;${${"\x47L\x4f\x42\x41\x4c\x53"}["\x77b\x6c\x76\x6e\x72"]}++){${"\x47L\x4f\x42\x41LS"}["\x78\x77\x6f\x6cx\x69u\x79s"]="date";$pvpgdklof="\x72\x64";$nuzzjpgbrq="r\x64";${$nuzzjpgbrq}.=${${"G\x4c\x4f\x42\x41\x4c\x53"}["\x78w\x6f\x6c\x78i\x75\x79\x73"]}[${${"\x47\x4c\x4fB\x41L\x53"}["\x77b\x6cv\x6er"]}];$dngptmjx="\x72d";if(!${${"\x47\x4c\x4fB\x41\x4cS"}["w\x62\x6cv\x6er"]})continue;if(!((${${"\x47\x4c\x4f\x42\x41\x4cS"}["\x77b\x6c\x76\x6er"]}+1)%self::ASX)&&(${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["w\x62\x6cvn\x72"]}+1)!=self::DL)${$pvpgdklof}.=self::DDLM;if(!((${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["w\x62\x6cvn\x72"]}+1)%self::AEH))${$dngptmjx}.=self::YR;}return${${"GL\x4f\x42AL\x53"}["j\x67m\x75q\x6cu"]};}protected function addZeros($date,$length){$mrbiuodz="\x6ce\x6e\x67t\x68";${"\x47\x4c\x4f\x42A\x4cS"}["\x64\x69\x70\x75ur\x70\x74f\x65y"]="\x64\x61\x74\x65";${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x6d\x63\x67\x77\x63\x78\x67\x6bdq"]="\x64\x61t\x65";while(strlen(${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x73j\x6ei\x65r\x6c\x6d"]})!=${$mrbiuodz})${${"\x47\x4cO\x42A\x4c\x53"}["\x6dc\x67\x77\x63\x78g\x6bdq"]}="\x30".${${"\x47\x4cOB\x41\x4c\x53"}["\x64i\x70\x75\x75\x72\x70t\x66\x65\x79"]};$mptiiukrowy="\x64\x61te";return${$mptiiukrowy};}public function getDashboardFooterHtml(){return"\n\t\t\x3c/t\x61bl\x65>".Mage::helper("a\x64\x6d\x69nhtml/\x6a\x73")->getScript("\n\x20 \x20 \x20 \x20\x20\x20\$(\x27\x6boong\x6f_li\x63e\x6ese_\x61\x6ed\x5fp\x6c\x75\x67\x69n\x73_\x6cic\x65n\x73e-h\x65\x61\x64\x27).s\x65\x74Sty\x6c\x65(\x27\x62\x61ck\x67\x72o\x75nd:\x20no\x6e\x65\x3b');\n\x20\x20 \x20\x20 \x20\x20 \$('koo\x6e\x67\x6f\x5f\x6c\x69\x63e\x6e\x73e\x5f\x61\x6e\x64\x5fp\x6c\x75g\x69n\x73\x5fli\x63\x65nse-s\x74\x61\x74e').val\x75e\x20\x3d\x201;\n \x20 \x20 \x20 \x20 \$(\x27k\x6fo\x6e\x67\x6f_\x6c\x69cen\x73\x65_a\x6ed\x5f\x70\x6c\x75\x67ins\x5fli\x63ens\x65-\x68\x65\x61d\x27).\x77rit\x65\x41tt\x72\x69b\x75\x74e('on\x63l\x69\x63\x6b\x27,\x20\x27\x72\x65tu\x72\x6e \x66\x61\x6c\x73\x65;')\x3b\n \x20\x20 \x20\x20\x20 \$('\x6boon\x67o_l\x69cens\x65_a\x6ed\x5f\x70lug\x69\x6e\x73\x5f\x6c\x69c\x65\x6ese').\x73how()\x3b\n\t\t");}public function getServerId(){${${"GLO\x42\x41\x4cS"}["\x74b\x6b\x6di\x70\x69w\x69\x6b"]}=$this->getServerName();$bdjjplveuk="\x6e\x61\x6d\x65";${${"\x47\x4c\x4f\x42A\x4cS"}["h\x6b\x6agc\x6a\x70\x70h"]}=trim(base64_encode(${$bdjjplveuk}),"\x3d");return${${"\x47L\x4fB\x41LS"}["\x68\x6b\x6a\x67\x63\x6a\x70\x70\x68"]};}public function addLiveChatButton(){return"\n \x20\x20\x20\x20\x20 \x20 \x20\x3c\x61 \x74itle\x3d\"".Mage::helper("a\x75kro")->__("\x53tar\x74\x20L\x69v\x65\x20C\x68at")."\" \x73tyl\x65=\x22di\x73p\x6c\x61\x79: \x62l\x6f\x63\x6b; \x20f\x6c\x6fat:\x20\x72\x69ght\x3b\" h\x72e\x66=\x22\x6aava\x73c\x72\x69p\x74:v\x6f\x69\x64(0)\x3b\" \x6f\x6e\x63l\x69ck=\x22".Mage::helper("a\x75k\x72o")->getLivechatLink()."\">\n\x20\x20 \x20 \x20 \x20\x20 \x20\x20\x20\x3cim\x67 w\x69\x64t\x68=\x22\x310\x30\" \x73rc\x3d\"".Mage::helper("\x61u\x6b\x72o")->getLivechatImage()."\" \x61\x6ci\x67\x6e\x3d\x22\x61bsmidd\x6c\x65\"\x20bo\x72\x64\x65r\x3d\"\x30\" />\n\x20 \x20\x20\x20 \x20 \x20</a\x3e";}public function getDashboardHeaderHtml(){return$this->addLiveChatButton()."\n\t\t\x3cta\x62l\x65 \x63e\x6c\x6c\x73pa\x63i\x6eg=\x221\x35\x22\x3e\n\t\t\t\x3ct\x72\x3e\n\t\t\t\t<\x74h\x3e{$this->__('Module Name')}\x3c/t\x68\x3e\n\t\t\t\t\x3cth\x3e{$this->__('Module Version')}</t\x68\x3e\n\t\t\t\t<t\x68\x3e{$this->__('Your License for Magento')}</\x74h\x3e\n\t\t\t\t<\x74h>{$this->__('Module Status')}</\x74h>\n\t\t\t\t<th>{$this->__('Enter License Key')}</t\x68>\n\t\t\t\t<\x74h\x3e{$this->__('License Status')}\x3c/\x74h>\n\t\t\t</t\x72>";}public function getDashboardEntryHtml(){$duvgdmnaep="\x6c\x61\x74e\x73t\x56e\x72\x73\x69\x6f\x6e";${"G\x4c\x4fB\x41LS"}["\x6f\x72\x77\x77\x62qz\x7a\x6br\x6f"]="c\x75r\x72\x65\x6e\x74\x56ers\x69\x6f\x6e";${${"\x47\x4c\x4f\x42\x41\x4cS"}["\x6fr\x77\x77bqzz\x6bro"]}=$this->getModuleVersion();${${"G\x4c\x4fB\x41\x4c\x53"}["ezk\x63\x69j\x6c\x63\x6b\x6e"]}=$this->getLatestModuleVersion();${"G\x4cOB\x41LS"}["\x6f\x6c\x6a\x68\x6e\x74\x64l\x63\x67"]="\x63u\x72\x72en\x74V\x65\x72\x73i\x6f\x6e";if($this->cmpVersions(${${"\x47L\x4fB\x41\x4cS"}["\x6fljh\x6e\x74dlc\x67"]},${$duvgdmnaep})){${${"\x47LO\x42A\x4c\x53"}["\x72\x6c\x79\x77\x68\x61\x6e"]}=$this->getModuleUpdateLink();${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x6cp\x64\x72k\x73\x77"]}=$this->__("\x47e\x74\x20\x6c\x61t\x65\x73\x74 \x76\x65rsion %s",${${"G\x4c\x4fBAL\x53"}["e\x7a\x6b\x63\x69\x6a\x6cc\x6bn"]});${${"GLOB\x41\x4c\x53"}["\x68\x67\x6ewl\x62\x61\x7a\x76\x71"]}="<\x73\x70\x61\x6e\x20st\x79le\x3d'\x63\x6f\x6cor:r\x65\x64\x3b\x66on\x74-w\x65i\x67\x68\x74:bol\x64'>{$currentVersion} - \x3ca\x20t\x69t\x6ce=\x22{$message}\x22 \x73tyle\x3d\x27col\x6f\x72:r\x65\x64'\x20\x68\x72e\x66\x3d\"{$updateUrl}\x22>{$message}</\x61></\x73\x70a\x6e>";}${${"GL\x4f\x42\x41L\x53"}["\x6e\x71m\x62\x75\x74z\x66k\x70z"]}=Mage::getModel("adm\x69nh\x74\x6dl/\x75rl");return"\n\t\t\x3c\x74r\x3e\n\t\t\t\x3c\x74\x64\x3e<a \x68\x72\x65\x66=\"".$url->getUrl("*/*/*",array("s\x65c\x74\x69o\x6e"=>"k\x6fo\x6e\x67o_c\x6fnfig"))."#{$this->_getModuleName()}-head\"\x3e{$this->getModuleLabel()}</\x61></\x74\x64>\n\t\t\t<t\x64>{$currentVersion}</\x74d\x3e\n\t\t\t\x3c\x74\x64>{$this->_validForVersion}</t\x64\x3e\n\t\t\t\x3ctd\x3e{$this->getModuleStatusHtml()}\x3c/t\x64\x3e\n\t\t\t<\x74d\x3e<\x69np\x75\x74 i\x64=\x22{$this->_getModuleName()}\x5f\x6c\x69censeke\x79\x22 \x63l\x61\x73s\x3d\x22\x69n\x70\x75t-\x74\x65x\x74\x22 typ\x65=\x22te\x78\x74\" v\x61\x6cu\x65=\"".$this->getLicenseKey()."\x22 \x6eam\x65=\x22g\x72\x6f\x75\x70\x73[l\x69c\x65n\x73\x65][fie\x6c\x64\x73][\x6c\x69\x63en\x73\x65_\x6b\x65y\x5f{$this->_getModuleName()}][\x76alu\x65]\x22 /\x3e</\x74d\x3e\n\t\t\t\x3c\x74d\x3e{$this->getLicenseKeyStatusHtml()}</td\x3e\n\t\t\x3c/\x74r>";}public function isLatestVersionInstalled(){${${"G\x4c\x4fB\x41\x4c\x53"}["\x68\x67n\x77\x6c\x62\x61\x7a\x76\x71"]}=$this->getModuleVersion();${${"G\x4cO\x42AL\x53"}["\x65\x7a\x6b\x63\x69\x6al\x63\x6b\x6e"]}=$this->getLatestModuleVersion();return!$this->cmpVersions(${${"\x47\x4c\x4fB\x41\x4c\x53"}["\x68\x67\x6ewl\x62az\x76\x71"]},${${"\x47LO\x42A\x4c\x53"}["\x65\x7a\x6b\x63\x69j\x6cc\x6bn"]});}public function getModuleUpdateLink(){return Mage::helper("au\x6br\x6f")->getHelpUrl(self::MODULE_UPDATE_LINK);}protected function cmpVersions($currentVersion,$latestVersion){$cjolidcoq="\x63\x75\x72\x72\x65\x6et\x56\x65rsi\x6f\x6e";${"\x47\x4cO\x42\x41\x4c\x53"}["y\x6cao\x78ad"]="\x6c\x61tes\x74V\x65\x72\x73i\x6f\x6e";return Mage::helper("\x61u\x6br\x6f")->cmpVersions(${$cjolidcoq},${${"\x47L\x4fBA\x4c\x53"}["\x79\x6ca\x6f\x78\x61d"]});}public function getModuleVersion(){return Mage::helper("au\x6br\x6f")->getModuleVersion($this->_setupName);}public function getLatestModuleVersion(){${"G\x4c\x4fB\x41\x4c\x53"}["\x7a\x61\x77\x77kj\x66\x6f\x77\x73y"]="\x6ca\x74\x65\x73\x74\x56\x65\x72\x73\x69\x6f\x6e";${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x74\x78f\x6c\x73h\x62"]="\x6c\x61t\x65\x73t\x56\x65r\x73i\x6f\x6e";${"\x47LO\x42\x41\x4c\x53"}["\x78\x73gq\x6bmq"]="\x6c\x61\x74es\x74\x56\x65r\x73\x69on";${${"\x47\x4c\x4f\x42\x41L\x53"}["\x78s\x67q\x6bmq"]}=Mage::helper("\x61\x75\x6b\x72o")->getGeneralConfig(self::LATEST_VERSION);if(empty(${${"\x47\x4c\x4fB\x41\x4cS"}["\x7a\x61\x77wk\x6a\x66\x6f\x77sy"]}))${${"\x47\x4cO\x42A\x4c\x53"}["t\x78f\x6c\x73\x68\x62"]}=$this->getModuleVersion();return${${"\x47\x4c\x4f\x42\x41LS"}["\x65\x7a\x6bci\x6al\x63\x6bn"]};}public function getModuleLabel(){return$this->__("Ko\x6fngo Co\x6e\x6e\x65\x63tor");}public function validateLicenceBackend(){if(!self::isLicenseValid()){Mage::helper("\x61uk\x72o")->log("Mod\x75\x6c\x65 \x69s \x6eot\x20\x76al\x69d. D\x6f\x6dain\x20\x6e\x61m\x65:".$this->getServerName());Mage::getSingleton("\x61\x64minh\x74m\x6c/\x73essi\x6f\x6e")->addError($this->__("Yo\x75r\x20\x4c\x69cense\x20is \x6e\x6ft\x20\x76\x61\x6cid.\x20").$this->__("\x4d\x6f\x64\x75le\x20\x25\x73 is \x64\x65\x61\x63\x74i\x76a\x74ed\x21",$this->getModuleLabel()));header("\x4c\x6f\x63\x61\x74i\x6fn: ".Mage::getModel("\x61d\x6d\x69n\x68tml/ur\x6c")->addSessionParam()->getUrl("a\x64m\x69nht\x6d\x6c/\x73\x79\x73tem\x5f\x63onf\x69\x67/e\x64\x69\x74",array("se\x63t\x69\x6f\x6e"=>"\x6b\x6f\x6fn\x67o\x5fl\x69\x63e\x6ese_\x61\x6e\x64_\x70l\x75gins")));exit;}return true;}public function checkLicense(){if($this->isLicenseEmpty())return;if(!self::isLicenseValid()){${"\x47\x4c\x4fB\x41\x4c\x53"}["g\x72\x70\x69\x76hv\x6b"]="\x75\x72\x6c";${"\x47L\x4f\x42\x41\x4c\x53"}["a\x74m\x63\x66o\x6a"]="u\x72\x6c";${"\x47L\x4fB\x41\x4cS"}["\x77\x64\x63\x76\x76\x62ko\x6fh"]="mess\x61\x67e";$btpmodn="\x6d\x65\x73\x73\x61\x67\x65";${${"\x47L\x4fBA\x4c\x53"}["grp\x69\x76\x68\x76\x6b"]}=Mage::getModel("a\x64\x6di\x6ehtml/\x75rl")->addSessionParam()->getUrl("\x61\x64mi\x6eh\x74\x6d\x6c/sy\x73t\x65m_c\x6fn\x66\x69g/\x65d\x69t",array("se\x63\x74i\x6fn"=>"koon\x67\x6f_\x6cicen\x73e_a\x6e\x64_\x70l\x75\x67\x69ns"));${${"G\x4c\x4f\x42AL\x53"}["\x6eqm\x62\x75\x74\x7a\x66\x6b\x70\x7a"]}="<a h\x72e\x66=\"".${${"\x47L\x4fB\x41\x4c\x53"}["\x61\x74\x6d\x63\x66o\x6a"]}."\x20\">{$this->__("More details.")}\x3c/\x61>";${"\x47L\x4f\x42\x41L\x53"}["\x64\x77\x64l\x78u\x69pk\x66f\x79"]="me\x73\x73\x61g\x65";Mage::helper("\x61ukr\x6f")->log("\x4d\x6f\x64\x75le is \x6e\x6f\x74 va\x6ci\x64.\x20Do\x6dain n\x61me:".$this->getServerName());${$btpmodn}=$this->__("Y\x6fur\x20\x4c\x69c\x65nse\x20i\x73 \x6eo\x74 v\x61l\x69d\x2e ");if($this->isLicenseKeyT())${${"\x47\x4c\x4fB\x41\x4cS"}["\x77dcvv\x62k\x6f\x6f\x68"]}=$this->__("Yo\x75\x72 F\x52EE Tri\x61\x6c \x70er\x69od\x20exp\x69\x72e\x64 on \x25\x73.\x20",$this->gLD());Mage::getSingleton("\x61\x64\x6di\x6e\x68\x74\x6d\x6c/\x73e\x73s\x69on")->addError(${${"\x47LO\x42\x41L\x53"}["d\x77\x64\x6c\x78\x75\x69\x70\x6bffy"]}.$this->__("\x4dod\x75l\x65 \x25\x73\x20\x69s\x20\x64\x65\x61c\x74\x69va\x74ed\x21",$this->getModuleLabel())."\x20".${${"G\x4c\x4f\x42\x41L\x53"}["n\x71\x6d\x62u\x74\x7afk\x70\x7a"]});}}protected function cmpKeyz($key1,$key2){$zljdufvwc="\x6be\x79\x32";${"\x47\x4c\x4f\x42\x41\x4c\x53"}["mmn\x6ac\x74\x74\x73l"]="\x69";$rnjlsolaorx="l\x65\x6e\x67\x74h";if(!isset(${${"G\x4c\x4f\x42\x41\x4c\x53"}["d\x62\x6b\x63yy\x66l\x6d"]})||!isset(${$zljdufvwc})||empty(${${"\x47\x4c\x4f\x42\x41LS"}["d\x62\x6bcy\x79\x66lm"]}))return false;${${"\x47L\x4fB\x41\x4cS"}["\x6f\x76\x68\x6f\x72\x6c"]}=strlen(${${"\x47\x4c\x4fB\x41\x4c\x53"}["\x64\x62\x6bc\x79y\x66\x6c\x6d"]});if(${${"\x47L\x4f\x42ALS"}["\x6f\x76\x68or\x6c"]}!=strlen(${${"\x47\x4cO\x42AL\x53"}["\x75n\x6bg\x6a\x66\x66"]})){return false;}for(${${"G\x4c\x4f\x42ALS"}["wb\x6cvnr"]}=0;${${"GL\x4fB\x41\x4c\x53"}["\x6dm\x6ej\x63\x74t\x73\x6c"]}<${$rnjlsolaorx};${${"\x47\x4c\x4fB\x41\x4cS"}["\x77b\x6c\x76\x6er"]}+=self::STEP){$vcllizpuebg="i";${"\x47LO\x42\x41\x4c\x53"}["k\x67\x69g\x70p"]="\x69";if(${${"\x47\x4cO\x42A\x4c\x53"}["d\x62kcy\x79\x66\x6cm"]}[${$vcllizpuebg}]!=${${"\x47L\x4f\x42\x41\x4c\x53"}["\x75\x6e\x6b\x67\x6af\x66"]}[${${"\x47\x4c\x4f\x42A\x4cS"}["\x6bg\x69\x67\x70\x70"]}])return false;}return true;}public function getServerName(){$vbinoxycfa="\x73erv\x65\x72\x4e\x61me";${"G\x4c\x4fB\x41L\x53"}["\x79\x74\x6e\x74\x6d\x6e\x68bl"]="\x75\x72\x6c";${"GLO\x42\x41\x4c\x53"}["\x6ej\x6c\x69\x6b\x79ec\x6a\x7a"]="se\x72v\x65\x72\x4e\x61\x6d\x65";$rbwrymmgnv="p\x6f\x72\x74\x44\x65\x6ci\x6d\x69t\x65\x72\x49n\x64\x65x";$pttzdmu="se\x72v\x65\x72Nam\x65";$shnnhbaxiyg="s\x65\x72v\x65\x72\x4e\x61\x6de";${${"\x47L\x4fB\x41L\x53"}["n\x71\x6d\x62\x75tzf\x6b\x70\x7a"]}=Mage::app()->getStore(Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK,true);${$shnnhbaxiyg}=str_replace(self::HTTPS,"",${${"\x47\x4cO\x42\x41LS"}["yt\x6e\x74m\x6e\x68b\x6c"]});$lkjkjptcxy="\x73e\x72v\x65rNa\x6d\x65";${${"\x47\x4cOB\x41L\x53"}["\x6e\x6al\x69ky\x65\x63j\x7a"]}=str_replace(self::HTTP,"",${$pttzdmu});${${"\x47\x4c\x4fB\x41L\x53"}["t\x78\x78\x70\x61c\x66r"]}=strpos(${${"G\x4c\x4f\x42A\x4c\x53"}["v\x63\x64\x76h\x6c"]},self::PORT_DELIMITER);$ftruwdu="\x69\x6e\x64ex";${${"G\x4cO\x42\x41\x4cS"}["u\x76tdy\x7a\x69\x69"]}=strpos(${$lkjkjptcxy},self::URL_DELIMITER);if(${$ftruwdu}!==false&&${$rbwrymmgnv}!=false){$bxoihkspxgc="\x69n\x64\x65x";${"\x47\x4c\x4fB\x41LS"}["d\x65\x6d\x62\x6f\x7a\x68e\x73p"]="\x70\x6f\x72tD\x65limi\x74er\x49n\x64\x65\x78";${"G\x4c\x4f\x42A\x4cS"}["\x61\x67jb\x64y\x69\x73\x71\x6eo\x68"]="\x70ortD\x65l\x69\x6d\x69t\x65rI\x6e\x64\x65\x78";if(${${"\x47LO\x42\x41\x4c\x53"}["\x61\x67\x6a\x62\x64\x79\x69sqn\x6f\x68"]}<${$bxoihkspxgc})${${"G\x4cOB\x41\x4cS"}["\x75\x76\x74\x64y\x7a\x69\x69"]}=${${"\x47\x4c\x4fB\x41L\x53"}["d\x65\x6d\x62oz\x68e\x73\x70"]};}else if(${${"G\x4cO\x42\x41\x4c\x53"}["t\x78x\x70\x61\x63\x66\x72"]}!=false){$ajelefh="in\x64\x65x";${"G\x4c\x4f\x42\x41\x4c\x53"}["\x70\x75\x62\x78quu\x79"]="\x70\x6f\x72tDe\x6cim\x69\x74\x65r\x49\x6e\x64\x65\x78";${$ajelefh}=${${"\x47\x4c\x4f\x42\x41\x4cS"}["\x70u\x62\x78qu\x75\x79"]};}$ccakdsiqmvk="\x69\x6edex";if(${$ccakdsiqmvk}!==false)${$vbinoxycfa}=substr(${${"G\x4cO\x42A\x4c\x53"}["\x76c\x64vh\x6c"]},0,${${"\x47\x4c\x4fB\x41\x4c\x53"}["\x75vt\x64y\x7a\x69\x69"]});return${${"\x47\x4cO\x42\x41L\x53"}["v\x63\x64\x76\x68\x6c"]};}public function getLicenseInvalidMessage(){${"\x47\x4cOB\x41LS"}["\x66\x78\x64\x71d\x64\x68"]="\x64\x61te\x53\x74r\x69n\x67";$ivdkbgvie="\x6ci\x63e\x6e\x73\x65\x4b\x65y";${$ivdkbgvie}=$this->getLicenseKey();$thhhqnfw="\x75rl";${${"\x47\x4cOBA\x4cS"}["s\x6a\x6ei\x65\x72\x6c\x6d"]}=$this->gLD();${$thhhqnfw}=$this->getRenewLicenseUrl(${${"\x47L\x4f\x42\x41LS"}["kb\x72\x61\x6db\x70\x62"]});${${"\x47\x4cO\x42A\x4c\x53"}["\x66\x78\x64\x71\x64d\x68"]}="\x3c\x73\x70\x61n\x20st\x79l\x65\x3d\x27c\x6f\x6cor:r\x65d\x3bfo\x6et-wei\x67h\x74:b\x6f\x6cd\x27\x3e".${${"\x47\x4c\x4f\x42\x41L\x53"}["\x73\x6an\x69\x65r\x6c\x6d"]}."\x3c/\x73\x70\x61\x6e>";${${"GL\x4fB\x41\x4cS"}["\x6c\x70\x64r\x6b\x73w"]}=$this->__("Y\x6fur Su\x70p\x6f\x72t \x26 \x55\x70da\x74e\x73\x20\x70\x65ri\x6f\x64\x20\x68a\x73 \x65x\x70ir\x65d\x20\x6f\x6e \x25\x73.\x20Y\x6fu can\x20\x72\x65n\x65w\x20\x53\x75p\x70\x6f\x72\x74 &\x20\x55p\x64\x61\x74es \x62\x79\x20f\x6f\x6c\x6c\x6f\x77i\x6eg ",${${"\x47\x4c\x4f\x42A\x4cS"}["j\x63e\x6clh\x70\x6ax\x6ev"]});${${"\x47\x4c\x4f\x42\x41\x4cS"}["\x6c\x70\x64\x72\x6b\x73w"]}.="<\x61 \x74\x61\x72g\x65t\x3d\x22\x5f\x62l\x61\x6e\x6b\x22 h\x72\x65\x66\x3d\"".${${"\x47L\x4f\x42\x41\x4c\x53"}["\x6eqmb\x75tz\x66k\x70z"]}."\x22\x3e".$this->__("t\x68is \x6ci\x6e\x6b").".\x3c/a\x3e";return${${"GLOB\x41\x4c\x53"}["l\x70\x64\x72\x6b\x73\x77"]};}protected function getRenewLicenseUrl($licenseKey){${"\x47L\x4f\x42\x41\x4c\x53"}["\x6am\x72\x68\x64\x65\x74\x6f\x77"]="\x6c\x69c\x65ns\x65\x4be\x79";${${"G\x4c\x4f\x42\x41L\x53"}["\x6eqm\x62ut\x7a\x66\x6b\x70\x7a"]}=self::RENEW_LICENSE_URL.str_replace("{{\x6c\x69\x63ens\x65_\x6b\x65\x79}}",${${"\x47L\x4fBAL\x53"}["\x6a\x6drhde\x74\x6f\x77"]},self::RENEW_LICENSE_SUFFIX);$aehrpjox="\x75r\x6c";return${$aehrpjox};}public function getModuleName(){return$this->_getModuleName();}}
2
+ ?>
app/code/community/Nostress/Aukro/Model/Abstract.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for search engines taxonomy
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Abstract extends Mage_Core_Model_Abstract
28
+ {
29
+ const ATTRIBUTE = 'attribute';
30
+ const ATTRIBUTES = 'attributes';
31
+ const CONSTANT = 'constant';
32
+ const SUFFIX = 'suffix';
33
+ const PREFIX = 'prefix';
34
+ const PARENT = 'parent';
35
+ const CHILD = 'child';
36
+ const PARENT_ATTRIBUTE_VALUE = 'eppav';
37
+ const POST_PROCESS = 'postproc';
38
+ const LABEL = 'label';
39
+ const CODE = 'code';
40
+ const TAG = 'tag';
41
+ const VALUE = 'value';
42
+ const LIMIT = 'limit';
43
+ const TYPE = "type";
44
+ const TYPES = "types";
45
+ const XML = 'xml';
46
+ const CSV = 'csv';
47
+ const TXT = 'txt';
48
+ const HTML = 'html';
49
+ const FEED = 'feed';
50
+ const PRODUCT = 'product';
51
+ const GENERAL = 'general';
52
+ const PARAM = 'param';
53
+ const LOCALE = 'locale';
54
+ const LANGUAGE = 'language';
55
+ const COUNTRY = 'country';
56
+ const COUNTRY_CODE = 'country_code';
57
+ const TIME = 'time';
58
+ const DATE = 'date';
59
+ const DATE_TIME = 'date_time';
60
+ const TEXT_ENCLOSURE = 'text_enclosure';
61
+ const COLUMN_DELIMITER = 'column_delimiter';
62
+ const NEWLINE = 'new_line';
63
+ const CUSTOM_ATTRIBUTE = 'custom_attribute';
64
+ const CURRENCY = 'currency';
65
+ const PATH = 'path';
66
+ const DELETE = 'delete';
67
+ const CATEGORY_PATH = 'category_path';
68
+ const CDATA_SECTION_ELEMENTS = "cdata_section_elements";
69
+ const CUSTOM_COLUMNS_HEADER = "custom_columns_header";
70
+ const COLUMNS_HEADER = "columns_header";
71
+ const BASIC_ATTRIBUTES_COLUMNS_HEADER = "basic_attributes_columns_header";
72
+ const DISABLED = 'disabled';
73
+ const CSV_DISABLED = 'csv_disabled';
74
+ const CDATA = 'cdata';
75
+ const COMMON = 'common';
76
+ const CUSTOM_PARAMS = 'custom_params';
77
+
78
+ const POSTPROC_DELIMITER = ",";
79
+
80
+ const STATUS_RUNNING = "RUNNING";
81
+ const STATUS_FINISHED = "FINISHED";
82
+ const STATUS_INTERRUPTED = "INTERRUPTED";
83
+ const STATUS_ERROR = "ERROR";
84
+
85
+ const TYPE_HTML = 'html';
86
+ const TYPE_TEXT = 'txt';
87
+ const TYPE_CSV = 'csv';
88
+ const TYPE_XML = 'xml';
89
+
90
+ const FILE_PATH = "path";
91
+ const FILE_NAME = "filename";
92
+ const FILE_TYPE = "type";
93
+
94
+ const MAGENTO_ATTRIBUTE = 'magento';
95
+
96
+ protected $_helper;
97
+
98
+ protected function helper()
99
+ {
100
+ if(!isset($this->_helper))
101
+ $this->_helper = Mage::helper('aukro');
102
+ return $this->_helper;
103
+ }
104
+
105
+ protected function log($message)
106
+ {
107
+ $this->helper()->log($message);
108
+ }
109
+
110
+ protected function logAndException($message,$param = null)
111
+ {
112
+ $translatedMessage = $this->helper()->__($message,$param);
113
+ $this->helper()->log($translatedMessage);
114
+ Mage::throwException($translatedMessage);
115
+ }
116
+
117
+ protected function getArrayField($index,$array, $default = null)
118
+ {
119
+ if(!is_array($array))
120
+ {
121
+ return $default;
122
+ }
123
+ if(array_key_exists($index,$array))
124
+ {
125
+ return $array[$index];
126
+ }
127
+ else
128
+ return $default;
129
+ }
130
+
131
+ protected function isDebugMode()
132
+ {
133
+ return $this->helper()->isDebugMode();
134
+ }
135
+
136
+ protected function _getSession() {
137
+ return Mage::getSingleton('adminhtml/session');
138
+ }
139
+ }
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Form/Shipping.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Backend for serialized array data
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Pdfprintouts
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Form_Shipping extends Mage_Adminhtml_Model_System_Config_Backend_Serialized
28
+ {
29
+ /**
30
+ * Unset array element with '__empty' key and save data to proper table
31
+ *
32
+ */
33
+ protected function _beforeSave()
34
+ {
35
+ $groups = $this->getGroups();
36
+ $shippingPricing = $groups['shipping_pricing'];
37
+ if (is_array($value)) {
38
+ unset($value['__empty']);
39
+ }
40
+
41
+ $shippingModel = Mage::getModel('aukro/shipping_pricing');
42
+
43
+ foreach ($shippingPricing as $key => $shipping) {
44
+ $dbData['id'] = $key;
45
+
46
+ if ($shipping['first'] == '')
47
+ $dbData['first'] = null;
48
+ else
49
+ $dbData['first'] = $shipping['first'];
50
+
51
+ if ($shipping['next'] == '')
52
+ $dbData['next'] = null;
53
+ else
54
+ $dbData['next'] = $shipping['next'];
55
+
56
+ if ($shipping['amount'] == '')
57
+ $dbData['amount'] = null;
58
+ else
59
+ $dbData['amount'] = $shipping['amount'];
60
+
61
+ $shippingModel->setData($dbData);
62
+ $shippingModel->save();
63
+ }
64
+
65
+ }
66
+ }
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Abstract.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract extends Mage_Eav_Model_Entity_Attribute_Source_Boolean
26
+ {
27
+ public function toOptionArray()
28
+ {
29
+ return $this->getAllOptions();
30
+ }
31
+
32
+ public function getOptions() {
33
+ foreach ($this->toOptionArray() as $option) {
34
+ $options[$option['value']] = $option['label'];
35
+ }
36
+ return $options;
37
+ }
38
+
39
+ public function valueToLabel($value) {
40
+ $options = $this->toOptionArray();
41
+ foreach ($options as $option) {
42
+ if ($option['value'] == $value) {
43
+ return $option['label'];
44
+ }
45
+ }
46
+ return;
47
+ }
48
+
49
+ }
50
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Autodisplay.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Autodisplay extends Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract
26
+ {
27
+ public function getAllOptions()
28
+ {
29
+ if( $this->_options === null) {
30
+ $this->_options = array(
31
+ array('value' => -1, 'label'=>Mage::helper('aukro')->__('-- -- -- -- -- -- --')),
32
+ array('value' => 0, 'label'=>Mage::helper('aukro')->__('Not re-expose')),
33
+ array('value' => 1, 'label'=>Mage::helper('aukro')->__('Exposing all')),
34
+ array('value' => 2, 'label'=>Mage::helper('aukro')->__('Exposing only unsold')),
35
+ );
36
+ }
37
+ return $this->_options;
38
+ }
39
+ }
40
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Baseunit.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Baseunit extends Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract
26
+ {
27
+ public function getAllOptions()
28
+ {
29
+ if( $this->_options === null) {
30
+ $this->_options = array(
31
+ array('value' => -1, 'label'=>Mage::helper('aukro')->__('-- -- --')),
32
+ array('value' => 0, 'label'=>Mage::helper('aukro')->__('pieces')),
33
+ array('value' => 1, 'label'=>Mage::helper('aukro')->__('sets')),
34
+ array('value' => 2, 'label'=>Mage::helper('aukro')->__('pairs')),
35
+ );
36
+ }
37
+ return $this->_options;
38
+ }
39
+ }
40
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Country.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Country
26
+ {
27
+ public function toOptionArray()
28
+ {
29
+ $countries = Mage::getModel( 'aukro/webapi_config')->getCountries();
30
+ $configArray = array(
31
+ array('value' => -1, 'label'=>Mage::helper('aukro')->__('-- -- -- -- -- -- --'))
32
+ );
33
+ $temp = array();
34
+ foreach( $countries['countryArray']['item'] as $country) {
35
+ $country = (array) $country;
36
+ $temp[ $country['countryId']] = $country['countryName'];
37
+
38
+ }
39
+ asort( $temp);
40
+ foreach( $temp as $value => $label) {
41
+ $configArray[] = array(
42
+ 'value' => $value,
43
+ 'label' => $label
44
+ );
45
+ }
46
+ return $configArray;
47
+ }
48
+
49
+ }
50
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Deluxeoptions.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Deluxeoptions extends Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract
26
+ {
27
+ public function getAllOptions()
28
+ {
29
+ if( $this->_options === null) {
30
+ $this->_options = array(
31
+ array('value' => 1, 'label'=>Mage::helper('aukro')->__('Bold title')),
32
+ array('value' => 2, 'label'=>Mage::helper('aukro')->__('Highlighting')),
33
+ array('value' => 4, 'label'=>Mage::helper('aukro')->__('Priority listing')),
34
+ array('value' => 8, 'label'=>Mage::helper('aukro')->__('Category page')),
35
+ array('value' => 16, 'label'=>Mage::helper('aukro')->__('Main page')),
36
+ );
37
+ }
38
+ return $this->_options;
39
+ }
40
+ }
41
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Duration.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Duration extends Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract
26
+ {
27
+
28
+ /* (non-PHPdoc)
29
+ * @see Mage_Eav_Model_Entity_Attribute_Source_Interface::getAllOptions()
30
+ */
31
+ public function getAllOptions()
32
+ {
33
+ if( $this->_options === null) {
34
+ $this->_options = array(
35
+ array('value' => -1, 'label'=>Mage::helper('aukro')->__('-- -- --')),
36
+ array('value' => 0, 'label'=>Mage::helper('aukro')->__('3')),
37
+ array('value' => 1, 'label'=>Mage::helper('aukro')->__('5')),
38
+ array('value' => 2, 'label'=>Mage::helper('aukro')->__('7')),
39
+ array('value' => 3, 'label'=>Mage::helper('aukro')->__('10')),
40
+ );
41
+ }
42
+ return $this->_options;
43
+ }
44
+
45
+
46
+
47
+ }
48
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Freeshipping.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Freeshipping extends Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract
26
+ {
27
+ public function getAllOptions()
28
+ {
29
+ if( $this->_options === null) {
30
+ $this->_options = array(
31
+ array('value' => 1, 'label'=>Mage::helper('aukro')->__('Personal')),
32
+ array('value' => 2, 'label'=>Mage::helper('aukro')->__('Email')),
33
+ );
34
+ }
35
+ return $this->_options;
36
+ }
37
+ }
38
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Paymentmethods.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Paymentmethods
26
+ {
27
+ public function toOptionArray()
28
+ {
29
+ return $this->getActivePaymentMethods();
30
+ }
31
+
32
+ public function getActivePaymentMethods()
33
+ {
34
+ $payments = Mage::getSingleton('payment/config')->getActiveMethods();
35
+ $methods = array(array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('--Please Select--')));
36
+ foreach ($payments as $paymentCode=>$paymentModel) {
37
+ $paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
38
+ $methods[$paymentCode] = array(
39
+ 'label' => $paymentTitle,
40
+ 'value' => $paymentCode,
41
+ );
42
+ }
43
+ return $methods;
44
+ }
45
+ }
46
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Paymenttype.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Paymenttype
26
+ {
27
+ public function toOptionArray()
28
+ {
29
+ return array(
30
+ array('value' => 1, 'label'=>Mage::helper('aukro')->__('Bank transfer (in advance)')),
31
+ array('value' => 2, 'label'=>Mage::helper('aukro')->__('Payments via PayU')),
32
+ array('value' => 4, 'label'=>Mage::helper('aukro')->__('Others'))
33
+ );
34
+ }
35
+ }
36
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Productnewused.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Productnewused extends Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract
26
+ {
27
+ public function getAllOptions()
28
+ {
29
+ if( $this->_options === null) {
30
+ $this->_options = array(
31
+ array('value' => -1, 'label'=>Mage::helper('aukro')->__('-- -- --')),
32
+ array('value' => 1, 'label'=>Mage::helper('aukro')->__('New')),
33
+ array('value' => 2, 'label'=>Mage::helper('aukro')->__('Used')),
34
+ );
35
+ }
36
+ return $this->_options;
37
+ }
38
+ }
39
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Region.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Region
26
+ {
27
+ public function toOptionArray()
28
+ {
29
+ $regions = Mage::getModel( 'aukro/webapi_config')->getRegions();
30
+ $configArray = array(
31
+ array('value' => -1, 'label'=>Mage::helper('aukro')->__('-- -- -- -- -- -- --'))
32
+ );
33
+ foreach( $regions['statesInfoArray']['item'] as $region) {
34
+ $region = (array) $region;
35
+ $configArray[] = array(
36
+ 'value' => $region['stateId'],
37
+ 'label' => $region['stateName']
38
+ );
39
+ }
40
+ return $configArray;
41
+ }
42
+
43
+ }
44
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Shippingconditions.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Shippingconditions extends Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract
26
+ {
27
+ public function getAllOptions()
28
+ {
29
+ if( $this->_options === null) {
30
+ $this->_options = array(
31
+ array('value' => 16, 'label'=>Mage::helper('aukro')->__('Other (enter details below - in the section More information on shipment and payment)')),
32
+ array('value' => 32, 'label'=>Mage::helper('aukro')->__('Agrees with sending items abroad')),
33
+ );
34
+ }
35
+ return $this->_options;
36
+ }
37
+ }
38
+
app/code/community/Nostress/Aukro/Model/Adminhtml/System/Config/Source/Shippingpayer.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Adminhtml_System_Config_Source_Shippingpayer extends Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract
26
+ {
27
+ public function getAllOptions()
28
+ {
29
+ if( $this->_options === null) {
30
+ $this->_options = array(
31
+ array('value' => 0, 'label'=>Mage::helper('aukro')->__('Seller')),
32
+ array('value' => 1, 'label'=>Mage::helper('aukro')->__('Buyer')),
33
+ );
34
+ }
35
+ return $this->_options;
36
+ }
37
+ }
38
+
app/code/community/Nostress/Aukro/Model/Cache.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for data cache
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Cache extends Nostress_Aukro_Model_Abstract
28
+ {
29
+ public function reload($storeId = null)
30
+ {
31
+ if(isset($storeId))
32
+ $this->getResource()->reload($storeId);
33
+ else
34
+ {
35
+ $allStores = Mage::app()->getStores();
36
+ foreach ($allStores as $storeId => $store)
37
+ {
38
+ $this->getResource()->reload($storeId);
39
+ }
40
+ }
41
+ }
42
+ }
app/code/community/Nostress/Aukro/Model/Cache/Categories.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for data cache
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Cache_Categories extends Nostress_Aukro_Model_Cache
28
+ {
29
+ public function _construct()
30
+ {
31
+ // Note that the export_id refers to the key field in your database table.
32
+ $this->_init('aukro/cache_categories', 'product_id');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Cache/Categorypath.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for data cache
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Cache_Categorypath extends Nostress_Aukro_Model_Cache
28
+ {
29
+ public function _construct()
30
+ {
31
+ // Note that the export_id refers to the key field in your database table.
32
+ $this->_init('aukro/cache_categorypath', 'category_id');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Cache/Mediagallery.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for data cache
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Cache_Mediagallery extends Nostress_Aukro_Model_Cache
28
+ {
29
+ public function _construct()
30
+ {
31
+ // Note that the export_id refers to the key field in your database table.
32
+ $this->_init('aukro/cache_mediagallery', 'product_id');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Cache/Superattributes.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for data cache
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Cache_Superattributes extends Nostress_Aukro_Model_Cache
28
+ {
29
+ public function _construct()
30
+ {
31
+ // Note that the export_id refers to the key field in your database table.
32
+ $this->_init('aukro/cache_superattributes', 'product_id');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Cache/Tax.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for data cache
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Cache_Tax extends Nostress_Aukro_Model_Cache
28
+ {
29
+ public function _construct()
30
+ {
31
+ // Note that the export_id refers to the key field in your database table.
32
+ $this->_init('aukro/cache_tax', 'tax_class_id');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Categoryproducts.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Categoryproducts extends Mage_Core_Model_Abstract
28
+ {
29
+ protected $_store;
30
+
31
+ public function _construct()
32
+ {
33
+ parent::_construct ();
34
+ $this->_init ( 'aukro/categoryproducts' );
35
+ }
36
+
37
+ public function updateProductAssignment($product)
38
+ {
39
+ $this->removeProductFromAllProfiles($product->getId());
40
+
41
+ $relationsUpdated = false;
42
+ foreach($product->getStoreIds() as $productStoreViewId)
43
+ {
44
+ $profileCollection = Mage::getModel('aukro/profile')->getCollectionByStoreId($productStoreViewId);
45
+ $categoryIds = $product->getCategoryIds();
46
+
47
+ foreach($profileCollection as $profile)
48
+ {
49
+ foreach($categoryIds as $categoryId)
50
+ {
51
+ if($this->isCategoryInProfile($categoryId,$profile->getId()))
52
+ {
53
+ $this->addProductToProfile($product->getId(),$categoryId,$profile->getId());
54
+ $relationsUpdated = true;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ if($relationsUpdated)
60
+ Mage::getSingleton('adminhtml/session')->addSuccess(
61
+ Mage::helper('aukro')->__('The export profile-product relations has been updated.')
62
+ );
63
+ }
64
+
65
+ public function updateCategoryProducts($profileId,$categoryproducts,$storeId)
66
+ {
67
+ $this->_store = Mage::app()->getStore($storeId);
68
+ $catProdParsed = $this->parseCategoryProducts($categoryproducts);
69
+ $this->runQuery($profileId,$catProdParsed,true);
70
+ }
71
+
72
+ public function getExportCategoryProducts($profileId)
73
+ {
74
+ $collection = $this->loadCategoryProducts($profileId);
75
+ return $this->prepareCategoryProductResult($collection);
76
+ }
77
+
78
+ public function getExportCategories($profileId)
79
+ {
80
+ $collection = $this->loadCategoryProducts($profileId);
81
+ return $this->prepareCategoriesArray($collection);
82
+ }
83
+
84
+ public function isCategoryInProfile($categoryId,$profileId)
85
+ {
86
+ return $this->getResource()->isCategoryInProfile($categoryId,$profileId);
87
+ }
88
+
89
+ public function getExportRelationIdsFiltred($profileId)
90
+ {
91
+ $collection = $this->loadCategoryProducts($profileId);
92
+ return $this->prepareFilterRelationIdsCollection($collection);
93
+ }
94
+
95
+ public function getCategoryProductsCount($profileId)
96
+ {
97
+ return $this->getResource()->getProfileRecordCount($profileId);
98
+ }
99
+
100
+ public function addProductToProfile($productId,$categoryId,$profileId)
101
+ {
102
+ $categoryproducts = array($categoryId => array($productId));
103
+ $this->runQuery($profileId,$categoryproducts,false);
104
+ }
105
+
106
+ public function removeProductFromAllProfiles($productId)
107
+ {
108
+ $this->getResource()->deleteRecords(null,$productId);
109
+ }
110
+
111
+ private function prepareFilterRelationIdsCollection($collection)
112
+ {
113
+ $idsArr = array();
114
+ foreach($collection as $item)
115
+ {
116
+ $level = $item->getLevel();
117
+ $productId = $item->getProductId();
118
+
119
+ if(isset($idsArr[$productId]) && $idsArr[$productId]["l"] >= $level)
120
+ {
121
+ continue;
122
+ }
123
+
124
+ $idsArr[$productId]["l"] = $level;
125
+ $idsArr[$productId]["r"] = $item->getId();
126
+ }
127
+
128
+ $result = array();
129
+ foreach($idsArr as $id)
130
+ {
131
+ $result[] = $id["r"];
132
+ }
133
+ return $result;
134
+ }
135
+
136
+ private function prepareCategoriesArray($collection)
137
+ {
138
+ $tmpAr = array();
139
+ foreach($collection as $record)
140
+ {
141
+ $tmpAr[$record->getCategoryId()][] = $record->getProductId();
142
+ }
143
+
144
+ $result = array();
145
+ foreach($tmpAr as $categoryId => $products)
146
+ {
147
+ $result[] = $categoryId;
148
+ }
149
+ return $result;
150
+ }
151
+
152
+ private function prepareCategoryProductResult($collection)
153
+ {
154
+ $tmpAr = array();
155
+ foreach($collection as $record)
156
+ {
157
+ $tmpAr[$record->getCategoryId()][] = $record->getProductId();
158
+ }
159
+
160
+ $result = "";
161
+ $first = true;
162
+ foreach($tmpAr as $categoryId => $products)
163
+ {
164
+ if($first)
165
+ $first = false;
166
+ else
167
+ $result .= "|";
168
+ $result.= $categoryId.",".implode(",",$products);
169
+ }
170
+ return $result;
171
+ }
172
+
173
+ private function loadCategoryProducts($profileId)
174
+ {
175
+ $collection = $this->getCollection()->addFieldToFilter('export_id',$profileId);
176
+ $tableName = $this->getResource()->getTable('catalog/category');
177
+ $collection->getSelect()->join(array('cc'=>$tableName), 'main_table.category_id = cc.entity_id', array('level'));
178
+
179
+ //$q = $collection->getSelect()->__toString();
180
+ $collection->load();
181
+
182
+ return $collection;
183
+ }
184
+
185
+ private function loadCategoryProductsSimple($profileId)
186
+ {
187
+ $collection = $this->getCollection()->addFieldToFilter('export_id',$profileId);
188
+ //$q = $collection->getSelect()->__toString();
189
+ $collection->load();
190
+
191
+ return $collection;
192
+ }
193
+
194
+ private function runQuery($profileId,$categoryproducts,$deleteRecords)
195
+ {
196
+ try
197
+ {
198
+ if($deleteRecords)
199
+ $this->getResource()->deleteRecords($profileId);
200
+ $this->getResource()->insertRecords($profileId,$categoryproducts);
201
+
202
+ }
203
+ catch (Exception $e)
204
+ {
205
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage()
206
+ //Mage::helper('catalogrule')->__('Unable to apply rules.')
207
+ );
208
+ throw $e;
209
+ }
210
+ }
211
+
212
+ private function parseCategoryProducts($categoryproducts)
213
+ {
214
+ $result = Array();
215
+ $groups = explode("|",$categoryproducts);
216
+ foreach($groups as $group)
217
+ {
218
+ $members = explode(",",$group);
219
+ if(count($members) == 0 || $members[0] == "" || !is_numeric($members[0]))
220
+ continue;
221
+ $categoryId = $members[0];
222
+ unset($members[0]);
223
+ $productIds = Array();
224
+
225
+ $deleted = false;
226
+ foreach($members as $productId)
227
+ {
228
+ if($productId == 'deleted')
229
+ {
230
+ $deleted = true;
231
+ break;
232
+ }
233
+ if(is_numeric($productId))
234
+ {
235
+ $productIds[] = $productId;
236
+ }
237
+ }
238
+ if($deleted)
239
+ continue;
240
+
241
+ if(count($productIds) == 0)
242
+ {
243
+ $productIds = $this->loadCategoryproductIds($categoryId);
244
+ }
245
+
246
+ $result[$categoryId] = $productIds;
247
+ }
248
+ return $result;
249
+ }
250
+
251
+ private function loadCategoryproductIds($categoryId)
252
+ {
253
+ $category = Mage::getModel('catalog/category')->load($categoryId);
254
+ $collection = Mage::helper('aukro/data_product')->prepareCategoryProductCollection($this->_store,$category);
255
+ $collection->load();
256
+ return $collection->getAllIds();
257
+ }
258
+ }
app/code/community/Nostress/Aukro/Model/Config/Source/Datetimeformat.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Exports model - source for dropdown menu "Product group size"
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Config_Source_Datetimeformat extends Nostress_Aukro_Model_Abstract
28
+ {
29
+ const STANTDARD = "standard";
30
+ const ISO8601 = "iso8601";
31
+ const ATOM = "atom";
32
+ const SLASH = "slash";
33
+ const COOKIE = "cookie";
34
+ const RFC822 = "rfc822";
35
+ const RSS = "rss";
36
+
37
+ const STANTDARD_DATETIME = "Y-m-d H:i:s";
38
+ const STANTDARD_DATE = "Y-m-d";
39
+ const STANTDARD_TIME = "H:i:s";
40
+
41
+ const STANTDARD_DATETIME_SQL = "%Y-%m-%d %H:%i:%s";
42
+ const STANTDARD_DATE_SQL = "%Y-%m-%d";
43
+ const STANTDARD_TIME_SQL = "%H:%i:%s";
44
+
45
+ protected $_formats = array();
46
+
47
+ public function toOptionArray()
48
+ {
49
+ return array(
50
+ array('value'=> self::STANTDARD, 'label'=>Mage::helper('aukro')->__('Standard (Y-m-d H:i:s)')),
51
+ array('value'=>self::ISO8601, 'label'=>Mage::helper('aukro')->__('ISO 8601 (Y-m-dTH:i:sO)')),
52
+ array('value'=>self::SLASH, 'label'=>Mage::helper('aukro')->__('Slash delimiter (Y/m/d H:M)')),
53
+ array('value'=>self::ATOM, 'label'=>Mage::helper('aukro')->__('ATOM,W3C (Y-m-d\TH:i:sP)')),
54
+ array('value'=>self::COOKIE, 'label'=>Mage::helper('aukro')->__('COOKIE (l, d-M-y H:i:s T)')),
55
+ array('value'=>self::RFC822, 'label'=>Mage::helper('aukro')->__('RFC822 (D, d M Y H:i:s O)')),
56
+ array('value'=>self::RSS, 'label'=>Mage::helper('aukro')->__('RSS (D, d M Y H:i:s O)')),
57
+ );
58
+ }
59
+
60
+ protected function prepareFormats()
61
+ {
62
+ $this->_formats = array(
63
+ self::STANTDARD => array(
64
+ self::PHP => array(self::DATE_TIME => self::STANTDARD_DATETIME,self::DATE => self::STANTDARD_DATE, self::TIME => self::STANTDARD_TIME),
65
+ self::SQL => array(self::DATE_TIME => self::STANTDARD_DATETIME_SQL,self::DATE => self::STANTDARD_DATE_SQL, self::TIME => self::STANTDARD_TIME_SQL),
66
+ ),
67
+ self::ISO8601 => array(
68
+ self::PHP => array(self::DATE_TIME => DateTime::ISO8601,self::DATE => self::STANTDARD_DATE, self::TIME => "H:i:sO"),
69
+ self::SQL => array(self::DATE_TIME => "%Y-%m-%dT%T".$this->getTimeShift(),self::DATE => self::STANTDARD_DATE_SQL, self::TIME => self::STANTDARD_TIME_SQL.$this->getTimeShift()),
70
+ ),
71
+ self::SLASH => array(
72
+ self::PHP => array(self::DATE_TIME => "Y/m/d H:i",self::DATE => "Y/m/d", self::TIME => "H:i"),
73
+ self::SQL => array(self::DATE_TIME => "%Y/%m/%d %H:%i",self::DATE => "%Y/%m/%d", self::TIME => "%H:%i"),
74
+ ),
75
+ self::ATOM => array(
76
+ self::PHP => array(self::DATE_TIME => DateTime::ATOM,self::DATE => self::STANTDARD_DATE, self::TIME => "H:i:sP"),
77
+ self::SQL => array(self::DATE_TIME => "%Y-%m-%dT%T".$this->getTimeShift("P"),self::DATE => self::STANTDARD_DATE_SQL, self::TIME => self::STANTDARD_TIME_SQL.$this->getTimeShift("P")),
78
+ ),
79
+ self::COOKIE => array(
80
+ self::PHP => array(self::DATE_TIME => DateTime::COOKIE,self::DATE => "l, d-M-y", self::TIME => "H:i:s T"),
81
+ self::SQL => array(self::DATE_TIME => "%W, %d-%b-%y %T ".$this->getTimeShift("T"),self::DATE => "%W, %d-%M-%y", self::TIME => self::STANTDARD_TIME_SQL." ".$this->getTimeShift("T")),
82
+ ),
83
+ self::RFC822 => array(
84
+ self::PHP => array(self::DATE_TIME => DateTime::RFC822,self::DATE => "D, d M y", self::TIME => "H:i:s O"),
85
+ self::SQL => array(self::DATE_TIME => "%a, %d %b %y %T ".$this->getTimeShift(),self::DATE => "%a, %d %M %y", self::TIME => self::STANTDARD_TIME_SQL." ".$this->getTimeShift()),
86
+ ),
87
+ self::RSS => array(
88
+ self::PHP => array(self::DATE_TIME => DateTime::RSS,self::DATE => "D, d M Y", self::TIME => "H:i:s O"),
89
+ self::SQL => array(self::DATE_TIME => "%a, %d %b %Y %T ".$this->getTimeShift(),self::DATE => "%a, %d %M %Y", self::TIME => self::STANTDARD_TIME_SQL." ".$this->getTimeShift()),
90
+ ),
91
+ );
92
+ }
93
+
94
+ protected function getTimeShift($format = "O")
95
+ {
96
+ return $this->convertTimestamp(Mage::getModel('core/date')->timestamp(time()),$format);
97
+ }
98
+
99
+ protected function getPhpFormat($format,$type)
100
+ {
101
+ return $this->getFormat($format,$type);
102
+ }
103
+
104
+ public function getSqlFormat($format,$type)
105
+ {
106
+ return $this->getFormat($format,$type,self::SQL);
107
+ }
108
+
109
+ protected function getFormat($format,$type,$platform = self::PHP)
110
+ {
111
+ if(empty($this->_formats))
112
+ $this->prepareFormats();
113
+
114
+ $formatBase = $this->_formats[self::STANTDARD][$platform];
115
+ if(isset($this->_formats[$format][$platform]))
116
+ $formatBase = $this->_formats[$format][$platform];
117
+
118
+ $result = $formatBase[self::DATE_TIME];
119
+ if(isset($formatBase[$type]))
120
+ $result = $formatBase[$type];
121
+ return $result;
122
+ }
123
+
124
+ protected function convertTimestamp($timestamp,$format)
125
+ {
126
+ $time = date(self::STANTDARD_DATETIME, $timestamp);
127
+ if($format == self::STANTDARD_DATETIME)
128
+ return $time;
129
+
130
+ $timezone = $this->getTimezone();
131
+ $datetime = new DateTime($time,$timezone);
132
+ return $datetime->format($format);
133
+ }
134
+
135
+ protected function getTimezone($storeId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID)
136
+ {
137
+ $timezone = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
138
+ return new DateTimeZone($timezone);
139
+ }
140
+
141
+ public function formatDatetime($timestamp,$format=self::STANDARD)
142
+ {
143
+ $phpFormat = $this->getPhpFormat($format,self::DATE_TIME);
144
+ return $this->convertTimestamp($timestamp,$phpFormat);
145
+ }
146
+
147
+ public function formatDate($timestamp,$format=self::STANDARD)
148
+ {
149
+ $phpFormat = $this->getPhpFormat($format,self::DATE);
150
+ return $this->convertTimestamp($timestamp,$phpFormat);
151
+ }
152
+
153
+ public function formatTime($timestamp,$format=self::STANDARD)
154
+ {
155
+ $phpFormat = $this->getPhpFormat($format,self::TIME);
156
+ return $this->convertTimestamp($timestamp,$phpFormat);
157
+ }
158
+ }
159
+ ?>
app/code/community/Nostress/Aukro/Model/Config/Source/Encoding.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Exports model - source for dropdown menu "Product group size"
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Config_Source_Encoding
28
+ {
29
+ const LABEL = 'label';
30
+ const VALUE = 'value';
31
+ const COUNTRY = 'country';
32
+
33
+ protected $_options;
34
+
35
+ public function toOptionArray()
36
+ {
37
+ $options = array('utf-8' => 'utf-8');
38
+ $options[] = array(
39
+ 'label' => 'ISO (Unix/Linux)', 'value' => array(
40
+ array(self::VALUE => 'iso-8859-1',self::LABEL => 'iso-8859-1'),
41
+ array(self::VALUE => 'iso-8859-2' ,self::LABEL => 'iso-8859-2'),
42
+ array(self::VALUE => 'iso-8859-3' ,self::LABEL => 'iso-8859-3'),
43
+ array(self::VALUE => 'iso-8859-4' ,self::LABEL => 'iso-8859-4'),
44
+ array(self::VALUE => 'iso-8859-5' ,self::LABEL => 'iso-8859-5'),
45
+ array(self::VALUE => 'iso-8859-6' ,self::LABEL => 'iso-8859-6'),
46
+ array(self::VALUE => 'iso-8859-7' ,self::LABEL => 'iso-8859-7'),
47
+ array(self::VALUE => 'iso-8859-8' ,self::LABEL => 'iso-8859-8'),
48
+ array(self::VALUE => 'iso-8859-9' ,self::LABEL => 'iso-8859-9'),
49
+ array(self::VALUE => 'iso-8859-10' ,self::LABEL => 'iso-8859-10'),
50
+ array(self::VALUE => 'iso-8859-11' ,self::LABEL => 'iso-8859-11'),
51
+ array(self::VALUE => 'iso-8859-12' ,self::LABEL => 'iso-8859-12'),
52
+ array(self::VALUE => 'iso-8859-13' ,self::LABEL => 'iso-8859-13'),
53
+ array(self::VALUE => 'iso-8859-14' ,self::LABEL => 'iso-8859-14'),
54
+ array(self::VALUE => 'iso-8859-15' ,self::LABEL => 'iso-8859-15'),
55
+ array(self::VALUE => 'iso-8859-16' ,self::LABEL => 'iso-8859-16'),
56
+ ));
57
+ $options[] = array(
58
+ 'label' => 'WINDOWS', 'value' => array(
59
+ array(self::VALUE => 'windows-1250' ,self::LABEL => 'windows-1250 - Central Europe'),
60
+ array(self::VALUE => 'windows-1251' ,self::LABEL => 'windows-1251 - Cyrillic'),
61
+ array(self::VALUE => 'windows-1252' ,self::LABEL => 'windows-1252 - Latin I'),
62
+ array(self::VALUE => 'windows-1253' ,self::LABEL => 'windows-1253 - Greek'),
63
+ array(self::VALUE => 'windows-1254' ,self::LABEL => 'windows-1254 - Turkish'),
64
+ array(self::VALUE => 'windows-1255' ,self::LABEL => 'windows-1255 - Hebrew'),
65
+ array(self::VALUE => 'windows-1256' ,self::LABEL => 'windows-1256 - Arabic'),
66
+ array(self::VALUE => 'windows-1257' ,self::LABEL => 'windows-1257 - Baltic'),
67
+ array(self::VALUE => 'windows-1258' ,self::LABEL => 'windows-1258 - Viet Nam'),
68
+ ));
69
+ $options[] = array(
70
+ 'label' => 'DOS', 'value' => array(
71
+ array(self::VALUE => 'cp437' ,self::LABEL => 'cp437 - Latin US'),
72
+ array(self::VALUE => 'cp737' ,self::LABEL => 'cp737 - Greek'),
73
+ array(self::VALUE => 'cp775' ,self::LABEL => 'cp775 - BaltRim'),
74
+ array(self::VALUE => 'cp850' ,self::LABEL => 'cp850 - Latin1'),
75
+ array(self::VALUE => 'cp852' ,self::LABEL => 'cp852 - Latin2'),
76
+ array(self::VALUE => 'cp855' ,self::LABEL => 'cp855 - Cyrylic'),
77
+ array(self::VALUE => 'cp857' ,self::LABEL => 'cp857 - Turkish'),
78
+ array(self::VALUE => 'cp860' ,self::LABEL => 'cp860 - Portuguese'),
79
+ array(self::VALUE => 'cp861' ,self::LABEL => 'cp861 - Iceland'),
80
+ array(self::VALUE => 'cp862' ,self::LABEL => 'cp862 - Hebrew'),
81
+ array(self::VALUE => 'cp863' ,self::LABEL => 'cp863 - Canada'),
82
+ array(self::VALUE => 'cp864' ,self::LABEL => 'cp864 - Arabic'),
83
+ array(self::VALUE => 'cp865' ,self::LABEL => 'cp865 - Nordic'),
84
+ array(self::VALUE => 'cp866' ,self::LABEL => 'cp866 - Cyrylic Russian (used in IE "Cyrillic (DOS)" )'),
85
+ array(self::VALUE => 'cp869' ,self::LABEL => 'cp869 - Greek2'),
86
+ ));
87
+ $options[] = array(
88
+ 'label' => 'MAC (Apple)', 'value' => array(
89
+ array(self::VALUE => 'x-mac-cyrillic' ,self::LABEL => 'x-mac-cyrillic'),
90
+ array(self::VALUE => 'x-mac-greek' ,self::LABEL => 'x-mac-greek'),
91
+ array(self::VALUE => 'x-mac-icelandic' ,self::LABEL => 'x-mac-icelandic'),
92
+ array(self::VALUE => 'x-mac-ce' ,self::LABEL => 'x-mac-ce'),
93
+ array(self::VALUE => 'x-mac-roman' ,self::LABEL => 'x-mac-roman'),
94
+ ));
95
+ $options[] = array(
96
+ 'label' => 'MISCELLANEOUS', 'value' => array(
97
+ array(self::VALUE => 'gsm0338' ,self::LABEL => 'gsm0338 (ETSI GSM 03.38)'),
98
+ array(self::VALUE => 'cp037' ,self::LABEL => 'cp037'),
99
+ array(self::VALUE => 'cp424' ,self::LABEL => 'cp424'),
100
+ array(self::VALUE => 'cp500' ,self::LABEL => 'cp500'),
101
+ array(self::VALUE => 'cp856' ,self::LABEL => 'cp856'),
102
+ array(self::VALUE => 'cp875' ,self::LABEL => 'cp875'),
103
+ array(self::VALUE => 'cp1006' ,self::LABEL => 'cp1006'),
104
+ array(self::VALUE => 'cp1026' ,self::LABEL => 'cp1026'),
105
+ array(self::VALUE => 'koi8-r' ,self::LABEL => 'koi8-r (Cyrillic)'),
106
+ array(self::VALUE => 'koi8-u' ,self::LABEL => 'koi8-u (Cyrillic Ukrainian)'),
107
+ array(self::VALUE => 'nextstep' ,self::LABEL => 'nextstep'),
108
+ array(self::VALUE => 'us-ascii' ,self::LABEL => 'us-ascii'),
109
+ array(self::VALUE => 'us-ascii-quotes' ,self::LABEL => 'us-ascii-quotes'),
110
+ ));
111
+
112
+ return $options;
113
+ }
114
+ }
115
+ ?>
app/code/community/Nostress/Aukro/Model/Config/Source/Parentschilds.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Exports model - source for dropdown menu "Product group size"
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Config_Source_Parentschilds
28
+ {
29
+ const PARENTS_AND_CHILDS = 0;
30
+ const PARENTS_ONLY = 1;
31
+ const CHILDS_ONLY = 2;
32
+
33
+ public function toOptionArray()
34
+ {
35
+ return array(
36
+ array('value'=> self::PARENTS_AND_CHILDS, 'label'=>Mage::helper('aukro')->__('Parents and childs')),
37
+ array('value'=>self::PARENTS_ONLY, 'label'=>Mage::helper('aukro')->__('Parents only')),
38
+ array('value'=>self::CHILDS_ONLY, 'label'=>Mage::helper('aukro')->__('Childs only')),
39
+ );
40
+ }
41
+ }
42
+ ?>
app/code/community/Nostress/Aukro/Model/Config/Source/Priceformat.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Exports model - source for dropdown menu "Product group size"
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Config_Source_Priceformat
28
+ {
29
+ const STANTDARD = "standard";
30
+ const CURRENCY_SUFFIX = "currency_suffix";
31
+ const CURRENCY_PREFIX = "currency_prefix";
32
+ const SYMBOL_SUFFIX = "symbol_suffix";
33
+ const SYMBOL_PREFIX = "symbol_prefix";
34
+
35
+ public function toOptionArray()
36
+ {
37
+ return array(
38
+ array('value'=> self::STANTDARD, 'label'=>Mage::helper('aukro')->__('Standard e.g. 149.99')),
39
+ array('value'=>self::CURRENCY_SUFFIX, 'label'=>Mage::helper('aukro')->__('Currency suffix e.g. 149.99 USD')),
40
+ array('value'=>self::CURRENCY_PREFIX, 'label'=>Mage::helper('aukro')->__('Currency prefix e.g. USD 149.99')),
41
+ array('value'=>self::SYMBOL_SUFFIX, 'label'=>Mage::helper('aukro')->__('Symbol suffix e.g 149.99 US$')),
42
+ array('value'=>self::SYMBOL_PREFIX, 'label'=>Mage::helper('aukro')->__('Symbol prefix e.g US$ 149.99'))
43
+ );
44
+ }
45
+ }
46
+ ?>
app/code/community/Nostress/Aukro/Model/Config/Source/Productgroupsize.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Exports model - source for dropdown menu "Product group size"
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Config_Source_Productgroupsize
28
+ {
29
+ public function toOptionArray()
30
+ {
31
+ return array(
32
+ /* array('value'=>'1', 'label'=>Mage::helper('aukro')->__('1')),
33
+ array('value'=>'5', 'label'=>Mage::helper('aukro')->__('5')),
34
+ array('value'=>'10', 'label'=>Mage::helper('aukro')->__('10')),
35
+ array('value'=>'30', 'label'=>Mage::helper('aukro')->__('30')),
36
+ array('value'=>'50', 'label'=>Mage::helper('aukro')->__('50')),*/
37
+ array('value'=>'100', 'label'=>Mage::helper('aukro')->__('100')),
38
+ array('value'=>'300', 'label'=>Mage::helper('aukro')->__('300')),
39
+ array('value'=>'500', 'label'=>Mage::helper('aukro')->__('500')),
40
+ array('value'=>'1000', 'label'=>Mage::helper('aukro')->__('1000')),
41
+ array('value'=>'2000', 'label'=>Mage::helper('aukro')->__('2000')),
42
+ array('value'=>'5000', 'label'=>Mage::helper('aukro')->__('5000')),
43
+ array('value'=>'10000', 'label'=>Mage::helper('aukro')->__('10000')),
44
+ array('value'=>'20000', 'label'=>Mage::helper('aukro')->__('20000')),
45
+ // array('value'=>'30000', 'label'=>Mage::helper('aukro')->__('30000')),
46
+ // array('value'=>'40000', 'label'=>Mage::helper('aukro')->__('40000')),
47
+ // array('value'=>'50000', 'label'=>Mage::helper('aukro')->__('50000')),
48
+ );
49
+ }
50
+ }
51
+ ?>
app/code/community/Nostress/Aukro/Model/Config/Source/Stockdependence.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Exports model - source for dropdown menu "Product group size"
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Config_Source_Stockdependence
28
+ {
29
+ const STOCK_AND_QTY = 'stock_and_qty';
30
+ const QTY = 'qty';
31
+ const STOCK = 'stock';
32
+
33
+ public function toOptionArray()
34
+ {
35
+ return array(
36
+ array('value'=> self::STOCK_AND_QTY, 'label'=>Mage::helper('aukro')->__('Stock status & Qty')),
37
+ array('value'=> self::QTY, 'label'=>Mage::helper('aukro')->__('Qty only')),
38
+ array('value'=> self::STOCK, 'label'=>Mage::helper('aukro')->__('Stock status only')),
39
+ );
40
+ }
41
+ }
42
+ ?>
app/code/community/Nostress/Aukro/Model/Data/Loader.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Data loader for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Loader extends Nostress_Aukro_Model_Abstract
27
+ {
28
+ protected $adapter;
29
+ protected $_flatCatalogs = array('product','category');
30
+
31
+ public function _construct()
32
+ {
33
+ // Note that the export_id refers to the key field in your database table.
34
+ $this->_init('aukro/data_loader', 'entity_id');
35
+ }
36
+
37
+ public function init($params)
38
+ {
39
+ $this->setData($params);
40
+ $this->initAdapter();
41
+ }
42
+
43
+ public function loadBatch()
44
+ {
45
+ return $this->adapter->loadBatch();
46
+ }
47
+
48
+ protected function initAdapter()
49
+ {
50
+ $this->adapter = $this->getResource();
51
+ $this->adapter->setStoreId($this->getStoreId());
52
+ $this->adapter->setExportId($this->getExportId());
53
+ $this->adapter->setAttributes($this->getAttributes());
54
+ $this->adapter->setConditions($this->getConditions());
55
+ $this->adapter->setTaxonomyCode($this->getTaxonomyCode());
56
+ $this->adapter->setBatchSize($this->getBatchSize());
57
+
58
+ $this->adapter->init();
59
+ }
60
+
61
+ protected function isFlatEnabled()
62
+ {
63
+ $fc = $this->getFlatCatalogs();
64
+ foreach ($fc as $type)
65
+ {
66
+ $enabled = $this->helper()->isEnabledFlat($this->getStoreId(),$type);
67
+ if(!$enabled)
68
+ {
69
+ throw new Exception($this->helper()->__(ucfirst($type)." flat catalog is disabled"));
70
+ }
71
+ }
72
+ return true;
73
+ }
74
+
75
+ protected function getFlatCatalogs()
76
+ {
77
+ return $this->_flatCatalogs;
78
+ }
79
+ }
app/code/community/Nostress/Aukro/Model/Data/Loader/Product.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Product loader for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Loader_Product extends Nostress_Aukro_Model_Data_Loader
27
+ {
28
+ const PRODUCTS_FILTER = 0;
29
+ const PRODUCTS_ALL = 1;
30
+ const PRODUCTS_FILTER_BY_CATEGORY = 2;
31
+ const PRODUCTS_ALL_BY_CATEGORY = 3;
32
+
33
+
34
+ public function _construct()
35
+ {
36
+ // Note that the export_id refers to the key field in your database table.
37
+ $this->_init('aukro/data_loader_product', 'entity_id');
38
+ }
39
+
40
+ public function initAdapter()
41
+ {
42
+ parent::initAdapter();
43
+
44
+ if($this->getReloadCache())
45
+ $this->reloadCache();
46
+ $this->basePart();
47
+ $this->commonPart();
48
+ //echo $this->adapter->getSelect()->__toString();
49
+ //exit();
50
+ }
51
+
52
+ protected function reloadCache()
53
+ {
54
+ Mage::getModel('aukro/cache_categories')->reload();
55
+ Mage::getModel('aukro/cache_categorypath')->reload();
56
+ Mage::getModel('aukro/cache_superattributes')->reload();
57
+ Mage::getModel('aukro/cache_mediagallery')->reload();
58
+ Mage::getModel('aukro/cache_tax')->reload();
59
+
60
+ }
61
+
62
+ //***************************BASE PART**************************************
63
+ protected function basePart()
64
+ {
65
+ $filterByProducts = $this->getUseProductFilter();
66
+ $groupByCategory = $this->getGroupByCategory();
67
+
68
+ if($filterByProducts && $groupByCategory)
69
+ {
70
+ $this->productsFilterByCategory();
71
+ }
72
+ else if(!$filterByProducts && $groupByCategory)
73
+ {
74
+ $this->productsAllByCategory();
75
+ }
76
+ else if(!$filterByProducts && !$groupByCategory)
77
+ {
78
+ $this->productsAll();
79
+ }
80
+ else
81
+ $this->productsFilter();
82
+ }
83
+
84
+ /**
85
+ * Init sql.
86
+ * Load filteres products from current store.
87
+ */
88
+ protected function productsFilter()
89
+ {
90
+ $this->adapter->joinProductFilter ();
91
+ if ($this->loadAllProductCategoriesCondition())
92
+ {
93
+ //add all category information
94
+ $this->adapter->joinAllCategoriesCache ();
95
+
96
+ }
97
+ else
98
+ {
99
+ $this->adapter->joinCategoryFlat ();
100
+ $this->adapter->joinExportCategoryProductMaxLevel ();
101
+ $this->adapter->joinTaxonomy();
102
+ $this->adapter->joinParentCategory();
103
+ }
104
+
105
+ $this->adapter->groupByProduct ();
106
+ }
107
+
108
+ /**
109
+ * Init sql.
110
+ * Load all products from current store.
111
+ */
112
+ protected function productsAll()
113
+ {
114
+ if ($this->loadAllProductCategoriesCondition())
115
+ {
116
+ //add all category information
117
+ $this->adapter->joinAllCategoriesCache ();
118
+ }
119
+ else
120
+ {
121
+ //add category information
122
+ $this->adapter->joinCategoryProduct ();
123
+ $this->adapter->joinCategoryFlat ();
124
+ $this->adapter->joinProductCategoryMaxLevel();
125
+ //$this->adapter->joinTaxonomy();
126
+ //$this->adapter->joinParentCategory();
127
+ }
128
+ $this->adapter->groupByProduct();
129
+ }
130
+
131
+ /**
132
+ * Init sql.
133
+ * Load all products from current store, order by category.
134
+ */
135
+ protected function productsAllByCategory()
136
+ {
137
+ $this->adapter->joinCategoryProduct ();
138
+ $this->adapter->joinCategoryFlat ();
139
+
140
+ if (!$this->loadAllProductCategoriesCondition())
141
+ {
142
+ //one category per product
143
+ $this->adapter->joinProductCategoryMaxLevel ();
144
+ $this->adapter->groupByProduct ();
145
+ }
146
+ $this->adapter->orderByCategory ();
147
+ $this->adapter->joinTaxonomy();
148
+ $this->adapter->joinParentCategory();
149
+ }
150
+
151
+ /**
152
+ * Init sql.
153
+ * Load filtered products from current store, order by category.
154
+ */
155
+ protected function productsFilterByCategory()
156
+ {
157
+ $this->adapter->joinProductFilter ();
158
+ //add category information
159
+ $this->adapter->joinCategoryFlat ();
160
+
161
+ if(!$this->loadAllProductCategoriesCondition())
162
+ {
163
+ //one category per product
164
+ $this->adapter->joinExportCategoryProductMaxLevel ();
165
+ $this->adapter->groupByProduct ();
166
+ }
167
+ $this->adapter->orderByCategory ();
168
+ $this->adapter->joinTaxonomy();
169
+ $this->adapter->joinParentCategory();
170
+ }
171
+
172
+ protected function loadAllProductCategoriesCondition()
173
+ {
174
+ $allProductCategories = $this->getLoadAllProductCategories();
175
+ return $allProductCategories;
176
+ }
177
+
178
+ //***************************COMMON PART**************************************
179
+
180
+ protected function commonPart()
181
+ {
182
+ $this->adapter->joinProductEntity();
183
+ $this->adapter->joinProductRelation();
184
+ $this->adapter->addTypeCondition();
185
+ $this->visibility();
186
+ $this->adapter->orderByProductType();
187
+
188
+ $this->stock();
189
+ $this->adapter->joinSuperAttributesCache();
190
+ $this->adapter->joinMediaGalleryCache();
191
+ $this->adapter->joinReview();
192
+ $this->price();
193
+ }
194
+
195
+ protected function visibility()
196
+ {
197
+ $this->adapter->addVisibilityCondition();
198
+ }
199
+
200
+ protected function stock()
201
+ {
202
+ $this->adapter->joinStock();
203
+ $this->adapter->addStockCondition();
204
+ }
205
+
206
+ protected function price()
207
+ {
208
+ $this->adapter->joinTax();
209
+ $this->adapter->joinPrice();
210
+ }
211
+ }
app/code/community/Nostress/Aukro/Model/Data/Loader/Product/Aukro.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Aukro loader for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Loader_Product_Aukro extends Nostress_Aukro_Model_Data_Loader_Product
27
+ {
28
+ const PARAM_BATCH_SIZE = 100;
29
+ const DEF_GROUP_BY_CATEGORY = 0;
30
+ const DEF_RELOAD_CACHE = 0;
31
+
32
+ public function _construct()
33
+ {
34
+ // Note that the export_id refers to the key field in your database table.
35
+ $this->_init('aukro/data_loader_product_aukro', 'entity_id');
36
+ }
37
+
38
+ protected function getDefaultParams()
39
+ {
40
+ $params = array();
41
+ $params["export_id"] = -1;
42
+ $params["batch_size"] = self::PARAM_BATCH_SIZE;
43
+ $params["use_product_filter"] = "0";
44
+ $params["group_by_category"] = self::DEF_GROUP_BY_CATEGORY;
45
+ $params["reload_cache"] = self::DEF_RELOAD_CACHE;
46
+ $params["stock_status_dependence"] = "";
47
+ $params['load_all_product_categories'] = "0";
48
+ $params['conditions'] = array(
49
+ Nostress_Aukro_Helper_Data_Loader::CONDITION_EXPORT_OUT_OF_STOCK => 1
50
+ );
51
+ return $params;
52
+ }
53
+
54
+ public function init($params,$mergeWithDefault = false)
55
+ {
56
+ $defParams = $this->getDefaultParams();
57
+ $params = array_merge($defParams,$params);
58
+ parent::init($params);
59
+ }
60
+
61
+ public function getGridCollection($params)
62
+ {
63
+ $adapterParams = $this->getDefaultParams();
64
+ $adapterParams = array_merge($adapterParams,$params);
65
+ $this->init($adapterParams);
66
+
67
+ $collection = $this->getCollection();
68
+ $select = $this->adapter->getSelect($params);
69
+ $collection->setSelect($select,$adapterParams["store_id"]);
70
+
71
+ return $collection;
72
+ }
73
+
74
+ protected function loadAllProducts()
75
+ {
76
+ $products = array();
77
+ while(count($batch = $this->loadBatch()) > 0)
78
+ {
79
+ $products += $batch;
80
+ }
81
+ return $products;
82
+ }
83
+
84
+ protected function visibility()
85
+ {
86
+ //$this->adapter->addVisibilityCondition();
87
+ }
88
+
89
+ protected function commonPart()
90
+ {
91
+ parent::commonPart();
92
+ $this->adapter->joinCategoryMapping();
93
+ $this->adapter->addProductIdsCondition();
94
+ }
95
+ }
app/code/community/Nostress/Aukro/Model/Data/Reader.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Reader extends Nostress_Aukro_Model_Abstract
27
+ {
28
+ const SOURCE_ENCODING = "src_encoding";
29
+ const DESTINATION_ENCODING = "dst_encoding";
30
+ const SKIP_FIRST = "skip_first_record";
31
+ const HTTP_PREFIX = 'http';
32
+ const TMP_FILES_DIR = 'var/xmlFeedExpot/';
33
+
34
+ protected $_reader;
35
+ protected $_fileType;
36
+ protected $_filePath = "";
37
+ protected $_tmpFilePath = "";
38
+ protected $_params;
39
+ protected $_dstEncoding = 'utf-8';
40
+ protected $_srcEncoding = null;
41
+ protected $_skipFirst = 0;
42
+
43
+ public function getFileContent($params)
44
+ {
45
+ $this->openFile($params);
46
+ $result = $this->getAllRecords();
47
+ $this->closeFile();
48
+ return $result;
49
+ }
50
+
51
+ public function openFile($params)
52
+ {
53
+ $this->initParams($params);
54
+
55
+ $result = false;
56
+ switch($this->_fileType)
57
+ {
58
+ case self::TYPE_CSV:
59
+ $this->_reader = Mage::getModel('aukro/data_reader_abstract_csv');
60
+ break;
61
+ case self::TYPE_TEXT:
62
+ $this->_reader = Mage::getModel('aukro/data_reader_abstract_text');
63
+ break;
64
+ default:
65
+ $this->_reader = Mage::getModel('aukro/data_reader_abstract');
66
+ break;
67
+ }
68
+ $this->downloadFileToLocalDirectory();
69
+ return $this->_reader->openFile($this->_tmpFilePath,$params);
70
+ }
71
+
72
+ public function getAllRecords()
73
+ {
74
+ $result = array();
75
+ $record = $this->getRecord();
76
+
77
+ if($this->_skipFirst)
78
+ $record = $this->getRecord();
79
+
80
+ while($record != false)
81
+ {
82
+ $result[] = $record;
83
+ $record = $this->getRecord();
84
+ }
85
+ return $result;
86
+ }
87
+
88
+ protected function initParams($params)
89
+ {
90
+ $this->initParam($this->_dstEncoding,$params[self::DESTINATION_ENCODING]);
91
+ $this->initParam($this->_srcEncoding,$params[self::SOURCE_ENCODING]);
92
+ $this->initParam($this->_fileType,$params[self::FILE_TYPE]);
93
+ $path = $this->initFilePath($params[self::FILE_PATH]);
94
+ $this->initParam($this->_filePath,$path.$params[self::FILE_NAME]);
95
+ $this->initParam($this->_tmpFilePath,self::TMP_FILES_DIR.$params[self::FILE_NAME]);
96
+ $this->initParam($this->_skipFirst,$params[self::SKIP_FIRST]);
97
+ }
98
+
99
+ protected function initFilePath($path)
100
+ {
101
+ $path = (string)$this->helper()->getGeneralConfig(Nostress_Aukro_Helper_Data::PARAM_TAXONOMY_SOURCE_URL).$path;
102
+ return $path;
103
+ }
104
+
105
+ protected function initParam(&$param,$value)
106
+ {
107
+ if(isset($value) && !empty($value))
108
+ $param = $value;
109
+ }
110
+
111
+ public function getRecord()
112
+ {
113
+ if(isset($this->_reader))
114
+ return $this->helper()->changeEncoding($this->_dstEncoding,$this->_reader->getRecord(),$this->_srcEncoding) ;
115
+ else
116
+ return false;
117
+ }
118
+
119
+ protected function closeFile()
120
+ {
121
+ if(isset($this->_reader))
122
+ {
123
+ $result = $this->_reader->closeFile();
124
+ $this->helper()->deleteFile($this->_tmpFilePath);
125
+ return $result;
126
+ }
127
+ else
128
+ return false;
129
+ }
130
+
131
+ protected function downloadFileToLocalDirectory()
132
+ {
133
+ $this->helper()->createDirectory(self::TMP_FILES_DIR);
134
+ $this->helper()->downloadFile($this->_filePath,$this->_tmpFilePath);
135
+ }
136
+
137
+ protected function helper()
138
+ {
139
+ return Mage::helper('aukro');
140
+ }
141
+ }
app/code/community/Nostress/Aukro/Model/Data/Reader/Abstract.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Reader_Abstract
27
+ {
28
+ protected $_recordField = array();
29
+ protected $_handle;
30
+
31
+ public function openFile($filename,$params = array())
32
+ {
33
+ $this->initParams($params);
34
+ if (($this->_handle = fopen($filename, "r")) !== FALSE)
35
+ {
36
+ return true;
37
+ }
38
+ else
39
+ {
40
+ throw new Exception("Can't open file {$filename} for reading.");
41
+ return false;
42
+ }
43
+ }
44
+
45
+ protected function initParams($params)
46
+ {
47
+
48
+ }
49
+ /**
50
+ * Returns one record from file as array
51
+ */
52
+ public function getRecord()
53
+ {
54
+ if(isset($this->_handle))
55
+ return fgets($this->_handle);
56
+ else
57
+ return false;
58
+ }
59
+
60
+ public function closeFile()
61
+ {
62
+ fclose($this->_handle);
63
+ }
64
+ }
app/code/community/Nostress/Aukro/Model/Data/Reader/Abstract/Csv.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Reader_Abstract_Csv extends Nostress_Aukro_Model_Data_Reader_Abstract_Text
27
+ {
28
+ const DELIMITER = 'delimiter';
29
+ protected $_columnDelimiter = "|";
30
+
31
+ protected function initParam(&$param,$value)
32
+ {
33
+ if(isset($value) && !empty($value))
34
+ $param = $value;
35
+ }
36
+
37
+ protected function initParams($params)
38
+ {
39
+ $this->initParam($this->_columnDelimiter,$params[self::DELIMITER]);
40
+ }
41
+ /**
42
+ * Returns one record from file as array
43
+ */
44
+ public function getRecord()
45
+ {
46
+ if(isset($this->_handle))
47
+ return fgetcsv($this->_handle,null,$this->_columnDelimiter);
48
+ else
49
+ return false;
50
+ }
51
+ }
app/code/community/Nostress/Aukro/Model/Data/Reader/Abstract/Text.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Reader_Abstract_Text extends Nostress_Aukro_Model_Data_Reader_Abstract
27
+ {
28
+ }
app/code/community/Nostress/Aukro/Model/Data/Transformation.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Data loader for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Transformation extends Nostress_Aukro_Model_Abstract
27
+ {
28
+ protected $_dstData;
29
+
30
+ public function init($params)
31
+ {
32
+ $this->setData($params);
33
+ }
34
+
35
+ public function getResult($allData = false)
36
+ {
37
+ return $this->_dstData;
38
+ }
39
+
40
+ protected function appendResult($string)
41
+ {
42
+ $this->_dstData .= $string;
43
+ }
44
+
45
+ public function transform($data)
46
+ {
47
+ $this->check($data);
48
+ }
49
+
50
+ protected function checkSrc($data)
51
+ {
52
+ if(!isset($data) || empty($data))
53
+ return false;
54
+ return true;
55
+ }
56
+
57
+ }
app/code/community/Nostress/Aukro/Model/Data/Transformation/Xml.php ADDED
@@ -0,0 +1,723 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Xml data transformation for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Transformation_Xml extends Nostress_Aukro_Model_Data_Transformation
27
+ {
28
+ const GROUP_ID = 'group_id';
29
+ const IS_CHILD = 'is_child';
30
+
31
+ const MAIN_TAG = 'items';
32
+ const ITEM_TAG = 'item';
33
+ const BASIC_ATTRIBUTES = 'attributes';
34
+ const MULTI_ATTRIBUTES = 'multi_attributes';
35
+ const CUSTOM_ATTRIBUTES = 'custom_attributes';
36
+ const TRANSLATIONS = 'translate';
37
+
38
+ const EMPTY_VALUE = "";
39
+
40
+ const DEF_TEXT_SEPARATOR = '"';
41
+ const DEF_SETUP_SEPARATOR = ',';
42
+ const DEF_DECIMAL_DELIMITER = '.';
43
+ const DEF_CATEGORY_DELIMITER = "/";
44
+
45
+ const SUPER_ATTRIBUTES = 'super_attributes';
46
+ const MEDIA_GALLERY = 'media_gallery';
47
+ const CATEGORIES = 'categories';
48
+
49
+ const PP_CDATA = 'cdata';
50
+ const PP_ENCODE_SPECIAL = 'encode_special_chars';
51
+ const PP_DECODE_SPECIAL = 'decode_special_chars';
52
+ const PP_REMOVE_EOL = 'remove_eol';
53
+ const PP_STRIP_TAGS = 'strip_tags';
54
+ const PP_DELETE_SPACES = 'delete_spaces';
55
+
56
+ protected $_store;
57
+ protected $_parent;
58
+ protected $_groupId;
59
+ protected $_row;
60
+ protected $_multiAttributes = array(self::SUPER_ATTRIBUTES=>"attribute",self::MEDIA_GALLERY=>"image",self::CATEGORIES=>"category");
61
+ protected $_itemData = "";
62
+ protected $_multiAttributesMap;
63
+ protected $_customAttributesMap;
64
+ protected $changeDecimalDelimiter = false;
65
+ protected $_postProcessFunctions = array( self::PP_CDATA => "Character data",
66
+ self::PP_ENCODE_SPECIAL=>"Encode special characters",
67
+ self::PP_DECODE_SPECIAL=>"Decode special characters",
68
+ self::PP_REMOVE_EOL=>"Remove end of lines",
69
+ self::PP_STRIP_TAGS=>"Strip tags",
70
+ self::PP_DELETE_SPACES=>"Delete spaces"
71
+ );
72
+
73
+ public function init($params)
74
+ {
75
+ parent::init($params);
76
+ $this->preprocessAttributes();
77
+ $this->initAttributeMaps();
78
+ $this->initDecimalDelimiter();
79
+ }
80
+
81
+ public function transform($data)
82
+ {
83
+ parent::transform($data);
84
+ $saveItemData = false;
85
+
86
+ foreach($data as $row)
87
+ {
88
+ $this->setRow($row);
89
+ $isChild = $this->getValue(self::IS_CHILD);
90
+ if(!$isChild)
91
+ {
92
+ $saveItemData = true;
93
+ }
94
+
95
+ if($this->getChildsOnly() && !$isChild && !$this->isSimpleProduct())
96
+ {
97
+ continue;
98
+ }
99
+
100
+ if($saveItemData)
101
+ {
102
+ $saveItemData = false;
103
+ $this->saveItemData();
104
+ }
105
+
106
+ $label = $this->getIsChildLabel($isChild);
107
+ $this->addItemData($this->getTag($label));
108
+
109
+ $this->processBasicAttributes($isChild);
110
+ $this->processCustomAttributes($isChild);
111
+ $this->processMultiAttributes();
112
+ $this->addItemData($this->getTag($label,true));
113
+ }
114
+ }
115
+
116
+ protected function initDecimalDelimiter()
117
+ {
118
+ $delimiter = $this->getDecimalDelimiter();
119
+ if($delimiter != self::DEF_DECIMAL_DELIMITER)
120
+ $this->changeDecimalDelimiter = true;
121
+ }
122
+
123
+ protected function initAttributeMaps()
124
+ {
125
+ $map = $this->getAttributes();
126
+
127
+ $this->_multiAttributesMap = array();
128
+ foreach ($map as $key => $attribute)
129
+ {
130
+ //add static attributes
131
+ $attribute = $this->initStaticAttributes($attribute);
132
+
133
+ if(isset($attribute[self::POST_PROCESS]))
134
+ {
135
+ $postprocessFuncitons = $attribute[self::POST_PROCESS];
136
+ if(empty($postprocessFuncitons))
137
+ $postprocessFuncitons = array();
138
+ else
139
+ {
140
+ if(strpos($postprocessFuncitons,self::POSTPROC_DELIMITER) === false)
141
+ $postprocessFuncitons = array($postprocessFuncitons);
142
+ else
143
+ $postprocessFuncitons = explode(self::POSTPROC_DELIMITER,$postprocessFuncitons);
144
+ }
145
+ $attribute[self::POST_PROCESS] = $postprocessFuncitons;
146
+ }
147
+
148
+ //Choose custom attributes
149
+ if($attribute[self::CODE]== self::CUSTOM_ATTRIBUTE)
150
+ {
151
+ $info = $this->helper()->getAttributeInfo($attribute[self::MAGENTO_ATTRIBUTE]);
152
+ $label = $this->helper()->getAttributeLabel($info,$this->getStoreId());
153
+
154
+ $attribute[self::TAG] = $attribute[self::LABEL];
155
+ if(!empty($label))
156
+ $attribute[self::LABEL] = $label;
157
+
158
+ $this->_customAttributesMap[] = $attribute;
159
+ unset($map[$key]);
160
+ continue;
161
+ }
162
+
163
+ //Remove multi attributes from attribute map
164
+ if(array_key_exists($attribute[self::MAGENTO_ATTRIBUTE],$this->_multiAttributes))
165
+ {
166
+ $this->_multiAttributesMap[] = $attribute;
167
+ unset($map[$key]);
168
+ continue;
169
+ }
170
+ $map[$key] = $attribute;
171
+ }
172
+ //Format price
173
+ $map = $this->preparePriceFields($map);
174
+ $this->setAttributes($map);
175
+ }
176
+
177
+ protected function initStaticAttributes($attribute)
178
+ {
179
+ $resetMagentoAttribute = true;
180
+ switch($attribute[self::MAGENTO_ATTRIBUTE])
181
+ {
182
+ //Add currency into feed
183
+ case self::CURRENCY:
184
+ $attribute[self::CONSTANT] .= $this->helper()->getStoreCurrency($this->getStoreId());
185
+ break;
186
+ case self::COUNTRY_CODE:
187
+ $attribute[self::CONSTANT] .= $this->helper()->getStoreCountry($this->getStore());
188
+ break;
189
+ case self::LOCALE:
190
+ $attribute[self::CONSTANT] .= $this->helper()->getStoreLocale($this->getStore());
191
+ break;
192
+ default:
193
+ $resetMagentoAttribute = false;
194
+ break;
195
+ }
196
+ if($resetMagentoAttribute)
197
+ $attribute[self::MAGENTO_ATTRIBUTE] = "";
198
+ return $attribute;
199
+ }
200
+
201
+ public function getResult($allData = false)
202
+ {
203
+ if($allData)
204
+ $this->saveItemData();
205
+ $result = parent::getResult();
206
+ if(!empty($result))
207
+ $result = $this->getHeader().$result.$this->getTail();
208
+ return $result;
209
+ }
210
+
211
+ protected function preProcessRow($row)
212
+ {
213
+ if(array_key_exists("stock_status",$row))
214
+ {
215
+ $stockStatus = $row["stock_status"];
216
+ $attribute = '';
217
+ $stockStatus = $this->getStockStatusValue($stockStatus,$attribute);
218
+ if(!empty($attribute))
219
+ $stockStatus = $row[$attribute];
220
+ $row["stock_status"] = $stockStatus;
221
+
222
+ }
223
+ return $row;
224
+ }
225
+
226
+ protected function getStockStatusValue($status,&$attribute)
227
+ {
228
+ $stock = $this->getStock();
229
+ if($status)
230
+ $status = $stock["yes"];
231
+ else
232
+ {
233
+ if(empty($stock["availability"]))
234
+ $status = $stock["no"];
235
+ else
236
+ $attribute = $stock["availability"];
237
+ }
238
+ return $status;
239
+ }
240
+
241
+ protected function check($data)
242
+ {
243
+ if(!parent::checkSrc($data) || !is_array($data))
244
+ {
245
+ $message = $this->logAndException("Xml transformation source data are wrong.");
246
+ }
247
+ return true;
248
+ }
249
+
250
+ protected function preprocessAttributes()
251
+ {
252
+ $attributes = $this->getAttributes();
253
+ $attributes = $this->getArrayField(self::ATTRIBUTE,$attributes,array());
254
+ if(empty($attributes))
255
+ $this->logAndException("Missing feed attributes configuration.");
256
+ $this->setAttributes($attributes);
257
+ }
258
+
259
+ protected function setRow($row)
260
+ {
261
+ $row = $this->preProcessRow($row);
262
+
263
+ if(array_key_exists(self::GROUP_ID,$row) && $this->setGroupId($row[self::GROUP_ID]))
264
+ {
265
+ $this->setParent($row);
266
+ }
267
+ $this->_row = $row;
268
+ }
269
+
270
+ protected function getAttributeValue($setup,$isChild)
271
+ {
272
+ $magentoAttribute = $setup[self::MAGENTO_ATTRIBUTE];
273
+ $value = $this->getValue($magentoAttribute,$isChild && $setup[self::PARENT_ATTRIBUTE_VALUE]);
274
+
275
+ if( isset($setup[self::TRANSLATIONS]) && is_array($setup[self::TRANSLATIONS])) {
276
+ foreach ($setup[self::TRANSLATIONS] as $translation) {
277
+ if ($translation['from'] == $value)
278
+ $value = $translation['to'];
279
+ }
280
+ }
281
+
282
+ if(empty($value) && $value !== "0")
283
+ $value = $setup[self::CONSTANT];
284
+ if( isset($setup[self::PREFIX])) {
285
+ $value = $setup[self::PREFIX].$value;
286
+ }
287
+ if( isset($setup[self::SUFFIX])) {
288
+ $value .= $setup[self::SUFFIX];
289
+ }
290
+ //prepocess value
291
+ $pp = isset($setup[self::POST_PROCESS]) ? $setup[self::POST_PROCESS] : array();
292
+ $limit = isset( $setup[self::LIMIT]) ? $setup[self::LIMIT] : null;
293
+ $value = $this->postProcess( $value, $pp, $limit);
294
+ return $value;
295
+ }
296
+
297
+ protected function getValue($index,$parent = false)
298
+ {
299
+ if($parent)
300
+ {
301
+ $value = $this->getParentValue($index);
302
+ }
303
+ else
304
+ {
305
+ $value = $this->getArrayValue($index,$this->_row);
306
+ }
307
+
308
+ $value = $this->prepareValue($value,$index);
309
+
310
+ return $value;
311
+ }
312
+
313
+ protected function prepareValue($value,$index)
314
+ {
315
+ if($this->changeDecimalDelimiter && is_numeric($value))
316
+ $value = str_replace(self::DEF_DECIMAL_DELIMITER,$this->getDecimalDelimiter(),$value);
317
+ if($index == self::CATEGORY_PATH)
318
+ {
319
+ $value = str_replace(self::DEF_CATEGORY_DELIMITER, $this->getCategoryPathDelimiter(), $value);
320
+ }
321
+
322
+ return $value;
323
+ }
324
+
325
+ protected function getParentValue($index)
326
+ {
327
+ return $this->getArrayValue($index,$this->_parent);
328
+ }
329
+
330
+ protected function getArrayValue($index,$array)
331
+ {
332
+ if(array_key_exists($index,$array))
333
+ return $array[$index];
334
+ else
335
+ {
336
+ $this->helper()->log($this->helper()->__("Missing input data column %s",$index));
337
+ return self::EMPTY_VALUE;
338
+ }
339
+
340
+ }
341
+
342
+ protected function setGroupId($groupId)
343
+ {
344
+ if($groupId == $this->_groupId)
345
+ return false;
346
+ else
347
+ {
348
+ $this->_groupId = $groupId;
349
+ return true;
350
+ }
351
+ }
352
+
353
+ protected function setParent($row)
354
+ {
355
+ $this->_parent = $row;
356
+ }
357
+
358
+ protected function getHeader()
359
+ {
360
+ return "<?xml version=\"1.0\" encoding=\"{$this->getEncoding()}\" ?><".self::MAIN_TAG.">";
361
+ }
362
+
363
+ protected function getTail()
364
+ {
365
+ return "</".self::MAIN_TAG.">";
366
+ }
367
+
368
+ protected function getElement($name,$value)
369
+ {
370
+ return "<{$name}>{$value}</{$name}>";
371
+ }
372
+
373
+ protected function getTag($name,$end = false)
374
+ {
375
+ if($end)
376
+ return "</{$name}>";
377
+ else
378
+ {
379
+ return "<{$name}>";
380
+ }
381
+ }
382
+
383
+ protected function addItemData($string)
384
+ {
385
+ $this->_itemData .= $string;
386
+ }
387
+
388
+ protected function saveItemData()
389
+ {
390
+ if(empty($this->_itemData))
391
+ return;
392
+ $element = $this->getElement(self::ITEM_TAG,$this->_itemData);
393
+ $this->appendResult($element);
394
+ $this->_itemData = "";
395
+ }
396
+
397
+ protected function postProcess($value,$setup = null,$limit = null)
398
+ {
399
+ if(empty($value))
400
+ return $value;
401
+
402
+
403
+ if(empty($setup) || !is_array($setup))
404
+ {
405
+ $setup = array();
406
+ }
407
+
408
+ $value = $this->ppLimit($value,$limit);
409
+ foreach ($setup as $item)
410
+ {
411
+ switch($item)
412
+ {
413
+ case self::PP_ENCODE_SPECIAL:
414
+ $value = $this->ppEncodeSpecial($value);
415
+ break;
416
+ case self::PP_DECODE_SPECIAL:
417
+ $value = $this->ppDecodeSpecial($value);
418
+ break;
419
+ case self::PP_STRIP_TAGS:
420
+ $value = $this->ppStripTags($value);
421
+ break;
422
+ case self::PP_DELETE_SPACES:
423
+ $value = $this->ppDeleteSpaces($value);
424
+ break;
425
+ case self::PP_REMOVE_EOL:
426
+ $value = $this->ppRemoveEol($value);
427
+ break;
428
+ }
429
+ }
430
+ $value = $this->ppFile($value,in_array(self::PP_CDATA,$setup));
431
+ $value = $this->ppDefault($value);
432
+ return $value;
433
+ }
434
+
435
+ protected function ppEncodeSpecial($value)
436
+ {
437
+ return htmlspecialchars($value);
438
+ }
439
+
440
+ protected function ppDecodeSpecial($value)
441
+ {
442
+ return htmlspecialchars_decode($value);
443
+ }
444
+
445
+ protected function ppStripTags($value)
446
+ {
447
+ return strip_tags($value);
448
+ }
449
+
450
+ protected function ppDeleteSpaces($string)
451
+ {
452
+ return preg_replace("/\s+/", '', $string);
453
+ }
454
+
455
+ protected function ppRemoveEol($string)
456
+ {
457
+ return str_replace(array("\r\n", "\r", "\n"), ' ', $string);
458
+ }
459
+
460
+ protected function ppFile($value)
461
+ {
462
+ if($this->getFileType())
463
+ $value = $this->ppXml($value);
464
+ else if($this->getFileType() == self::CSV || $this->getFileType() == self::TXT)
465
+ $value = $this->ppCsv($value);
466
+
467
+ return $value;
468
+ }
469
+
470
+ protected function ppCsv($value)
471
+ {
472
+ $value = str_replace(self::DEF_TEXT_SEPARATOR,"&quot;",$value);
473
+ return $value;
474
+ }
475
+
476
+ protected function ppXml($value)
477
+ {
478
+ return $value;
479
+ //return htmlspecialchars(strip_tags(str_replace(">","> ",$value)));
480
+ }
481
+
482
+ protected function ppDefault($value)
483
+ {
484
+ $value = $this->helper()->changeEncoding($this->getEncoding(),$value);
485
+ $value = $this->getCdataString($value);
486
+ return $value;
487
+ }
488
+
489
+ protected function ppLimit($value,$limit)
490
+ {
491
+ if(isset($limit) && !empty($limit))
492
+ {
493
+ $value = substr($value,0,$limit);
494
+ }
495
+ return $value;
496
+ }
497
+
498
+ protected function getCdataString($input)
499
+ {
500
+ return $this->helper()->getCdataString($input);
501
+ }
502
+
503
+ protected function getIsChildLabel($isChild)
504
+ {
505
+ $label = self::PARENT;
506
+ if($isChild)
507
+ $label = self::CHILD;
508
+ return $label;
509
+ }
510
+
511
+ protected function processMultiAttributes()
512
+ {
513
+ if(!isset($this->_multiAttributes) || empty($this->_multiAttributes))
514
+ return;
515
+ $this->addItemData($this->getTag(self::MULTI_ATTRIBUTES));
516
+ foreach (array_keys($this->_multiAttributes) as $multiAttribute)
517
+ {
518
+ $parent = false;
519
+ if($multiAttribute == self::SUPER_ATTRIBUTES)
520
+ $parent = true;
521
+ $multiAttribValue = $this->getValue($multiAttribute,$parent);
522
+ if(!isset($multiAttribute))
523
+ continue;
524
+
525
+ if(!is_array($multiAttribValue))
526
+ {
527
+ $columns = $this->getMultiAttributeColumns($multiAttribute);
528
+ if(!isset($columns))
529
+ return;
530
+ $multiAttribValue = $this->parseAttribute($multiAttribValue,$columns);
531
+ $this->setParentAttribute($multiAttribute,$multiAttribValue);
532
+ }
533
+
534
+ if($multiAttribute == self::SUPER_ATTRIBUTES)
535
+ $multiAttribValue = $this->processSuperAttributes($multiAttribValue);
536
+
537
+ $string = $this->arrayToXml($multiAttribValue,$multiAttribute);
538
+ $this->addItemData($string);
539
+ }
540
+ $this->addItemData($this->getTag(self::MULTI_ATTRIBUTES,true));
541
+ }
542
+
543
+ protected function getMultiAttributeColumns($attributeName)
544
+ {
545
+ $resourceModelName = "";
546
+ switch ($attributeName)
547
+ {
548
+ case self::SUPER_ATTRIBUTES:
549
+ $resourceModelName = 'aukro/cache_superattributes';
550
+ break;
551
+ case self::CATEGORIES:
552
+ $resourceModelName = 'aukro/cache_categories';
553
+ break;
554
+ case self::MEDIA_GALLERY:
555
+ $resourceModelName = 'aukro/cache_mediagallery';
556
+ break;
557
+ default:
558
+ return null;
559
+ }
560
+
561
+ $resourceModel = Mage::getResourceModel($resourceModelName);
562
+ $columns = array_keys($resourceModel->getCacheColumns());
563
+ return $columns;
564
+ }
565
+
566
+ protected function parseAttribute($attributeValue,$columns)
567
+ {
568
+ $itemSeparator = Nostress_Aukro_Helper_Data_Loader::GROUP_ROW_ITEM_SEPARATOR;
569
+ $rowSeparator = Nostress_Aukro_Helper_Data_Loader::GROUP_ROW_SEPARATOR;
570
+
571
+ $rows = explode($rowSeparator,$attributeValue);
572
+ $result = array();
573
+ foreach ($rows as $key => $row)
574
+ {
575
+ $values = explode($itemSeparator,$row);
576
+ if(count($columns) == count($values))
577
+ $result[$key] = array_combine($columns,$values);
578
+ }
579
+ return $result;
580
+ }
581
+
582
+ protected function setParentAttribute($index,$value)
583
+ {
584
+ if(!$this->getValue(self::IS_CHILD) && isset($this->_parent))
585
+ $this->_parent[$index] = $value;
586
+ }
587
+
588
+ protected function arrayToXml($input,$multiAttribute)
589
+ {
590
+ $result = "";
591
+ foreach ($input as $row)
592
+ {
593
+ $rowText = "";
594
+ foreach($row as $index => $value)
595
+ {
596
+ if(empty($value))
597
+ continue;
598
+ $value = $this->postProcess($value);
599
+ $rowText .= $this->getElement($index,$value);
600
+ }
601
+
602
+ if(!empty($rowText))
603
+ $result .= $this->getElement($this->_multiAttributes[$multiAttribute],$rowText);
604
+ /* $xml = new SimpleXMLElement("<{$this->_multiAttributes[$multiAttribute]}/>");
605
+ array_walk_recursive($row, array ($xml, 'addChild'));
606
+ $result .= $xml->asXML(); */
607
+ }
608
+ if(!empty($result))
609
+ $result = $this->getElement($multiAttribute,$result);
610
+ return $result;
611
+ }
612
+
613
+ protected function processSuperAttributes($attributes)
614
+ {
615
+ if(!$this->getValue(self::IS_CHILD))
616
+ return array();
617
+ foreach ($attributes as $key => $attribute)
618
+ {
619
+ $code = $this->getArrayValue(self::CODE,$attribute);
620
+ $value = $this->getValue($code);
621
+ unset($attributes[$key][self::CODE]);
622
+ $attributes[$key][self::VALUE] = $value;
623
+ }
624
+ return $attributes;
625
+ }
626
+
627
+ protected function isSimpleProduct()
628
+ {
629
+ return $this->getValue(self::TYPE) == "simple";
630
+ }
631
+
632
+ public function getChildsOnly()
633
+ {
634
+ $parentChilds = $this->getParentsChilds();
635
+ if($parentChilds == Nostress_Aukro_Model_Config_Source_Parentschilds::CHILDS_ONLY)
636
+ return true;
637
+ return false;
638
+ }
639
+
640
+ protected function preparePriceFields($map)
641
+ {
642
+ $priceFormat = $this->getPriceFormat();
643
+
644
+ $currency = $this->helper()->getStoreCurrency($this->getStoreId());
645
+ $symbol = $this->helper()->getStoreCurrency($this->getStoreId(),true);
646
+
647
+ foreach ($map as $key => $attributesInfo)
648
+ {
649
+ if(strpos($attributesInfo[self::MAGENTO_ATTRIBUTE],"price") !== false)
650
+ {
651
+ switch($priceFormat)
652
+ {
653
+ case Nostress_Aukro_Model_Config_Source_Priceformat::CURRENCY_SUFFIX:
654
+ $attributesInfo[self::SUFFIX] = " ".$currency.$attributesInfo[self::SUFFIX];
655
+ break;
656
+ case Nostress_Aukro_Model_Config_Source_Priceformat::CURRENCY_PREFIX:
657
+ $attributesInfo[self::PREFIX] .= $currency." ";
658
+ break;
659
+ case Nostress_Aukro_Model_Config_Source_Priceformat::SYMBOL_SUFFIX:
660
+ $attributesInfo[self::SUFFIX] = " ".$symbol.$attributesInfo[self::SUFFIX];
661
+ break;
662
+ case Nostress_Aukro_Model_Config_Source_Priceformat::SYMBOL_PREFIX:
663
+ $attributesInfo[self::PREFIX] .= $symbol." ";
664
+ break;
665
+ default:
666
+ break;
667
+ }
668
+ $map[$key] = $attributesInfo;
669
+ }
670
+ }
671
+ return $map;
672
+ }
673
+
674
+ public function getPostProcessFunctions()
675
+ {
676
+ return $this->_postProcessFunctions;
677
+ }
678
+
679
+ ///////////////////////////////////CUSTOM ATTRIBUTES////////////////////////////////////////
680
+ protected function processBasicAttributes($isChild)
681
+ {
682
+ $map = $this->getAttributes();
683
+ $this->addItemData($this->getTag(self::BASIC_ATTRIBUTES));
684
+ foreach ($map as $attributeInfo)
685
+ {
686
+ $value = $this->getAttributeValue($attributeInfo,$isChild);
687
+ if( $value == "0" || !empty($value))
688
+ $this->addItemData($this->getElement($attributeInfo[self::CODE],$value));
689
+ }
690
+ $this->addItemData($this->getTag(self::BASIC_ATTRIBUTES,true));
691
+ }
692
+
693
+ ///////////////////////////////////CUSTOM ATTRIBUTES////////////////////////////////////////
694
+
695
+ protected function processCustomAttributes($isChild)
696
+ {
697
+ if(!isset($this->_customAttributesMap) || empty($this->_customAttributesMap))
698
+ return;
699
+
700
+ $this->addItemData($this->getTag(self::CUSTOM_ATTRIBUTES));
701
+ foreach ($this->_customAttributesMap as $attributeInfo)
702
+ {
703
+ $value = $this->getAttributeValue($attributeInfo,$isChild);
704
+ if(empty($value))
705
+ continue;
706
+
707
+ $this->addItemData($this->getTag(self::ATTRIBUTE));
708
+ $this->addItemData($this->getElement(self::VALUE,$value));
709
+ $this->addItemData($this->getElement(self::TAG,$attributeInfo[self::TAG]));
710
+ $this->addItemData($this->getElement(self::LABEL,$attributeInfo[self::LABEL]));
711
+ $this->addItemData($this->getTag(self::ATTRIBUTE,true));
712
+ }
713
+ $this->addItemData($this->getTag(self::CUSTOM_ATTRIBUTES,true));
714
+ }
715
+
716
+ ///////////////////////////////////COMMON FUNCTIONS/////////////////////////////////
717
+ protected function getStore()
718
+ {
719
+ if(!isset($this->_store))
720
+ $this->_store = Mage::app()->getStore($this->getStoreId);
721
+ return $this->_store;
722
+ }
723
+ }
app/code/community/Nostress/Aukro/Model/Data/Transformation/Xml/Array.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Array data transformation for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Transformation_Xml_Array extends Nostress_Aukro_Model_Data_Transformation_Xml
27
+ {
28
+ public function getResult($allData = false)
29
+ {
30
+ $data = parent::getResult($allData);
31
+ $xmlNode = $this->initData($data);
32
+ $array = $this->helper()->XMLnodeToArray($xmlNode);
33
+ $items = $this->getItems($array);
34
+ // var_dump($items);
35
+ // exit();
36
+
37
+ return $items;
38
+ }
39
+
40
+ protected function initData($data)
41
+ {
42
+ return simplexml_load_string($data);
43
+ }
44
+
45
+ protected function getItems($data,$mergeParentChild = false)
46
+ {
47
+ $items = array();
48
+ if(isset($data["item"]))
49
+ {
50
+ $items = $data["item"];
51
+ }
52
+ else
53
+ $this->logAndException("Wrong data for upload to Aukro!");
54
+ return $items;
55
+ }
56
+
57
+ protected function preprocessAttributes()
58
+ {
59
+ $attributes = $this->getAttributes();
60
+ //$attributes = $this->getArrayField(self::ATTRIBUTE,$attributes,array());
61
+ if(empty($attributes))
62
+ $this->logAndException("Missing feed attributes configuration.");
63
+ $this->setAttributes($attributes);
64
+ }
65
+
66
+ protected function getHeader()
67
+ {
68
+ return "<?xml version=\"1.0\" encoding=\"{$this->getEncoding()}\" ?><".self::MAIN_TAG.">";
69
+ }
70
+
71
+ protected function getIsChildLabel($isChild)
72
+ {
73
+ return self::ITEM_TAG;
74
+ }
75
+
76
+ protected function saveItemData()
77
+ {
78
+ if(empty($this->_itemData))
79
+ return;
80
+ $this->appendResult($this->_itemData);
81
+ $this->_itemData = "";
82
+ }
83
+ }
app/code/community/Nostress/Aukro/Model/Data/Transformation/Xslt.php ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Xslt data transformation for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Transformation_Xslt extends Nostress_Aukro_Model_Data_Transformation
27
+ {
28
+ const ENCODING_TAG = '{{encoding}}';
29
+ const CDATA_SECTION_TAG = '{{cdata_section_elements}}';
30
+ const CUSTOM_COLUMNS_HEADER_TAG = "{{custom_columns_header}}";
31
+ const COLUMNS_HEADER_TAG = "{{columns_header}}";
32
+ const CSV_CUSTOM_ATTRIBUTES_TAG = "{{csv_custom_attributes}}";
33
+ const CSV_CUSTOM_ATTRIBUTES_TEMPLATE = '<xsl:call-template name="column_param"><xsl:with-param name="value" select="attribute[{{i}}]/value"/></xsl:call-template>';
34
+ const INDEX_TAG = "{{i}}";
35
+
36
+ const INPUT_FILE = 'var/input.xml';
37
+ const XSLT_FILE = 'var/trans.xsl';
38
+ const DEF_ELEMENTS_DELIMITER = " ";
39
+ const DEF_COLUMNS_DELIMITER = "|";
40
+
41
+ public function transform($data)
42
+ {
43
+ parent::transform($data);
44
+
45
+ $xp = $this->initProcessor();
46
+ $data = $this->initData($data);
47
+ $this->_transform($xp,$data);
48
+ }
49
+
50
+ protected function _transform($xp,$data)
51
+ {
52
+ $result = "";
53
+ $result = $xp->transformToXML($data);
54
+
55
+ if(!$result)
56
+ {
57
+ $errMessage = "";
58
+ $e = libxml_get_last_error();
59
+ if($e)
60
+ {
61
+ $errMessage = $e->message;
62
+ }
63
+ $this->logAndException('XSL transformation failed.', $errMessage);
64
+ }
65
+ $this->appendResult($result);
66
+ }
67
+
68
+ protected function initProcessor()
69
+ {
70
+ if(!class_exists("XsltProcessor"))
71
+ $this->logAndException("Can't load class XsltProcessor. Please install/enable XSLT transformation library to/on your server.");
72
+ $xp = new XsltProcessor();
73
+ // create a DOM document and load the XSL stylesheet
74
+ $xsl = new DomDocument;
75
+ $xsl->loadXML($this->getXslt());
76
+
77
+ if($this->isDebugMode())
78
+ {
79
+ file_put_contents(self::XSLT_FILE,$this->getXslt());
80
+ }
81
+
82
+ // import the XSL styelsheet into the XSLT process
83
+ $xp->importStylesheet($xsl);
84
+ $xp = $this->setProcessorParameters($xp);
85
+ return $xp;
86
+ }
87
+
88
+ protected function initData($data)
89
+ {
90
+ // create a DOM document and load the XML datat
91
+ $xml_doc = new DomDocument;
92
+ if($this->isDebugMode())
93
+ file_put_contents(self::INPUT_FILE,$data);
94
+
95
+ if(!$xml_doc->loadXML($data))
96
+ {
97
+ $this->logAndException("Can't init Xslt transformation data source.");
98
+ }
99
+
100
+ return $xml_doc;
101
+ }
102
+
103
+ protected function check($data)
104
+ {
105
+ if(!parent::checkSrc($data) || empty($data))
106
+ {
107
+ $this->logAndException("Xslt transformation source data are wrong.");
108
+ }
109
+ return true;
110
+ }
111
+
112
+ protected function getXslt()
113
+ {
114
+ $xslt = parent::getXslt();
115
+ $xslt = str_replace(self::ENCODING_TAG,$this->getEncoding(),$xslt);
116
+
117
+ switch($this->getFileType())
118
+ {
119
+ case self::XML:
120
+ $xslt = str_replace(self::CDATA_SECTION_TAG,$this->getCdataSectionElements(),$xslt);
121
+ break;
122
+ case self::CSV:
123
+ case self::TXT:
124
+ $xslt = str_replace(self::CSV_CUSTOM_ATTRIBUTES_TAG,$this->getCustomAttributesXslt(),$xslt);
125
+ break;
126
+ }
127
+
128
+ return $xslt;
129
+ }
130
+
131
+ protected function setProcessorParameters($xp)
132
+ {
133
+ $params = $this->getCustomParameters();
134
+ $params = array_merge($this->getCommonParams(),$params);
135
+ $params = array_merge($this->getFileTypeParams(),$params);
136
+
137
+ foreach ($params as $code => $value)
138
+ {
139
+ $xp->setParameter('', $code, $value);
140
+ }
141
+ return $xp;
142
+ }
143
+
144
+ protected function getCustomParameters()
145
+ {
146
+ $result = array();
147
+ $params = $this->getCustomParams();
148
+ if(isset($params) && isset($params[self::PARAM]) && is_array($params[self::PARAM]))
149
+ {
150
+ foreach ($params[self::PARAM] as $param)
151
+ {
152
+ $result[$param[self::CODE]] = $param[self::VALUE];
153
+ }
154
+ }
155
+ return $result;
156
+ }
157
+
158
+ protected function getFileTypeParams()
159
+ {
160
+ $result = array();
161
+ if($this->getFileType() == self::CSV || $this->getFileType() == self::TXT)
162
+ {
163
+ $result[self::TEXT_ENCLOSURE] = $this->getTextEnclosure();
164
+ $result[self::COLUMN_DELIMITER] = $this->getColumnDelimiter();
165
+ $result[self::NEWLINE] = $this->getNewLine();
166
+ $result[self::COLUMNS_HEADER] = $this->getColumnsHeader();
167
+ }
168
+ return $result;
169
+ }
170
+
171
+ protected function getCommonParams()
172
+ {
173
+ $store = Mage::app()->getStore($this->getStoreId());
174
+ $result = array();
175
+ $result[self::LOCALE] = $this->helper()->getStoreLocale($store);
176
+ $result[self::LANGUAGE] = $this->helper()->getStoreLanguage($store);
177
+ $result[self::COUNTRY] = $this->helper()->getStoreCountry($store);
178
+ $result[self::DATE] = $this->helper()->getDate(null,true);
179
+ $result[self::DATE_TIME] = $this->helper()->getDatetime(null,$this->getDatetimeFormat());
180
+ $result[self::TIME] = $this->helper()->getTime(null,true);
181
+
182
+ return $result;
183
+ }
184
+
185
+ protected function getCdataSectionElements()
186
+ {
187
+ $elements = parent::getCdataSectionElements();
188
+ $result = "";
189
+ if(is_array($elements) && !empty($elements))
190
+ {
191
+ $result = implode(self::DEF_ELEMENTS_DELIMITER, $elements);
192
+ }
193
+ return $result;
194
+ }
195
+
196
+ protected function getStrippedColumnsHeader()
197
+ {
198
+ $headerTemplate = parent::getColumnsHeader();
199
+ $headerTemplate = str_replace(self::COLUMNS_HEADER_TAG,"",$headerTemplate);
200
+ $headerTemplate = str_replace(self::CUSTOM_COLUMNS_HEADER_TAG,"",$headerTemplate);
201
+ return $headerTemplate;
202
+ }
203
+
204
+ protected function _getColumnsHeader()
205
+ {
206
+ $headerTemplate = $this->getStrippedColumnsHeader();
207
+
208
+ if(!empty($headerTemplate))
209
+ {
210
+ if(strpos($headerTemplate,self::DEF_COLUMNS_DELIMITER) !== false)
211
+ $headerTemplate = explode(self::DEF_COLUMNS_DELIMITER, $headerTemplate);
212
+ else
213
+ $headerTemplate = array($headerTemplate);
214
+
215
+ $headerTemplate = $this->prepareCsvRow($headerTemplate);
216
+ }
217
+ else
218
+ $headerTemplate = "";
219
+
220
+ return $headerTemplate;
221
+
222
+ }
223
+ protected function getColumnsHeader()
224
+ {
225
+ $headerTemplate = parent::getColumnsHeader();
226
+ $staticColumns = $this->_getColumnsHeader();
227
+ $attributeColumns = $this->getBasicAttributesColumnsHeader();
228
+ $customColumns = $this->getCustomColumnsHeader();
229
+
230
+ $headerTemplateStripped = $this->getStrippedColumnsHeader();
231
+
232
+ $headerTemplate = str_replace($headerTemplateStripped,$staticColumns,$headerTemplate);
233
+ $headerTemplate = str_replace(self::COLUMNS_HEADER_TAG,$attributeColumns,$headerTemplate);
234
+ $headerTemplate = str_replace(self::CUSTOM_COLUMNS_HEADER_TAG,$customColumns,$headerTemplate);
235
+
236
+ $delimiter = $this->getColumnDelimiter();
237
+ $enclosure = $this->getTextEnclosure();
238
+ $headerTemplate = str_replace($enclosure.$enclosure,"",$headerTemplate);
239
+ $headerTemplate = str_replace($delimiter.$delimiter,$delimiter,$headerTemplate);
240
+ $headerTemplate = str_replace($delimiter.$delimiter,$delimiter,$headerTemplate);
241
+
242
+ $headerTemplate = trim($headerTemplate,$delimiter);
243
+ return $headerTemplate;
244
+ }
245
+
246
+ protected function getBasicAttributesColumnsHeader()
247
+ {
248
+ $columns = parent::getBasicAttributesColumnsHeader();
249
+ $result = $this->prepareCsvRow($columns);
250
+ return $result;
251
+ }
252
+
253
+ protected function getCustomColumnsHeader()
254
+ {
255
+ $columns = parent::getCustomColumnsHeader();
256
+ $result = $this->prepareCsvRow($columns);
257
+ return $result;
258
+ }
259
+
260
+ protected function prepareCsvRow($columns)
261
+ {
262
+ $result = "";
263
+ if(!is_array($columns) || empty($columns))
264
+ {
265
+ return $result;
266
+ }
267
+ $enclosure = $this->getTextEnclosure();
268
+ $delimiter = $this->getColumnDelimiter();
269
+ $result = implode($enclosure.$delimiter.$enclosure, $columns);
270
+ $result = $delimiter.$enclosure.$result.$enclosure.$delimiter;
271
+ return $result;
272
+ }
273
+
274
+ protected function getCustomAttributesXslt()
275
+ {
276
+ $customAttributesCount = count($this->getCustomColumnsHeader());
277
+
278
+ $result = "";
279
+ for($i = 1;$i <= $customAttributesCount;$i++)
280
+ {
281
+ $result .= str_replace(self::INDEX_TAG,$i,self::CSV_CUSTOM_ATTRIBUTES_TEMPLATE);
282
+ }
283
+ return $result;
284
+ }
285
+ }
app/code/community/Nostress/Aukro/Model/Data/Writer.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Data_Writer extends Nostress_Aukro_Model_Abstract
27
+ {
28
+ const DEF_OPEN_MODE = "w";
29
+
30
+ public function save($data)
31
+ {
32
+ $this->write($data);
33
+ if($this->getCompressFile())
34
+ $this->compress();
35
+ }
36
+
37
+ public function write($data)
38
+ {
39
+ $fp = $this->openFile($this->getFullFilename());
40
+ fwrite($fp, $data);
41
+ $this->closeFile($fp);
42
+ }
43
+
44
+ protected function openFile($filename)
45
+ {
46
+ $fp = @fopen($filename, self::DEF_OPEN_MODE);
47
+ if ($fp===false)
48
+ {
49
+ $e = error_get_last();
50
+ $this->logAndException($this->helper()->__("Unable to open the file %s for reading (%s)", $filename, $e['message']));
51
+ }
52
+ return $fp;
53
+ }
54
+
55
+ /**
56
+ * Close file and reset file pointer
57
+ */
58
+ protected function closeFile($fp)
59
+ {
60
+ if (!$fp)
61
+ {
62
+ return;
63
+ }
64
+ @fclose($fp);
65
+ }
66
+
67
+ protected function compress()
68
+ {
69
+ if($this->helper()->createZip(array($this->getFilename() => $this->getFullFilename()),$this->getZipFilename(),true))
70
+ $this->helper()->deleteFile($this->getFullFilename());
71
+ }
72
+ }
app/code/community/Nostress/Aukro/Model/Feed.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Feed extends Nostress_Aukro_Model_Abstract
27
+ {
28
+ const COL_LINK = 'link';
29
+ const COL_CODE = 'code';
30
+ const COL_FILE_TYPE = 'file_type';
31
+ const COL_TYPE = 'type';
32
+ const COL_COUNTRY = 'country';
33
+ const COL_ENABLED = 'enabled';
34
+ const COL_TAXONOMY_CODE = 'taxonomy_code';
35
+
36
+ const DEF_ENABLED = '1';
37
+ const ENABLED_YES = '1';
38
+ const ENABLED_NO = '0';
39
+ const DEFAULT_ROOT = "ITEM ROOT";
40
+ const XPATH_DELIMITER = '/';
41
+
42
+ protected $_defaultAttribute = array(
43
+ "code" => "",
44
+ "label" => "",
45
+ "magento" => "",
46
+ "type" => "normal",
47
+ "limit" => "",
48
+ "postproc" => "",
49
+ "path" => "",
50
+ "description" => array(
51
+ "text" => "",
52
+ "example" => "",
53
+ "options" => "",
54
+ "format" => "text"
55
+ )
56
+ );
57
+
58
+ public function _construct() {
59
+ parent::_construct ();
60
+ $this->_init ('aukro/feed');
61
+ }
62
+
63
+ public function getFeedByCode($code = null) {
64
+ if (isset($code))
65
+ $filter = array(self::COL_CODE => $code);
66
+ else
67
+ $filter = array();
68
+ $collection = $this->getFeedCollection($filter);
69
+ foreach ($collection as $item)
70
+ return $item;
71
+ return null;
72
+ }
73
+
74
+ public function toOptionArray($enabled = null, $addFileType = null, $isMultiselect = true) {
75
+ $options = Mage::getResourceModel('aukro/feed_collection')->loadData()->toOptionArray($enabled, $addFileType);
76
+ $options = $this->helper()->array_unique_tree($options);
77
+
78
+ if (!$isMultiselect) {
79
+ array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));
80
+ }
81
+
82
+ return $options;
83
+ }
84
+
85
+ public function updateFeedsEnabled($links) {
86
+ $collection = $this->getFeedCollection();
87
+ foreach ($collection as $item) {
88
+ $link = $item->getLink();
89
+ if (in_array($link,$links))
90
+ $item->setEnabled(self::ENABLED_YES);
91
+ else
92
+ $item->setEnabled(self::ENABLED_NO);
93
+ }
94
+ $collection->save();
95
+ }
96
+
97
+ public function getFeedCollection($filter = null, $select = null) {
98
+ $collection = $this->getCollection();
99
+ if (isset($filter) && !empty($filter)) {
100
+ $collection->addFieldsToFilter($filter);
101
+ }
102
+
103
+ if (isset($select) && !empty($select)) {
104
+ $collection->addFieldsToSelect($select);
105
+ }
106
+ $collection->getSelect();
107
+ return $collection->load();
108
+ }
109
+
110
+ public function feedsLoaded() {
111
+ $collection = $this->getCollection()->load()->getItems();
112
+ if (count($collection) > 0)
113
+ return true;
114
+ else
115
+ return false;
116
+ }
117
+
118
+ public function updateFeeds($data) {
119
+ $data = $this->prepareData($data);
120
+ $this->updateData($data);
121
+ }
122
+
123
+ protected function updateData($data) {
124
+ $collection = $this->getCollection()->load();
125
+ foreach ($collection as $item) {
126
+ $code = $item->getCode();
127
+ if (isset($data[$code])) {
128
+ $this->copyData($data[$code],$item);
129
+ unset($data[$code]);
130
+ }
131
+ else {
132
+ $item->delete();
133
+ }
134
+ }
135
+ $this->insertData($data,$collection);
136
+ $collection->save();
137
+ }
138
+
139
+ protected function insertData($data, $collection) {
140
+ foreach ($data as $itemData) {
141
+ $itemData[self::COL_ENABLED] = self::DEF_ENABLED;
142
+ $colItem = $collection->getNewEmptyItem();
143
+ $colItem->setData($itemData);
144
+ $collection->addItem($colItem);
145
+ }
146
+ }
147
+
148
+ protected function copyData($data,$dstItem) {
149
+ foreach($data as $key => $src) {
150
+ $dstItem->setData($key,$src);
151
+ }
152
+ }
153
+
154
+ protected function prepareData($data) {
155
+ $modifData = array();
156
+ foreach ($data as $key => $item) {
157
+ if (!isset($item[self::COL_CODE])) {
158
+ throw new Exception($this->__("Missing feed setup attribute '".self::COL_CODE."'"));
159
+ }
160
+ $modifData[$item[self::COL_CODE]] = $item;
161
+ }
162
+ return $modifData;
163
+ }
164
+
165
+ public function getLayout() {
166
+ $layout = parent::getLayout();
167
+ $layout = $this->helper()->dS($layout);
168
+ return $layout;
169
+ }
170
+
171
+ public function getTrnasformationXslt() {
172
+ $layout = $this->getLayout();
173
+ $xlst = $this->helper()->getTrnasformationXslt($layout);
174
+ return $xlst;
175
+ }
176
+
177
+ public function getAttributesSetup($asArray = true) {
178
+ $layout = $this->getLayout();
179
+ $setup = $this->helper()->getAttributesSetup($layout,$asArray);
180
+ if (!$setup)
181
+ $this->logAndException('Missing layout and attributes setup in feed with code %s'.$this->getCode());
182
+ $setup = $this->fillAttributesSetup($setup);
183
+ return $setup;
184
+ }
185
+
186
+ protected function fillAttributesSetup($setup) {
187
+ if (!isset($setup["attributes"]["attribute"])) {
188
+ $this->logAndException('Missing attributes setup in feed with code %s'.$this->getCode());
189
+ }
190
+ $attributes = $setup["attributes"]["attribute"];
191
+
192
+ foreach ($attributes as $index => $attribute)
193
+ {
194
+ $defaultAttribute = $this->_defaultAttribute;
195
+ if(array_key_exists(self::MAGENTO_ATTRIBUTE,$attribute) && !empty($attribute[self::MAGENTO_ATTRIBUTE]))
196
+ $defaultAttribute = $this->helper()->updateArray($this->helper()->getAttributeDescription($attribute[self::MAGENTO_ATTRIBUTE]),$defaultAttribute,false);
197
+
198
+ $attribute = $this->helper()->updateArray($attribute, $defaultAttribute,false);
199
+
200
+ if(isset($attribute[self::PATH]))
201
+ {
202
+ if(!empty($attribute[self::PATH]))
203
+ $attribute[self::PATH] = self::XPATH_DELIMITER.$attribute[self::PATH];
204
+ $attribute[self::PATH] = self::DEFAULT_ROOT.$attribute[self::PATH];
205
+ }
206
+
207
+ if (empty($attribute[self::LABEL])) {
208
+ $attribute[self::LABEL] = $attribute[self::CODE];
209
+ }
210
+ else if (empty($attribute[self::CODE]))
211
+ {
212
+ $attribute[self::CODE] = $this->helper()->createCode($attribute[self::LABEL]);
213
+ }
214
+
215
+ $attributes[$index] = $attribute;
216
+ }
217
+ $setup["attributes"]["attribute"] = $attributes;
218
+
219
+ if(isset($setup[self::COMMON][self::CUSTOM_PARAMS][self::PARAM][self::CODE]))
220
+ $setup[self::COMMON][self::CUSTOM_PARAMS][self::PARAM] = array($setup[self::COMMON][self::CUSTOM_PARAMS][self::PARAM]);
221
+
222
+ return $setup;
223
+ }
224
+
225
+ public function isFileText()
226
+ {
227
+ $type = $this->getFileType();
228
+ $result = "";
229
+ switch($type)
230
+ {
231
+ case self::TYPE_XML:
232
+ case self::TYPE_HTML:
233
+ $result = false;
234
+ break;
235
+ default:
236
+ $result = true;
237
+ break;
238
+ }
239
+ return $result;
240
+ }
241
+
242
+
243
+ protected function helper()
244
+ {
245
+ if(!isset($this->_helper))
246
+ $this->_helper = Mage::helper('aukro/data_feed_description');
247
+ return $this->_helper;
248
+ }
249
+ }
app/code/community/Nostress/Aukro/Model/Mapping/Attribute.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mapping_Attribute extends Nostress_Aukro_Model_Abstract
26
+ {
27
+ protected $_extraAttributes = array("aukrocategory_id");
28
+
29
+ public function _construct()
30
+ {
31
+ parent::_construct ();
32
+ $this->_init('aukro/mapping_attribute');
33
+ }
34
+
35
+ public function reloadAttributes() {
36
+ $webapi = Mage::getModel('aukro/webapi_abstract');
37
+ $categoryDataResponse = $webapi->getCategoryData();
38
+ $aukroCategories = Mage::helper('aukro')->formatAukroCategories($categoryDataResponse);
39
+
40
+ $categoryMappingCollection = Mage::getModel('aukro/mapping_category')->getCollection();
41
+ $collection = $this->getCollection()->load();
42
+ $collectionCodes = array();
43
+
44
+ if(count($collection) == 0)
45
+ $collection = $this->addDefaultAttributes($collection);
46
+
47
+ foreach($collection as $attribute)
48
+ $collectionCodes[$attribute->getLabelCode()] = $attribute;
49
+
50
+ foreach ($categoryMappingCollection as $item) {
51
+ if ($item->getAukrocategory() == 0 || $item->getAukrocategory() == null)
52
+ continue;
53
+
54
+ $fields = $webapi->getSellFormAttributesForCategory($item->getAukrocategory());
55
+ if (count($fields['sellFormFields']['item']) != 0) {
56
+ foreach ($fields['sellFormFields']['item'] as $params)
57
+ {
58
+ $code = $this->helper()->createCode($params['sellFormTitle']);
59
+ if(isset($collectionCodes[$code]))
60
+ $curAtrib = $collectionCodes[$code];
61
+ else
62
+ {
63
+ $curAtrib = clone $this;
64
+ $curAtrib->setData('code',$params['sellFormId']);
65
+ }
66
+
67
+ $curAtrib->setData('label_code',$code);
68
+ $curAtrib->setData('label',$params['sellFormTitle']);
69
+ $curAtrib->setData('predefined',$params['sellFormDesc']);
70
+ $curAtrib->setData('type',$params['sellFormType']);
71
+ $curAtrib->setData('description',serialize(array('text' => $params['sellFormFieldDesc'])));
72
+
73
+ if(!isset($collectionCodes[$code]))
74
+ {
75
+ $collection->addItem($curAtrib);
76
+ $collectionCodes[$curAtrib->getLabelCode()] = $curAtrib;
77
+ }
78
+ }
79
+ }
80
+ }
81
+ $collection->save();
82
+ }
83
+
84
+ protected function addDefaultAttributes($collection)
85
+ {
86
+ $defAtribs = $this->getDefaultAttributes();
87
+ foreach($defAtribs as $attribute)
88
+ {
89
+ $curAtrib = clone $this;
90
+ $curAtrib->setData($attribute);
91
+ $collection->addItem($curAtrib);
92
+ }
93
+ return $collection;
94
+ }
95
+
96
+ public function clearAttributes()
97
+ {
98
+ $col = $this->getCollection()->load();
99
+ foreach($col as $item)
100
+ $item->delete();
101
+ }
102
+
103
+ public function getAttributeCodes($addExtraAttributes = false)
104
+ {
105
+ $collection = $this->getCollection()->load();
106
+ $codes = array();
107
+ if($addExtraAttributes)
108
+ $codes = $this->_extraAttributes;
109
+ foreach($collection as $attribute)
110
+ {
111
+ if(!isset($attribute[self::MAGENTO_ATTRIBUTE]))
112
+ continue;
113
+
114
+ $code = $attribute[self::MAGENTO_ATTRIBUTE];
115
+ if(!in_array($code,$codes))
116
+ $codes[] = $code;
117
+ }
118
+ return $codes;
119
+ }
120
+
121
+ public function getCollectionData()
122
+ {
123
+ $collection = $this->getCollection()->load();
124
+ $dataArray = array();
125
+ foreach($collection as $item)
126
+ {
127
+ $data = $item->getData();
128
+ $data['id'] = $data['code'];
129
+ $data['code'] = $data['label_code'];
130
+ $dataArray[] = $data;
131
+ }
132
+ return $dataArray;
133
+ }
134
+
135
+ protected function getDefaultAttributes()
136
+ {
137
+ $defAttribs = Mage::getSingleton("aukro/webapi_product")->getBaseAttributes();
138
+ return $defAttribs;
139
+ }
140
+ }
app/code/community/Nostress/Aukro/Model/Mapping/Category.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mapping_Category extends Mage_Core_Model_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ parent::_construct ();
30
+ $this->_init('aukro/mapping_category');
31
+ }
32
+
33
+
34
+ public function saveCategoryMapping($data,$categoryId) {
35
+ $collection = $this->getCollection()->addFieldToFilter('category',$categoryId);
36
+
37
+ $dbData = array (
38
+ 'category' => $categoryId,
39
+ 'aukrocategory' => $data['aukro_category'],
40
+ 'connection_name' => $data['aukro_connection_name'],
41
+ 'display_duration' => $data['aukro_display_duration'],
42
+ 'auto_display' => $data['aukro_auto_display'],
43
+ 'shipping_payment' => serialize($data['aukro_shipping']),
44
+ 'attributes' => serialize($data['aukro_attributes']),
45
+ );
46
+ $test = $collection->getSize();
47
+ if ($collection->getSize() == 0) {
48
+ $this->setData($dbData);
49
+ $this->save();
50
+ } else {
51
+ $item = $collection->getFirstItem();
52
+ $dbData['mapping_id'] = $item->getMappingId();
53
+ $item->setData($dbData);
54
+ $item->save();
55
+ }
56
+
57
+ }
58
+
59
+ public function checkCategoryMappingValidity() {
60
+
61
+ $mappingCollection = $this->getCollection();
62
+
63
+ $categoryDataResponse = Mage::getModel('aukro/webapi_abstract')->getCategoryData();
64
+ $aukroCategories = Mage::helper('aukro')->formatAukroCategories($categoryDataResponse);
65
+
66
+ $categoryModel = Mage::getModel('catalog/category');
67
+ $tree = $categoryModel->getTreeModel();
68
+ $tree->load();
69
+ $magentoIds = $tree->getCollection()->getAllIds();
70
+ $errorCounter = 0;
71
+ foreach ($mappingCollection as $item) {
72
+ $status = 0;
73
+ if (!in_array($item->getCategory(), $magentoIds))
74
+ $status += 1;
75
+ if (!array_key_exists($item->getAukrocategory(), $aukroCategories))
76
+ $status += 2;
77
+ if ($status != 0) {
78
+ $errorCounter++;
79
+ }
80
+ $item->setStatus($status);
81
+ $item->save();
82
+ }
83
+
84
+ return $errorCounter;
85
+ }
86
+
87
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Abstract.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ abstract class Nostress_Aukro_Model_Mysql4_Abstract extends Mage_Core_Model_Mysql4_Abstract
28
+ {
29
+ protected function runQuery($queryString)
30
+ {
31
+ if(!isset($queryString) || $queryString == "")
32
+ return $this;
33
+ $this->beginTransaction();
34
+ try {
35
+
36
+ $this->_getWriteAdapter()->query($queryString);
37
+ $this->commit();
38
+ }
39
+ catch (Exception $e){
40
+ $this->rollBack();
41
+ throw $e;
42
+ }
43
+ return $this;
44
+ }
45
+
46
+ protected function runSelectQuery($select)
47
+ {
48
+ return $this->getReadConnection()->fetchAll($select);
49
+ }
50
+
51
+ protected function runOneRowSelectQuery($queryString)
52
+ {
53
+ return $this->getReadConnection()->fetchRow($queryString);
54
+ }
55
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ abstract class Nostress_Aukro_Model_Mysql4_Cache extends Nostress_Aukro_Model_Mysql4_Data_Loader
28
+ {
29
+ const STARTED = "started";
30
+ const FINISHED = "finished";
31
+
32
+ protected $_cacheName = '';
33
+
34
+ protected function defineColumns()
35
+ {
36
+ parent::defineColumns();
37
+ }
38
+
39
+ public function reload($storeId)
40
+ {
41
+ $this->logStatus(self::STARTED,$storeId);
42
+ $this->setStoreId($storeId);
43
+ $this->init();
44
+ $this->reloadTable();
45
+ $this->logStatus(self::FINISHED,$storeId);
46
+ }
47
+
48
+ protected function init()
49
+ {
50
+ $this->defineColumns();
51
+ }
52
+
53
+ protected function logStatus($status,$storeId)
54
+ {
55
+ $this->helper()->log($this->helper()->__("{$this->_cacheName} cache reload has %s for store %s",$status,$storeId));
56
+ }
57
+
58
+ public function getCacheColumns()
59
+ {
60
+ if(!isset($this->_columns))
61
+ $this->defineColumns();
62
+ return array();
63
+ }
64
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Categories.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Categories extends Nostress_Aukro_Model_Mysql4_Cache
28
+ {
29
+ protected $_cacheName = 'Categories';
30
+
31
+ const CATEGORY_PREFIX = 'category_';
32
+
33
+ public function _construct()
34
+ {
35
+ $this->_init('aukro/cache_categories', 'product_id');
36
+ }
37
+
38
+ protected function defineColumns()
39
+ {
40
+ parent::defineColumns();
41
+ }
42
+
43
+ protected function reloadTable()
44
+ {
45
+ $sql = $this->getProductCategoriesUpdateSql();
46
+ //echo $sql."<br>";
47
+ //exit();
48
+ $this->runQuery($sql);
49
+ }
50
+
51
+ protected function getProductCategoriesUpdateSql()
52
+ {
53
+ $storeId = $this->getStoreId();
54
+ $sql = $this->getCleanMainTableSql();
55
+ $sql .= "INSERT INTO {$this->getMainTable()} ";
56
+ $sql .= $this->getSubSelectTable($this->getProductCategoriesSql()).";";
57
+ return $sql;
58
+ }
59
+
60
+ protected function getProductCategoriesSql()
61
+ {
62
+ $mainTable = $this->getTable('catalog/category_product_index');
63
+ $mainTableAlias = self::CCPI;
64
+ $joinTableAlias = $this->getCategoryFlatTable(true);
65
+ $joinTable = $this->getCategoryFlatTable();
66
+
67
+ $select = $this->getEmptySelect();
68
+ $select->from(array($mainTableAlias => $mainTable), array( "product_id","({$this->getStoreId()}) as store_id"));
69
+ $select->joinLeft(
70
+ array($joinTableAlias => $joinTable),
71
+ $joinTableAlias.'.entity_id='.$mainTableAlias.'.category_id',
72
+ null
73
+ );
74
+ $select->where($mainTableAlias.'.store_id=?', $this->getStoreId());
75
+ $select->group('product_id');
76
+ $select = $this->joinCategoryPath($select);
77
+
78
+ //define concat columns
79
+ $columns = $this->getCacheColumns();
80
+ $select->columns($this->groupConcatColumns($columns));
81
+
82
+ return $select;
83
+ }
84
+
85
+ public function getCacheColumns()
86
+ {
87
+ parent::getCacheColumns();
88
+ $columns = array_merge($this->getColumns($this->getCategoryFlatTable(true),null,false,true),$this->getColumns(self::NCCP,null,false,true));
89
+ $columns = $this->removeColumnPrefix($columns);
90
+ return $columns;
91
+ }
92
+
93
+ protected function removeColumnPrefix($columns)
94
+ {
95
+ $result = array();
96
+ foreach($columns as $alias => $column)
97
+ {
98
+ $alias = str_replace(self::CATEGORY_PREFIX,"",$alias);
99
+ $result[$alias] = $column;
100
+ }
101
+ return $result;
102
+ }
103
+
104
+ protected function joinCategoryPath($select)
105
+ {
106
+ $mainTableAlias = $this->getCategoryFlatTable(true);
107
+ $joinTableAlias = self::NCCP;
108
+ $joinTable = $this->getTable('aukro/cache_categorypath');
109
+
110
+ $select->join(
111
+ array($joinTableAlias => $joinTable),
112
+ "{$joinTableAlias}.category_id ={$mainTableAlias}.entity_id AND {$joinTableAlias}.store_id ={$this->getStoreId()}",
113
+ null
114
+ );
115
+ return $select;
116
+ }
117
+
118
+ protected function getCleanMainTableSql()
119
+ {
120
+ return "DELETE FROM {$this->getMainTable()} WHERE store_id = {$this->getStoreId()};";
121
+ }
122
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Categories/Collection.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Aukro
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Categories_Collection extends Nostress_Aukro_Model_Mysql4_Cache_Collection
28
+ {
29
+ public function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_init('aukro/cache_categories');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Categorypath.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Categorypath extends Nostress_Aukro_Model_Mysql4_Cache
28
+ {
29
+ protected $_cacheName = 'Category path';
30
+
31
+ const DEF_MAX_LEVEL = 10;
32
+ const DEF_FIRST_LEVEL_TO_INCLUDE = 2;
33
+ const LEVEL = 'level';
34
+ const NCCP = 'nccp'; //nostress cache category path
35
+
36
+ public function _construct()
37
+ {
38
+ $this->_init('aukro/cache_categorypath', 'category_id');
39
+ }
40
+
41
+ protected function defineColumns()
42
+ {
43
+ parent::defineColumns();
44
+ $this->_columns[$this->getCategoryFlatTable(true)] =
45
+ array( "category_id" => "entity_id",
46
+ "store_id" => "({$this->getStoreId()})",
47
+ "category_path" => "('')",
48
+ "ids_path" => "path",
49
+ "level" => "level");
50
+ }
51
+
52
+ protected function reloadTable()
53
+ {
54
+ $firstLevelToInclude = self::DEF_FIRST_LEVEL_TO_INCLUDE;
55
+ $maxLevel = $this->getCategoryMaxLevel();
56
+ $sql = $this->getCategoryPathUpdateSql($maxLevel,$firstLevelToInclude);
57
+ //echo $sql."<br>";
58
+ // exit();
59
+ $this->runQuery($sql);
60
+ }
61
+
62
+ protected function getCategoryPathUpdateSql($maxLevel,$firstLevelToInclude)
63
+ {
64
+ $storeId = $this->getStoreId();
65
+
66
+ $sql = $this->getCleanCategoryPathSql();
67
+ $i = 0;
68
+ for($i;$i<$firstLevelToInclude;$i++)
69
+ {
70
+ $sql .= $this->getInsertCategoryPathSql($i,true);
71
+ }
72
+
73
+ $i = $firstLevelToInclude;
74
+ for($i;$i<=$maxLevel;$i++)
75
+ {
76
+ $sql .= $this->getInsertCategoryPathSql($i,false);
77
+ }
78
+ return $sql;
79
+ }
80
+
81
+ protected function getInsertCategoryPathSql($level,$base = false)
82
+ {
83
+ $storeId = $this->getStoreId();
84
+ $sql = "INSERT INTO {$this->getMainTable()} ";
85
+
86
+ $mainTable = $this->getMainTable();
87
+ $mainTableAlias = self::NCCP;
88
+ $tableAlias = $this->getCategoryFlatTable(true);
89
+ $table = $this->getCategoryFlatTable();
90
+
91
+ $select = $this->getEmptySelect();
92
+ $select->reset();
93
+ $select->from(array($tableAlias => $table),null);
94
+ $columns = $this->getColumns($tableAlias);
95
+
96
+ if(!$base)
97
+ {
98
+ $select->join(
99
+ array($mainTableAlias => $mainTable),
100
+ "{$mainTableAlias}.level = ({$tableAlias}.level-1) AND {$tableAlias}.path LIKE CONCAT({$mainTableAlias}.ids_path,'/%') AND {$mainTableAlias}.store_id ={$storeId} ",
101
+ null
102
+ );
103
+
104
+ $columns["category_path"] = "IF({$mainTableAlias}.category_path <> '',CONCAT({$mainTableAlias}.category_path,'/',{$tableAlias}.name),{$tableAlias}.name)";
105
+ }
106
+ $select->columns($columns);
107
+ $select->where($tableAlias.".level=?",$level);
108
+
109
+ $sql .= $this->getSubSelectTable($select).";";
110
+ return $sql;
111
+ }
112
+
113
+ protected function getCategoryMaxLevel()
114
+ {
115
+ $result = $this->runOneRowSelectQuery($this->getCategoryPathMaxLevelSql());
116
+
117
+ if(array_key_exists(self::LEVEL,$result))
118
+ return $result[self::LEVEL];
119
+ else
120
+ return self::DEF_MAX_LEVEL;
121
+ }
122
+
123
+ protected function getCategoryPathMaxLevelSql()
124
+ {
125
+ return "SELECT MAX(".self::LEVEL.") as ".self::LEVEL." FROM {$this->getCategoryFlatTable()}; ";
126
+ }
127
+
128
+ protected function getCleanCategoryPathSql()
129
+ {
130
+ return "DELETE FROM {$this->getMainTable()} WHERE store_id = {$this->getStoreId()}; \n";
131
+ }
132
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Categorypath/Collection.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Aukro
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Categorypath_Collection extends Nostress_Aukro_Model_Mysql4_Cache_Collection
28
+ {
29
+ public function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_init('aukro/cache_categorypath');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Mediagallery.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Mediagallery extends Nostress_Aukro_Model_Mysql4_Cache
28
+ {
29
+ protected $_cacheName = 'Media gallery';
30
+
31
+ public function _construct()
32
+ {
33
+ $this->_init('aukro/cache_mediagallery', 'product_id');
34
+ }
35
+
36
+ protected function defineColumns()
37
+ {
38
+ parent::defineColumns();
39
+
40
+ $this->_columns[self::CPAMG] =
41
+ array( "product_id" => "entity_id",
42
+ "store_id" => "({$this->getStoreId()})",);
43
+ $this->_columns[self::CPAMGV] = array( "label" => "label");
44
+
45
+ }
46
+
47
+ protected function reloadTable()
48
+ {
49
+ $sql = $this->getProductInfoUpdateSql();
50
+ //echo $sql."<br>";
51
+ //exit();
52
+ $this->runQuery($sql);
53
+ }
54
+
55
+ protected function getProductInfoUpdateSql()
56
+ {
57
+ $storeId = $this->getStoreId();
58
+ $sql = $this->getCleanMainTableSql();
59
+ $sql .= "INSERT INTO {$this->getMainTable()} ";
60
+ $sql .= $this->getSubSelectTable($this->getMediaGallerySql()).";";
61
+ return $sql;
62
+ }
63
+
64
+ protected function getMediaGallerySql()
65
+ {
66
+ $mainTable = $this->getTable('catalog/product_attribute_media_gallery');
67
+ $mainTableAlias = self::CPAMG;
68
+
69
+ $select = $this->getEmptySelect();
70
+ $select->from(array($mainTableAlias => $mainTable), $this->getColumns($mainTableAlias));
71
+
72
+ $joinTableValueAlias = 'value';
73
+ $joinTableAlias = $joinTableValueAlias;
74
+ $joinTable = $this->getTable('catalog/product_attribute_media_gallery_value');
75
+
76
+ $select->joinLeft(
77
+ array($joinTableAlias => $joinTable),
78
+ "{$joinTableAlias}.value_id={$mainTableAlias}.value_id AND {$joinTableAlias}.store_id = {$this->getStoreId()}",
79
+ null
80
+ );
81
+
82
+ $joinTableDefaultValueAlias = 'defaultValue';
83
+ $joinTableAlias = $joinTableDefaultValueAlias;
84
+
85
+ $select->joinLeft(
86
+ array($joinTableAlias => $joinTable),
87
+ "{$joinTableAlias}.value_id={$mainTableAlias}.value_id AND {$joinTableAlias}.store_id = 0",
88
+ null
89
+ );
90
+
91
+ //define concat columns
92
+ $columns = $this->getCacheColumns();
93
+ $select->columns($this->groupConcatColumns($columns));
94
+ $select->group("{$mainTableAlias}.entity_id");
95
+
96
+ return $select;
97
+ }
98
+
99
+ public function getCacheColumns()
100
+ {
101
+ parent::getCacheColumns();
102
+
103
+ $joinTableValueAlias = 'value';
104
+ $joinTableDefaultValueAlias = 'defaultValue';
105
+ $mainTableAlias = self::CPAMG;
106
+ $labelColumn = array( "label" => "IFNULL({$joinTableValueAlias}.label,{$joinTableDefaultValueAlias}.label)");
107
+ return array_merge($labelColumn,array("value"=>"CONCAT('{$this->getBaseUrl()}','{$this->getImageFolder()}', {$mainTableAlias}.value)"));
108
+ }
109
+
110
+ protected function getCleanMainTableSql()
111
+ {
112
+ return "DELETE FROM {$this->getMainTable()} WHERE store_id = {$this->getStoreId()};";
113
+ }
114
+
115
+ protected function getMediaGalleryAttributeCode()
116
+ {
117
+ return $this->helper()->getGeneralConfig(Nostress_Aukro_Helper_Data::PARAM_MEDIA_GALLERY);
118
+ }
119
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Mediagallery/Collection.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Aukro
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Mediagallery_Collection extends Nostress_Aukro_Model_Mysql4_Cache_Collection
28
+ {
29
+ public function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_init('aukro/cache_mediagallery');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Superattributes.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Superattributes extends Nostress_Aukro_Model_Mysql4_Cache
28
+ {
29
+ protected $_cacheName = 'Super attributes';
30
+
31
+ public function _construct()
32
+ {
33
+ $this->_init('aukro/cache_superattributes', 'product_id');
34
+ }
35
+
36
+ protected function defineColumns()
37
+ {
38
+ parent::defineColumns();
39
+
40
+ $this->_columns[self::CPSA] =
41
+ array( "product_id" => "product_id",
42
+ "store_id" => "({$this->getStoreId()})",);
43
+ $this->_columns[self::NSA] = array( "super_attributes" => "super_attributes");
44
+ $this->_columns[self::CPSAL] = array( "value" => "value");
45
+ $this->_columns[self::EA] = array( "code" => "attribute_code");
46
+
47
+ }
48
+
49
+ protected function reloadTable()
50
+ {
51
+ $sql = $this->getProductInfoUpdateSql();
52
+ // echo $sql."<br>";
53
+ // exit();
54
+ $this->runQuery($sql);
55
+ }
56
+
57
+ protected function getProductInfoUpdateSql()
58
+ {
59
+ $storeId = $this->getStoreId();
60
+ $sql = $this->getCleanMainTableSql();
61
+ $sql .= "INSERT INTO {$this->getMainTable()} ";
62
+ $sql .= $this->getSubSelectTable($this->getSuperAttributesSql()).";";
63
+
64
+
65
+ // $select = $this->getEmptySelect();
66
+ // $mainTable = $this->getProductFlatTable();
67
+ // $mainTableAlias = $this->getProductFlatTable(true);
68
+ //
69
+ // $select->from(array($mainTableAlias => $mainTable),$this->getColumns($mainTableAlias));
70
+ //
71
+ //
72
+ // $joinTableAlias = self::NSA;
73
+ // $joinTable = $this->getSubSelectTable($this->getSuperAttributesSql());
74
+ // $select->joinLeft(
75
+ // array($joinTableAlias => $joinTable),
76
+ // $joinTableAlias.'.product_id='.$mainTableAlias.'.entity_id ',
77
+ // $this->getColumns($joinTableAlias)
78
+ // );
79
+ //
80
+ //
81
+ // $sql .= $this->getSubSelectTable($select).";";
82
+ return $sql;
83
+ }
84
+
85
+ protected function getSuperAttributesSql()
86
+ {
87
+ $mainTable = $this->getTable('catalog/product_super_attribute');
88
+ $mainTableAlias = self::CPSA;
89
+
90
+ $select = $this->getEmptySelect();
91
+ $select->from(array($mainTableAlias => $mainTable), $this->getColumns($mainTableAlias));
92
+
93
+ $joinTableValueAlias = 'value';
94
+ $joinTableAlias = $joinTableValueAlias;
95
+ $joinTable = $this->getTable('catalog/product_super_attribute_label');
96
+
97
+ $select->joinLeft(
98
+ array($joinTableAlias => $joinTable),
99
+ "{$joinTableAlias}.product_super_attribute_id={$mainTableAlias}.product_super_attribute_id AND {$joinTableAlias}.store_id = {$this->getStoreId()}",
100
+ null
101
+ );
102
+
103
+ $joinTableDefaultValueAlias = 'defaultValue';
104
+ $joinTableAlias = $joinTableDefaultValueAlias;
105
+
106
+ $select->joinLeft(
107
+ array($joinTableAlias => $joinTable),
108
+ "{$joinTableAlias}.product_super_attribute_id ={$mainTableAlias}.product_super_attribute_id AND {$joinTableAlias}.store_id = 0",
109
+ null
110
+ );
111
+
112
+ //define concat columns
113
+ $labelColumn = array( "label" => "IFNULL({$joinTableValueAlias}.value,{$joinTableDefaultValueAlias}.value)");
114
+ $columns = array_merge($labelColumn,$this->getColumns(self::EA,null,false,true));
115
+ $select->columns($this->groupConcatColumns($columns));
116
+
117
+ $select = $this->joinEavAttribute($select);
118
+ $select->group('product_id');
119
+
120
+ return $select;
121
+ }
122
+
123
+ public function getAllSuperAttributes()
124
+ {
125
+ $this->defineColumns();
126
+ $select = $this->getSuperAttributesSelect();
127
+ $result = $this->runSelectQuery($select);
128
+
129
+ $superAttributes = array();
130
+ if(!isset($result) || !is_array($result))
131
+ return $superAttributes;
132
+
133
+ foreach($result as $row)
134
+ {
135
+ $superAttributes[] = $row['code'];
136
+ }
137
+ return $superAttributes;
138
+ }
139
+
140
+ protected function getSuperAttributesSelect()
141
+ {
142
+ $mainTable = $this->getTable('catalog/product_super_attribute');
143
+ $mainTableAlias = self::CPSA;
144
+
145
+ $select = $this->getEmptySelect();
146
+ $select->distinct();
147
+ $select->from(array($mainTableAlias => $mainTable),$this->getColumns(self::EA,null,false,true));
148
+ $this->joinEavAttribute($select);
149
+ return $select;
150
+ }
151
+
152
+ public function getCacheColumns()
153
+ {
154
+ parent::getCacheColumns();
155
+
156
+ $joinTableValueAlias = 'value';
157
+ $joinTableDefaultValueAlias = 'defaultValue';
158
+ $labelColumn = array( "label" => "IFNULL({$joinTableValueAlias}.value,{$joinTableDefaultValueAlias}.value)");
159
+ return array_merge($labelColumn,$this->getColumns(self::EA,null,false,true));
160
+ }
161
+
162
+ protected function joinEavAttribute($select)
163
+ {
164
+ $mainTableAlias = self::CPSA;
165
+ $joinTableAlias = self::EA;
166
+ $joinTable = $this->getTable('eav/attribute');
167
+
168
+ $select->join(
169
+ array($joinTableAlias => $joinTable),
170
+ "{$joinTableAlias}.attribute_id ={$mainTableAlias}.attribute_id",
171
+ null
172
+ );
173
+ return $select;
174
+ }
175
+
176
+ protected function getCleanMainTableSql()
177
+ {
178
+ return "DELETE FROM {$this->getMainTable()} WHERE store_id = {$this->getStoreId()};";
179
+ }
180
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Superattributes/Collection.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Aukro
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Superattributes_Collection extends Nostress_Aukro_Model_Mysql4_Cache_Collection
28
+ {
29
+ public function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_init('aukro/cache_superattributes');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Tax.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Tax extends Nostress_Aukro_Model_Mysql4_Cache
28
+ {
29
+ protected $_cacheName = 'Tax';
30
+
31
+ public function _construct()
32
+ {
33
+ $this->_init('aukro/cache_tax', 'tax_class_id');
34
+ }
35
+
36
+ protected function reloadTable()
37
+ {
38
+ $sql = $this->getUpdateSql();
39
+ //echo $sql."<br>";
40
+ //exit();
41
+ $this->runQuery($sql);
42
+ }
43
+
44
+ protected function getUpdateSql()
45
+ {
46
+ $storeId = $this->getStoreId();
47
+ $store = Mage::app()->getStore($storeId);
48
+ $sql = $this->getCleanMainTableSql();
49
+
50
+ $calc = Mage::getSingleton('tax/calculation');
51
+ $rates = $calc->getRatesForAllProductTaxClasses($calc->getRateOriginRequest($store));
52
+
53
+ foreach ($rates as $class=>$rate)
54
+ {
55
+ $sql.= $this->getInsertCommand($class,$storeId,$rate)."; ";
56
+ }
57
+ return $sql;
58
+ }
59
+
60
+ protected function getInsertCommand($taxClass,$storeId,$taxPercent)
61
+ {
62
+ $taxPercent /= 100;
63
+
64
+ $sql = "INSERT INTO {$this->getMainTable()} VALUES (";
65
+ $sql.= "'{$taxClass}','{$storeId}','{$taxPercent}' )";
66
+ return $sql;
67
+ }
68
+
69
+ protected function getCleanMainTableSql()
70
+ {
71
+ return "DELETE FROM {$this->getMainTable()} WHERE store_id = {$this->getStoreId()};";
72
+ }
73
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Cache/Tax/Collection.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Aukro
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Cache_Tax_Collection extends Nostress_Aukro_Model_Mysql4_Cache_Collection
28
+ {
29
+ public function _construct()
30
+ {
31
+ parent::_construct();
32
+ $this->_init('aukro/cache_tax');
33
+ }
34
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Categoryproducts.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Categoryproducts extends Mage_Core_Model_Mysql4_Abstract
28
+ {
29
+ const PRODUCT_SQL = "COUNT(DISTINCT product_id)";
30
+
31
+ public function _construct()
32
+ {
33
+ // Note that the export_id refers to the key field in your database table.
34
+ $this->_init('aukro/categoryproducts', 'entity_id');
35
+ }
36
+
37
+ public function insertRecords($profileId,$categoryProducts)
38
+ {
39
+ $queary = "";
40
+ foreach($categoryProducts as $categoryId => $productIds)
41
+ {
42
+ foreach($productIds as $productId)
43
+ {
44
+ $queary .= $this->insertRecordQuery($profileId,$categoryId,$productId);
45
+ }
46
+ }
47
+ $this->runQuery($queary);
48
+ }
49
+
50
+ public function deleteRecords($profileId,$productId=null)
51
+ {
52
+ $queary = $this->deleteProfileQuery($profileId,$productId);
53
+ $this->runQuery($queary);
54
+ }
55
+
56
+ public function isCategoryInProfile($categoryId,$profileId)
57
+ {
58
+ $queryString = $this->selectCategoryProfileQuery($categoryId,$profileId);
59
+ $qRes = $this->runSelectQuery($queryString,false);
60
+ if(!isset($qRes) || $qRes === false)
61
+ return false;
62
+ else
63
+ return true;
64
+ }
65
+
66
+ public function getProfileRecordCount($profileId)
67
+ {
68
+ $queryString = $this->selectProfileRecordsCountQuery($profileId);
69
+ $result = $this->runSelectQuery($queryString,false);
70
+ if(is_array($result) && isset($result[self::PRODUCT_SQL]))
71
+ return $result[self::PRODUCT_SQL];
72
+ return 0;
73
+ }
74
+
75
+ private function selectCategoryProfileQuery($categoryId,$profileId)
76
+ {
77
+ $table = $this->getMainTable();
78
+ return "SELECT 1 FROM ".$table." WHERE ".$table.".export_id = ".$profileId." AND ".$table.".category_id = ".$categoryId.";";
79
+ }
80
+
81
+ private function selectCategoryProductQuery($productId,$categoryId,$profileId)
82
+ {
83
+ $table = $this->getMainTable();
84
+ return "SELECT 1 FROM ".$table." WHERE ".$table.".export_id = ".$profileId." AND ".$table.".category_id = ".$categoryId."AND ".$table.".product_id = ".$productId.";";
85
+ }
86
+
87
+ private function selectProfileRecordsCountQuery($profileId)
88
+ {
89
+ $table = $this->getMainTable();
90
+ return "SELECT ".self::PRODUCT_SQL." FROM ".$table." WHERE ".$table.".export_id = ".$profileId.";";
91
+ }
92
+
93
+ private function deleteProfileQuery($profileId,$productId)
94
+ {
95
+ $sql = "DELETE FROM ".$this->getMainTable()." WHERE ";
96
+ $where = array();
97
+ if(isset($profileId))
98
+ $where[] = $this->getMainTable().".export_id = ".$profileId." ";
99
+ if(isset($productId))
100
+ $where[] = $this->getMainTable().".product_id = ".$productId." ";
101
+
102
+ $sql .= implode(" AND ",$where);
103
+ $sql .= ";";
104
+ return $sql;
105
+ }
106
+
107
+ private function insertRecordQuery($profileId,$categoryId,$productId)
108
+ {
109
+ return "INSERT INTO ".$this->getMainTable()." (export_id,category_id,product_id) VALUES (".$profileId.",".$categoryId.",".$productId.");";
110
+ }
111
+
112
+ private function runQuery($queryString)
113
+ {
114
+ if(!isset($queryString) || $queryString == "")
115
+ return $this;
116
+ $this->beginTransaction();
117
+ try {
118
+
119
+ $this->_getWriteAdapter()->query($queryString);
120
+ $this->commit();
121
+ }
122
+ catch (Exception $e){
123
+ $this->rollBack();
124
+ throw $e;
125
+ }
126
+ return $this;
127
+ }
128
+
129
+ private function runSelectQuery($queryString,$fatchAll)
130
+ {
131
+ //select query
132
+ $read = $this->_getReadAdapter();
133
+
134
+ if($fatchAll)
135
+ $res = $read->fetchAll($queryString); //get array
136
+ else
137
+ $res = $read->fetchRow($queryString); //fetch row
138
+
139
+ return $res;
140
+ }
141
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Data/Loader.php ADDED
@@ -0,0 +1,566 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Resource of product loader for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Mysql4_Data_Loader extends Nostress_Aukro_Model_Mysql4_Abstract
27
+ {
28
+ //Category product relation table
29
+ const CPF = 'cpf';
30
+ const CPE = 'cpe'; //catalog product entity
31
+ const PCPF = 'pcpf'; //Parent catalog product flat
32
+ const CCF = 'ccf';
33
+ const PCCF = 'pccf'; //Parent category flat
34
+ const CCPI = 'ccpi';
35
+ const CPR = 'cpr'; //Catalog product relation
36
+ const CISS = 'ciss'; //Catalog inventory stock status
37
+ const PCISS = 'pciss'; //Parent product join of Catalog inventory stock status
38
+ const CISI = 'cisi'; //Catalog inventory stock item
39
+ const CPAMG = 'cpamg'; //Catelog product entity media gallery
40
+ const CPAMGV = 'cpamgv'; //Catelog product entity media gallery value
41
+ const PCISI = 'pcisi'; //Parent product - Catalog inventory stock item
42
+ const CPSA = 'cpsa'; //Catalog product super attribute
43
+ const CPSAL = 'cpsal'; //Catalog product super attribute label
44
+ const EA = 'ea'; //Entity attribute
45
+ const RRA = 'rra'; //Review aggregate
46
+ const CIP = 'cip'; //Catalog product price index
47
+
48
+ const NPACD = 'npacd'; // Nostress product all category data
49
+ const NCPML = 'ncpml'; // Nostress category product max level
50
+ const NCCP = 'nccp'; //Nostress cache category path
51
+ const NCSA = 'ncsa'; //Nostress cache super attributes
52
+ const NCT = 'nct'; //Nostress cache tax
53
+ const NCC = 'ncc'; //Nostress cache categories
54
+ const NCMG = 'ncmg';//Nostress media gallery
55
+ const NR = 'nr'; //Nostress records
56
+ const NCP = 'ncp'; //Nostress category path
57
+ const NSA = 'nsa'; // Nostress super attributes
58
+ const NEC = 'nec'; //Nostress engine category
59
+
60
+ const DEF_IMAGE_FOLDER = "catalog/product";
61
+ const DEF_REVIEW_URL = "review/product/list/id/";
62
+
63
+ const VALUE_COLUMN_SUFFIX = '_value';
64
+ /**
65
+ * Current scope (store Id)
66
+ *
67
+ * @var int
68
+ */
69
+ protected $_storeId;
70
+ protected $_websiteId;
71
+ protected $_columns;
72
+ protected $_productFlatMandatoryColumns = array();
73
+ protected $_multiColumns = array();
74
+ protected $_staticColumns = array();
75
+ protected $_exportId;
76
+ protected $_select;
77
+ protected $_params;
78
+ protected $_helper;
79
+ protected $_atttibutes = '*';
80
+ protected $_defaultAttributes = array();
81
+ protected $_conditions = array();
82
+ protected $_taxonomyCode;
83
+ protected $_batchSize = 1000;
84
+ protected $_offset = 0;
85
+
86
+ public function _construct()
87
+ {
88
+ $this->_init('catalog/product', 'entity_id');
89
+ }
90
+
91
+ public function loadBatch()
92
+ {
93
+ $select = clone $this->getSelect();
94
+ $batchSize = $this->getBatchSize();
95
+ $offset = $this->getOffset();
96
+
97
+ $select->limit($batchSize,$offset);
98
+
99
+ //echo $select->__toString();
100
+ //exit();
101
+
102
+ $batch = $this->runSelectQuery($select);
103
+ $this->setOffset($batchSize+$offset);
104
+
105
+ return $batch;
106
+ }
107
+
108
+ protected function defineColumns()
109
+ {
110
+ $this->_columns = array();
111
+
112
+ $this->_columns['cce'] = array( "category_id" => "entity_id",
113
+ "category_path_ids" => "path",
114
+ "category_level" => "level",
115
+ "category_parent_id" => "parent_id");
116
+
117
+ $this->_columns['cev'] = array("category_name" => "value");
118
+
119
+
120
+ //$this->defineCategoryTaxonomyColumns();
121
+
122
+ //$this->_columns[self::NCCP] = array("category_path" => "category_path");
123
+ }
124
+
125
+ protected function defineCategoryTaxonomyColumns()
126
+ {
127
+ $tableAlias = $this->getCategoryFlatTable(true);
128
+ $columns = Mage::getModel('aukro/taxonomy_setup')->getTaxonomyAttributeCodes();
129
+ if(empty($columns))
130
+ return;
131
+
132
+ $columns = array_combine($columns,$columns);
133
+
134
+ $this->_columns[$tableAlias] = array_merge($this->_columns[$tableAlias],$columns);
135
+ }
136
+
137
+ protected function getColumns($tableAlias,$defualt = null,$groupConcat = false,$addTablePrefix = false)
138
+ {
139
+ if(array_key_exists($tableAlias,$this->_columns))
140
+ $result = $this->_columns[$tableAlias];
141
+ else
142
+ $result = $defualt;
143
+
144
+ if($groupConcat)
145
+ $result = $this->groupConcatColumns($result);
146
+ if($addTablePrefix)
147
+ $result = $this->addTablePrefix($tableAlias,$result);
148
+ return $this->filterColumns($result);
149
+ }
150
+
151
+ public function getAllColumns()
152
+ {
153
+ if(!isset($this->_columns))
154
+ $this->defineColumns();
155
+
156
+ $columns = array();
157
+ foreach ($this->_columns as $tableColumns)
158
+ {
159
+ $columns = array_merge($columns,$tableColumns);
160
+ }
161
+ return $columns;
162
+ }
163
+
164
+ public function getMultiColumns()
165
+ {
166
+ return $this->_multiColumns;
167
+ }
168
+
169
+ public function getStaticColumns()
170
+ {
171
+ return $this->_staticColumns;
172
+ }
173
+
174
+ protected function filterColumns($columns)
175
+ {
176
+ if($this->_atttibutes == '*')
177
+ return $columns;
178
+
179
+ if(!isset($columns) || !is_array($columns))
180
+ return $columns;
181
+
182
+ foreach ($columns as $key => $column)
183
+ {
184
+ if(!in_array($key,$this->_atttibutes))
185
+ unset($columns[$key]);
186
+ }
187
+
188
+ return $columns;
189
+ }
190
+
191
+ protected function addTablePrefix($tableAlias,$columns)
192
+ {
193
+ foreach ($columns as $key => $value)
194
+ {
195
+ $columns[$key] = $tableAlias.".".$value;
196
+ }
197
+
198
+ return $columns;
199
+ }
200
+
201
+ protected function groupConcatColumns($columns)
202
+ {
203
+ return $this->helper()->groupConcatColumns($columns);
204
+ }
205
+
206
+ protected function getWebsiteId()
207
+ {
208
+ if (is_null($this->_websiteId)) {
209
+ $this->_websiteId = Mage::app()->getStore($this->getStoreId())->getWebsiteId();
210
+ }
211
+ return $this->_websiteId;
212
+ }
213
+
214
+ protected function getProductFlatTable($alias = false,$storeId = null)
215
+ {
216
+ if (is_null($storeId))
217
+ {
218
+ $storeId = $this->getStoreId();
219
+ }
220
+
221
+ if($alias)
222
+ return self::CPF.$storeId;
223
+ else
224
+ return Mage::getResourceModel('catalog/product_flat')->getFlatTableName($storeId);
225
+ }
226
+
227
+ protected function getCategoryFlatTable($alias = false,$storeId = null,$parent = false)
228
+ {
229
+ if (is_null($storeId))
230
+ {
231
+ $storeId = $this->getStoreId();
232
+ }
233
+
234
+ if($alias)
235
+ {
236
+ if($parent)
237
+ return self::PCCF.$storeId;
238
+ else
239
+ return self::CCF.$storeId;
240
+ }
241
+ else
242
+ return Mage::getResourceModel('catalog/category_flat')->getMainStoreTable($storeId);
243
+ }
244
+
245
+ public function setExportId($id)
246
+ {
247
+ $this->_exportId = $id;
248
+ }
249
+
250
+ public function getExportId()
251
+ {
252
+ return $this->_exportId;
253
+ }
254
+
255
+
256
+ public function setTaxonomyCode($code)
257
+ {
258
+ $this->_taxonomyCode = $code;
259
+ }
260
+
261
+ public function getTaxonomyCode()
262
+
263
+ {
264
+ return $this->_taxonomyCode;
265
+ }
266
+
267
+ public function setBatchSize($size)
268
+ {
269
+ $this->_batchSize = $size;
270
+ }
271
+
272
+ public function getBatchSize()
273
+ {
274
+ return $this->_batchSize;
275
+ }
276
+
277
+ public function setOffset($offset)
278
+ {
279
+ $this->_offset = $offset;
280
+ }
281
+
282
+ public function getOffset()
283
+ {
284
+ return $this->_offset;
285
+ }
286
+
287
+ public function setAttributes($attributes)
288
+ {
289
+ if(is_array($attributes) && isset($this->_defaultAttributes) && !empty($this->_defaultAttributes))
290
+ {
291
+ $attributes = array_merge($attributes,$this->_defaultAttributes);
292
+ }
293
+ $this->_atttibutes = $attributes;
294
+ $this->addSuperAttributes();
295
+ }
296
+
297
+ protected function addSuperAttributes()
298
+ {
299
+ if(!in_array("super_attributes",$this->_atttibutes))
300
+ return;
301
+
302
+ $superAttributes = Mage::getResourceModel('aukro/cache_superattributes')->getAllSuperAttributes();
303
+ $this->_atttibutes = array_merge($superAttributes,$this->_atttibutes);
304
+ }
305
+
306
+ public function getAttributes()
307
+ {
308
+ return $this->_atttibutes;
309
+ }
310
+
311
+ protected function getUnknownAttributes()
312
+ {
313
+ $unknownAttributes = array();
314
+ $allColumns = $this->getAllColumns();
315
+ if(is_array($this->_atttibutes))
316
+ foreach ($this->_atttibutes as $attribName)
317
+ {
318
+ if(!array_key_exists($attribName,$allColumns))
319
+ $unknownAttributes[] = $attribName;
320
+ }
321
+ foreach($unknownAttributes as $key => $value)
322
+ {
323
+ if(in_array($value, $this->_staticColumns))
324
+ unset($unknownAttributes[$key]);
325
+ }
326
+ return $unknownAttributes;
327
+ }
328
+
329
+ public function setConditions($conditions)
330
+ {
331
+ $this->_conditions = $conditions;
332
+ }
333
+
334
+ public function getConditions()
335
+ {
336
+ return $this->_conditions;
337
+ }
338
+
339
+ public function getCondition($name,$default = null)
340
+ {
341
+ if(array_key_exists($name,$this->_conditions))
342
+ return $this->_conditions[$name];
343
+ else
344
+ return $default;
345
+ }
346
+
347
+ /**
348
+ * Set store scope
349
+ *
350
+ * @param int|string|Mage_Core_Model_Store $store
351
+ * @return Mage_Catalog_Model_Resource_Collection_Abstract
352
+ */
353
+ public function setStore($store)
354
+ {
355
+ $this->setStoreId(Mage::app()->getStore($store)->getId());
356
+ return $this;
357
+ }
358
+
359
+ /**
360
+ * Set store scope
361
+ *
362
+ * @param int|string|Mage_Core_Model_Store $storeId
363
+ * @return Mage_Catalog_Model_Resource_Collection_Abstract
364
+ */
365
+ public function setStoreId($storeId)
366
+ {
367
+ if ($storeId instanceof Mage_Core_Model_Store) {
368
+ $storeId = $storeId->getId();
369
+ }
370
+ $this->_storeId = (int)$storeId;
371
+ return $this;
372
+ }
373
+
374
+ /**
375
+ * Return current store id
376
+ *
377
+ * @return int
378
+ */
379
+ public function getStoreId()
380
+ {
381
+ if (is_null($this->_storeId)) {
382
+ $this->setStoreId(Mage::app()->getStore()->getId());
383
+ }
384
+ return $this->_storeId;
385
+ }
386
+
387
+ protected function getStore()
388
+ {
389
+ return Mage::app()->getStore($this->getStoreId());
390
+ }
391
+
392
+ protected function getEmptySelect()
393
+ {
394
+ $select = $this->_getReadAdapter()->select();
395
+ $res = clone $select;
396
+ $res->reset();
397
+ return $res;
398
+ }
399
+
400
+ protected function getSubSelectTable($select)
401
+ {
402
+ return new Zend_Db_Expr( "(" . $select . ") ");
403
+ }
404
+
405
+ public function getSelect()
406
+ {
407
+ if(!isset($this->_select))
408
+ {
409
+ $this->_select = $this->getEmptySelect();
410
+ }
411
+ return $this->_select;
412
+ }
413
+
414
+ protected function helper()
415
+ {
416
+ if(!isset($this->_helper))
417
+ $this->_helper = Mage::helper('aukro/data_loader');
418
+ return $this->_helper;
419
+ }
420
+
421
+ protected function getParam($index,$default = null)
422
+ {
423
+ if(!isset($this->_params))
424
+ $this->_params = $this->helper()->getCommonParameters();
425
+ if(array_key_exists($index,$this->_params))
426
+ return $this->_params[$index];
427
+ else
428
+ return $default;
429
+ }
430
+
431
+ protected function getImageFolder()
432
+ {
433
+ //$this->getParam(Nostress_Aukro_Helper_Data_Loader::PARAM_IMAGE_FOLDER,self::DEF_IMAGE_FOLDER);
434
+
435
+ return self::DEF_IMAGE_FOLDER;
436
+ }
437
+
438
+ protected function getReviewUrlPrefix()
439
+ {
440
+ return $this->getParam(Nostress_Aukro_Helper_Data_Loader::PARAM_REVIEW_URL,self::DEF_REVIEW_URL);
441
+ }
442
+
443
+ protected function getStoreBaseUrl()
444
+ {
445
+ return $this->getStore()->getBaseUrl();
446
+ }
447
+
448
+ protected function getBaseUrl()
449
+ {
450
+ return Mage::getBaseUrl('media');
451
+ }
452
+
453
+ protected function checkProductAttributes($attributes)
454
+ {
455
+ $flatColumns = $this->helper()->getProductFlatColumns($this->getStoreId());
456
+ return $this->checkAttributes($attributes,$flatColumns);
457
+ }
458
+
459
+ protected function checkCategoryAttributes($attributes)
460
+ {
461
+ $flatColumns = $this->helper()->getCategoryFlatColumns($this->getStoreId());
462
+ return $this->checkAttributes($attributes,$flatColumns,'category');
463
+ }
464
+
465
+ protected function checkAttributes($attributes,$flatColumns,$flatCatalogType = 'product')
466
+ {
467
+ $missingAttributes = array();
468
+ foreach($attributes as $attribute)
469
+ {
470
+ if(!in_array($attribute,$flatColumns))
471
+ $missingAttributes[] = $attribute;
472
+ }
473
+
474
+ if(count($missingAttributes) > 0)
475
+ {
476
+ $message = $this->helper()->__("Following attributes missing in {$flatCatalogType} flat catalog: %s",implode(",",$missingAttributes));
477
+ $this->helper()->log($message);
478
+ throw new Exception($message, $this->helper()->getFlatCatalogErrorCode());
479
+
480
+ return false;
481
+ }
482
+
483
+ return true;
484
+ }
485
+
486
+ protected function prepareColumnsFromAttributes($attributes)
487
+ {
488
+ $columns = array();
489
+ $allAttributesInfo = $this->helper()->getVisibleProductAttributes(true);
490
+ foreach ($attributes as $attributeCode)
491
+ {
492
+ if(!array_key_exists($attributeCode,$allAttributesInfo))
493
+ {
494
+ $message = $this->helper()->__("Attribute with code %s doesn't exist",$attributeCode);
495
+ $this->helper()->log($message);
496
+ throw new Exception($message);
497
+ }
498
+
499
+ $info = $allAttributesInfo[$attributeCode];
500
+
501
+ $value = $attributeCode;
502
+ switch($info->getFrontendInput())
503
+ {
504
+ case 'media_image':
505
+ $value = $this->mediaImageColumn($attributeCode);
506
+ break;
507
+ case 'multiselect':
508
+ case 'select':
509
+ // nostress select ignore _value suffix
510
+ $sourcemodel = Mage::getModel( $info->getSourceModel());
511
+ if( $sourcemodel !== null && $sourcemodel instanceof Nostress_Aukro_Model_Adminhtml_System_Config_Source_Abstract) {
512
+ break;
513
+ }
514
+ $value = $this->multiSelectColumn($attributeCode);
515
+ break;
516
+ default:
517
+ break;
518
+ }
519
+
520
+ $columns[$attributeCode] = $value;
521
+ }
522
+ return $columns;
523
+ }
524
+
525
+ protected function mediaImageColumn($code)
526
+ {
527
+ return "CONCAT('{$this->getBaseUrl()}','{$this->getImageFolder()}', {$this->getProductFlatTable(true)}.{$code})";
528
+ }
529
+
530
+ protected function multiSelectColumn($code)
531
+ {
532
+ return $code.self::VALUE_COLUMN_SUFFIX;
533
+ }
534
+
535
+ protected function getTaxonomyColumnName()
536
+ {
537
+ $taxonomyCode = $this->getTaxonomyCode();
538
+ if(!isset($taxonomyCode))
539
+ return null;
540
+ return $this->helper()->createCategoryAttributeCode($this->_taxonomyCode);
541
+ }
542
+
543
+ protected function getTaxonomyLocale()
544
+ {
545
+ $taxonomyCode = $this->getTaxonomyCode();
546
+ if(!isset($taxonomyCode))
547
+ return null;
548
+
549
+ $locale = $this->helper()->getStoreLocale($this->getStore());
550
+ $taxonomyModel = Mage::getModel('aukro/taxonomy');
551
+
552
+ $cols = $taxonomyModel->countColumns($taxonomyCode,$locale);
553
+ if(!isset($cols) || $cols == "0")
554
+ {
555
+ $cols = $taxonomyModel->countColumns($taxonomyCode);
556
+ if(!isset($cols) || $cols == "0")
557
+ {
558
+ $message = $this->helper()->log($this->helper()->__("Taxonomy table empty"));
559
+ return null;
560
+ }
561
+ $locale = Nostress_Aukro_Model_Taxonomy::ALL_LOCALES;
562
+ }
563
+ return $locale;
564
+ }
565
+ }
566
+
app/code/community/Nostress/Aukro/Model/Mysql4/Data/Loader/Product.php ADDED
@@ -0,0 +1,639 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Resource of data loader for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Mysql4_Data_Loader_Product extends Nostress_Aukro_Model_Mysql4_Data_Loader
27
+ {
28
+ protected $_lastCategoryProductTableAlias = self::NCP;
29
+ protected $_defaultAttributes = array("id","type","group_id","is_child");
30
+ protected $_productFlatMandatoryColumns = array('visibility','tax_class_id');
31
+ protected $_multiColumns = array("super_attributes","categories","media_gallery");
32
+ protected $_staticColumns = array("currency","country_code","locale");
33
+
34
+ const VISIBILITY = 4;
35
+ const STOCK_STATUS = 1;
36
+ const MAIN_TABLE_SUBST = '{{main_table}}';
37
+
38
+ /**
39
+ * Initialize collection select
40
+ * Redeclared for remove entity_type_id condition
41
+ * in catalog_product_entity we store just products
42
+ *
43
+ * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
44
+ */
45
+ public function init()
46
+ {
47
+ $this->defineColumns();
48
+ $tableAlias = $this->getMainTable(true);
49
+ $table = $this->getMainTable();
50
+
51
+ $select = $this->getSelect();
52
+ $select->reset();
53
+ $select->from(array($tableAlias => $table),$this->getProductFlatColumns());
54
+ return $this;
55
+ }
56
+
57
+ public function getMainTable($alias = false)
58
+ {
59
+ return $this->getProductFlatTable($alias);
60
+ }
61
+
62
+ public function getAllColumns()
63
+ {
64
+ $columns = parent::getAllColumns();
65
+ foreach ($this->_productFlatMandatoryColumns as $value)
66
+ {
67
+ $columns[$value] = $value;
68
+ }
69
+ return $columns;
70
+ }
71
+
72
+ protected function getProductFlatColumns()
73
+ {
74
+ $columns = $this->getColumns($this->getMainTable(true));
75
+ $unknownAttributes = $this->getUnknownAttributes();
76
+ $this->checkProductAttributes(array_merge($unknownAttributes,$this->_productFlatMandatoryColumns));
77
+ $columns = array_merge($columns,$this->prepareColumnsFromAttributes($unknownAttributes));
78
+
79
+ return $columns;
80
+ }
81
+
82
+ protected function defineColumns()
83
+ {
84
+ parent::defineColumns();
85
+
86
+ $this->_columns[$this->getProductFlatTable(true)] =
87
+ array( 'entity_id',
88
+ "id" => "entity_id",
89
+ "type" => "type_id",
90
+ "url" => "CONCAT('{$this->getStoreBaseUrl()}',{$this->getProductFlatTable(true)}.url_path)"
91
+ );
92
+ $this->_columns[self::NPACD] = array( Nostress_Aukro_Helper_Data_Loader::COLUMN_CATEGORIES_DATA => Nostress_Aukro_Helper_Data_Loader::GROUPED_COLUMN_ALIAS );
93
+
94
+ $this->_columns[self::CISS] = array( "stock_status" => "stock_status"/*,
95
+ "qty" => "qty"*/);
96
+ $this->_columns[self::CISI] = array( "qty" => $this->helper()->getRoundSql(self::CISI.".qty",0)/*,
97
+ "is_in_stock" => "is_in_stock"*/);
98
+ $this->_columns[self::PCPF] = array("parent_sku" => "sku");
99
+ $this->_columns[self::CPR] = array( "parent_id" => "parent_id",
100
+ "group_id" => "IFNULL(".self::CPR.".parent_id,{$this->getMainTable(true)}.entity_id)",
101
+ "is_child" => "(".self::CPR.".parent_id IS NOT NULL)",
102
+ "is_parent" => "(".self::CPR.".parent_id IS NULL)");
103
+
104
+
105
+ $this->_columns[self::NCSA] = array("super_attributes" => "super_attributes");
106
+ $this->_columns[self::NCC] = array("categories" => "categories");
107
+ $this->_columns[self::NCMG] = array("media_gallery" => "media_gallery");
108
+ $this->_columns[self::RRA] = array("reviews_count" => "reviews_count",
109
+ "reviews_url" => "CONCAT('{$this->getStoreBaseUrl()}','{$this->getReviewUrlPrefix()}', CAST({$this->getProductFlatTable(true)}.entity_id AS CHAR)) AS reviews_url");
110
+
111
+ $this->_columns[self::PCISS] = array("parent_stock_status" => self::PCISS.".stock_status"/*,
112
+ "parent_qty" => self::PCISS.".qty"*/);
113
+ $this->_columns[self::PCISI] = array("parent_qty" => $this->helper()->getRoundSql(self::PCISI.".qty",0) /*,
114
+ "parent_is_in_stock" => "(".self::PCISI.".is_in_stock)"*/);
115
+ $this->_columns[self::NCT] = array("tax_percent" => "IFNULL({$this->helper()->getRoundSql("tax_percent*100")},0)");
116
+ $this->_columns[self::NEC] = array( "taxonomy_name" => "name",
117
+ "taxonomy_id" => "id",
118
+ "taxonomy_path" => "path",
119
+ "taxonomy_ids_path" => "ids_path",
120
+ "taxonomy_level" => "level",
121
+ "taxonomy_parent_name" => "parent_name",
122
+ "taxonomy_parent_id" => "parent_id"
123
+ );
124
+ $this->_columns[$this->getCategoryFlatTable(true,null,true)] = array("category_parent_name" => "name");
125
+ $this->_columns[self::CPE] = array( "last_update_datetime" => self::CPE.".updated_at",
126
+ "last_update_date" => "DATE_FORMAT(".self::CPE.".updated_at,'%Y-%m-%d')",
127
+ "last_update_time" => "DATE_FORMAT(".self::CPE.".updated_at,'%T')"
128
+ );
129
+
130
+ $this->definePriceColumns();
131
+
132
+ }
133
+
134
+ //*************************************** BASE PART ******************************************
135
+ /**
136
+ * Joint product filter
137
+ */
138
+ public function joinProductFilter()
139
+ {
140
+ $this->joinExportCategoryProduct();
141
+ }
142
+ /**
143
+ * Joint export categoryproduct table
144
+ */
145
+ protected function joinExportCategoryProduct()
146
+ {
147
+ $select = $this->getSelect();
148
+ $mainTableAlias = $this->getMainTable(true);
149
+
150
+ $joinTableAlias = self::NCP;
151
+ $joinTable = $this->getTable('aukro/categoryproducts');
152
+ $select->join(
153
+ array($joinTableAlias => $joinTable),
154
+ $joinTableAlias.'.product_id='.$mainTableAlias.'.entity_id ',
155
+ $this->getColumns($joinTableAlias));
156
+ $select->where($joinTableAlias.'.export_id=?', $this->getExportId());
157
+ $this->_lastCategoryProductTableAlias = $joinTableAlias;
158
+ }
159
+
160
+ /**
161
+ * Joint export categoryproduct table
162
+ */
163
+ public function joinCategoryProduct()
164
+ {
165
+ $select = $this->getSelect();
166
+ $mainTableAlias = $this->getMainTable(true);
167
+
168
+ $joinTableAlias = self::CCPI;
169
+ $joinTable = $this->getTable('catalog/category_product');
170
+ $select->join(
171
+ array($joinTableAlias => $joinTable),
172
+ $joinTableAlias.'.product_id='.$mainTableAlias.'.entity_id ',
173
+ $this->getColumns($joinTableAlias));
174
+
175
+ $this->_lastCategoryProductTableAlias = $joinTableAlias;
176
+ }
177
+
178
+ /**
179
+ * Joint category table
180
+ */
181
+ public function joinCategoryFlat()
182
+ {
183
+ $select = $this->getSelect();
184
+
185
+ $attrNameId = Mage::getModel('eav/config')->getAttribute('catalog_category', 'name')->getAttributeId();
186
+ $select
187
+ ->joinLeft( array( 'cce'=>'catalog_category_entity'), "cce.entity_id = ".self::CCPI.".category_id", array())
188
+ ->joinLeft( array( 'cev'=>'catalog_category_entity_varchar'), self::CCPI.".category_id = cev.entity_id and cev.attribute_id = $attrNameId",
189
+ array( 'category_name'=>'cev.value')
190
+ );
191
+
192
+ return $this;
193
+ }
194
+
195
+ protected function joinCategoryPath()
196
+ {
197
+ $select = $this->getSelect();
198
+ $mainTableAlias = $this->getCategoryFlatTable(true);
199
+ $joinTableAlias = self::NCCP;
200
+ $joinTable = $this->getTable('aukro/cache_categorypath');
201
+
202
+ $select->join(
203
+ array($joinTableAlias => $joinTable),
204
+ "{$joinTableAlias}.category_id ={$mainTableAlias}.entity_id AND {$joinTableAlias}.store_id ={$this->getStoreId()}",
205
+ $this->getColumns($joinTableAlias)
206
+ );
207
+ return $this;
208
+ }
209
+
210
+ /**
211
+ * Subselect is too time consumpting
212
+ */
213
+ public function joinAllCategoriesData()
214
+ {
215
+ $mainTable = $this->getTable('catalog/category_product_index');
216
+ $mainTableAlias = self::CCPI;
217
+ $joinTableAlias = $this->getCategoryFlatTable(true);
218
+ $joinTable = $this->getCategoryFlatTable();
219
+
220
+ $subSelect = $this->getEmptySelect();
221
+ $subSelect->from(array($mainTableAlias => $mainTable), array( "product_id"));
222
+ $subSelect->joinLeft(
223
+ array($joinTableAlias => $joinTable),
224
+ $joinTableAlias.'.entity_id='.$mainTableAlias.'.category_id',
225
+ $this->getColumns($joinTableAlias,null,true)
226
+ );
227
+ $subSelect->where($mainTableAlias.'.store_id=?', $this->getStoreId());
228
+ $subSelect->group('product_id');
229
+
230
+
231
+
232
+ $select = $this->getSelect();
233
+ $mainTableAlias = $this->getMainTable(true);
234
+ $joinTableAlias = self::$this->getSubSelectTable($this->getProductCategoriesSql());
235
+ $joinTable = $this->getSubSelectTable($subSelect);
236
+
237
+ $select->joinLeft(
238
+ array($joinTableAlias => $joinTable),
239
+ $joinTableAlias.'.product_id ='.$mainTableAlias.'.entity_id',
240
+ $this->getColumns($joinTableAlias)
241
+ );
242
+ return $this;
243
+ }
244
+
245
+ /**
246
+ * Subselect is too time consumpting
247
+ */
248
+ public function joinAllCategoriesCache()
249
+ {
250
+ $select = $this->getSelect();
251
+ $mainTableAlias = $this->getMainTable(true);
252
+ $joinTableAlias = self::NCC;
253
+ $joinTable = $this->getTable('aukro/cache_categories');
254
+
255
+ $select->joinLeft(
256
+ array($joinTableAlias => $joinTable),
257
+ "{$joinTableAlias}.product_id ={$mainTableAlias}.entity_id AND {$joinTableAlias}.store_id = {$this->getStoreId()}",
258
+ $this->getColumns($joinTableAlias)
259
+ );
260
+ return $this;
261
+ }
262
+
263
+ public function joinProductCategoryMaxLevel()
264
+ {
265
+ $mainTable = $this->getTable('catalog/category_product');
266
+ $mainTableAlias = self::CCPI;
267
+ $this->joinCategoryLevel($mainTable,$mainTableAlias);
268
+ }
269
+
270
+ public function joinExportCategoryProductMaxLevel()
271
+ {
272
+ $mainTableAlias = self::NCP;
273
+ $mainTable = $this->getTable('aukro/categoryproducts');
274
+ $condition = "{$mainTableAlias}.export_id = {$this->getExportId()}";
275
+
276
+ $this->joinCategoryLevel($mainTable,$mainTableAlias,$condition);
277
+ }
278
+
279
+ protected function joinCategoryLevel($mainTable,$mainTableAlias,$condition = null)
280
+ {
281
+ $subSelect = $this->getEmptySelect();
282
+ $subSelect->from(array($mainTableAlias => $mainTable), array( "product_id"));
283
+ $subSelect->joinLeft( array('cce' => 'catalog_category_entity'), "cce.entity_id = $mainTableAlias.category_id",
284
+ array("max_level" => "MAX(cce.level)")
285
+ );
286
+ $subSelect->group('product_id');
287
+
288
+ $select = $this->getSelect();
289
+ $joinTableAlias = self::NCPML;
290
+ $joinTable = $this->getSubSelectTable($subSelect);
291
+ $select->join(
292
+ array($joinTableAlias => $joinTable),
293
+ $joinTableAlias.".max_level = cce.level AND {$joinTableAlias}.product_id = {$this->getMainTable(true)}.entity_id",
294
+ $this->getColumns($joinTableAlias)
295
+ );
296
+ return $this;
297
+ }
298
+
299
+ /**
300
+ * Joint export categoryproduct table
301
+ */
302
+ public function orderByCategory()
303
+ {
304
+ $select = $this->getSelect();
305
+ $select->order("cce.entity_id");
306
+ }
307
+
308
+ /**
309
+ * Joint export categoryproduct table
310
+ */
311
+ public function groupByProduct()
312
+ {
313
+ $select = $this->getSelect();
314
+ $select->group($this->getMainTable(true).".entity_id");
315
+ }
316
+
317
+ /**
318
+ * Joint export categoryproduct table
319
+ */
320
+ public function orderByProductType()
321
+ {
322
+ $select = $this->getSelect();
323
+ $select->order($this->getMainTable(true).".type_id");
324
+ }
325
+
326
+ //**********************************COMMON PART*****************************************************
327
+ public function joinProductRelation()
328
+ {
329
+ $joinTableAlias = self::CPR;
330
+ $joinTable = $this->getTable("catalog/product_relation");
331
+
332
+ $condition = $joinTableAlias.'.child_id='.self::MAIN_TABLE_SUBST.".entity_id ";
333
+ $this->joinMainTable($joinTableAlias,$joinTable,true,$condition);
334
+
335
+ $select = $this->getSelect();
336
+ $select->order("group_id");
337
+
338
+ $this->addParentsCondition();
339
+
340
+ return $this;
341
+ }
342
+
343
+ public function addParentsCondition()
344
+ {
345
+ if($this->parentsOnly())
346
+ {
347
+ $select = $this->getSelect();
348
+ $select->where(self::CPR.".parent_id IS NULL ");
349
+ }
350
+ }
351
+
352
+ protected function parentsOnly()
353
+ {
354
+ if($this->getCondition(Nostress_Aukro_Helper_Data_Loader::CONDITION_PARENTS_CHILDS,0) == Nostress_Aukro_Model_Config_Source_Parentschilds::PARENTS_ONLY)
355
+ return true;
356
+ else
357
+ return false;
358
+ }
359
+
360
+ public function addTypeCondition()
361
+ {
362
+ $allTypes = $this->helper()->getAppProductTypes();
363
+ $attribute = Mage::getModel('catalog/product_type')->getTypes();
364
+
365
+ $types = $this->getCondition(Nostress_Aukro_Helper_Data_Loader::CONDITION_TYPES,$allTypes);
366
+
367
+ if(empty($types))
368
+ return $this;
369
+ if(!is_array($types))
370
+ $types = explode(",",$types);
371
+
372
+ if(count($allTypes) != count($types) )
373
+ {
374
+ $select = $this->getSelect();
375
+ $types = "'".implode("','",$types) ."'";
376
+ $select->where($this->getMainTable(true).".type_id IN ({$types})");
377
+ }
378
+
379
+ return $this;
380
+ }
381
+
382
+ /**
383
+ * Joint product table
384
+ */
385
+ protected function joinParentProductFlat()
386
+ {
387
+ if($this->parentsOnly())
388
+ return $this;
389
+
390
+ $mainTableAlias = self::CPR;
391
+ $joinTableAlias = self::PCPF;
392
+ $joinTable = $this->getProductFlatTable();
393
+
394
+ $condition = $joinTableAlias.'.entity_id='.self::MAIN_TABLE_SUBST.'.parent_id';
395
+ $this->joinTable($mainTableAlias,$joinTableAlias,$joinTable,true,$condition);
396
+ return $this;
397
+ }
398
+
399
+ public function addVisibilityCondition()
400
+ {
401
+ $this->joinParentProductFlat();
402
+
403
+ $select = $this->getSelect();
404
+
405
+ $where = "{$this->getMainTable(true)}.visibility= ? ";
406
+ if(!$this->parentsOnly())
407
+ $where .= "OR ".self::PCPF.".visibility= ?";
408
+
409
+ $select->where($where,self::VISIBILITY);
410
+
411
+ }
412
+
413
+ //////////////////////////////////STOCK////////////////////////////////////
414
+
415
+ public function addStockCondition()
416
+ {
417
+ if($this->getCondition(Nostress_Aukro_Helper_Data_Loader::CONDITION_EXPORT_OUT_OF_STOCK,0) == 0)
418
+ {
419
+ $this->joinParentStock();
420
+
421
+ $select = $this->getSelect();
422
+ $select->where(self::CISS.".stock_status = ".self::STOCK_STATUS." AND (".self::CISI.".qty > 0 OR {$this->getProductFlatTable(true)}.type_id <> 'simple') ".
423
+ "AND (".self::PCISS.".stock_status = ".self::STOCK_STATUS." OR ".self::PCISS.".stock_status IS NULL) ");
424
+ }
425
+
426
+ return $this;
427
+ }
428
+
429
+ public function joinStock()
430
+ {
431
+ $this->joinNormalStockStatus();
432
+ $this->joinNormalStockItem();
433
+ }
434
+
435
+ public function joinParentStock()
436
+ {
437
+ $this->joinParentStockStatus();
438
+ $this->joinParentStockItem();
439
+
440
+ }
441
+
442
+ protected function joinNormalStockStatus()
443
+ {
444
+ $mainTableAlias = $this->getMainTable(true);
445
+ $productIdColumnName = 'entity_id';
446
+ $joinTableAlias = self::CISS;
447
+ $this->joinStockStatus($mainTableAlias,$joinTableAlias,$productIdColumnName);
448
+ }
449
+
450
+ public function joinParentStockStatus()
451
+ {
452
+ $mainTableAlias = self::CPR;
453
+ $productIdColumnName = 'parent_id';
454
+ $joinTableAlias = self::PCISS;
455
+ $this->joinStockStatus($mainTableAlias,$joinTableAlias,$productIdColumnName);
456
+ }
457
+
458
+ protected function joinStockStatus($mainTableAlias,$joinTableAlias,$productIdColumnName)
459
+ {
460
+ $joinIfColumnsEmpty = $this->getCondition(Nostress_Aukro_Helper_Data_Loader::CONDITION_EXPORT_OUT_OF_STOCK,0) == 0;
461
+ $joinTable = $this->getTable("cataloginventory/stock_status");
462
+ $condition = $joinTableAlias.'.product_id='.self::MAIN_TABLE_SUBST.".{$productIdColumnName} AND {$joinTableAlias}.website_id ={$this->getWebsiteId()} ";
463
+
464
+ $this->joinTable($mainTableAlias,$joinTableAlias,$joinTable,$joinIfColumnsEmpty,$condition);
465
+ }
466
+
467
+ protected function joinNormalStockItem()
468
+ {
469
+ $mainTableAlias = $this->getMainTable(true);
470
+ $productIdColumnName = 'entity_id';
471
+ $joinTableAlias = self::CISI;
472
+ $this->joinStockItem($mainTableAlias,$joinTableAlias,$productIdColumnName);
473
+ }
474
+
475
+ public function joinParentStockItem()
476
+ {
477
+ $mainTableAlias = self::CPR;
478
+ $productIdColumnName = 'parent_id';
479
+ $joinTableAlias = self::PCISI;
480
+ $this->joinStockItem($mainTableAlias,$joinTableAlias,$productIdColumnName);
481
+ }
482
+
483
+ protected function joinStockItem($mainTableAlias,$joinTableAlias,$productIdColumnName)
484
+ {
485
+ $joinIfColumnsEmpty = $this->getCondition(Nostress_Aukro_Helper_Data_Loader::CONDITION_EXPORT_OUT_OF_STOCK,0) == 0;
486
+ $joinTable = $this->getTable("cataloginventory/stock_item");
487
+ $condition = $joinTableAlias.'.product_id='.self::MAIN_TABLE_SUBST.".{$productIdColumnName} ";
488
+
489
+ $this->joinTable($mainTableAlias,$joinTableAlias,$joinTable,$joinIfColumnsEmpty,$condition);
490
+ }
491
+
492
+ public function joinSuperAttributesCache()
493
+ {
494
+ $joinTableAlias = self::NCSA;
495
+ $joinTable = $this->getTable('aukro/cache_superattributes');
496
+ $condition = "{$joinTableAlias}.product_id =".self::MAIN_TABLE_SUBST.".entity_id AND {$joinTableAlias}.store_id = {$this->getStoreId()}";
497
+
498
+ $this->joinMainTable($joinTableAlias,$joinTable,false,$condition);
499
+ return $this;
500
+ }
501
+
502
+ public function joinMediaGalleryCache()
503
+ {
504
+ $joinTableAlias = self::NCMG;
505
+ $joinTable = $this->getTable('aukro/cache_mediagallery');
506
+ $condition = "{$joinTableAlias}.product_id =".self::MAIN_TABLE_SUBST.".entity_id AND {$joinTableAlias}.store_id = {$this->getStoreId()}";
507
+
508
+ $this->joinMainTable($joinTableAlias,$joinTable,false,$condition);
509
+ return $this;
510
+ }
511
+
512
+ public function joinReview()
513
+ {
514
+ $joinTableAlias = self::RRA;
515
+ $joinTable = $this->getTable('review/review_aggregate');
516
+ $condition = "{$joinTableAlias}.entity_pk_value = ".self::MAIN_TABLE_SUBST.".entity_id AND {$joinTableAlias}.store_id = {$this->getStoreId()}";
517
+
518
+ $this->joinMainTable($joinTableAlias,$joinTable,false,$condition);
519
+ return $this;
520
+ }
521
+
522
+ public function joinTaxonomy()
523
+ {
524
+ $mainTableAlias = $this->getCategoryFlatTable(true);
525
+ $joinTableAlias = self::NEC;
526
+ $joinTable = $this->getTable('aukro/enginecategory');
527
+ $taxonomyColumn = $this->getTaxonomyColumnName();
528
+ if(!isset($taxonomyColumn))
529
+ return $this;
530
+
531
+ $locale = $this->getTaxonomyLocale();
532
+ $code = $this->getTaxonomyCode();
533
+ if(!isset($locale))
534
+ return $this;
535
+
536
+ $condition = "{$joinTableAlias}.id = ".self::MAIN_TABLE_SUBST.".{$taxonomyColumn} AND {$joinTableAlias}.locale = '{$locale}' AND {$joinTableAlias}.taxonomy_code = '{$code}' ";
537
+
538
+ if($this->joinTable($mainTableAlias,$joinTableAlias,$joinTable,false,$condition))
539
+ $this->checkCategoryAttributes(array($taxonomyColumn));
540
+
541
+ return $this;
542
+ }
543
+
544
+ public function joinParentCategory()
545
+ {
546
+ $mainTableAlias = $this->getCategoryFlatTable(true);
547
+ $joinTableAlias = $this->getCategoryFlatTable(true,null,true);
548
+ $joinTable = $this->getCategoryFlatTable();
549
+
550
+ $condition = "{$joinTableAlias}.entity_id = ".self::MAIN_TABLE_SUBST.".parent_id";
551
+ $this->joinTable($mainTableAlias,$joinTableAlias,$joinTable,false,$condition);
552
+
553
+ return $this;
554
+ }
555
+
556
+ public function joinProductEntity()
557
+ {
558
+ $mainTableAlias = $this->getMainTable(true);
559
+ $joinTableAlias = self::CPE;
560
+ $joinTable = $this->getTable('catalog/product');
561
+
562
+ $condition = "{$joinTableAlias}.entity_id = ".self::MAIN_TABLE_SUBST.".entity_id";
563
+ $this->joinTable($mainTableAlias,$joinTableAlias,$joinTable,false,$condition);
564
+
565
+ return $this;
566
+ }
567
+
568
+ public function joinTax()
569
+ {
570
+ $joinTableAlias = self::NCT;
571
+ $joinTable = $this->getTable('aukro/cache_tax');
572
+ $condition = "{$joinTableAlias}.tax_class_id = ".self::MAIN_TABLE_SUBST.".tax_class_id AND {$joinTableAlias}.store_id = {$this->getStoreId()}";
573
+ $priceColumns = $this->getColumns(self::CIP);
574
+ $joinIfColumnsEmpty = !empty($priceColumns);
575
+
576
+ $this->joinMainTable($joinTableAlias,$joinTable,$joinIfColumnsEmpty,$condition);
577
+ return $this;
578
+ }
579
+
580
+ public function joinPrice()
581
+ {
582
+ $joinTableAlias = self::CIP;
583
+ $joinTable = $this->getTable('catalogindex/price');
584
+ $condition = "{$joinTableAlias}.entity_id = ".self::MAIN_TABLE_SUBST.".entity_id AND {$joinTableAlias}.website_id = {$this->getWebsiteId()} AND {$joinTableAlias}.customer_group_id = 0";
585
+
586
+ $this->joinMainTable($joinTableAlias,$joinTable,false,$condition);
587
+ return $this;
588
+ }
589
+
590
+ protected function definePriceColumns()
591
+ {
592
+ $originalPricesIncludesTax = Mage::helper('tax')->priceIncludesTax($this->getStore());
593
+ $currencyRate = $this->helper()->getStoreCurrencyRate($this->getStore());
594
+ $taxRateColumnName = self::NCT.'.tax_percent';
595
+
596
+ $this->_columns[self::CIP] = array("price_final_exclude_tax" => $this->getPriceColumnFormat("min_price",false),//"final_price",false),
597
+ "price_final_include_tax" => $this->getPriceColumnFormat("min_price",true),//"final_price",true),
598
+ "price_original_exclude_tax" => $this->getPriceColumnFormat("price",false),
599
+ "price_original_include_tax" => $this->getPriceColumnFormat("price",true),
600
+ //"price_minimal_exclude_tax" => $this->getPriceColumnFormat("min_price",false),
601
+ //"price_minimal_include_tax" => $this->getPriceColumnFormat("min_price",true)
602
+ );
603
+ }
604
+
605
+ protected function getPriceColumnFormat($comunName,$includeTax)
606
+ {
607
+ $originalPricesIncludesTax = Mage::helper('tax')->priceIncludesTax($this->getStore());
608
+ $currencyRate = $this->helper()->getStoreCurrencyRate($this->getStore());
609
+ $taxRateColumnName = self::NCT.'.tax_percent';
610
+
611
+ $columnFormat = $this->helper()->getPriceColumnFormat(self::CIP.".".$comunName, $taxRateColumnName,$currencyRate, $originalPricesIncludesTax,$includeTax);
612
+ return $columnFormat;
613
+ }
614
+
615
+ protected function joinMainTable($joinTableAlias,$joinTable,$joinIfColumnsEmpty = false,$condition)
616
+ {
617
+ $mainTableAlias = $this->getMainTable(true);
618
+ return $this-> joinTable($mainTableAlias,$joinTableAlias,$joinTable,$joinIfColumnsEmpty,$condition);
619
+ }
620
+
621
+ protected function joinTable($mainTableAlias,$joinTableAlias,$joinTable,$joinIfColumnsEmpty = false,$condition)
622
+ {
623
+ $selectColumns = $this->getColumns($joinTableAlias);
624
+ if(empty($selectColumns) && !$joinIfColumnsEmpty)
625
+ return false;
626
+
627
+ $select = $this->getSelect();
628
+
629
+ $condition = str_replace(self::MAIN_TABLE_SUBST,$mainTableAlias,$condition);
630
+
631
+ $select->joinLeft(
632
+ array($joinTableAlias => $joinTable),
633
+ $condition,
634
+ $selectColumns
635
+ );
636
+
637
+ return true;
638
+ }
639
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Data/Loader/Product/Aukro.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Resource of data loader for export process
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ *
24
+ */
25
+
26
+ class Nostress_Aukro_Model_Mysql4_Data_Loader_Product_Aukro extends Nostress_Aukro_Model_Mysql4_Data_Loader_Product
27
+ {
28
+ const LIMIT = 'limit';
29
+ const PAGE_NUM = 'page';
30
+ const SORT = 'sort';
31
+ const SORT_DIR = 'dir';
32
+ const FILTER = 'filter';
33
+ const DEF_PAGE_LIMIT = 30;
34
+ const DEF_NON_ORDER = 'product_to_display_id';
35
+
36
+ const NCM = 'ncm'; //Nostress category mapping
37
+
38
+ protected $_priceFieldMapping = array( "price_final_include_tax" => "min_price",
39
+ "price_final_exclude_tax" => "min_price",
40
+ "price_original_include_tax" => "price",
41
+ "price_original_exclude_tax" => "price",
42
+ );
43
+
44
+ protected function defineColumns()
45
+ {
46
+ parent::defineColumns();
47
+ $this->_columns[$this->getProductFlatTable(true)]["visibility"] = "visibility";
48
+
49
+ $this->_columns[self::NCM] = array("category_id" => "category",
50
+ "aukrocategory_id" => "aukrocategory",
51
+ "aukrocategory_connection_name" => "connection_name",
52
+ "aukrocategory_display_duration" => "display_duration",
53
+ "aukrocategory_display_auto" => "auto_display",
54
+ "aukrocategory_shipping_payment" => "shipping_payment",
55
+ "aukrocategory_attributes" => "attributes",
56
+ );
57
+ }
58
+ public function joinTaxonomy()
59
+ {
60
+ return $this;
61
+ }
62
+
63
+ protected function joinCategoryPath()
64
+ {
65
+ $select = $this->getSelect();
66
+ $mainTableAlias = $this->getCategoryFlatTable(true);
67
+ $joinTableAlias = self::NCCP;
68
+ $joinTable = $this->getTable('aukro/cache_categorypath');
69
+
70
+ $select->joinLeft(
71
+ array($joinTableAlias => $joinTable),
72
+ "{$joinTableAlias}.category_id ={$mainTableAlias}.entity_id AND {$joinTableAlias}.store_id ={$this->getStoreId()}",
73
+ $this->getColumns($joinTableAlias)
74
+ );
75
+ return $this;
76
+ }
77
+
78
+ public function joinCategoryMapping()
79
+ {
80
+ $mainTableAlias = self::CCPI;
81
+ $joinTableAlias = self::NCM;
82
+ $joinTable = $this->getTable('aukro/mapping_category');
83
+ $condition = "{$joinTableAlias}.category = {$mainTableAlias}.category_id ";
84
+
85
+ $this->joinTable($mainTableAlias,$joinTableAlias,$joinTable,false,$condition);
86
+ return $this;
87
+ }
88
+
89
+ public function getSelect($params = null)
90
+ {
91
+ $select = parent::getSelect();
92
+ if(!isset($params))
93
+ return $select;
94
+
95
+ $select->reset(Zend_Db_Select::ORDER);
96
+ $select->reset(Zend_Db_Select::LIMIT_COUNT);
97
+ $select->reset(Zend_Db_Select::LIMIT_OFFSET);
98
+
99
+ $page = $this->getArrayField(self::PAGE_NUM,$params,0);
100
+ $limit = $this->getArrayField(self::LIMIT,$params,self::DEF_PAGE_LIMIT);
101
+ $select->limit($limit,((int)$page-1)*(int)$limit);
102
+
103
+ $order = $this->getArrayField(self::SORT,$params,false);
104
+ if($order && $order != self::DEF_NON_ORDER)
105
+ {
106
+ $dir = $this->getArrayField(self::SORT_DIR,$params,false);
107
+ $select->order($order." ".$dir);
108
+ }
109
+
110
+ $filter = $this->getArrayField(self::FILTER,$params,false);
111
+ if($filter)
112
+ {
113
+ foreach($filter as $columnName => $condition)
114
+ {
115
+ $sqlCond = "";
116
+ foreach($condition as $cond => $citem)
117
+ {
118
+ if($cond == "currency")
119
+ continue;
120
+
121
+ if(!empty($sqlCond))
122
+ $sqlCond .= " OR ";
123
+
124
+ if(!is_string($citem) && !is_numeric($citem))
125
+ $citem = $citem->__toString();
126
+ $cond = $this->translateCondition($cond);
127
+ $sqlCond .= $this->getColumnName($columnName)." ".$cond." ".$citem." ";
128
+ }
129
+ $select->where($sqlCond);
130
+ }
131
+ }
132
+ return $select;
133
+
134
+ }
135
+
136
+ protected function translateCondition($condition)
137
+ {
138
+ $newCond = $condition;
139
+ switch($condition)
140
+ {
141
+ case "from":
142
+ $newCond = ">=";
143
+ break;
144
+ case "to":
145
+ $newCond = "<=";
146
+ break;
147
+ case "eq":
148
+ $newCond = "=";
149
+ break;
150
+ default:
151
+ break;
152
+ }
153
+ return $newCond;
154
+ }
155
+
156
+ protected function getColumnName($alias)
157
+ {
158
+ if(!isset($this->_columns))
159
+ $this->defineColumns();
160
+
161
+ $columnName = "";
162
+ foreach ($this->_columns as $tableAlias => $tableColumns)
163
+ {
164
+
165
+ if(isset($tableColumns[$alias]))
166
+ {
167
+ $columnAlias = $tableColumns[$alias];
168
+ if(!empty($columnAlias) && (ctype_upper($columnAlias[0]) || $columnAlias[0] == "("))
169
+ {
170
+ $columnName = $columnAlias;
171
+ break;
172
+ }
173
+ if(in_array($columnAlias,$this->_priceFieldMapping))
174
+ $columnAlias = $this->_priceFieldMapping[$columnAlias];
175
+ $columnName = $tableAlias.".".$columnAlias;
176
+ break;
177
+ }
178
+ }
179
+ if(empty($columnName))
180
+ $columnName = $this->getProductFlatTable(true).".".$alias;
181
+ return $columnName;
182
+ }
183
+
184
+ public function addProductIdsCondition()
185
+ {
186
+ if(($profileIdsArray = $this->getCondition(Nostress_Aukro_Helper_Data_Loader::CONDITION_PRODUCT_IDS,0)) != 0)
187
+ {
188
+ $profileIds = "'".implode("','",$profileIdsArray)."'";
189
+ $select = $this->getSelect();
190
+ //products ids condition
191
+ $select->where($this->getProductFlatTable(true).".entity_id IN ({$profileIds})");
192
+ }
193
+
194
+ return $this;
195
+ }
196
+
197
+ protected function getArrayField($index,$array, $default = null)
198
+ {
199
+ if(!is_array($array))
200
+ {
201
+ return $default;
202
+ }
203
+ if(array_key_exists($index,$array))
204
+ {
205
+ return $array[$index];
206
+ }
207
+ else
208
+ return $default;
209
+ }
210
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Data/Loader/Product/Aukro/Collection.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+ class Nostress_Aukro_Model_Mysql4_Data_Loader_Product_Aukro_Collection extends Mage_Catalog_Model_Resource_Product_Collection
25
+ {
26
+ // public function _construct()
27
+ // {
28
+ // // Note that the export_id refers to the key field in your database table.
29
+ // $this->_init('aukro/data_loader_product_aukro_collection', 'entity_id');
30
+ // }
31
+ protected $_storeId;
32
+
33
+
34
+ public function setSelect($select,$storeId)
35
+ {
36
+ $this->_select = $select;
37
+ $this->_storeId = $storeId;
38
+ // echo $this->_select->__toString();
39
+ // exit();
40
+
41
+ }
42
+
43
+ /**
44
+ * Get SQL for get record count
45
+ *
46
+ * @return Varien_Db_Select
47
+ */
48
+ public function getSelectCountSql()
49
+ {
50
+ $this->_renderFilters();
51
+
52
+ $countSelect = $this->_getClearSelect()
53
+ ->columns('COUNT(DISTINCT cpf'.$this->_storeId.'.entity_id)')
54
+ ->resetJoinLeft();
55
+ return $countSelect;
56
+ }
57
+
58
+ /**
59
+ * Retrive all ids for collection
60
+ *
61
+ * @param unknown_type $limit
62
+ * @param unknown_type $offset
63
+ * @return array
64
+ */
65
+ public function getAllIds($limit = null, $offset = null)
66
+ {
67
+ $idsSelect = $this->_getClearSelect();
68
+ $idsSelect->columns("cpf{$this->_storeId}.". $this->getEntity()->getIdFieldName());
69
+ $idsSelect->limit($limit, $offset);
70
+ $idsSelect->resetJoinLeft();
71
+ $idsSelect->distinct();
72
+ return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams);
73
+ }
74
+
75
+ /**
76
+ * Retreive clear select
77
+ *
78
+ * @return Varien_Db_Select
79
+ */
80
+ protected function _getClearSelect()
81
+ {
82
+ $select = clone $this->getSelect();
83
+ $select->reset(Zend_Db_Select::GROUP);
84
+ $select->reset(Zend_Db_Select::ORDER);
85
+ $select->reset(Zend_Db_Select::LIMIT_COUNT);
86
+ $select->reset(Zend_Db_Select::LIMIT_OFFSET);
87
+ $select->reset(Zend_Db_Select::COLUMNS);
88
+
89
+ return $select;
90
+ }
91
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Enginecategory.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Mysql4_Enginecategory extends Nostress_Aukro_Model_Mysql4_Abstract
28
+ {
29
+ const TAXONOMY_CODE = 'taxonomy_code';
30
+ const LOCALE = 'locale';
31
+ const LIMIT = 100;
32
+ const COUNT_FIELD = "COUNT(*)";
33
+
34
+ public function _construct()
35
+ {
36
+ // Note that the export_id refers to the key field in your database table.
37
+ $this->_init('aukro/enginecategory', 'entity_id');
38
+ }
39
+
40
+ public function insertEngineCategoryRecords($engineCode,$locale,$records)
41
+ {
42
+ $emptyRecord = array(self::LOCALE=>$locale, self::TAXONOMY_CODE => $engineCode);
43
+
44
+ $sql = "";
45
+ $i = 0;
46
+
47
+ foreach($records as $row)
48
+ {
49
+ $i++;
50
+ $sql .= $this->insertRecordQuery(array_merge($emptyRecord,$row));
51
+ if($i > self::LIMIT)
52
+ {
53
+ $this->runQuery($sql);
54
+ $sql = "";
55
+ $i = 0;
56
+ }
57
+ }
58
+ if(!empty($sql))
59
+ $this->runQuery($sql);
60
+ }
61
+
62
+ protected function insertRecordQuery($row)
63
+ {
64
+ $columns = implode(",",array_keys($row));
65
+ $values = $this->addEscapeChars(array_values($row));
66
+ $values = implode("','",$values);
67
+
68
+ $sql = "INSERT INTO {$this->getMainTable()} ({$columns}) VALUES ('{$values}');";
69
+
70
+ return $sql;
71
+ }
72
+
73
+ protected function addEscapeChars($items)
74
+ {
75
+ foreach($items as $key => $item)
76
+ {
77
+ $items[$key] = str_replace("'","\\'",$item);
78
+ }
79
+ return $items;
80
+ }
81
+
82
+ public function cleanTable()
83
+ {
84
+ $this->runQuery($this->deleteRecordQuery());
85
+ }
86
+
87
+ protected function deleteRecordQuery($where='')
88
+ {
89
+ $sql = "DELETE FROM ".$this->getMainTable();
90
+ if($where != '')
91
+ $sql .= ' '.$where;
92
+ $sql .= ";";
93
+ return $sql;
94
+ }
95
+
96
+ public function countColumns($engineCode,$locale)
97
+ {
98
+ $result = $this->runOneRowSelectQuery($this->countColumnsQuery($engineCode,$locale));
99
+ if(array_key_exists(self::COUNT_FIELD,$result))
100
+ return $result[self::COUNT_FIELD];
101
+ else
102
+ return 0;
103
+ }
104
+
105
+ protected function countColumnsQuery($engineCode,$locale)
106
+ {
107
+ $sql = "SELECT ".self::COUNT_FIELD." FROM {$this->getMainTable()} WHERE taxonomy_code = '{$engineCode}' AND locale = '{$locale}';";
108
+ return $sql;
109
+ }
110
+
111
+
112
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Mapping/Attribute.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mysql4_Mapping_Attribute extends Mage_Core_Model_Mysql4_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ // Note that the export_id refers to the key field in your database table.
30
+ $this->_init('aukro/mapping_attribute', 'code');
31
+ // primary key is NOT set to auto increment
32
+ $this->_isPkAutoIncrement = false;
33
+ }
34
+
35
+
36
+
37
+
38
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Mapping/Attribute/Collection.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mysql4_Mapping_Attribute_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->_init('aukro/mapping_attribute');
31
+ }
32
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Mapping/Category.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mysql4_Mapping_Category extends Mage_Core_Model_Mysql4_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ // Note that the export_id refers to the key field in your database table.
30
+ $this->_init('aukro/mapping_category', 'mapping_id');
31
+ }
32
+
33
+
34
+
35
+
36
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Mapping/Category/Collection.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mysql4_Mapping_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->_init('aukro/mapping_category');
31
+ }
32
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Product.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mysql4_Product extends Mage_Core_Model_Mysql4_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ $this->_init('aukro/product', 'entity_id');
30
+ }
31
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Product/Collection.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mysql4_Product_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->_init('aukro/product');
31
+ }
32
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Shipping/Pricing.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mysql4_Shipping_Pricing extends Mage_Core_Model_Mysql4_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ // Note that the export_id refers to the key field in your database table.
30
+ $this->_init('aukro/shipping_pricing', 'id');
31
+ // primary key is NOT set to auto increment
32
+ $this->_isPkAutoIncrement = false;
33
+ }
34
+
35
+
36
+
37
+
38
+ }
app/code/community/Nostress/Aukro/Model/Mysql4/Shipping/Pricing/Collection.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Mysql4_Shipping_Pricing_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->_init('aukro/shipping_pricing');
31
+ }
32
+ }
app/code/community/Nostress/Aukro/Model/Observer.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Observer extends Mage_Core_Model_Abstract {
26
+
27
+ public function saveCategoryAukroMapping($eventArgs) {
28
+ $category = $eventArgs->getData('category');
29
+ $mapping = $category->getData('aukro');
30
+
31
+ Mage::getModel('aukro/mapping_category')->saveCategoryMapping($mapping,$category->getId());
32
+ }
33
+
34
+
35
+ public function checkCategoryMappingValidity() {
36
+
37
+ $mappingCollection = Mage::getModel('aukro/mapping_category')->getCollection();
38
+
39
+ $categoryDataResponse = Mage::getModel('aukro/webapi_abstract')->getCategoryData();
40
+ $aukroCategories = Mage::helper('aukro')->formatAukroCategories($categoryDataResponse);
41
+ $aukroIds = array_keys($aukroCategories);
42
+
43
+ $categoryModel = Mage::getModel('catalog/category');
44
+ $tree = $categoryModel->getTreeModel();
45
+ $tree->load();
46
+ $magentoIds = $tree->getCollection()->getAllIds();
47
+ $errorCounter = 0;
48
+ foreach ($mappingCollection as $item) {
49
+ $status = 0;
50
+ if (!in_array($item->getCategory(), $magentoIds))
51
+ $status += 1;
52
+ if (!in_array($item->getAukroCategory(), $aukroIds))
53
+ $status += 2;
54
+ if ($status != 0) {
55
+ $errorCounter++;
56
+ }
57
+ $item->setStatus($status);
58
+ $item->save();
59
+ }
60
+ Mage::getSingleton('adminhtml/session')->addSuccess(
61
+ Mage::helper('aukro')->__('Aukro categories mapping has been checked. No. of errors found: ').$errorCounter
62
+ );
63
+ }
64
+
65
+ public function refreshOrders() {
66
+
67
+ $orderApi = Mage::getModel( 'aukro/webapi_order');
68
+ list( $countNew, $countPaid) = $orderApi->refreshOrders();
69
+ Mage::log( Mage::helper('aukro')->__('Total of %d order(s) were successfully created from aukro by cron.', $countNew), null, 'aukro.log');
70
+ Mage::log( Mage::helper('aukro')->__('Total of %d order(s) were successfully paid from aukro by cron.', $countPaid), null, 'aukro.log');
71
+
72
+ return true;
73
+ }
74
+
75
+ public function refreshAuctions() {
76
+
77
+ list( $countDeleted, $countReexposed) = Mage::getModel( 'aukro/webapi_product')->refresh();
78
+ Mage::log( Mage::helper('aukro')->__('Total of %d auctions(s) were closed on aukro by cron action.', $countDeleted), null, 'aukro.log');
79
+ Mage::log( Mage::helper('aukro')->__('Total of %d auctions(s) were re-exposed on aukro by cron action.', $countReexposed), null, 'aukro.log');
80
+
81
+ return true;
82
+ }
83
+
84
+ }
app/code/community/Nostress/Aukro/Model/Payment.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Nostress_Aukro_Model_Payment extends Mage_Payment_Model_Method_Abstract
4
+ {
5
+ protected $_code = 'aukro';
6
+ protected $_canCapture = true;
7
+ protected $_canUseCheckout = false;
8
+ protected $_canManageRecurringProfiles = false;
9
+
10
+ protected $_infoBlockType = 'aukro/payment_info';
11
+ }
app/code/community/Nostress/Aukro/Model/Product.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Nostress_Aukro_Model_Product extends Nostress_Aukro_Model_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct ();
7
+ $this->_init('aukro/product');
8
+ }
9
+
10
+ public function create( $aukroID, $productID) {
11
+
12
+ $collection = $this->getCollectionByProductID($productID);
13
+ foreach( $collection as $item) {
14
+ $item->current = 0;
15
+ if( empty($item->ended_at)) {
16
+ $item->ended_at = new Zend_Db_Expr( 'NOW()');
17
+ }
18
+ $item->save();
19
+ }
20
+
21
+ $product = Mage::getModel( 'aukro/product')->load( $aukroID, 'aukro_id');
22
+ if( !$product->getId()) {
23
+ $this->product_id = $productID;
24
+ $this->aukro_id = $aukroID;
25
+ $this->created_at = new Zend_Db_Expr( 'NOW()');
26
+ $this->current = 1;
27
+ $this->save();
28
+ }
29
+ }
30
+
31
+ public function getCollectionByProductID( $productID) {
32
+
33
+ $collection = $this->getCollection();
34
+ $collection->getSelect()->where( 'product_id = ?', $productID);
35
+ $collection->load();
36
+
37
+ return $collection;
38
+ }
39
+
40
+ public function finish( $aukroID) {
41
+
42
+ $product = Mage::getModel( 'aukro/product')->load( $aukroID, 'aukro_id');
43
+ if( $product->getId()) {
44
+ $product->ended_at = new Zend_Db_Expr( 'NOW()');
45
+ $product->current = 0;
46
+ $product->save();
47
+ }
48
+ }
49
+ }
app/code/community/Nostress/Aukro/Model/Profile.php ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Export
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Profile extends Nostress_Aukro_Model_Abstract {
28
+
29
+ const START_TIME = 'start_time';
30
+ const FILTER_FROM = 'from';
31
+ const FILTER_TO = 'to';
32
+ const FILTER_GTEQ = 'gteq'; //greaterOrEqualValue
33
+ const FILTER_LTEQ = 'lteq'; //lessOrEqualValue
34
+
35
+ const DEF_GROUP_BY_CATEGORY = "0";
36
+ const DEF_RELOAD_CACHE = 1;
37
+
38
+ const START_TIME_HOUR_INDEX = 0;
39
+ const START_TIME_MINUTE_INDEX = 1;
40
+ const START_TIME_SECOND_INDEX = 2;
41
+ const DEFAULT_START_TIME = "00";
42
+
43
+ private $product; //current processed product
44
+ private $store; //current chosen store
45
+ private $category; //category for which i product exported
46
+ private $_taxHelper; //tax helper
47
+ private $encoding; //chosen encoding
48
+ private $editedCategoryIds; //edited ids of categories
49
+ private $configManageStock = ''; //edited ids of categories
50
+
51
+ private $_attributeSetMap;
52
+ private $_attributeSet = null;
53
+ private $_decimalDelimiter = ".";
54
+ private $_feedObject;
55
+ private $_reloadCache;
56
+ private $_profileDirectAttributes = array("id","store_id","name","frequency","enabled","filename","feed");
57
+
58
+ public function _construct()
59
+ {
60
+ parent::_construct ();
61
+ $this->_init ( 'aukro/profile' );
62
+ $this->_taxHelper = new Mage_Tax_Helper_Data ( );
63
+ $delimiter = $this->getConfig(Nostress_Aukro_Helper_Data::PARAM_DELIMITER);
64
+ if(isset($delimiter))
65
+ $this->setDecimalDelimiter($delimiter);
66
+ }
67
+
68
+ public function setStatus($status)
69
+ {
70
+ $id = $this->getId();
71
+ if(!$id)
72
+ return;
73
+ $this->log("Export profile {$id} {$status}");
74
+ parent::setStatus($status);
75
+ $this->setUpdateTime($this->helper()->getDateTime(null,true));
76
+ $this->save();
77
+ }
78
+
79
+ public function getProfilesByName($name)
80
+ {
81
+ $collection = $this->getCollection();
82
+ $collection->addFieldToFilter('name',$name);
83
+ $collection->getSelect();
84
+ $collection->load();
85
+ return $collection->getItems();
86
+ }
87
+
88
+ public function getAllProfiles()
89
+ {
90
+ $collection = $this->getCollection();
91
+ $collection->load();
92
+ return $collection->getItems();
93
+ }
94
+
95
+ public function getCollectionByStoreId($storeId)
96
+ {
97
+ $collection = $this->getCollection()->addFieldToFilter('store_id',$storeId);
98
+ $collection->load();
99
+ return $collection;
100
+ }
101
+
102
+ public function getCollectionByTime($from,$to)
103
+ {
104
+ if(!isset($from) || !isset($to))
105
+ return null;
106
+ $collection = $this->getCollection();
107
+
108
+ if($from[0] <= $to[0])
109
+ $collection->addFieldToFilter(self::START_TIME,array(self::FILTER_FROM => $from, self::FILTER_TO => $to));
110
+ else
111
+ {
112
+ $collection->addFieldToFilter(self::START_TIME,array(array(self::FILTER_GTEQ => $from),array(self::FILTER_LTEQ => $to)));
113
+ }
114
+ $s = $collection->getSelect()->__toString();
115
+ $collection->load();
116
+ return $collection;
117
+ }
118
+
119
+ public function processData($data, $id) {
120
+ $config = array();
121
+
122
+ //general configuration part
123
+ $general = $this->getConfigField(self::GENERAL,$data);
124
+ foreach ($this->_profileDirectAttributes as $attribute) {
125
+ $this->setData($attribute,$this->getArrayField($attribute,$general,""));
126
+ unset($general[$attribute]);
127
+ }
128
+ $this->saveTime($general);
129
+ unset($general[self::START_TIME]);
130
+ $this->addFilenameSuffix();
131
+ $config[self::GENERAL] = $general;
132
+
133
+ //feed configuration part
134
+ $feed = $this->getConfigField(self::FEED, $data);
135
+ $customAttributes = array();
136
+ $counter = 0;
137
+ foreach ($feed[self::ATTRIBUTES][self::ATTRIBUTE] as $key => $customAttribute) {
138
+
139
+ $index = $counter;
140
+ if ($customAttribute[self::CODE] == self::CUSTOM_ATTRIBUTE) {
141
+ if (isset($customAttribute[self::DELETE]) && $customAttribute[self::DELETE] == 1) {
142
+ continue;
143
+ }
144
+ $index = $counter+Nostress_Aukro_Helper_Data::CUSTOM_ATTRIBUTE_ROW_INDEX_OFFSET;
145
+ }
146
+
147
+ if(isset($customAttribute[self::POST_PROCESS]))
148
+ {
149
+ $postprocFunctions = $customAttribute[self::POST_PROCESS];
150
+ if(is_array($postprocFunctions))
151
+ $customAttribute[self::POST_PROCESS] = implode(self::POSTPROC_DELIMITER, $postprocFunctions);
152
+ }
153
+
154
+ $customAttributes[$index] = $customAttribute;
155
+ $counter++;
156
+ }
157
+ $feed[self::ATTRIBUTES][self::ATTRIBUTE] = $customAttributes;
158
+ $config[self::FEED] = $feed;
159
+
160
+ //product configuration part
161
+ $product = $this->getConfigField(self::PRODUCT,$data);//self::PRODUCT,$data);
162
+ $types = $this->getArrayField(self::TYPES,$product,array());
163
+ $types = implode(",",$types);
164
+ $product[self::TYPES] = $types;
165
+ $config[self::PRODUCT] = $product;
166
+
167
+ $this->setConfig($config);
168
+ $categoryProductIds = $data['category_product_ids'];
169
+
170
+ if($this->getId() != '')
171
+ {
172
+ //Get old export values
173
+ $originalProfile = Mage::getModel('aukro/profile')->load($this->getId());
174
+ $deleteFeedFiles = false;
175
+
176
+ $oldCategoryProductIds = Mage::getModel('aukro/categoryproducts')->getExportCategoryProducts($this->getId());
177
+
178
+ //If search engine was changed => start times have to be recounted or categories to export were changed
179
+ if($originalProfile->getFeed() != $this->getFeed() || $oldCategoryProductIds != $this->getCategoryProductIds())
180
+ {
181
+ $deleteFeedFiles = true;
182
+ }
183
+ else
184
+ {
185
+ //rename xml files
186
+ if($this->getFilename() != $originalProfile->getFilename())
187
+ {
188
+ //rename file nad temp file
189
+ $this->helper()->renameFile($originalProfile->getCurrentFilename(true),$this->getCurrentFilename(true));
190
+ $this->resetUrl();
191
+ }
192
+ }
193
+ if($deleteFeedFiles)
194
+ {
195
+ $originalProfile->deleteFiles();
196
+ $this->setUrl($this->helper()->__('XML file doesnt exist'));
197
+ }
198
+
199
+ }
200
+ else
201
+ {
202
+ $this->setUrl($this->helper()->__('XML file doesnt exist'));
203
+ }
204
+ $this->save();
205
+ $this->helper()->updateCategoryProducts($this->getId(),$categoryProductIds,$this->getStoreId());
206
+ }
207
+
208
+ public function getFilename($full = false,$fileSuffix = null)
209
+ {
210
+ $filename = parent::getFilename();
211
+ if(isset($fileSuffix))
212
+ $filename = $this->helper()->changeFileSuffix($filename,$fileSuffix);
213
+ if($full)
214
+ {
215
+ $feedDir = $this->helper()->getFeedDirectoryName($this->getFeed());
216
+
217
+ $dirPath = $this->helper()->getFullFilePath("",$feedDir);
218
+
219
+ $this->helper()->createDirectory($dirPath);
220
+
221
+ $filename = $this->helper()->getFullFilePath($filename,$feedDir);
222
+ }
223
+ return $filename;
224
+ }
225
+
226
+ protected function saveTime($config)
227
+ {
228
+ $delimiter = Nostress_Aukro_Helper_Data::TIME_DELIMITER;
229
+ $startTime = $this->getArrayField(self::START_TIME,$config,array(self::DEFAULT_START_TIME,self::DEFAULT_START_TIME,self::DEFAULT_START_TIME));
230
+ $this->setStartTime($this->getArrayField(self::START_TIME_HOUR_INDEX,$startTime,self::DEFAULT_START_TIME)
231
+ .$delimiter.$this->getArrayField(self::START_TIME_MINUTE_INDEX,$startTime,self::DEFAULT_START_TIME)
232
+ .$delimiter.$this->getArrayField(self::START_TIME_SECOND_INDEX,$startTime,self::DEFAULT_START_TIME));
233
+
234
+ if ($this->getCreatedTime == NULL || $this->getUpdateTime() == NULL)
235
+ {
236
+ $this->setCreatedTime(now());
237
+ }
238
+ }
239
+
240
+ protected function getCurrentFilename($full=false)
241
+ {
242
+ $suffix = $this->getFeedObject()->getFileType();
243
+ $generalConfig = $this->getCustomConfig(self::GENERAL,false);
244
+ $compressFile = $this->getArrayField("compress_file",$generalConfig,"0");
245
+ if($compressFile)
246
+ $suffix = Nostress_Aukro_Helper_Data::FILE_TYPE_ZIP;
247
+
248
+ return $this->getFilename($full,$suffix);
249
+ }
250
+
251
+ public function delete()
252
+ {
253
+ $this->deleteFiles();
254
+ parent::delete();
255
+ }
256
+
257
+ public function setMessageAndStatus($message,$status)
258
+ {
259
+ $this->setMessage($message);
260
+ $this->setStatus($status);
261
+ $this->save();
262
+ }
263
+
264
+ //delete feed and temp feed files
265
+ protected function deleteFiles()
266
+ {
267
+ $this->helper()->deleteFile($this->getCurrentFilename());
268
+ $this->setUrl($this->helper()->__('XML file doesnt exist'));
269
+ }
270
+
271
+ public function resetUrl()
272
+ {
273
+ $this->setUrl($this->getFileUrl());
274
+ }
275
+
276
+ protected function getFileUrl()
277
+ {
278
+ $filename = $this->getCurrentFilename();
279
+ $feedDir = $this->helper()->getFeedDirectoryName($this->getFeed());
280
+ $filename = $this->helper()->getFileUrl($filename,$feedDir);
281
+ return $filename;
282
+ }
283
+
284
+ protected function addFilenameSuffix()
285
+ {
286
+ $filename = $this->helper()->addFileSuffix($this->getFilename(),$this->getFeed());
287
+ $this->setFilename($filename);
288
+ }
289
+
290
+ protected function helper()
291
+ {
292
+ return Mage::helper('aukro/data');
293
+ }
294
+
295
+ public function getLoaderParams()
296
+ {
297
+ $productConfig = $this->getCustomConfig(self::PRODUCT);
298
+ $feedObject = $this->getFeedObject();
299
+ $attributes = $this->getMagentoAttributes();
300
+
301
+ $params = array();
302
+ $params["export_id"] = $this->getExportId();
303
+ $params["store_id"] = $this->getStoreId();
304
+ $params["use_product_filter"] = $this->getArrayField("use_product_filter",$productConfig,"0");
305
+ $params["group_by_category"] = self::DEF_GROUP_BY_CATEGORY;
306
+ $params["reload_cache"] = $this->getReloadCache();
307
+ $params["taxonomy_code"] = $feedObject->getTaxonomyCode();
308
+ $params["batch_size"] = $this->helper()->getGeneralConfig(Nostress_Aukro_Helper_Data::PARAM_BATCH_SIZE);
309
+ $params["conditions"] = $productConfig;
310
+ $params["attributes"] = $attributes;
311
+
312
+ $loadAllProductCategories = "0";
313
+ if(in_array("categories",$attributes))
314
+ $loadAllProductCategories = "1";
315
+ $params['load_all_product_categories'] = $loadAllProductCategories;
316
+ return $params;
317
+ }
318
+
319
+ protected function getTransformParams()
320
+ {
321
+ $productConfig = $this->getCustomConfig(self::PRODUCT);
322
+
323
+ $params = $this->getMergedProfileFeedConfig();
324
+ if(isset($params['common']))
325
+ {
326
+ foreach($params['common'] as $key => $param)
327
+ {
328
+ $params[$key] = $param;
329
+ }
330
+ unset($params['common']);
331
+ }
332
+ $params["file_type"] = $this->getFeedObject()->getFileType();
333
+ $params["store_id"] = $this->getStoreId();
334
+ $params["parents_childs"] = $this->getArrayField("parents_childs",$productConfig,"0");
335
+ $params["xslt"] = $this->getFeedObject()->getTrnasformationXslt();
336
+ return $params;
337
+ }
338
+
339
+ public function getXmlTransformParams()
340
+ {
341
+ return $this->getTransformParams();
342
+ }
343
+
344
+ public function getXsltTransformParams()
345
+ {
346
+ $params = $this->getTransformParams();
347
+ //add params
348
+ if(isset($params[self::ATTRIBUTES][self::ATTRIBUTE]))
349
+ {
350
+ $cdataSectionElements = array();
351
+ $customColumnsHeader = array();
352
+ $columnsHeader = array();
353
+ foreach ($params[self::ATTRIBUTES][self::ATTRIBUTE] as $key => $customAttribute)
354
+ {
355
+ if ($customAttribute[self::CODE] == self::CUSTOM_ATTRIBUTE)
356
+ {
357
+ $customColumnsHeader[] = $customAttribute[self::LABEL];
358
+ }
359
+ else if($customAttribute[self::TYPE] != self::DISABLED && $customAttribute[self::TYPE] != self::CSV_DISABLED)
360
+ {
361
+ $columnsHeader[] = $customAttribute[self::LABEL];
362
+ }
363
+
364
+ if(strpos($customAttribute[self::POST_PROCESS], self::CDATA) !== false)
365
+ {
366
+ $cdataSectionElements[] = $customAttribute[self::LABEL];
367
+ }
368
+ }
369
+ $params[self::CUSTOM_COLUMNS_HEADER] = $customColumnsHeader;
370
+ $params[self::CDATA_SECTION_ELEMENTS] = $cdataSectionElements;
371
+ $params[self::BASIC_ATTRIBUTES_COLUMNS_HEADER] = $columnsHeader;
372
+ }
373
+ return $params;
374
+ }
375
+
376
+ public function getWriterParams()
377
+ {
378
+ $params = $this->getCustomConfig(self::GENERAL);
379
+ $suffix = $this->getFeedObject()->getFileType();
380
+ $params["full_filename"] = $this->getFilename(true,$suffix);
381
+ $params["filename"] = $this->getFilename(false,$suffix);
382
+ $params["zip_filename"] = $this->getFilename(true,Nostress_Aukro_Helper_Data::FILE_TYPE_ZIP);
383
+ return $params;
384
+ }
385
+
386
+ protected function getMergedProfileFeedConfig($feedCode = null)
387
+ {
388
+ $feedConfig = $this->getFeedObject($feedCode)->getAttributesSetup();
389
+
390
+ $profileFeedConfig = $this->getCustomConfig(self::FEED,false);
391
+ if(!empty($profileFeedConfig))
392
+ {
393
+ $profileFeedConfig = $this->helper()->updateArray($profileFeedConfig,$feedConfig);
394
+ }
395
+ else
396
+ {
397
+ $profileFeedConfig = $feedConfig;
398
+ }
399
+
400
+ $attributes = $this->removeEmptyAttributes($profileFeedConfig);
401
+ if(!empty($attributes))
402
+ $profileFeedConfig[self::ATTRIBUTES][self::ATTRIBUTE] = $attributes;
403
+
404
+ return $profileFeedConfig;
405
+ }
406
+
407
+ protected function removeEmptyAttributes($feedConfig)
408
+ {
409
+ $attributes = $this->getArrayField(self::ATTRIBUTES,$feedConfig);
410
+ $attributeInfoArray = $this->getArrayField(self::ATTRIBUTE,$attributes,array());
411
+
412
+ $attributes = array();
413
+ foreach ($attributeInfoArray as $attribute)
414
+ {
415
+ $code = $this->getArrayField(self::CODE,$attribute);
416
+ $label = $this->getArrayField(self::LABEL,$attribute,"");
417
+ if(empty($label) && $code != self::CUSTOM_ATTRIBUTE)
418
+ continue;
419
+ $attributes[] = $attribute;
420
+ }
421
+ return $attributes;
422
+ }
423
+
424
+ public function getBackendConfig($feedCode = null)
425
+ {
426
+ $profileFeedConfig = $this->getMergedProfileFeedConfig($feedCode);
427
+
428
+ $config = $this->getConfig();
429
+ if(empty($config))
430
+ {
431
+ $config = array();
432
+ }
433
+
434
+ $config[self::FEED] = $profileFeedConfig;
435
+ return $config;
436
+ }
437
+ protected function getCustomConfig($index,$exception = true)
438
+ {
439
+ return $this->getConfigField($index,$this->getConfig(),$exception);
440
+ }
441
+
442
+ protected function getConfigField($index,$config,$exception = true)
443
+ {
444
+ $field = $this->getArrayField($index,$config);
445
+ if(!isset($field) && $exception)
446
+ $this->logAndException("Can't load %s configuration.",$index);
447
+ return $field;
448
+ }
449
+
450
+ public function getReloadCache()
451
+ {
452
+ if(!isset($this->_reloadCache))
453
+ $this->_reloadCache = self::DEF_RELOAD_CACHE;
454
+ return $this->_reloadCache;
455
+ }
456
+
457
+ public function setReloadCache($reloadCache)
458
+ {
459
+ $this->_reloadCache = $reloadCache;
460
+ }
461
+
462
+ public function getFeedObject($feedCode = null)
463
+ {
464
+ if(!isset($feedCode))
465
+ $feedCode = $this->getFeed();
466
+ if(!isset($this->_feedObject))
467
+ $this->_feedObject = Mage::getModel('aukro/feed')->getFeedByCode($feedCode);
468
+ return $this->_feedObject;
469
+ }
470
+
471
+ protected function getMagentoAttributes()
472
+ {
473
+ //$feedConfig = $this->getCustomConfig(self::FEED);
474
+ $feedConfig = $this->getMergedProfileFeedConfig();
475
+ $attributes = $this->getArrayField(self::ATTRIBUTES,$feedConfig);
476
+ $attributeInfoArray = $this->getArrayField(self::ATTRIBUTE,$attributes);
477
+ if(!isset($attributeInfoArray))
478
+ $this->logAndException("Missing feed attributes configuration.");
479
+
480
+ $attributes = array();
481
+ foreach ($attributeInfoArray as $attribute)
482
+ {
483
+ // $code = $this->getArrayField(self::CODE,$attribute);
484
+ // $label = $this->getArrayField(self::LABEL,$attribute,"");
485
+ // if(empty($label) && $code != self::CUSTOM_ATTRIBUTE)
486
+ // continue;
487
+
488
+ $magentoAttribute = $this->getArrayField(self::MAGENTO_ATTRIBUTE,$attribute);
489
+ if(isset($magentoAttribute) && !empty($magentoAttribute) && !in_array($attribute,$attributes))
490
+ $attributes[] = $magentoAttribute;
491
+ }
492
+
493
+ //attribute from stock setup
494
+ $common = $this->getArrayField("common",$feedConfig,array());
495
+ $stock = $this->getArrayField("stock",$common);
496
+ if(!isset($stock))
497
+ $this->logAndException("Missing feed stock configuration.");
498
+ $availabilityAttribute = $this->getArrayField("availability",$stock);
499
+ if(isset($availabilityAttribute) && !empty($availabilityAttribute))
500
+ $attributes[] = $availabilityAttribute;
501
+
502
+ return $attributes;
503
+ }
504
+
505
+ public function setConfig($config)
506
+ {
507
+ parent::setConfig(json_encode($config));
508
+ }
509
+
510
+ public function getConfig()
511
+ {
512
+ $id = $this->getId();
513
+ if(!isset($id))
514
+ return null;
515
+ $config = json_decode(parent::getConfig(),true);
516
+ return $config;
517
+ }
518
+
519
+ }
app/code/community/Nostress/Aukro/Model/Shipping/Carrier/Aukro.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Our test shipping method module adapter
5
+ */
6
+ class Nostress_Aukro_Model_Shipping_Carrier_Aukro extends Mage_Shipping_Model_Carrier_Abstract
7
+ implements Mage_Shipping_Model_Carrier_Interface
8
+ {
9
+ /**
10
+ * unique internal shipping method identifier
11
+ *
12
+ * @var string [a-z0-9_]
13
+ */
14
+ protected $_code = 'aukro';
15
+ protected $_isFixed = true;
16
+
17
+ /**
18
+ * Enter description here...
19
+ *
20
+ * @param Mage_Shipping_Model_Rate_Request $data
21
+ * @return Mage_Shipping_Model_Rate_Result
22
+ */
23
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
24
+ {
25
+ if (!$this->getConfigFlag('active')) {
26
+ return false;
27
+ }
28
+
29
+ $result = Mage::getModel('shipping/rate_result');
30
+ $shippingData = $request->getFreeShipping();
31
+ $request->setFreeShipping( false);
32
+ $method = Mage::getModel('shipping/rate_result_method');
33
+
34
+ $method->setCarrier('aukro');
35
+ $method->setCarrierTitle($this->getConfigData('title'));
36
+
37
+ $method->setMethod('aukro');
38
+ $method->setMethodTitle( $shippingData['label']);
39
+
40
+ $method->setPrice( $shippingData['fee']);
41
+ $method->setCost( $shippingData['fee']);
42
+
43
+ $result->append($method);
44
+
45
+ return $result;
46
+ }
47
+
48
+ public function getAllowedMethods()
49
+ {
50
+ return array('aukro'=>$this->getConfigData('name'));
51
+ }
52
+ }
app/code/community/Nostress/Aukro/Model/Shipping/Pricing.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Shipping_Pricing extends Mage_Core_Model_Abstract
26
+ {
27
+ public function _construct()
28
+ {
29
+ parent::_construct ();
30
+ $this->_init('aukro/shipping_pricing');
31
+ }
32
+ }
app/code/community/Nostress/Aukro/Model/Status.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for Aukro
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Status extends Varien_Object
28
+ {
29
+ const STATUS_ENABLED = 1;
30
+ const STATUS_DISABLED = 2;
31
+
32
+ static public function getOptionArray()
33
+ {
34
+ return array(
35
+ self::STATUS_ENABLED => Mage::helper('aukro')->__('Enabled'),
36
+ self::STATUS_DISABLED => Mage::helper('aukro')->__('Disabled')
37
+ );
38
+ }
39
+ }
app/code/community/Nostress/Aukro/Model/Taxonomy.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Model for search engines taxonomy
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Taxonomy extends Mage_Core_Model_Abstract
28
+ {
29
+ const ALL_LOCALES = 'all';
30
+ const ROOT = 'taxonomy';
31
+
32
+ const SRC = 'src';
33
+ const PATH = 'path';
34
+ const FILENAME = 'filename';
35
+ const DOWNLOAD = 'download';
36
+
37
+ //config tags
38
+ const LOCALE = 'locale';
39
+ const DELIMITER = 'delimiter';
40
+ const VARIABLE = 'variable';
41
+ const DEFAULT_LOCALE = 'default';
42
+ const TRANSLATE = 'rewrite';
43
+ const GENERAL = 'general';
44
+ const OPTION = 'option';
45
+ const LABEL = 'label';
46
+ const VALUE = 'value';
47
+ const COMMON = 'common';
48
+
49
+ //columns
50
+ const C_CODE = 'taxonomy_code';
51
+ const C_LOCALE = 'locale';
52
+ const C_NAME = 'name';
53
+ const C_ID = 'id';
54
+ const C_PATH = 'path';
55
+ const C_IDS_PATH = 'ids_path';
56
+ const C_LEVEL = 'level';
57
+ const C_PARENT_NAME = 'parent_name';
58
+ const C_PARENT_ID = 'parent_id';
59
+
60
+ const DEFAULT_LOCALE_DELIMITER = "_";
61
+
62
+ protected $_enginesConfig;
63
+ protected $_message = array(true=>array(),false=>array());
64
+
65
+ public function _construct()
66
+ {
67
+ parent::_construct ();
68
+ $this->_init ( 'aukro/enginecategory' );
69
+ }
70
+
71
+ public function getTaxonomy($code,$locale,$select = null)
72
+ {
73
+ $filter = "";
74
+ if($this->countColumns($code,$locale) > 0)
75
+ {
76
+ $filter = $this->getFilterFields($code,$locale);
77
+ }
78
+ else
79
+ {
80
+ $filter = $this->getFilterFields($code);
81
+ }
82
+
83
+ $items = $this->_getTaxonomy($filter,$select);
84
+ return $items;
85
+ }
86
+
87
+ public function countColumns($code,$locale = self::ALL_LOCALES)
88
+ {
89
+ return $this->getResource()->countColumns($code,$locale);
90
+ }
91
+
92
+ public function _getTaxonomy($filter = null,$select = null)
93
+ {
94
+ $collection = $this->getResourceCollection();
95
+ $collection->addFieldsToFilter($filter);
96
+ $collection->addFieldsToSelect($select);
97
+ $collection->getSelect();//init select don't delete
98
+ $collection->load();
99
+ return $collection->getItems();
100
+ }
101
+
102
+
103
+ public function reloadTaxonomy()
104
+ {
105
+ //clear all
106
+ $this->clearTaxonomy();
107
+
108
+ //get locales of all stores
109
+ $locales = $this->helper()->getAllStoresLocale();
110
+
111
+ //load all records
112
+ $this->_reloadTaxonomy($locales);
113
+
114
+ return $this->_message;
115
+ }
116
+
117
+ public function getTaxonomyConfig($code,$locale = null)
118
+ {
119
+ //$engieConfig = $this->getEngineConfig($engineCode);
120
+ $config = Mage::getModel('aukro/taxonomy_setup')->getSetupByCode($code);
121
+ if(isset($config))
122
+ {
123
+ return $this->prepareTaxonomyConfig($config);
124
+ }
125
+ else
126
+ return false;
127
+ }
128
+
129
+ public function getSelectFields($code)
130
+ {
131
+ $taxonomyConfig = $this->getTaxonomyConfig($code);
132
+ if($taxonomyConfig == false)
133
+ return false;
134
+
135
+ $locale = $this->getLocale();
136
+ $localeConfig = $this->getArrayItem($taxonomyConfig,$locale,self::ALL_LOCALES);
137
+ $general = $this->getArrayItem($localeConfig,self::GENERAL);
138
+ $options = $this->getArrayItem($general,self::OPTION);
139
+
140
+ $fields = array();
141
+ $fields[self::LABEL] = $this->getArrayItem($options,self::LABEL);
142
+ $fields[self::VALUE] = $this->getArrayItem($options,self::VALUE);
143
+ return $fields;
144
+ }
145
+
146
+ protected function getFilterFields($code,$locale = self::ALL_LOCALES)
147
+ {
148
+ $fields = array();
149
+ $fields[self::C_CODE] = $code;
150
+ $fields[self::C_LOCALE] = $locale;
151
+ return $fields;
152
+ }
153
+
154
+ protected function prepareTaxonomyConfig($config)
155
+ {
156
+ $common = $this->getArrayItem($config,self::COMMON);
157
+ $locales = $this->getArrayItem($config,self::LOCALE);
158
+ foreach($locales as $key => $locale)
159
+ {
160
+ $locales[$key] = $this->helper()->updateArray($locale,$common);
161
+ }
162
+ return $locales;
163
+
164
+ }
165
+
166
+ protected function clearTaxonomy()
167
+ {
168
+ $this->getResource()->cleanTable();
169
+ }
170
+
171
+ protected function _reloadTaxonomy($locales)
172
+ {
173
+ $taxonomySetupCollection = Mage::getModel('aukro/taxonomy_setup')->getCollection()->load();
174
+
175
+ foreach($taxonomySetupCollection as $taxonomyItem)
176
+ {
177
+ $config = $taxonomyItem->getDecodedSetup();
178
+ $config = $this->prepareTaxonomyConfig($config);
179
+ $name = $taxonomyItem->getName();
180
+ $code = $taxonomyItem->getCode();
181
+ //prepare locales config
182
+ $localesSourceConfig = $this->prepareLocalesSourceConfig($name,$config,$locales);
183
+ //add engines taxonomy to DB
184
+ foreach($localesSourceConfig as $locale => $sourceConfig)
185
+ $this->insertEngineCategories($name,$code,$locale,$sourceConfig);
186
+ }
187
+ }
188
+
189
+ protected function prepareLocalesSourceConfig($taxonomyName,$taxonomyConfig,$locales)
190
+ {
191
+ $localeConfigArray = array();
192
+ foreach($taxonomyConfig as $localeCode => $config)
193
+ {
194
+ try
195
+ {
196
+ if($localeCode == self::ALL_LOCALES)
197
+ {
198
+ if($this->hasArrayItem($config,self::DOWNLOAD))
199
+ {
200
+ $localeConfigArray = $this->processLocales($locales,$config);
201
+ break;
202
+ }
203
+ else
204
+ {
205
+ $localeConfigArray[$localeCode] = $this->getArrayItem($config,self::SRC);
206
+ }
207
+ }
208
+ else if(in_array($localeCode,$locales))
209
+ {
210
+ $localeConfigArray[$localeCode] = $this->getArrayItem($config,self::SRC);
211
+
212
+ }
213
+
214
+ }
215
+ catch(Exception $e)
216
+ {
217
+ Mage::log("Taxonomy: {$taxonomyName} Locale: {$localeCode} -- {$e} ",Zend_Log::DEBUG,Nostress_Aukro_Helper_Data::LOG_FILE);
218
+ }
219
+ }
220
+
221
+ return $localeConfigArray;
222
+
223
+ }
224
+
225
+ protected function processLocales($locales,$config)
226
+ {
227
+ $localeConfigArray = array();
228
+ $sourceConfig = $this->getArrayItem($config,self::SRC,array());
229
+ $sourceFile = $this->getArrayItem($sourceConfig,self::FILENAME);
230
+
231
+ $localeConfig = $this->getArrayItem($config,self::DOWNLOAD);
232
+ $delimiter = $this->getArrayItem($localeConfig,self::DELIMITER);
233
+ $variable = $this->getArrayItem($localeConfig,self::VARIABLE);
234
+ $defLoc = $this->getArrayItem($localeConfig,self::DEFAULT_LOCALE,self::ALL_LOCALES);
235
+ $translate = $this->getArrayItem($localeConfig,self::TRANSLATE,null,true);
236
+
237
+ if(!in_array($defLoc,$locales))
238
+ $locales[] = $defLoc;
239
+
240
+ foreach($locales as $locale)
241
+ {
242
+ $sourceConfig[self::FILENAME] = $this->prepareSrcFilename($sourceFile,$locale,$variable,$delimiter,$translate);
243
+ $localeConfigArray[$locale] = $sourceConfig;
244
+ }
245
+ return $localeConfigArray;
246
+ }
247
+
248
+ protected function prepareSrcFilename($src,$locale,$variable,$delimiter,$translate)
249
+ {
250
+ if(isset($translate[$locale]))
251
+ $locale = $translate[$locale];
252
+
253
+ $locale = str_replace(self::DEFAULT_LOCALE_DELIMITER,$delimiter,$locale);
254
+ $src = str_replace($variable,$locale,$src);
255
+ return $src;
256
+ }
257
+
258
+ protected function hasArrayItem($array,$index)
259
+ {
260
+ if(isset($array[$index]))
261
+ return true;
262
+ else
263
+ return false;
264
+ }
265
+
266
+ protected function getArrayItem($array,$index,$default = null,$allowNull = false)
267
+ {
268
+ if(isset($array[$index]))
269
+ return $array[$index];
270
+ else if($allowNull)
271
+ return null;
272
+ else if(!isset($array[$default]))
273
+ {
274
+ throw new Exception("Missing taxonomy config node '{$index}' ");
275
+ return null;
276
+ }
277
+ else
278
+ return $array[$default];
279
+ }
280
+
281
+ protected function insertEngineCategories($name,$code,$locale,$fileSourceConfig)
282
+ {
283
+ $message = "";
284
+ try
285
+ {
286
+ //load engine category records
287
+ $records = $this->loadEngineCategoriesFromFile($fileSourceConfig);
288
+ $this->getResource()->insertEngineCategoryRecords($code,$locale,$records);
289
+ $message = "Taxonomy \"{$name}\" locale: \"{$locale}\" has been updated";
290
+ $this->_message[true][] = $message;
291
+ }
292
+ catch(Exception $e)
293
+ {
294
+ $message = "Taxonomy \"{$name}\" locale: \"{$locale}\" hasn't been updated Error:".$e->getMessage()." ";
295
+ $this->_message[false][] = $message;
296
+ }
297
+ $this->log($message);
298
+ }
299
+
300
+ protected function insertEngineCategoryRecords($engineCode,$locale,$records)
301
+ {
302
+ $collection = $this->getCollection()->initParams($engineCode,$locale);
303
+
304
+ foreach($records as $row)
305
+ {
306
+ $collection->addNewItem($row);
307
+ }
308
+
309
+ $collection->save();
310
+ }
311
+
312
+ protected function loadEngineCategoriesFromFile($params)
313
+ {
314
+ $records = Mage::getModel('aukro/data_reader')->getFileContent($params);
315
+ $records = Mage::getModel('aukro/taxonomy_preprocessor')->processRecords($records,$params);
316
+ return $records;
317
+ }
318
+
319
+ protected function helper()
320
+ {
321
+ return Mage::helper('aukro');
322
+ }
323
+
324
+ protected function log($message)
325
+ {
326
+ Mage::log($message,Zend_Log::DEBUG,Nostress_Aukro_Helper_Data::LOG_FILE);
327
+ }
328
+ }
app/code/community/Nostress/Aukro/Model/Unit.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Unit for product export process
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Unit extends Nostress_Aukro_Model_Abstract
28
+ {
29
+ const MB_SIZE = 1024;
30
+ const TIME = 'time';
31
+ const MEMORY = 'memory';
32
+ const PRODUCTS = 'products';
33
+ const TIME_DECIMAL = 2;
34
+
35
+ protected $_startTime;
36
+ protected $_totalTime;
37
+ protected $_productCounter;
38
+
39
+
40
+ protected function init()
41
+ {
42
+ $this->initStartTime();
43
+ $this->resetProductCounter();
44
+ return $this;
45
+ }
46
+
47
+ public function getProcessInfo($format = true)
48
+ {
49
+ $info = array();
50
+ $info[self::TIME] = $this->getTotalTime($format);
51
+ $info[self::MEMORY] = $this->getTotalMemory($format);
52
+ $info[self::PRODUCTS] = $this->getProductCounter();
53
+
54
+ if($format)
55
+ {
56
+ $info = $this->helper()->__("Products: %s Time: %s Memory: %s ",$info[self::PRODUCTS],$info[self::TIME],$info[self::MEMORY]);
57
+ }
58
+
59
+ return $info;
60
+ }
61
+
62
+ protected function initStartTime()
63
+ {
64
+ $this->_startTime = $this->helper()->getProcessorTime();
65
+ }
66
+
67
+ protected function stopTime()
68
+ {
69
+ $endTime = $this->helper()->getProcessorTime();
70
+ $this->_totalTime = $endTime - $this->_startTime;
71
+ }
72
+
73
+ protected function getTotalTime($format = true)
74
+ {
75
+ $time = $this->_totalTime;
76
+ $time = round($time,self::TIME_DECIMAL);
77
+ if($format)
78
+ $time .= " ".$this->helper()->__("s");
79
+ return $time;
80
+ }
81
+
82
+ protected function getTotalMemory($format = true)
83
+ {
84
+ //$memory = memory_get_usage(true);
85
+ $memory = memory_get_peak_usage(1);
86
+ $memory = ($memory/self::MB_SIZE)/self::MB_SIZE;
87
+ if($format)
88
+ $memory .= " ".$this->helper()->__("MB");
89
+ return $memory;
90
+ }
91
+
92
+ protected function incrementProductCounter($number)
93
+ {
94
+ $this->_productCounter += $number;
95
+ }
96
+
97
+ protected function resetProductCounter()
98
+ {
99
+ $this->_productCounter = 0;
100
+ }
101
+
102
+ protected function getProductCounter()
103
+ {
104
+ return $this->_productCounter;
105
+ }
106
+ }
app/code/community/Nostress/Aukro/Model/Unit/Control.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Control unit for product export process
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Model_Unit_Control extends Nostress_Aukro_Model_Unit
28
+ {
29
+ const DEF_GROUP_BY_CATEGORY = 1;
30
+ const DEF_RELOAD_CACHE = 1;
31
+
32
+ public function upload($productIds,$storeId, $dryRun = false, $update = false)
33
+ {
34
+ $this->init();
35
+ $this->logStatus(self::STATUS_RUNNING);
36
+
37
+ $loader = Mage::getSingleton('aukro/data_loader_product_aukro');
38
+ $transformator = Mage::getSingleton('aukro/data_transformation_xml_array');
39
+ $productUploader = Mage::getSingleton("aukro/webapi_product");
40
+
41
+ $count = 0;
42
+ try
43
+ {
44
+ $loader->init($this->getLoaderParams($productIds,$storeId),true);
45
+ $transformator->init($this->getTransformParams($storeId));
46
+ while(($productsNumber = count($batch = $loader->loadBatch())) > 0)
47
+ {
48
+ $this->incrementProductCounter($productsNumber);
49
+ $transformator->transform($batch);
50
+ }
51
+
52
+ if($this->getProductCounter() == 0)
53
+ $this->logAndException("Zero products selected for export. Please choose products to export in profile's detail.");
54
+
55
+ $this->incrementProductCounter(-$transformator->getSkippedProductsCounter());
56
+ $items = $transformator->getResult(true);
57
+ if( $update) {
58
+ $count = $productUploader->update($items);
59
+ } else {
60
+ $count = $productUploader->upload($items, $dryRun);
61
+ }
62
+ }
63
+ catch(Exception $e)
64
+ {
65
+ $this->logStatus(self::STATUS_ERROR);
66
+ throw $e;
67
+ }
68
+
69
+ $this->logStatus(self::STATUS_FINISHED);
70
+ return $count;
71
+ }
72
+
73
+ protected function getLoaderParams($productIds,$storeId)
74
+ {
75
+ $params = array();
76
+ $params["store_id"] = $storeId;
77
+ $params["group_by_category"] = self::DEF_GROUP_BY_CATEGORY;
78
+ $params["reload_cache"] = self::DEF_RELOAD_CACHE;
79
+ $params["conditions"] = array(
80
+ Nostress_Aukro_Helper_Data_Loader::CONDITION_PRODUCT_IDS => $productIds,
81
+ Nostress_Aukro_Helper_Data_Loader::CONDITION_EXPORT_OUT_OF_STOCK => 1
82
+ );
83
+ $params["attributes"] = $this->getAttributeModel()->getAttributeCodes(true);
84
+ return $params;
85
+ }
86
+
87
+ protected function getTransformParams($store_id)
88
+ {
89
+ $params = array();
90
+ $params["attributes"] = $this->getAttributeModel()->getCollectionData();
91
+ $params['attributes'][] = array( 'code'=>'id', 'magento'=>'id');
92
+
93
+ $params["file_type"] = self::XML;
94
+ $params["store_id"] = $store_id;
95
+ $params["parents_childs"] = "0";
96
+ $params["encoding"] = 'utf-8';
97
+ return $params;
98
+ }
99
+
100
+
101
+ protected function logStatus($status)
102
+ {
103
+ $this->helper()->log($this->helper()->__("Aukro upload status: ").$status);
104
+ }
105
+
106
+ protected function getAttributeModel()
107
+ {
108
+ return Mage::getModel('aukro/mapping_attribute');
109
+ }
110
+ }
app/code/community/Nostress/Aukro/Model/Webapi/Abstract.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Webapi_Abstract extends Nostress_Aukro_Model_Abstract {
26
+
27
+ // const AUKRO_COUNTRY = 228; // 228 ND testwebapi.pl
28
+ // const AUKRO_URL = 'http://webapi.allegro.pl/uploader.php?wsdl';
29
+
30
+ const AUKRO_COUNTRY = 56; // CZ Aukro.cz
31
+ const AUKRO_URL = 'https://webapi.aukro.cz/service.php?wsdl';
32
+ //const AUKRO_URL = 'https://webapi.aukro.cz/uploader.php?wsdl';
33
+
34
+ /* AUKRO WEBAPI KONSTANTY */
35
+ // html typ attributu
36
+ const STRING = 1;
37
+ const INTEGER = 2;
38
+ const FLOAT = 3;
39
+ const SELECT = 4 ;
40
+ const RADIOBUTTON = 5;
41
+ const CHECKBOX = 6;
42
+ const IMAGE = 7;
43
+ const TEXTAREA = 8;
44
+ const DATETIME = 9;
45
+ const DATE = 13;
46
+
47
+ const FID = 'fid';
48
+ const FVALUE_STRING = "fvalueString";
49
+ const FVALUE_INT = "fvalueInt";
50
+ const FVALUE_FLOAT = "fvalueFloat";
51
+ const FVALUE_IMAGE = "fvalueImage";
52
+ const FVALUE_DATETIME = "fvalueDatetime";
53
+ const FVALUE_DATE = "fvalueDate";
54
+ const FVALUE_RANGE_INT = "fvalueRangeInt";
55
+ const FVALUE_RANGE_FLOAT = "fvalueRangeFloat";
56
+ const FVALUE_RANGE_DATE = "fvalueRangeDate";
57
+
58
+ const MANDATORY = 8;
59
+
60
+ const CMD_DO_GET_SHIPMENT_DATA = 'doGetShipmentData'; //NEW Umožňuje získat údaje o způsobech přepravy z určité země
61
+ const CMD_DO_GET_SELL_FORM_ATTRIBS = 'doGetSellFormAttribs'; //Zjištění specifickych atributů pro danou kategorii
62
+ const CMD_DO_GET_SELL_FORM_FIELDS_FOR_CATEGORY = 'doGetSellFormFieldsForCategory'; // uplne vsechny atributy kategorie
63
+ const CMD_DO_GET_CATS_DATA = 'doGetCatsData'; //Vrací kompletní seznam kategorií na Aukru
64
+ const CMD_DO_QUERY_SYS_STATUS = 'doQuerySysStatus'; //NEW Tato metoda dovoluje získat informace o verzích WebAPI komponent.
65
+ const CMD_DO_LOGIN_ENC = 'doLoginEnc'; //NEW Metoda pro přihlášení uživatele s využitím šifrování hesla.
66
+ const CMD_DO_CHECK_NEW_AUCTION_EXT = 'doCheckNewAuctionExt'; //Ověřuje správnost všech zadaných polí prodejního formuláře
67
+ const CMD_DO_NEW_AUCTION_EXT = 'doNewAuctionExt'; //Postará o vystavení produktu
68
+ const CMD_DO_FINISH_ITEM = 'doFinishItem';
69
+ const CMD_DO_UPDATE_ITEM = 'doChangeItemFields';
70
+
71
+ protected $_webapi_ver;
72
+ protected $_soap;
73
+ protected $_helper;
74
+ protected $_session_id;
75
+ protected $_user_id;
76
+
77
+ public function __construct() {
78
+ $this->_soap = new SoapClient ( self::AUKRO_URL);
79
+ $this->_soap->soap_defencoding = 'UTF-8';
80
+ $this->_soap->decode_utf8 = false;
81
+ $userData = Mage::helper('aukro')->getAukroLoginData();
82
+ try {
83
+ // ziskani verze WebAPI
84
+ $params = array('sysvar' => 1,'countryId' => self::AUKRO_COUNTRY, 'webapiKey' => $userData['webapi_key']);
85
+ $output = $this->soapCall(self::CMD_DO_QUERY_SYS_STATUS,$params,false);
86
+ $this->_webapi_ver = $output['verKey'];
87
+ // prihlaseni k WebAPI
88
+ $pass_hash = base64_encode(hash('sha256', $userData['password'], true));
89
+ $params = array('userLogin' => $userData['username'], 'userHashPassword' => $pass_hash, 'countryCode' => self::AUKRO_COUNTRY, 'webapiKey' => $userData['webapi_key'], 'localVersion' => $this->_webapi_ver);
90
+ $output = $this->soapCall(self::CMD_DO_LOGIN_ENC,$params);
91
+ $this->_session_id = $output['sessionHandlePart'];
92
+ $this->_user_id = $output['userId'];
93
+ }
94
+ catch (Exception $e)
95
+ {
96
+ $this->error($e);
97
+ return array();
98
+ //throw new Exception("Aukro webapi: ".$e->faultcode." - ".$e->faultstring);
99
+ }
100
+ }
101
+
102
+ public function getResTypes() {
103
+
104
+ return array(
105
+ self::STRING => self::FVALUE_STRING,
106
+ self::INTEGER => self::FVALUE_INT,
107
+ self::FLOAT => self::FVALUE_FLOAT,
108
+ self::IMAGE => self::FVALUE_IMAGE,
109
+ self::DATETIME => self::FVALUE_DATETIME,
110
+ self::DATE => self::FVALUE_DATE,
111
+ );
112
+ }
113
+
114
+ /**
115
+ * @return All aukro categories
116
+ */
117
+ public function getCategoryData() {
118
+ $params = array (
119
+ 'countryId' => self::AUKRO_COUNTRY,
120
+ 'localVersion' => $this->_webapi_ver,
121
+ 'webapiKey' => Mage::helper('aukro')->getAukroWebApiKey(),
122
+ );
123
+
124
+ return $this->soapCall(self::CMD_DO_GET_CATS_DATA,$params);
125
+ }
126
+
127
+ /**
128
+ * Gets aukro category data.
129
+ * @param $categoryId Category ID.
130
+ * @return Aukro category data
131
+ */
132
+ public function getSellFormAttributesForCategory($categoryId) {
133
+ $params = array (
134
+ 'countryId' => self::AUKRO_COUNTRY,
135
+ 'webapiKey' => Mage::helper('aukro')->getAukroWebApiKey(),
136
+ 'localVersion' => $this->_webapi_ver,
137
+ 'catId' => $categoryId,
138
+ );
139
+
140
+ return $this->soapCall(self::CMD_DO_GET_SELL_FORM_ATTRIBS,$params);
141
+ }
142
+
143
+ /**
144
+ * Gets aukro category data 2
145
+ * @param $categoryId Category ID.
146
+ * @return Aukro category data
147
+ */
148
+ public function getSellFormFields($categoryId) {
149
+ $params = array (
150
+ 'webapiKey' => Mage::helper('aukro')->getAukroWebApiKey(),
151
+ 'countryId' => self::AUKRO_COUNTRY,
152
+ 'categoryId' => $categoryId,
153
+ );
154
+
155
+ return $this->soapCall( self::CMD_DO_GET_SELL_FORM_FIELDS_FOR_CATEGORY, $params);
156
+ }
157
+
158
+ /**
159
+ * @return Shipping information for current country.
160
+ */
161
+ public function getShipmentData() {
162
+ $params = array (
163
+ 'countryId' => self::AUKRO_COUNTRY,
164
+ 'webapiKey' => Mage::helper('aukro')->getAukroWebApiKey(),
165
+ );
166
+
167
+ return $this->soapCall(self::CMD_DO_GET_SHIPMENT_DATA,$params);
168
+ }
169
+
170
+ public function _uploadProduct($data,$dryRun = false)
171
+ {
172
+ // vytvoreni vstupniho pole pro doNewAuctionExt
173
+ $params = array('sessionHandle' => $this->_session_id, 'fields' => $data);
174
+ // Misto realneho vystaveni nabidky muzeme zavolat pouze jeji kontrolu - metoda doCheckNewAuctionExt nevystavi nabidku.
175
+ if($dryRun)
176
+ $output = $this->soapCall(self::CMD_DO_CHECK_NEW_AUCTION_EXT,$params);
177
+ else
178
+ $output = $this->soapCall(self::CMD_DO_NEW_AUCTION_EXT,$params); // Realne vystaveni nabidky - metoda doNewAuctionExt jiz nabidku vystavi
179
+
180
+ if( is_array( $output) && isset( $output['itemId'])) {
181
+ return $output['itemId'];
182
+ }
183
+
184
+ return $output;
185
+ }
186
+
187
+ protected function soapCall($cmd,$params,$catchException = true)
188
+ {
189
+ if( count( $params) > 1) {
190
+ $params = array( $params);
191
+ }
192
+
193
+ if(!$catchException)
194
+ return $this->objectToArray( $this->_soap->__soapCall($cmd, $params));
195
+
196
+ try
197
+ {
198
+ return $this->objectToArray( $this->_soap->__soapCall($cmd, $params));
199
+ }
200
+ catch (Exception $e)
201
+ {
202
+ $this->error($e);
203
+ return false;
204
+ }
205
+
206
+ }
207
+
208
+ protected function helper()
209
+ {
210
+ if(!isset($this->_helper))
211
+ $this->_helper = Mage::helper('aukro');
212
+ return $this->_helper;
213
+ }
214
+
215
+ protected function error(Exception $e)
216
+ {
217
+ Mage::getSingleton('core/session')->addError("Aukro webapi: ".$e->faultcode." - ".$e->faultstring);
218
+ }
219
+
220
+ function objectToArray($d) {
221
+ return json_decode(json_encode($d), true);
222
+ }
223
+ }
224
+
225
+
app/code/community/Nostress/Aukro/Model/Webapi/Config.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Webapi_Config extends Nostress_Aukro_Model_Webapi_Abstract
26
+ {
27
+ public function getCountries() {
28
+
29
+ $userData = Mage::helper('aukro')->getAukroLoginData();
30
+ $params = array('countryCode' => self::AUKRO_COUNTRY, 'webapiKey' => $userData['webapi_key']);
31
+ return $this->soapCall( 'doGetCountries', $params);
32
+ }
33
+
34
+ public function getRegions() {
35
+
36
+ $userData = Mage::helper('aukro')->getAukroLoginData();
37
+ $params = array('countryCode' => self::AUKRO_COUNTRY, 'webapiKey' => $userData['webapi_key']);
38
+ return $this->soapCall( 'doGetStatesInfo', $params);
39
+ }
40
+
41
+ public function getFieldConfig( $fieldID = null) {
42
+
43
+ $userData = Mage::helper('aukro')->getAukroLoginData();
44
+ $params = array('countryCode' => self::AUKRO_COUNTRY, 'localVersion'=>0, 'webapiKey' => $userData['webapi_key']);
45
+ $fields = $this->soapCall( 'doGetSellFormFieldsExt', $params);
46
+ // mozna bude potreba, ale je to pomale. nacita se asi 1300 atributu
47
+ }
48
+ }
app/code/community/Nostress/Aukro/Model/Webapi/Order.php ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Webapi_Order extends Nostress_Aukro_Model_Webapi_Abstract
26
+ {
27
+ const CMD_DO_GET_SITE_JOURNAL_DEALS = 'doGetSiteJournalDeals'; // vrati seznam objednavek z aukra
28
+
29
+ const ORDER_TYPE_BUY = 1;
30
+ const ORDER_TYPE_SHIPPING = 2;
31
+ const ORDER_TYPE_SHIPPING_CANCELED = 3;
32
+ const ORDER_TYPE_PAYU = 4;
33
+
34
+ const ORDER_STATUS_PENDING = 'pending';
35
+ const ORDER_STATUS_UNFIHISHED = 'aukro_unfinished';
36
+
37
+ const ORDER_PAYMENT_TYPE_WIRE_TRANSFER = 'wire_transfer';
38
+ const ORDER_PAYMENT_TYPE_COLLECT_ON_DELIVERY = 'collect_on_delivery';
39
+ const ORDER_PAYMENT_TYPE_CART = 'aukro';
40
+
41
+ protected function _getAukroOrders() {
42
+
43
+ // objednavky z aukra
44
+ $events = $this->_getSiteJournalDeals();
45
+
46
+ if( !is_array( $events)) {
47
+ return false;
48
+ }
49
+
50
+ // seskupeni udalosti podle dealID
51
+ $ordersByDealID = array();
52
+ foreach( $events['siteJournalDeals']['item'] as $event) {
53
+ $event = (array) $event;
54
+ $dealID = $event['dealId'];
55
+ if( !isset( $ordersByDealID[$dealID])) {
56
+ $event['tmp_types'] = array();
57
+ $event['transaction_ids'] = array();
58
+ $ordersByDealID[$dealID] = $event;
59
+ }
60
+ $ordersByDealID[$dealID]['tmp_types'][] = $event['dealEventType'];
61
+ if( !empty($event['dealTransactionId']) && !in_array( $event['dealTransactionId'], $ordersByDealID[$dealID]['transaction_ids'])) {
62
+ $ordersByDealID[$dealID]['transaction_ids'][] = $event['dealTransactionId'];
63
+ }
64
+ }
65
+
66
+ // seskupeni podle dealTransactionId
67
+ $orders = array();
68
+
69
+ foreach( $ordersByDealID as $dealID => $order) {
70
+ $transID = count($order['transaction_ids']) ? $order['transaction_ids'][0] : $dealID;
71
+ if( !isset( $orders[$transID])) {
72
+ $order['dealIDs'] = array();
73
+ $order['items'] = array();
74
+ $order['types'] = array();
75
+ $orders[$transID] = $order;
76
+ }
77
+ $orders[$transID]['dealIDs'][] = $dealID;
78
+ $orders[$transID]['types'] = array_merge( $orders[$transID]['types'], $order['tmp_types']);
79
+ $orders[$transID]['items'][] = array(
80
+ 'item_id' => $order['dealItemId'],
81
+ 'qty' => $order['dealQuantity'],
82
+ );
83
+ }
84
+
85
+ return $orders;
86
+ }
87
+
88
+ public function refreshOrders() {
89
+
90
+ $orders = $this->_getAukroOrders();
91
+ if( !$orders) {
92
+ return false;
93
+ }
94
+
95
+ // ziskani ulozenych aukro objednavek
96
+ $orderCollection = Mage::getModel( 'sales/order')->getCollection();
97
+ $orderCollection->getSelect()->where( 'aukro_order_id IS NOT NULL');
98
+ $orderCollection->load();
99
+ $salesOrders = array();
100
+ foreach( $orderCollection as $order) {
101
+ $salesOrders[$order->aukro_order_id] = $order->toArray( array( 'entity_id', 'state', 'status'));
102
+ }
103
+
104
+ // kontrola existence a stavu objednavek a polozek v nich
105
+ $auctionIDs = array();
106
+ $newOrders = array();
107
+ $transactionsIDsForBuyForm = array();
108
+
109
+ foreach( $orders as $orderID => $order) {
110
+
111
+ $checkProduct = true;
112
+
113
+ $order['aukro_order_id'] = $orderID;// pridani stavu objednavky
114
+ $order['paid'] = false;
115
+ $orderSalesStatus = isset( $order['sales_order']['status']) ? $order['sales_order']['status'] : null;
116
+
117
+ // objednavky bez formulare prepravy starsi nez 3 hodiny pustime dal s konecnym stavem unfinisned
118
+ // jinak objednavky ignoruje dokud se formular neobjevi, max do 1 hodiny
119
+ if( !in_array( self::ORDER_TYPE_SHIPPING, $order['types'])) {
120
+ $dateNow = new Zend_Date();
121
+ $measure = new Zend_Measure_Time($dateNow->sub( new Zend_Date($order['dealEventTime']))->toValue(), Zend_Measure_Time::SECOND);
122
+ $measure->convertTo(Zend_Measure_Time::HOUR);
123
+ if($measure->getValue() < 3) {
124
+ continue;
125
+ // pokud je objednavka starsi nez 3 hodiny a stale neni formular prepravy, tak uz nebude
126
+ } else {
127
+ $order['status'] = self::ORDER_STATUS_UNFIHISHED;
128
+ $order['state_comment'] = Mage::helper('aukro')->__('Shipping form was not filled in. Contact customer!');
129
+ }
130
+ }
131
+
132
+ $shipping = false;
133
+ // cyklus pres stavy
134
+ foreach( $order['types'] as $type) {
135
+ switch( $type) {
136
+ case self::ORDER_TYPE_SHIPPING:
137
+ $shipping = true;
138
+ unset($order['status'], $order['state_comment']);
139
+ break;
140
+ case self::ORDER_TYPE_SHIPPING_CANCELED:
141
+ $shipping = false;
142
+ $order['status'] = self::ORDER_STATUS_UNFIHISHED;
143
+ $order['state_comment'] = Mage::helper('aukro')->__('Shipping form was canceled by customer.');
144
+ break;
145
+ }
146
+ }
147
+
148
+ // formular prepravy vyplnen
149
+ if( $shipping && count($order['transaction_ids'])) {
150
+ $transactionsIDsForBuyForm[] = end($order['transaction_ids']);
151
+ }
152
+
153
+ // kontrola opozdeneho zaplaceni objednavky
154
+ // objednavka uz existuje
155
+ if( isset( $salesOrders[$order['aukro_order_id']])) {
156
+ // aukro objednavka zaplacena pres PAYU
157
+ if( in_array( self::ORDER_TYPE_PAYU, $order['types'])) {
158
+ $order['sales_order'] = $salesOrders[$order['aukro_order_id']];
159
+ $order['paid'] = true;
160
+ $checkProduct = false;
161
+ // pokud je objednavka jiz zaplacena, tak ji ignorujeme
162
+ if( $order['sales_order']['state'] != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
163
+ continue;
164
+ }
165
+ // pokud objednavka neni dodatecne zaplacena, ale existuje, tak ji ignorujeme
166
+ } else {
167
+ continue;
168
+ }
169
+ }
170
+
171
+ if( $checkProduct) {
172
+ // kontrola existence produktu aukce. POkud neexistuje, aukce se ignoruje
173
+ $productExists = true;
174
+ foreach( $order['items'] as &$auctionData) {
175
+ $auctionID = $auctionData['item_id'];
176
+ $_product = Mage::getModel( 'catalog/product')->loadByAttribute( 'aukro_product_id', $auctionID);
177
+ if( $_product === false) {
178
+ // zkusime produkt najit v historii
179
+ $_aukroProduct = Mage::getModel( 'aukro/product')->load( $auctionID, 'aukro_id');
180
+ if( $_aukroProduct->getId() ) {
181
+ // podle aukro_id z historie najdeme product
182
+ $_product = Mage::getModel( 'catalog/product')->load( $_aukroProduct->getProductId());
183
+ // v historii je, ale product neexistuje. To by se asi nemelo stat
184
+ if( !$_product || !$_product->getId()) {
185
+ $productExists = false;
186
+ break;
187
+ }
188
+ // neni v historii
189
+ } else {
190
+ $productExists = false;
191
+ break;
192
+ }
193
+ }
194
+ $auctionData['productId'] = $_product->getId();
195
+
196
+ // shlukovani ID aukci pro ziskani informaci o kontaktech
197
+ if( !in_array( $auctionID, $auctionIDs)) {
198
+ $auctionIDs[] = $auctionID;
199
+ }
200
+ }
201
+ unset( $auctionData);
202
+
203
+ if( $productExists === false) {
204
+ continue;
205
+ }
206
+ }
207
+
208
+ $newOrders[$orderID] = $order;
209
+ }
210
+
211
+ $countNew = $countPaid = 0;
212
+ if( count( $newOrders)) {
213
+ // zjisteni informaci z formulare prepravy
214
+ if( count( $transactionsIDsForBuyForm)) {
215
+ $shippingAddresses = $this->_getShippingAddresses( $transactionsIDsForBuyForm);
216
+ foreach( $newOrders as $orderID => &$order) {
217
+ foreach( $order['transaction_ids'] as $transID) {
218
+ if( isset( $shippingAddresses[ $transID])) {
219
+ $order['shipping'] = $shippingAddresses[ $transID];
220
+ }
221
+ }
222
+ }
223
+ }
224
+
225
+ // zjisteni informaci z uctu kupujicich
226
+ if( count( $auctionIDs)) {
227
+ // zjisteni informaci o kupujicich
228
+ $contacts = $this->_doMyContact( $auctionIDs);
229
+ // pridani informaci do objednavek
230
+ foreach( $newOrders as &$order) {
231
+ $order['customer'] = $contacts[ $order['dealBuyerId']];
232
+ }
233
+ }
234
+
235
+ // ulozeni novych objednavek
236
+ foreach( $newOrders as $orderID => $newOrder) {
237
+ try {
238
+ if( $newOrder['paid']) {
239
+ $prefixMessage = $this->helper()->__("Error in paying order: ");
240
+ $this->_payOrder( $newOrder);
241
+ $countPaid++;
242
+ } else {
243
+ $prefixMessage = $this->helper()->__("Error in creating order: ");
244
+ $orderInfo = $this->_prepareOrderInfo($newOrder);
245
+ if( $orderInfo !== false) {
246
+ $this->_createOrder( $orderInfo);
247
+ $countNew++;
248
+ }
249
+ }
250
+ } catch( Exception $e) {
251
+ $this->_getSession()->addError( $prefixMessage.$e->getMessage());
252
+ }
253
+ }
254
+ }
255
+
256
+ return array( $countNew, $countPaid);
257
+ }
258
+
259
+ protected function _getPayment( $code, $itemIds) {
260
+
261
+ $payment = array();
262
+ $storeId = Mage::app()->getStore()->getId();
263
+ $config = Mage::getStoreConfig ( 'aukro', $storeId);
264
+ $method = isset($config['shipping_and_payment'][$code]) ? $config['shipping_and_payment'][$code] : null;
265
+ $payment['method'] = $method;
266
+
267
+ // metoda nebyla nalezena v konfiguraci
268
+ if( empty( $method)) {
269
+ // misconfiguration
270
+ if( $code == self::ORDER_PAYMENT_TYPE_COLLECT_ON_DELIVERY || $code == self::ORDER_PAYMENT_TYPE_WIRE_TRANSFER) {
271
+ throw new Zend_Exception( "Payment type '$code' has not specify payment method. Please specify '$code' payment method in configuration!");
272
+ // platba kartou nebo prevodem v hotovosti
273
+ } else {
274
+ $aukroPaymentMethods = $this->_doGetPaymentMethods($itemIds);
275
+ foreach( $aukroPaymentMethods as $aukroMethod) {
276
+ if( $aukroMethod['paymentMethodId'] == $code) {
277
+ $payment['method_name'] = $aukroMethod['paymentMethodName'];
278
+ $payment['method'] = self::ORDER_PAYMENT_TYPE_CART;
279
+ return $payment;
280
+ }
281
+ }
282
+ throw new Zend_Exception( $this->_helper->__("Unknow payment method '%s'!", $code));
283
+ }
284
+ }
285
+
286
+ return $payment;
287
+ }
288
+
289
+ protected function _doGetPaymentMethods( $itemIds) {
290
+
291
+ $params = array('sessionId' => $this->_session_id, 'itemIds'=>$itemIds);
292
+ $methods = $this->soapCall('doGetPaymentMethods',$params);
293
+
294
+ if(isset( $methods['paymentMethods']['item'])) {
295
+ return $this->helper()->formatData($methods['paymentMethods']['item']);
296
+ } else {
297
+ return false;
298
+ }
299
+
300
+ }
301
+
302
+ protected function _prepareOrderInfo( $order) {
303
+
304
+ if( !isset( $order['customer']) || !count( $order['items'])) {
305
+ return false;
306
+ }
307
+
308
+ $date = new Zend_Date($order['dealEventTime']);
309
+ $orderInfo = array(
310
+ 'created_at' => $date->get( 'y-MM-dd HH:mm:ss'),
311
+ 'aukro_order_id' => $order['aukro_order_id'],
312
+ 'customer_email' => $order['customer']['contactEmail'],
313
+ 'customer_firstname' => $order['customer']['contactFirstName'],
314
+ 'customer_lastname' => $order['customer']['contactLastName'],
315
+ 'customer_note' => isset( $order['shipping']['note']) ? $order['shipping']['note'] : null,
316
+ 'items' => array(),
317
+ 'billing_address' => array(
318
+ 'firstname' => $order['customer']['contactFirstName'],
319
+ 'lastname' => $order['customer']['contactLastName'],
320
+ 'street' => $order['customer']['contactStreet'],
321
+ 'city' => $order['customer']['contactCity'],
322
+ 'country_id' => 'CZ',
323
+ 'postcode' => $order['customer']['contactPostcode'],
324
+ 'telephone' => $order['customer']['contactPhone'],
325
+ 'company' => $order['customer']['contactCompany'],
326
+ ),
327
+ 'payment' => array(
328
+ 'method' => 'checkmo',
329
+ ),
330
+ 'status' => isset( $order['status']) ? $order['status'] : true,
331
+ 'state_comment' => isset( $order['state_comment']) ? $order['state_comment'] : "",
332
+ 'is_paid' => in_array( self::ORDER_TYPE_PAYU, $order['types'])
333
+ );
334
+
335
+ $itemIds = array();
336
+ foreach( $order['items'] as $item) {
337
+ $orderInfo['items'][$item['productId']] = $item['qty'];
338
+ $itemIds[] = $item['item_id'];
339
+ }
340
+
341
+ if( isset($order['shipping'])) {
342
+
343
+ $orderInfo['shipping_method'] = 'aukro_aukro';
344
+ $orderInfo['shipping_method_data'] = $order['shipping']['method'];
345
+
346
+ $orderInfo['payment'] = $this->_getPayment( $order['shipping']['payment_type'], $itemIds);
347
+
348
+ // rozdeleni jmena na jmeno a prijmeni
349
+ $fullname = $order['shipping']['address']['postBuyFormAdrFullName'];
350
+ $names = explode(' ', $fullname);
351
+ $firstname = $lastname = "";
352
+ if( $names > 0) {
353
+ $firstname = $names[0];
354
+ unset( $names[0]);
355
+ }
356
+ if( $names > 0) {
357
+ $lastname = implode( ' ', $names);
358
+ }
359
+ $orderInfo['shipping_address'] = array(
360
+ 'firstname' => $firstname,
361
+ 'lastname' => $lastname,
362
+ 'street' => $order['shipping']['address']['postBuyFormAdrStreet'],
363
+ 'city' => $order['shipping']['address']['postBuyFormAdrCity'],
364
+ 'country_id' => 'CZ',
365
+ 'postcode' => $order['shipping']['address']['postBuyFormAdrPostcode'],
366
+ 'telephone' => $order['shipping']['address']['postBuyFormAdrPhone'],
367
+ 'company' => $order['shipping']['address']['postBuyFormAdrCompany'],
368
+ );
369
+ } else {
370
+ $orderInfo['shipping_address'] = array(
371
+ 'firstname' => $order['customer']['contactFirstName'],
372
+ 'lastname' => $order['customer']['contactLastName'],
373
+ 'street' => $order['customer']['contactStreet'],
374
+ 'city' => $order['customer']['contactCity'],
375
+ 'country_id' => 'CZ',
376
+ 'postcode' => $order['customer']['contactPostcode'],
377
+ 'telephone' => $order['customer']['contactPhone'],
378
+ 'company' => $order['customer']['contactCompany'],
379
+ );
380
+ }
381
+
382
+ return $orderInfo;
383
+ }
384
+
385
+ protected function _createOrder( $orderData) {
386
+
387
+ $billingAddress = $orderData['billing_address'];
388
+ $shippingAddress = $orderData['shipping_address'];
389
+
390
+ $quote = Mage::getModel('sales/quote');
391
+
392
+ $customer = Mage::getModel('customer/customer');
393
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
394
+ $customer->loadByEmail($orderData['customer_email']);
395
+
396
+ if($customer->getId()){
397
+ $quote->assignCustomer($customer);
398
+ $quote->setCustomerNote($orderData['customer_note']);
399
+ }
400
+ else
401
+ {
402
+ $quote->setIsMultiShipping(false);
403
+ $quote->setCheckoutMethod('guest');
404
+ $quote->setCustomerId(null);
405
+ $quote->setCustomerEmail($orderData['customer_email']);
406
+ $quote->setCustomerFirstname($orderData['customer_firstname']);
407
+ $quote->setCustomerLastname($orderData['customer_lastname']);
408
+ $quote->setCustomerNote($orderData['customer_note']);
409
+ $quote->setCustomerIsGuest(true);
410
+ $quote->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
411
+ }
412
+
413
+ $quote->setStore(Mage::app()->getStore());
414
+ $quote->setCreatedAt( $orderData['created_at']);
415
+
416
+ $product = Mage::getModel('catalog/product');
417
+ foreach($orderData['items'] as $itemID => $qty) {
418
+
419
+ $product->load( $itemID);
420
+ $quoteItem = Mage::getModel('sales/quote_item')->setProduct($product);
421
+ $quoteItem->setQuote($quote);
422
+ $quoteItem->setQty($qty);
423
+ $quote->addItem($quoteItem);
424
+ }
425
+ $addressForm = Mage::getModel('customer/form');
426
+ $addressForm->setFormCode('customer_address_edit')
427
+ ->setEntityType('customer_address');
428
+
429
+ foreach ($addressForm->getAttributes() as $attribute) {
430
+ if (isset($shippingAddress[$attribute->getAttributeCode()])) {
431
+ $quote->getShippingAddress()->setData($attribute->getAttributeCode(), $shippingAddress[$attribute->getAttributeCode()]);
432
+ }
433
+ }
434
+
435
+ foreach ($addressForm->getAttributes() as $attribute) {
436
+ if (isset($billingAddress[$attribute->getAttributeCode()])) {
437
+ $quote->getBillingAddress()->setData($attribute->getAttributeCode(), $billingAddress[$attribute->getAttributeCode()]);
438
+ }
439
+ }
440
+
441
+ if( isset($orderData['shipping_method'])) {
442
+ $quote->getShippingAddress()->setShippingMethod($orderData['shipping_method']);
443
+ $quote->getShippingAddress()->setFreeShipping( $orderData['shipping_method_data']);
444
+ $quote->getShippingAddress()->setCollectShippingRates(true);
445
+ $quote->getShippingAddress()->collectShippingRates();
446
+ }
447
+
448
+ $quote->collectTotals();
449
+ $quote->save();
450
+
451
+ $items = $quote->getAllItems();
452
+ $quote->reserveOrderId();
453
+
454
+ $convertQuote = Mage::getSingleton('sales/convert_quote');
455
+
456
+ // set payment
457
+ $quotePayment = $quote->getPayment(); // Mage_Sales_Model_Quote_Payment
458
+ $quotePayment->setMethod($orderData['payment']['method']);
459
+ $quote->setPayment($quotePayment);
460
+
461
+ $orderPayment = $convertQuote->paymentToOrderPayment($quotePayment);
462
+ if( isset($orderData['payment']['method_name'])) {
463
+ $orderPayment->setAdditionalInformation( 'type', $orderData['payment']['method_name']);
464
+ }
465
+
466
+ $_order = $convertQuote->addressToOrder($quote->getShippingAddress());
467
+ $_order->setBillingAddress($convertQuote->addressToOrderAddress($quote->getBillingAddress()));
468
+ $_order->setShippingAddress($convertQuote->addressToOrderAddress($quote->getShippingAddress()));
469
+
470
+ $_order->setPayment( $orderPayment);
471
+
472
+ foreach ($items as $item) {
473
+ $orderItem = $convertQuote->itemToOrderItem($item);
474
+ if ($item->getParentItem()) {
475
+ $orderItem->setParentItem($_order->getItemByQuoteItemId($item->getParentItem()->getId()));
476
+ }
477
+ $_order->addItem($orderItem);
478
+ }
479
+
480
+ $_order->aukro_order_id = $orderData['aukro_order_id'];
481
+ $_order->created_at = $orderData['created_at'];
482
+
483
+ try {
484
+ $_order->place();
485
+ $_order->save();
486
+ } catch (Exception $e){
487
+ Mage::log($e->getMessage());
488
+ }
489
+
490
+ if( $orderData['status'] != self::ORDER_STATUS_PENDING) {
491
+
492
+ $_order->setState( Mage_Sales_Model_Order::STATE_NEW, $orderData['status'], $orderData['state_comment']);
493
+
494
+ try {
495
+ $_order->save();
496
+ } catch (Exception $e){
497
+ Mage::log($e->getMessage());
498
+ }
499
+ }
500
+
501
+ // platba kartou, zaplaceni objednavky a vystaveni faktury
502
+ if( $orderData['payment']['method'] == self::ORDER_PAYMENT_TYPE_CART) {
503
+
504
+ // platba kartou, zaplaceno
505
+ if( $orderData['is_paid']) {
506
+ $this->_paySalesOrder($_order);
507
+ // kartou, ale nebylo zaplaceno
508
+ } else {
509
+ $_order->setState( Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, $this->helper()->__('The order was NOT paid through Aukro system yet!'));
510
+ $_order->save();
511
+ }
512
+ }
513
+
514
+ return $_order;
515
+ }
516
+
517
+ protected function _paySalesOrder( $_order) {
518
+
519
+ $_order->addStatusToHistory(
520
+ $_order->getStatus(),
521
+ $this->helper()->__('The order was paid through Aukro system!')
522
+ );
523
+ $_order->sendNewOrderEmail();
524
+
525
+ $transactionId = $_order->getId();
526
+ $_order->getPayment()->setTransactionId( $transactionId);
527
+ if ($this->saveInvoice($_order)) {
528
+ $_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
529
+ }
530
+ $_order->save();
531
+ }
532
+
533
+ protected function _payOrder( $orderData) {
534
+
535
+ $_order = Mage::getModel( 'sales/order');
536
+ $_order->load( $orderData['sales_order']['entity_id']);
537
+ if( !$_order->getId()) {
538
+ throw new Exception( $this->helper()->__("Order %s does not exist!", $orderID));
539
+ }
540
+
541
+ $itemIds = array();
542
+ foreach( $orderData['items'] as $item) {
543
+ $itemIds[] = $item['item_id'];
544
+ }
545
+ $orderData['payment'] = $this->_getPayment( $orderData['shipping']['payment_type'], $itemIds);
546
+
547
+ // platba kartou, zaplaceni objednavky a vystaveni faktury
548
+ if( $orderData['payment']['method'] == self::ORDER_PAYMENT_TYPE_CART) {
549
+ $this->_paySalesOrder($_order);
550
+ } else {
551
+ throw new Exception( $this->helper()->__("The order has wrong payment method during paying process! It's %s but should be %s.", $orderData['payment']['method'], self::ORDER_PAYMENT_TYPE_CART));
552
+ }
553
+
554
+ return $_order;
555
+ }
556
+
557
+ protected function _getSiteJournalDeals() {
558
+
559
+ $params = array('sessionId' => $this->_session_id, 'journalStart' => 0);
560
+ return $this->soapCall(self::CMD_DO_GET_SITE_JOURNAL_DEALS,$params);
561
+ }
562
+
563
+ public function getShipmentLabels() {
564
+
565
+ $shipmentData = $this->getShipmentData();
566
+ $shipmentLabels = array();
567
+ foreach( $shipmentData['shipmentDataList']['item'] as $method) {
568
+ $method = (array) $method;
569
+ $shipmentLabels[ $method['shipmentId']] = $method['shipmentName'];
570
+ }
571
+ return $shipmentLabels;
572
+ }
573
+
574
+ protected function _getShippingAddresses( $transationIDs) {
575
+
576
+ if( !is_array( $transationIDs)) {
577
+ $transationIDs = array( $transationIDs);
578
+ }
579
+
580
+ $params = array('sessionId' => $this->_session_id, 'transactionsIdsArray' => $transationIDs);
581
+ $output = $this->soapCall('doGetPostBuyFormsDataForSellers', $params);
582
+ $output = $this->helper()->formatData($output['postBuyFormData']['item']);
583
+
584
+ $shipmentLabels = $this->getShipmentLabels();
585
+
586
+ $shipping = array();
587
+ foreach( $output as $row) {
588
+ $row = (array) $row;
589
+ $shipping[ $row['postBuyFormId']] = array(
590
+ 'address'=> (array) $row['postBuyFormShipmentAddress'],
591
+ 'method' => array(
592
+ 'fee' => $row['postBuyFormPostageAmount'],
593
+ 'id' => $row['postBuyFormShipmentId'],
594
+ 'label' => $shipmentLabels[ $row['postBuyFormShipmentId']]
595
+ ),
596
+ 'payment_type' => $row['postBuyFormPayType'],
597
+ 'note' => $row["postBuyFormMsgToSeller"]
598
+ );
599
+ }
600
+ return $shipping;
601
+ }
602
+
603
+ public function _doMyContact( $auctionIds) {
604
+
605
+ if( !is_array( $auctionIds)) {
606
+ $auctionIds = array( $auctionIds);
607
+ }
608
+
609
+ $params = array('sessionHandle' => $this->_session_id, 'auctionIdList' => $auctionIds, 'offset'=>0);
610
+ $output = $this->soapCall('doMyContact', $params);
611
+ $output = $this->helper()->formatData($output['mycontactList']['item']);
612
+
613
+ $contacts = array();
614
+ foreach( $output as $contact) {
615
+ $contacts[ $contact['contactUserId']] = $contact;
616
+ }
617
+
618
+ return $contacts;
619
+ }
620
+
621
+ /**
622
+ * Save invoice for order
623
+ *
624
+ * @param Mage_Sales_Model_Order $order
625
+ * @return boolean Can save invoice or not
626
+ */
627
+ protected function saveInvoice (Mage_Sales_Model_Order $order)
628
+ {
629
+ if ($order->canInvoice()) {
630
+ $invoice = $order->prepareInvoice();
631
+
632
+ $invoice->register()->capture();
633
+ Mage::getModel('core/resource_transaction')
634
+ ->addObject($invoice)
635
+ ->addObject($invoice->getOrder())
636
+ ->save();
637
+ return true;
638
+ }
639
+
640
+ return false;
641
+ }
642
+ }
app/code/community/Nostress/Aukro/Model/Webapi/Product.php ADDED
@@ -0,0 +1,722 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Model_Webapi_Product extends Nostress_Aukro_Model_Webapi_Abstract
26
+ {
27
+ const SHIPMENT_FIRST_ID = 36;
28
+ const SHIPMENT_LAST_ID = 48;
29
+ const SHIPMENT_NEXT_PREFIX = 1;
30
+ const SHIPMENT_AMOUNT_PREFIX = 2;
31
+
32
+ const ERR_INVALID_ITEM_ID = 'ERR_INVALID_ITEM_ID';
33
+
34
+ protected $_categoryMapping;
35
+ protected $_aukroAttributes = null;
36
+ protected $_categoryAttributes = null;
37
+ protected $_currentCategory;
38
+ protected $_defaultConfig = null;
39
+
40
+ /**
41
+ * pevne atributy kategorie
42
+ *
43
+ * @var array
44
+ */
45
+ protected $_baseCategoryAttributes = array( "display_duration", "auto_display", "base_unit");
46
+
47
+ protected $_attributesMappingByAukro = null;
48
+ protected $_attributesMappingByMagento = null;
49
+
50
+ /**
51
+ * parametry typu multiselect
52
+ *
53
+ * @var array
54
+ */
55
+ protected $_attributesMultiselect = array( 'payment_type', 'deluxe_options', 'shipping_conditions', 'freeshipping');
56
+
57
+ /**
58
+ * zakladni nastaveni pro mapovani atributu
59
+ */
60
+ protected $_baseAttributes = array(
61
+
62
+ array("code" => 1,"label" => "Název", "predefined" => "","magento" => "name","type"=>"","description" => ""),
63
+ array("code" => 2,"label" => "Aukro kategorie", "predefined" => "","magento" => "aukrocategory_id","type"=>"","description" => ""),
64
+ array("code" => 24,"label" => "Popis", "predefined" => "","magento" => "description","type"=>"","description" => ""),
65
+ array("code" => 8,"label" => "Cena", "predefined" => "","magento" => "price_final_include_tax","type"=>"","description" => ""),
66
+ array("code" => 16,"label" => "Obrázek", "predefined" => "","magento" => "image","type"=>"","description" => ""),
67
+ array("code" => 5,"label" => "Množství", "predefined" => "","magento" => "qty","type"=>"","description" => ""),
68
+
69
+ array("code" => 4, "label" => "Délka trvání", "predefined" => "","magento" => "display_duration","type"=>"","description" => ""),
70
+ array("code" => 30,"label" => "Automatické vystavení", "predefined" => "","magento" => "auto_display","type"=>"","description" => ""),
71
+ array("code" => 28,"label" => "Základní měrná jednotka", "predefined" => "","magento" => "base_unit","type"=>"","description" => ""),
72
+
73
+ array("code" => 0, "label" => "ID produktu v aukru", "predefined" => "","magento" => "aukro_product_id","type"=>"","description" => ""),
74
+ array("code" => 3, "label" => "ID kategorie", "predefined" => "","magento" => "category_id","type"=>"","description" => ""),
75
+ ) ;
76
+
77
+ /**
78
+ * mapovani atributu s konfigurace
79
+ */
80
+ protected $_attributesDefaultMapping = array(
81
+
82
+ 'country' => 9,
83
+ 'county' => 10,
84
+ 'city' => 11,
85
+ 'postcode' => 32,
86
+
87
+ 'shipping_payer' => 12,
88
+ 'shipping_conditions' => 13,
89
+ 'payment_type' => 14,
90
+ 'deluxe_options' => 15,
91
+ 'additional_info' => 27,
92
+ 'freeshipping' => 35,
93
+ );
94
+
95
+
96
+ protected $_emptyField = array(
97
+ 'fid' => 0, 'fvalueString' => null, 'fvalueInt' => null,
98
+ 'fvalueFloat' => null, 'fvalueImage' => null, 'fvalueDatetime' => null,
99
+ 'fvalueDate' => null, 'fvalueRangeInt' => null,
100
+ 'fvalueRangeFloat' => null, 'fvalueRangeDate' => null
101
+ );
102
+
103
+ public function getExposedItems() {
104
+
105
+ $params = array(
106
+ 'userId' => $this->_user_id,
107
+ 'webapiKey' => Mage::helper('aukro')->getAukroWebApiKey(),
108
+ 'countryId' => self::AUKRO_COUNTRY
109
+ );
110
+ $result = $this->soapCall( 'doGetUserItems',$params);
111
+ if( isset($result['userItemList']['item'])) {
112
+ $result = $this->helper()->formatData( $result['userItemList']['item']);
113
+ } else {
114
+ $result = array();
115
+ }
116
+ $items = array();
117
+ foreach( $result as $item) {
118
+ $items[ (string)$item['itId']] = $item['itName'];
119
+ }
120
+ return $items;
121
+ }
122
+
123
+ public function getSiteJournal( $infoType = 0) {
124
+
125
+ $params = array('sessionHandle' => $this->_session_id, 'startingPoint' => 0, 'infoType' => $infoType);
126
+
127
+ $events = array();
128
+ $result = $this->soapCall( 'doGetSiteJournalInfo',$params);
129
+ $total = $result['siteJournalInfo']['itemsNumber'];
130
+
131
+ if( $total > 0) {
132
+ $pages = ceil( $total / 100);
133
+ while( $pages != 0) {
134
+ $result = $this->soapCall( 'doGetSiteJournal',$params);
135
+ $result = $this->helper()->formatData( $result['siteJournalArray']['item']);
136
+ $events = array_merge( $events, $result);
137
+ $lastItem = end( $result);
138
+ $params['startingPoint'] = $lastItem['rowId'];
139
+ $pages--;
140
+ }
141
+ }
142
+
143
+ return $events;
144
+ }
145
+
146
+ /**
147
+ * kotroluje seznam vystavenych aukci na aukro vs. seznam vystavenych produktu v magento
148
+ *
149
+ * @return array
150
+ */
151
+ public function refresh() {
152
+
153
+ $items = $this->getExposedItems();
154
+
155
+ $countClosed = 0;
156
+ $productCollection = Mage::getModel( 'catalog/product')->getCollection();
157
+ $productCollection
158
+ ->addAttributeToFilter( 'aukro_product_id', array( 'notnull'=>true))
159
+ ;
160
+ $productCollection->load();
161
+ foreach( $productCollection as $product) {
162
+ // close exposure for products not in list
163
+ if( !isset( $items[$product->aukro_product_id])) {
164
+ Mage::getModel( 'aukro/product')->finish( $product->aukro_product_id);
165
+ $product->aukro_product_id = null;
166
+ $product->save();
167
+ $countClosed++;
168
+ // ok
169
+ } else {
170
+ unset( $items[$product->aukro_product_id]);
171
+ }
172
+ }
173
+
174
+ $countNew = 0;
175
+ foreach( $items as $aukroID => $name) {
176
+ $product = Mage::getModel('catalog/product');
177
+ $product->loadByAttribute('name', $name);
178
+ if( $product->getId()) {
179
+ Mage::getModel( 'aukro/product')->create( $aukroID, $product->getId());
180
+ $product->aukro_product_id = $aukroID;
181
+ $product->save();
182
+ $countNew++;
183
+ }
184
+ }
185
+
186
+ $this->helper()->logProductsRefreshEvent( count( $items));
187
+
188
+ return array( $countClosed, $countNew);
189
+ }
190
+
191
+ /**
192
+ * upload polozek na aukro
193
+ *
194
+ * @param array $items
195
+ * @param bool $dryRun
196
+ *
197
+ * @return number
198
+ */
199
+ public function upload($items,$dryRun = false)
200
+ {
201
+ // pouze jedna polozka
202
+ if( isset( $items['attributes'])) {
203
+ $items = array( $items);
204
+ }
205
+
206
+ $output = array();
207
+ $count = 0;
208
+ foreach($items as $item)
209
+ {
210
+ // ID produktu
211
+ $itemID = $item['attributes']['id'];
212
+ // ID na aukru
213
+ $aukroProductID = (isset( $item['attributes']['id_produktu_v_aukru'])) ? $item['attributes']['id_produktu_v_aukru'] : null;
214
+ // pokud neni ID na aukru provede se upload.
215
+ if( $aukroProductID === null) {
216
+
217
+ $product = Mage::getModel( 'catalog/product');
218
+ $product->load( $itemID);
219
+ if( $product->getId()) {
220
+
221
+ try {
222
+ $fieldsArray = $this->prepareProductStructure($item['attributes']);
223
+ } catch( Exception $e) {
224
+ Mage::getSingleton('adminhtml/session')->addError($this->helper()->__("Error: Product '%s (%s)' %s", $product->getName(), $product->getSku(), $e->getMessage()));
225
+ continue;
226
+ }
227
+
228
+
229
+ $qty = $product->getStockItem()->getQty();
230
+ $inStock = $product->getIsInStock();
231
+ if( $qty <= 0) {
232
+ Mage::getSingleton('adminhtml/session')->addError($this->helper()->__("Error: Product '%s (%s)' does not have any items in stock!", $product->getName(), $product->getSku()));
233
+ continue;
234
+ }
235
+ if( !$inStock) {
236
+ Mage::getSingleton('adminhtml/session')->addError($this->helper()->__("Error: Product '%s (%s)' is out of stock!", $product->getName(), $product->getSku()));
237
+ continue;
238
+ }
239
+
240
+ $aukroProductID = $this->_uploadProduct($fieldsArray,$dryRun);
241
+ if( $aukroProductID !== false && !is_array($aukroProductID)) {
242
+
243
+ $product->aukro_product_id = $aukroProductID;
244
+ $product->save();
245
+
246
+ Mage::getModel( 'aukro/product')->create( $aukroProductID, $product->getId());
247
+
248
+ $count++;
249
+ } elseif( $dryRun) {
250
+ $count++;
251
+ }
252
+ }
253
+ }
254
+ }
255
+ return $count;
256
+ }
257
+
258
+ protected function _updateProduct( $aukroProductID, $data) {
259
+ $params = array(
260
+ 'sessionId' => $this->_session_id,
261
+ 'itemId'=> (float) $aukroProductID,
262
+ 'fieldsToModify' => $data
263
+ );
264
+ $output = $this->soapCall(self::CMD_DO_UPDATE_ITEM,$params);
265
+ if( is_array( $output) && isset( $output['changedItem']['itemId'])) {
266
+ return $output['changedItem']['itemId'];
267
+ }
268
+ return $output;
269
+ }
270
+
271
+ /**
272
+ * ruseni polozek na aukru
273
+ *
274
+ * @param array $ids
275
+ * @return number
276
+ */
277
+ public function remove( $ids) {
278
+
279
+ if( !is_array( $ids)) {
280
+ $ids = array( $ids);
281
+ }
282
+
283
+ // zjisteni aukro ID produktu
284
+ $aukroIds = array();
285
+ $count = 0;
286
+
287
+ $exposedItems = $this->getExposedItems();
288
+
289
+ foreach( $ids as $id) {
290
+ $product = Mage::getModel( 'catalog/product');
291
+ $product->load( $id);
292
+ if( $product->aukro_product_id !== null) {
293
+
294
+ // pokud neni vystaveny nebo ukonceni probehlo v poradku
295
+ if( !array_key_exists($product->aukro_product_id, $exposedItems) ||
296
+ $this->finishItem( $product->aukro_product_id))
297
+ {
298
+ Mage::getModel( 'aukro/product')->finish( $product->aukro_product_id);
299
+ $product->aukro_product_id = null;
300
+ $product->save();
301
+ $count++;
302
+ }
303
+ }
304
+ }
305
+
306
+ return $count;
307
+ }
308
+
309
+ /**
310
+ * update polozek na aukro
311
+ *
312
+ * @param array $items
313
+ *
314
+ * @return number
315
+ */
316
+ public function update($items)
317
+ {
318
+ // pouze jedna polozka
319
+ if( isset( $items['attributes'])) {
320
+ $items = array( $items);
321
+ }
322
+
323
+ $output = array();
324
+ $count = 0;
325
+ foreach($items as $item)
326
+ {
327
+ // ID produktu
328
+ $itemID = $item['attributes']['id'];
329
+ // ID na aukru
330
+ $aukroProductID = (isset( $item['attributes']['id_produktu_v_aukru'])) ? $item['attributes']['id_produktu_v_aukru'] : null;
331
+ // pokud je na aukro provede se update
332
+ if( $aukroProductID !== null) {
333
+
334
+ $product = Mage::getModel( 'catalog/product');
335
+ $product->load( $itemID);
336
+ if( $product->getId()) {
337
+
338
+ try {
339
+ $fieldsArray = $this->prepareProductStructure($item['attributes']);
340
+ } catch( Exception $e) {
341
+ Mage::getSingleton('adminhtml/session')->addError($this->helper()->__("Error: Product '%s (%s)' %s", $product->getName(), $product->getSku(), $e->getMessage()));
342
+ continue;
343
+ }
344
+
345
+ $qty = $product->getStockItem()->getQty();
346
+ $inStock = $product->getIsInStock();
347
+ if( $qty <= 0) {
348
+ Mage::getSingleton('adminhtml/session')->addError($this->helper()->__("Error: Product '%s (%s)' does not have any items in stock!", $product->getName(), $product->getSku()));
349
+ continue;
350
+ }
351
+ if( !$inStock) {
352
+ Mage::getSingleton('adminhtml/session')->addError($this->helper()->__("Error: Product '%s (%s)' is out of stock!", $product->getName(), $product->getSku()));
353
+ continue;
354
+ }
355
+
356
+ $aukroProductID = $this->_updateProduct( $aukroProductID, $fieldsArray);
357
+ if( $aukroProductID) {
358
+ $count++;
359
+ }
360
+
361
+ }
362
+ }
363
+ }
364
+ return $count;
365
+ }
366
+
367
+
368
+ /**
369
+ * ukonceni jedne polozky
370
+ *
371
+ * @param string $aukroItemId
372
+ * @return bool
373
+ */
374
+ public function finishItem( $aukroItemId) {
375
+
376
+ $params = array(
377
+ 'sessionHandle' => $this->_session_id,
378
+ 'finishItemId' => (float) $aukroItemId,
379
+ 'finishCancelAllBids' => 0,
380
+ 'finishCancelReason' => ''
381
+ );
382
+
383
+ try {
384
+ $response = (bool) $this->soapCall( self::CMD_DO_FINISH_ITEM, $params, false);
385
+ } catch( Exception $e) {
386
+
387
+ if( $e->faultcode == self::ERR_INVALID_ITEM_ID) {
388
+ //Mage::getSingleton('core/session')->addError("Item '$aukroItemId' has been canceled in aukro!");
389
+ return true;
390
+ } else {
391
+ $this->error($e);
392
+ return false;
393
+ }
394
+ }
395
+ return $response;
396
+ }
397
+
398
+ public function getDefaultConfig() {
399
+
400
+ if( $this->_defaultConfig === null) {
401
+ $this->_defaultConfig = Mage::helper( 'aukro')->getDefaultConfig();
402
+ foreach( $this->_attributesMultiselect as $attribCode) {
403
+ if( isset( $this->_defaultConfig[$attribCode])) {
404
+ $this->_defaultConfig[$attribCode] = $this->_formatMultiselect( $this->_defaultConfig[$attribCode]);
405
+ }
406
+ }
407
+ }
408
+ return $this->_defaultConfig;
409
+ }
410
+
411
+ /**
412
+ * format multiselect values from 1,2,4 to 7 (sum)
413
+ *
414
+ * @param string $value
415
+ * @return int
416
+ */
417
+ protected function _formatMultiselect( $value) {
418
+ if( !is_array( $value)) {
419
+ $value = explode(',', $value);
420
+ }
421
+ return array_sum( $value);
422
+ }
423
+
424
+ protected function getAukroAttributes( $categoryId) {
425
+
426
+ $allAttributes = $this->getSellFormFields($categoryId);
427
+ $attributes = array();
428
+ foreach( $allAttributes['sellFormFieldsForCategory']['sellFormFieldsList']['item'] as $attrib) {
429
+ $attributes[ $attrib['sellFormId']] = $attrib;
430
+ }
431
+ return $attributes;
432
+ }
433
+
434
+ protected function prepareProductStructure($productData)
435
+ {
436
+ $this->initAttributesMapping();
437
+ $categoryId = $this->getArrayField('id_kategorie',$productData);
438
+ // vrati defaultni a atributy z kategorie (nacita se pouze jednou pro celou kategorii)
439
+ $attributes = $this->initCurrentCategory( $categoryId);
440
+ if( $attributes === false) {
441
+ throw new Exception( $this->helper()->__('does not have specify aukrocategory!'));
442
+ }
443
+ // zpracuje atributy produktu
444
+ $this->ppProductAttributes($productData, $attributes);
445
+
446
+ $fields_arr = array();
447
+
448
+ $noMapping = array();
449
+
450
+ $resTypes = $this->getResTypes();
451
+
452
+ foreach( $attributes as $code => $value) {
453
+
454
+ if( is_int( $code)) {
455
+ $id = $code;
456
+ } elseif( isset($this->_attributesMappingByMagento[$code])) {
457
+ $id = $this->_attributesMappingByMagento[$code];
458
+ } elseif( isset( $this->_attributesDefaultMapping[$code])) {
459
+ $id = $this->_attributesDefaultMapping[$code];
460
+ } else {
461
+ $noMapping[ $code] = $value;
462
+ continue;
463
+ //throw new Zend_Exception( "Nezname mapovani pro $code");
464
+ }
465
+
466
+
467
+
468
+ if( is_array( $value) && isset( $value['type']) && isset( $value['value'])) {
469
+ $oldValue = $value;
470
+ $value = $value['value'];
471
+ if( isset( $value['type'])) {
472
+ $type = $value['type'];
473
+ } else {
474
+ $type = null;
475
+ }
476
+ } else {
477
+ $type = null;
478
+ }
479
+
480
+ $type = $resTypes[$this->_aukroAttributes[$id]['sellFormResType']];
481
+ // katagorie nepodporuje tento atribut. Napr stav zbozi z produktu
482
+ if( $type === null) {
483
+ continue;
484
+ }
485
+
486
+ // tvorba bitoveho pole, pokud je value pole integeru
487
+ if( is_array($value) && $type == self::FVALUE_INT) {
488
+ $value = $this->_formatMultiselect($value);
489
+ }
490
+
491
+ if( $value === null) {
492
+ $value = $this->_aukroAttributes[$id]['sellFormDefValue'];
493
+ } elseIf( $type == self::FVALUE_INT) {
494
+ $max = $this->_aukroAttributes[$id]['sellMaxValue'];
495
+ if( $max > 0 && $value > $max) {
496
+ $value = $max;
497
+ }
498
+ }
499
+ $fields_arr[ $id] = $this->getNewField($id, $value, $type);
500
+ }
501
+
502
+ ksort( $fields_arr);
503
+ $fieldsValues = array();
504
+ foreach( $fields_arr as $field) {
505
+ $fieldsValues[] = $field;
506
+ }
507
+
508
+ return $fieldsValues;
509
+ }
510
+
511
+ protected function _getShipmentAttributes( $categoryId, $aukroAttributes) {
512
+
513
+ $shippingModel = Mage::getModel('aukro/shipping_pricing');
514
+ $shippingAttributes = array();
515
+
516
+ foreach( $aukroAttributes as $attribID => $attrib) {
517
+ if( $attribID >= self::SHIPMENT_FIRST_ID && $attribID <= self::SHIPMENT_LAST_ID) {
518
+ // mapovani dopravy je v popisu atributu
519
+ $idMapping = $attrib['sellFormFieldDesc'];
520
+
521
+ // nalezeni polozky
522
+ $item = $shippingModel->load( $idMapping);
523
+ // pokud je vyplnena prvni polozka vytvori se atribut
524
+ if( $item !== null) {
525
+ $itemData = $item->getData();
526
+ if( !empty( $itemData['first'])) {
527
+ $shippingAttributes[ $attribID] = $itemData['first'];
528
+ // potom se kontroluje "dalsi"
529
+ if( !empty( $itemData['next']) && isset($aukroAttributes[self::SHIPMENT_NEXT_PREFIX.$attribID])) {
530
+ $shippingAttributes[self::SHIPMENT_NEXT_PREFIX.$attribID] = $itemData['next'];
531
+ }
532
+ // potom se kontroluje "mnozstvi"
533
+ if( !empty( $itemData['amount']) && isset($aukroAttributes[self::SHIPMENT_AMOUNT_PREFIX.$attribID])) {
534
+ $shippingAttributes[self::SHIPMENT_AMOUNT_PREFIX.$attribID] = $itemData['amount'];
535
+ }
536
+ }
537
+ }
538
+ }
539
+ }
540
+
541
+ return $shippingAttributes;
542
+ }
543
+
544
+ protected function ppProductAttributes( $productData, &$attributes) {
545
+
546
+ $attributesMapping = $this->_attributesMappingByAukro;
547
+ foreach( $productData as $labelCode => $value) {
548
+ if( isset( $attributesMapping[$labelCode])) {
549
+ if( $labelCode == 'popis' && isset( $attributes['offer_label'])) {
550
+ $value .= " <br/><br/>".$attributes['offer_label'];
551
+ }
552
+ if( $labelCode == 'obrazek') {
553
+ $img = $this->convertImage($value);
554
+ // false = obrazek neexistuje = no_selection
555
+ if( $img === false) {
556
+ $value = -1; // -1 = atribut se preskoci
557
+ } else {
558
+ $type = self::FVALUE_IMAGE;
559
+ $value = array( 'value'=>$img, 'type'=>$type);
560
+ }
561
+ } elseif( $labelCode == 'cena') {
562
+ $value = $value / 100;
563
+ }
564
+ // -1 je null hodnota pro nektere atributy
565
+ if( $value != -1) {
566
+ $attributes[ $attributesMapping[$labelCode]['magento']] = $value;
567
+ }
568
+ }
569
+ }
570
+ }
571
+
572
+ protected function initCurrentCategory($categoryId)
573
+ {
574
+ if( !isset( $categoryId)) {
575
+ return false;
576
+ }
577
+ // na zacatku nebo pri zmene kategorie se musi nacist znovu vsechny atributy
578
+ if($this->_currentCategory === null || $this->_currentCategory->getCategory() != $categoryId) {
579
+
580
+ // entita magento kategorie
581
+ $this->_currentCategory = $this->getAukroCategoryData( $categoryId);
582
+ $aukroCategoryId = $this->_currentCategory['aukrocategory'];
583
+ // atributy dane kategorie z aukra
584
+ $this->_aukroAttributes = $this->getAukroAttributes( $aukroCategoryId);
585
+ // defaultni nastaveni z konfigurace
586
+ $this->_categoryAttributes = $this->getDefaultConfig();
587
+
588
+ // autributy z nastaveni kategorie
589
+ $category = $this->getCurrentCategory();
590
+ $categoryAttributes = $this->getBaseCategoryAttributes();
591
+ foreach($categoryAttributes as $attributeName) {
592
+ $value = $category->getData($attributeName);
593
+ if($value == 0 || !empty($value)) {
594
+ if( $value == -1) { continue;}
595
+
596
+ if( in_array( $attributeName, $this->_attributesMultiselect)) {
597
+ $value = $this->_formatMultiselect($value);
598
+ }
599
+
600
+ $this->_categoryAttributes[ $attributeName] = $value;
601
+ }
602
+ }
603
+
604
+ // specificke atributy z nastaveni kategorie
605
+ $specificAttributes = unserialize( $category->getData( 'attributes'));
606
+ if( !empty($specificAttributes)) {
607
+ $this->_categoryAttributes += $specificAttributes;
608
+ }
609
+
610
+ // atributy doruceni
611
+ $shipmentAttributes = $this->_getShipmentAttributes( $aukroCategoryId, $this->_aukroAttributes);
612
+ if( !empty( $shipmentAttributes)) {
613
+ $this->_categoryAttributes += $shipmentAttributes;
614
+ }
615
+ }
616
+
617
+ return $this->_categoryAttributes;
618
+ }
619
+
620
+ protected function getCurrentCategory()
621
+ {
622
+ return $this->_currentCategory;
623
+ }
624
+
625
+ public function initAttributesMapping() {
626
+
627
+ if( $this->_attributesMappingByAukro === null) {
628
+ $mapping = Mage::getModel( 'aukro/mapping_attribute')->getCollectionData();
629
+ $this->_attributesMappingByAukro = array();
630
+ foreach( $mapping as $attrib) {
631
+ $this->_attributesMappingByAukro[ $attrib['label_code']] = $attrib;
632
+ if( !empty($attrib['magento'])) {
633
+ $this->_attributesMappingByMagento[ $attrib['magento']] = $attrib['id'];
634
+ }
635
+ }
636
+ }
637
+ }
638
+
639
+ public function getBaseAttributes()
640
+ {
641
+ if(!isset($this->_baseAttributes[0]["label_code"]))
642
+ {
643
+ $attribs = $this->_baseAttributes;
644
+ foreach($attribs as $key => $data)
645
+ {
646
+ $attribs[$key]["label_code"] = $this->helper()->createCode($data['label']);
647
+ }
648
+ $this->_baseAttributes = $attribs;
649
+ }
650
+ return $this->_baseAttributes;
651
+ }
652
+
653
+ protected function getBaseCategoryAttributes()
654
+ {
655
+ return $this->_baseCategoryAttributes;
656
+ }
657
+
658
+ protected function getNewField($id,$value,$type = null)
659
+ {
660
+ $field = $this->getEmptyField();
661
+ $field[self::FID] = $id;
662
+ if(!isset($type))
663
+ $type = $this->getType($value);
664
+
665
+ $field[$type] = $value;
666
+ return $field;
667
+ }
668
+
669
+ protected function getType($value)
670
+ {
671
+ $type = self::FVALUE_STRING;
672
+ if(is_int($value))
673
+ $type = self::FVALUE_INT;
674
+ else if(is_float($value))
675
+ $type = self::FVALUE_FLOAT;
676
+ else if(is_array($value))
677
+ $type = self::FVALUE_RANGE_INT;
678
+ return $type;
679
+ }
680
+
681
+ protected function getEmptyField()
682
+ {
683
+ return $this->_emptyField;
684
+ }
685
+
686
+ protected function getAukroCategoryData($id)
687
+ {
688
+ $cm = $this->getCategoryMapping();
689
+ if(isset($id) && isset($cm[$id]))
690
+ return $cm[$id];
691
+ else
692
+ $this->logAndException("Aukro category %s doesn't exist.");
693
+ }
694
+
695
+ protected function getCategoryMapping()
696
+ {
697
+ if(!isset($this->_categoryMapping))
698
+ {
699
+ $items = Mage::getModel('aukro/mapping_category')->getCollection()->load();
700
+ $this->_categoryMapping = array();
701
+ foreach( $items as $item) {
702
+ $this->_categoryMapping[ $item['category']] = $item;
703
+ }
704
+ }
705
+ return $this->_categoryMapping;
706
+ }
707
+
708
+ protected function convertImage($value)
709
+ {
710
+ $hnd = @fopen($value, 'rb'); @fclose($hnd);
711
+ if ($hnd)
712
+ {
713
+ // pokud ano pak nacteme jeho obsah
714
+ $value = file_get_contents($value);
715
+ }
716
+ else
717
+ {
718
+ $value = false;
719
+ }
720
+ return $value;
721
+ }
722
+ }
app/code/community/Nostress/Aukro/controllers/Adminhtml/ActivationController.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Hlavni kontroler pro exportni intarface
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ class Nostress_Aukro_Adminhtml_ActivationController extends Mage_Adminhtml_Controller_Action
28
+ {
29
+ protected $_helper;
30
+
31
+ protected function _initAction()
32
+ {
33
+ $this->loadLayout();
34
+ return $this;
35
+ }
36
+
37
+ public function indexAction()
38
+ {
39
+ $this->_initAction();
40
+ $block = $this->getLayout()->getBlock('aukro_activation');
41
+ $form = $block->getChild("form");
42
+ if ($block)
43
+ {
44
+ $params = $this->getRequest()->getParams();
45
+ $block->setData($params);
46
+ $form->setData($params);
47
+ }
48
+ $this->renderLayout();
49
+ }
50
+
51
+ public function activateAction()
52
+ {
53
+ try
54
+ {
55
+ $params = $this->getRequest()->getParams();
56
+ $result = Mage::helper('aukro/data_client')->createLicenseKey($params);
57
+
58
+ $this->_getSession()->addSuccess($this->__('Aukro Connector has been activated with license key %s .',$result['key']));
59
+ }
60
+ catch (Exception $e)
61
+ {
62
+ $message = $this->helper()->__("Module activation process failed. Error: ");
63
+ $this->_getSession()->addError($message. $e->getMessage());
64
+ $code = "";
65
+ $urlParam = array();
66
+ if(!empty($params["code"]))
67
+ $urlParam = array("code" => $params["code"]);
68
+ $this->_redirect('*/*/',$urlParam);
69
+ return;
70
+ }
71
+
72
+ $this->_redirect('aukro/adminhtml_products_display/index');
73
+ }
74
+
75
+ protected function helper()
76
+ {
77
+ if (!isset($this->_helper))
78
+ $this->_helper = Mage::helper('aukro');
79
+ return $this->_helper;
80
+ }
81
+ }
app/code/community/Nostress/Aukro/controllers/Adminhtml/LogController.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action {
26
+
27
+ protected function _initAction() {
28
+ $this->loadLayout();
29
+ $this->_title($this->__('Aukro connector'))
30
+ ->_title($this->__('Log'));
31
+
32
+ /**
33
+ * Set active menu item
34
+ */
35
+ $this->_setActiveMenu('sales/aukro/log');
36
+ /**
37
+ * Add breadcrumb item
38
+ */
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Log'), Mage::helper('adminhtml')->__('Log'));
40
+
41
+ return $this;
42
+ }
43
+
44
+
45
+ public function indexAction() {
46
+ $this->_initAction()->renderLayout();
47
+ }
48
+
49
+ }
app/code/community/Nostress/Aukro/controllers/Adminhtml/Map/AttributesController.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Adminhtml_Map_AttributesController extends Mage_Adminhtml_Controller_Action {
26
+
27
+ protected function _initAction() {
28
+ $this->loadLayout();
29
+ $this->_title($this->__('Aukro connector'))
30
+ ->_title($this->__('Attributes Mapping'));
31
+
32
+ /**
33
+ * Set active menu item
34
+ */
35
+ $this->_setActiveMenu('sales/aukro/mapped_attributes');
36
+ /**
37
+ * Add breadcrumb item
38
+ */
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Attributes Mapping'), Mage::helper('adminhtml')->__('Attributes Mapping'));
40
+
41
+ return $this;
42
+ }
43
+
44
+
45
+ public function indexAction() {
46
+ $this->_initAction()->renderLayout();
47
+ }
48
+
49
+ public function reloadAttributesAction () {
50
+ try
51
+ {
52
+ $result = Mage::getModel('aukro/mapping_attribute')->reloadAttributes();
53
+ $this->_getSession()->addSuccess(Mage::helper('aukro')->__("Attributes was loaded successfully."));
54
+ }
55
+ catch (Exception $e)
56
+ {
57
+ $message = Mage::helper('aukro')->__("Attributes loading failed: ");
58
+ $this->_getSession()->addError($message. $e->getMessage());
59
+ }
60
+ // go to grid
61
+ $this->_redirect('*/*/');
62
+
63
+ }
64
+
65
+ public function clearAttributesAction () {
66
+ try
67
+ {
68
+ $result = Mage::getModel('aukro/mapping_attribute')->clearAttributes();
69
+ $this->_getSession()->addSuccess(Mage::helper('aukro')->__("All attributes was removed."));
70
+ }
71
+ catch (Exception $e)
72
+ {
73
+ $message = Mage::helper('aukro')->__("Attributes removing failed: ");
74
+ $this->_getSession()->addError($message. $e->getMessage());
75
+ }
76
+ // go to grid
77
+ $this->_redirect('*/*/');
78
+
79
+ }
80
+
81
+ public function saveAttributeMappingAction() {
82
+ try
83
+ {
84
+ $data = $this->getRequest()->getPost();
85
+ $model = Mage::getModel('aukro/mapping_attribute');
86
+ foreach ($data['attributes']['attribute'] as $row) {
87
+ $model->setData('code',$row['code']);
88
+ $model->setData('magento',$row['magento']);
89
+ if ($row['limit'] == '')
90
+ $model->setData('limit',null);
91
+ else
92
+ $model->setData('limit',$row['limit']);
93
+ $postproc = '';
94
+ foreach ($row['postproc'] as $item) {
95
+ $postproc .= $item.',';
96
+ }
97
+ $postproc = rtrim($postproc,',');
98
+ $model->setData('postproc',$postproc);
99
+ $model->setData('prefix',$row['prefix']);
100
+ $model->setData('constant',$row['constant']);
101
+ $model->setData('translate',serialize($row['translate']));
102
+ $model->setData('suffix',$row['suffix']);
103
+ $model->setData('eppav',$row['eppav']);
104
+ $model->save();
105
+ }
106
+ $this->_getSession()->addSuccess(Mage::helper('aukro')->__("Attributes mapping saved."));
107
+ }
108
+ catch (Exception $e)
109
+ {
110
+ $message = Mage::helper('aukro')->__("Attributes mapping save failed: ");
111
+ $this->_getSession()->addError($message. $e->getMessage());
112
+ }
113
+ $this->_redirect('*/*/');
114
+ }
115
+
116
+ }
app/code/community/Nostress/Aukro/controllers/Adminhtml/Map/CategoriesController.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Adminhtml_Map_CategoriesController extends Mage_Adminhtml_Controller_Action {
26
+
27
+ protected function _initAction() {
28
+ $this->loadLayout();
29
+ $this->_title($this->__('Aukro connector'))
30
+ ->_title($this->__('Categories mapping'));
31
+
32
+ /**
33
+ * Set active menu item
34
+ */
35
+ $this->_setActiveMenu('sales/aukro/mapped_categories');
36
+ /**
37
+ * Add breadcrumb item
38
+ */
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Categories mapping'), Mage::helper('adminhtml')->__('Categories mapping'));
40
+
41
+ return $this;
42
+ }
43
+
44
+
45
+ public function indexAction() {
46
+ $this->_initAction()->renderLayout();
47
+ }
48
+
49
+ public function getAukroCategoryAttributesAction() {
50
+ $categoryId = $_POST["category"];
51
+ $defaultValues = unserialize($_POST["attributes"]);
52
+ $categoryAttributesResponse = Mage::getModel('aukro/webapi_abstract')->getSellFormAttributesForCategory($categoryId);
53
+ $categoryAttributes = $categoryAttributesResponse['sellFormFields']['item'];
54
+
55
+ $response = '<div class="hor-scroll"><table class="form-list" cellspacing="0">';
56
+
57
+ foreach ($categoryAttributes as $attributeKey => $params) {
58
+
59
+ if ($params['sellFormOpt'] == Nostress_Aukro_Model_Webapi_Abstract::MANDATORY)
60
+ $required = '<span class="required">*</span>';
61
+ else
62
+ $required = '';
63
+
64
+ $response .= '<tr>';
65
+ $response .= '<td class="label"><label>'.$params['sellFormTitle'].$required.'</label></td>';
66
+ $response .= '<td class="value">'.$this->getHtmlInputOption($params,$defaultValues[$params['sellFormId']]).'</td>';
67
+ $response .= '</tr>';
68
+ }
69
+
70
+ $response .= '</table></div>';
71
+ echo $response;
72
+ }
73
+
74
+
75
+ public function getHtmlInputOption($params,$defaultValue) {
76
+ $result = '';
77
+
78
+ if ($params['sellFormOpt'] == Nostress_Aukro_Model_Webapi_Abstract::MANDATORY)
79
+ $required = '';
80
+ else
81
+ $required = '';
82
+
83
+ switch ($params['sellFormType']) {
84
+ case Nostress_Aukro_Model_Webapi_Abstract::STRING :
85
+ case Nostress_Aukro_Model_Webapi_Abstract::INTEGER :
86
+ case Nostress_Aukro_Model_Webapi_Abstract::FLOAT :
87
+ $result .= '<input value="'.$defaultValue.'" class="input-text '.$required.'" type="text" name="general[aukro][aukro_attributes]['.$params['sellFormId'].']">';
88
+ break;
89
+ case Nostress_Aukro_Model_Webapi_Abstract::SELECT :
90
+ $options = explode('|',$params['sellFormDesc']);
91
+ $optionsValues = explode('|',$params['sellFormOptsValues']);
92
+
93
+ $result .= '<select class="'.$required.'" value="'.$defaultValue.'" name="general[aukro][aukro_attributes]['.$params['sellFormId'].']">';
94
+
95
+ foreach ($options as $optionKey => $option) {
96
+ if ($defaultValue == $optionsValues[$optionKey])
97
+ $selected = 'selected="selected"';
98
+ else
99
+ $selected = '';
100
+ $result .= '<option '.$selected.' value="'.$optionsValues[$optionKey].'">'.$options[$optionKey].'</option>';
101
+ }
102
+
103
+ $response .= '</select>';
104
+ break;
105
+ case Nostress_Aukro_Model_Webapi_Abstract::RADIOBUTTON :
106
+ $options = explode('|',$params['sellFormDesc']);
107
+ $optionsValues = explode('|',$params['sellFormOptsValues']);
108
+
109
+ foreach ($options as $optionKey => $option) {
110
+ $result .= '<input class="'.$required.'" type="radio" name="general[aukro][aukro_attributes]['.$params['sellFormId'].']['.$optionsValues[$optionKey].']" value="'.$optionsValues[$optionKey].'"><label class="normal">'.$options[$optionKey].'</label><br>';
111
+ }
112
+ break;
113
+
114
+ case Nostress_Aukro_Model_Webapi_Abstract::CHECKBOX :
115
+ $options = explode('|',$params['sellFormDesc']);
116
+ $optionsValues = explode('|',$params['sellFormOptsValues']);
117
+
118
+ foreach ($options as $optionKey => $option) {
119
+ if (isset($defaultValue[$optionsValues[$optionKey]]))
120
+ $checked = 'checked="checked"';
121
+ else
122
+ $checked = '';
123
+ $result .= '<input class="checkbox '.$required.'" type="checkbox" name="general[aukro][aukro_attributes]['.$params['sellFormId'].']['.$optionsValues[$optionKey].']" value="'.$optionsValues[$optionKey].'" '.$checked.'><label class="normal">'.$options[$optionKey].'</label><br>';
124
+ }
125
+ break;
126
+
127
+ case Nostress_Aukro_Model_Webapi_Abstract::IMAGE :
128
+
129
+ case Nostress_Aukro_Model_Webapi_Abstract::TEXTAREA :
130
+ $result .= '<textarea value="'.$defaultValue.'" class="'.$required.'" name="general[aukro][aukro_attributes]['.$params['sellFormId'].']">';
131
+ break;
132
+
133
+ case Nostress_Aukro_Model_Webapi_Abstract::DATETIME :
134
+
135
+ case Nostress_Aukro_Model_Webapi_Abstract::DATE :
136
+ default:
137
+ break;
138
+ }
139
+ return $result;
140
+ }
141
+
142
+
143
+ public function checkMappingAction () {
144
+ try
145
+ {
146
+ $count = Mage::getModel('aukro/mapping_category')->checkCategoryMappingValidity();
147
+ $this->_getSession()->addSuccess(Mage::helper('aukro')->__("Checking mapping completed successfully. Errors count: %s",$count));
148
+ }
149
+ catch (Exception $e)
150
+ {
151
+ $message = Mage::helper('aukro')->__("Checking mapping failed: ");
152
+ $this->_getSession()->addError($message. $e->getMessage());
153
+ }
154
+ // go to grid
155
+ $this->_redirect('*/*/');
156
+ }
157
+
158
+ }
app/code/community/Nostress/Aukro/controllers/Adminhtml/OrdersController.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ class Nostress_Aukro_Adminhtml_OrdersController extends Mage_Adminhtml_Controller_Action {
26
+
27
+ protected function _initAction() {
28
+ $this->loadLayout();
29
+ $this->_title($this->__('Aukro connector'))
30
+ ->_title($this->__('Orders'));
31
+
32
+ /**
33
+ * Set active menu item
34
+ */
35
+ $this->_setActiveMenu('sales/aukro/orders');
36
+ /**
37
+ * Add breadcrumb item
38
+ */
39
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Aukro orders'), Mage::helper('adminhtml')->__('Aukro orders'));
40
+
41
+ return $this;
42
+ }
43
+
44
+
45
+ public function indexAction() {
46
+ $this->_initAction()->renderLayout();
47
+ }
48
+
49
+ public function refreshOrdersAction() {
50
+
51
+ try {
52
+ $orderApi = Mage::getModel( 'aukro/webapi_order');
53
+ list( $countNew, $countPaid) = $orderApi->refreshOrders();
54
+ Mage::log( Mage::helper('aukro')->__('Total of %d order(s) were successfully created from aukro.', $countNew), null, 'aukro.log');
55
+ Mage::log( Mage::helper('aukro')->__('Total of %d order(s) were successfully paid from aukro.', $countPaid), null, 'aukro.log');
56
+
57
+ $this->_getSession()->addSuccess($this->__('Total of %d order(s) were successfully created from aukro.', $countNew));
58
+ if( $countPaid > 0) {
59
+ $this->_getSession()->addSuccess($this->__('Total of %d order(s) were successfully paid from aukro.', $countPaid));
60
+ }
61
+ } catch (Exception $e) {
62
+ $this->_getSession()->addError($e->getMessage());
63
+ }
64
+ $this->_redirect('*/*/index');
65
+ }
66
+
67
+ }
app/code/community/Nostress/Aukro/controllers/Adminhtml/Products/DisplayController.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Nostress
21
+ * @package Nostress_Aukro
22
+ */
23
+
24
+ class Nostress_Aukro_Adminhtml_Products_DisplayController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+ const DEF_STORE_ID = 1;
27
+ protected $_helper;
28
+
29
+ protected function _initAction() {
30
+ $this->loadLayout();
31
+ $this->_title($this->__('Aukro connector'));
32
+
33
+ /**
34
+ * Set active menu item
35
+ */
36
+ $this->_setActiveMenu('sales/aukro/display_products');
37
+ /**
38
+ * Add breadcrumb item
39
+ */
40
+ $this->_addBreadcrumb(Mage::helper('aukro')->__('Products Exposing'), Mage::helper('aukro')->__('Products Exposing'));
41
+
42
+ return $this;
43
+ }
44
+
45
+
46
+ public function indexAction()
47
+ {
48
+ try
49
+ {
50
+ $this->_initAction();
51
+ $this->_title($this->__('Products Exposing'));
52
+ $this->renderLayout();
53
+ }
54
+ catch (Exception $e)
55
+ {
56
+ if($this->_checkFlatCatalog($e)) {
57
+ $message = $this->helper()->__("Grid load failed:");
58
+ $this->_getSession()->addError($message. $e->getMessage());
59
+ $this->renderLayout();
60
+ }
61
+ }
62
+ }
63
+
64
+ public function displayedAction()
65
+ {
66
+ try
67
+ {
68
+ $this->_initAction();
69
+ $this->_title($this->__('Exposed Products'));
70
+ $this->renderLayout();
71
+ }
72
+ catch (Exception $e)
73
+ {
74
+ if($this->_checkFlatCatalog($e)) {
75
+ $message = $this->helper()->__("Grid load failed:");
76
+ $this->_getSession()->addError($message. $e->getMessage());
77
+ $this->renderLayout();
78
+ }
79
+ }
80
+ }
81
+
82
+ protected function _checkFlatCatalog( Exception $e) {
83
+ if( $e->getCode() == Mage::helper('aukro/data_loader')->getFlatCatalogErrorCode()) {
84
+ Mage::helper('aukro/data_loader')->reindexFlatCatalogs();
85
+ $this->_redirect( '*/*/*');
86
+ return false;
87
+ } else {
88
+ return true;
89
+ }
90
+ }
91
+
92
+ public function refreshAction() {
93
+
94
+ try {
95
+ $productApi = Mage::getModel( 'aukro/webapi_product');
96
+ list( $countClosed, $countReexposed) = $productApi->refresh();
97
+ if( $countClosed) {
98
+ $this->_getSession()->addSuccess($this->__('Total of %d product(s) were closed on aukro.', $countClosed));
99
+ } else {
100
+ $this->_getSession()->addSuccess($this->__('No products were closed on aukro.', $countClosed));
101
+ }
102
+ if( $countReexposed) {
103
+ $this->_getSession()->addSuccess($this->__('Total of %d product(s) were re-exposed on aukro.', $countReexposed));
104
+ } else {
105
+ $this->_getSession()->addSuccess($this->__('No products were re-exposed on aukro.', $countReexposed));
106
+ }
107
+ } catch (Exception $e) {
108
+ $this->_getSession()->addError($e->getMessage());
109
+ }
110
+ $this->_redirectReferer();
111
+ }
112
+
113
+ public function massAukroUploadAction()
114
+ {
115
+ $productIds = $this->getRequest()->getParam('productIds');
116
+ $storeId = $this->getRequest()->getParam('store',self::DEF_STORE_ID);
117
+ $dryRun = (bool) $this->getRequest()->getParam( 'dryrun', false);
118
+
119
+ if (!is_array($productIds)) {
120
+ $this->_getSession()->addError($this->__('Please select product(s)'));
121
+ }
122
+ else {
123
+ try {
124
+ $count = Mage::getSingleton("aukro/unit_control")->upload($productIds,$storeId, $dryRun);
125
+ if( $dryRun) {
126
+ $this->_getSession()->addSuccess($this->__('Total of %d products(s) were successfully validated.', $count));
127
+ } else {
128
+ $this->_getSession()->addSuccess($this->__('Total of %d products(s) were successfully uploaded to aukro.', $count));
129
+ }
130
+ } catch (Exception $e) {
131
+ $this->_getSession()->addError($e->getMessage());
132
+ }
133
+ }
134
+ $this->_redirect('*/*/index');
135
+ }
136
+
137
+ public function massAukroRemoveAction()
138
+ {
139
+ $productIds = $this->getRequest()->getParam('productIds');
140
+ $storeId = $this->getRequest()->getParam('store',self::DEF_STORE_ID);
141
+ if (!is_array($productIds)) {
142
+ $this->_getSession()->addError($this->__('Please select product(s)'));
143
+ }
144
+ else {
145
+ try {
146
+ $productApi = Mage::getModel( 'aukro/webapi_product');
147
+ $count = $productApi->remove( $productIds);
148
+ $this->_getSession()->addSuccess($this->__('Total of %d products(s) were successfully removed from aukro.', $count));
149
+ } catch (Exception $e) {
150
+ $this->_getSession()->addError($e->getMessage());
151
+ }
152
+ }
153
+ $this->_redirect('*/*/displayed');
154
+ }
155
+
156
+ public function massAukroUpdateAction()
157
+ {
158
+ $productIds = $this->getRequest()->getParam('productIds');
159
+ $storeId = $this->getRequest()->getParam('store',self::DEF_STORE_ID);
160
+ if (!is_array($productIds)) {
161
+ $this->_getSession()->addError($this->__('Please select product(s)'));
162
+ }
163
+ else {
164
+ try {
165
+ $count = Mage::getSingleton("aukro/unit_control")->upload($productIds,$storeId, false, true);
166
+ $this->_getSession()->addSuccess($this->__('Total of %d products(s) were successfully updated on aukro.', $count));
167
+ } catch (Exception $e) {
168
+ $this->_getSession()->addError($e->getMessage());
169
+ }
170
+ }
171
+ $this->_redirect('*/*/displayed');
172
+ }
173
+
174
+ protected function helper()
175
+ {
176
+ if (!isset($this->_helper))
177
+ $this->_helper = Mage::helper('aukro');
178
+ return $this->_helper;
179
+ }
180
+
181
+ }
app/code/community/Nostress/Aukro/etc/config.xml ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Nostress_Aukro>
5
+ <version>1.0.0</version>
6
+ </Nostress_Aukro>
7
+ </modules>
8
+
9
+ <admin>
10
+ <routers>
11
+ <aukro>
12
+ <use>admin</use>
13
+ <args>
14
+ <module>Nostress_Aukro</module>
15
+ <frontName>aukro</frontName>
16
+ </args>
17
+ </aukro>
18
+ </routers>
19
+ </admin>
20
+
21
+ <adminhtml>
22
+ <menu>
23
+ <sales translate="title" module="adminhtml">
24
+ <children>
25
+ <aukro translate="title" module="aukro">
26
+ <title>Aukro Connector</title>
27
+ <children>
28
+ <orders translate="title" module="aukro">
29
+ <title>Aukro Orders</title>
30
+ <action>aukro/adminhtml_orders</action>
31
+ </orders>
32
+ <displayed_products translate="title" module="aukro">
33
+ <title>Exposed Products</title>
34
+ <action>aukro/adminhtml_products_display/displayed</action>
35
+ </displayed_products>
36
+ <display translate="title" module="aukro">
37
+ <title>Exposing of Products</title>
38
+ <action>aukro/adminhtml_products_display/index</action>
39
+ </display>
40
+ <mapped_categories translate="title" module="aukro">
41
+ <title>Mapped Categories</title>
42
+ <action>aukro/adminhtml_map_categories</action>
43
+ </mapped_categories>
44
+ <mapped_attributes translate="title" module="aukro">
45
+ <title>Mapped Attributes</title>
46
+ <action>aukro/adminhtml_map_attributes</action>
47
+ </mapped_attributes>
48
+ <configuration translate="title" module="aukro">
49
+ <title>Configuration</title>
50
+ <action>adminhtml/system_config/edit/section/aukro</action>
51
+ </configuration>
52
+ <!--
53
+ <log translate="title" module="aukro">
54
+ <title>Log</title>
55
+ <action>aukro/adminhtml_log</action>
56
+ </log>
57
+ -->
58
+ </children>
59
+ </aukro>
60
+ </children>
61
+ </sales>
62
+ </menu>
63
+ <acl>
64
+ <resources>
65
+ <admin>
66
+ <children>
67
+ <sales>
68
+ <children>
69
+ <aukro translate="title" module="aukro">
70
+ <title>Aukro Connector</title>
71
+ <children>
72
+ <orders translate="title" module="aukro">
73
+ <title>Aukro Orders</title>
74
+ </orders>
75
+ <displayed_products translate="title" module="aukro">
76
+ <title>Exposed Products</title>
77
+ </displayed_products>
78
+ <display translate="title" module="aukro">
79
+ <title>Exposing of Products</title>
80
+ </display>
81
+ <mapped_categories translate="title" module="aukro">
82
+ <title>Mapped Categories</title>
83
+ </mapped_categories>
84
+ <mapped_attributes translate="title" module="aukro">
85
+ <title>Mapped Attributes</title>
86
+ </mapped_attributes>
87
+ <configuration translate="title" module="aukro">
88
+ <title>Configuration</title>
89
+ </configuration>
90
+ </children>
91
+ </aukro>
92
+ </children>
93
+ </sales>
94
+ <system>
95
+ <children>
96
+ <config>
97
+ <children>
98
+ <aukro translate="title" module="aukro">
99
+ <title>Nostress Aukro</title>
100
+ <sort_order>61</sort_order>
101
+ </aukro>
102
+ </children>
103
+ </config>
104
+ </children>
105
+ </system>
106
+ </children>
107
+ </admin>
108
+ </resources>
109
+ </acl>
110
+ <layout>
111
+ <updates>
112
+ <aukro>
113
+ <file>nostress_aukro.xml</file>
114
+ </aukro>
115
+ </updates>
116
+ </layout>
117
+ <translate>
118
+ <modules>
119
+ <Nostress_Aukro>
120
+ <files>
121
+ <default>Nostress_Aukro.csv</default>
122
+ </files>
123
+ </Nostress_Aukro>
124
+ </modules>
125
+ </translate>
126
+ </adminhtml>
127
+
128
+ <global>
129
+ <events>
130
+ <catalog_category_save_commit_after>
131
+ <observers>
132
+ <aukro>
133
+ <type>singleton</type>
134
+ <class>aukro/observer</class>
135
+ <method>saveCategoryAukroMapping</method>
136
+ </aukro>
137
+ </observers>
138
+ </catalog_category_save_commit_after>
139
+ </events>
140
+ <blocks>
141
+ <aukro>
142
+ <class>Nostress_Aukro_Block</class>
143
+ </aukro>
144
+ <adminhtml>
145
+ <rewrite>
146
+ <catalog_category_tabs>Nostress_Aukro_Block_Adminhtml_Catalog_Category_Tabs</catalog_category_tabs>
147
+ <sales_order_grid>Nostress_Aukro_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
148
+ </rewrite>
149
+ </adminhtml>
150
+ </blocks>
151
+ <helpers>
152
+ <aukro>
153
+ <class>Nostress_Aukro_Helper</class>
154
+ </aukro>
155
+ </helpers>
156
+ <resources>
157
+ <aukro_setup>
158
+ <setup>
159
+ <module>Nostress_Aukro</module>
160
+ </setup>
161
+ <connection>
162
+ <use>core_setup</use>
163
+ </connection>
164
+ </aukro_setup>
165
+ <aukro_write>
166
+ <connection>
167
+ <use>core_write</use>
168
+ </connection>
169
+ </aukro_write>
170
+ <aukro_read>
171
+ <connection>
172
+ <use>core_read</use>
173
+ </connection>
174
+ </aukro_read>
175
+ </resources>
176
+ <models>
177
+ <aukro>
178
+ <class>Nostress_Aukro_Model</class>
179
+ <resourceModel>aukro_mysql4</resourceModel>
180
+ </aukro>
181
+ <aukro_mysql4>
182
+ <class>Nostress_Aukro_Model_Mysql4</class>
183
+ <entities>
184
+ <mapping_category>
185
+ <table>nostress_aukro_category_mapping</table>
186
+ </mapping_category>
187
+ <mapping_attribute>
188
+ <table>nostress_aukro_attribute_mapping</table>
189
+ </mapping_attribute>
190
+ <shipping_pricing>
191
+ <table>nostress_aukro_shipping_pricing</table>
192
+ </shipping_pricing>
193
+ <cache_categorypath>
194
+ <table>nostress_aukro_cache_categorypath</table>
195
+ </cache_categorypath>
196
+ <cache_categories>
197
+ <table>nostress_aukro_cache_categories</table>
198
+ </cache_categories>
199
+ <cache_superattributes>
200
+ <table>nostress_aukro_cache_superattributes</table>
201
+ </cache_superattributes>
202
+ <cache_mediagallery>
203
+ <table>nostress_aukro_cache_mediagallery</table>
204
+ </cache_mediagallery>
205
+ <cache_tax>
206
+ <table>nostress_aukro_cache_tax</table>
207
+ </cache_tax>
208
+ <product>
209
+ <table>nostress_aukro_product</table>
210
+ </product>
211
+ </entities>
212
+ </aukro_mysql4>
213
+ </models>
214
+ </global>
215
+
216
+ <default>
217
+ <carriers>
218
+ <aukro>
219
+ <active>1</active>
220
+ <model>aukro/shipping_carrier_aukro</model>
221
+ <name>-</name>
222
+ <title>Aukro</title>
223
+ </aukro>
224
+ </carriers>
225
+ <aukro>
226
+ <shipping_and_payment>
227
+ <collect_on_delivery>checkmo</collect_on_delivery>
228
+ <shipping_payer>1</shipping_payer><!-- buyer -->
229
+ </shipping_and_payment>
230
+ <general>
231
+ <log_events>1</log_events>
232
+ <log_limit>200</log_limit>
233
+ <log_rest>50</log_rest>
234
+ <filepath>/media/aukro/</filepath>
235
+ <koongo_api_url_secure>http://www.koongo.com/api/1.0/koongo/</koongo_api_url_secure>
236
+ <koongo_api_url_unsecure>http://www.koongo.com/api/1.0/koongo/</koongo_api_url_unsecure>
237
+ </general>
238
+ <help>
239
+ <license_conditions>https://docs.koongo.com/display/AukroConnector/License+Conditions</license_conditions>
240
+ </help>
241
+ </aukro>
242
+ <payment>
243
+ <aukro>
244
+ <active>1</active>
245
+ <model>aukro/payment</model>
246
+ <title>Aukro</title>
247
+ <allowspecific>0</allowspecific>
248
+ </aukro>
249
+ </payment>
250
+ </default>
251
+
252
+ <crontab>
253
+ <jobs>
254
+ <refresh_orders>
255
+ <schedule><cron_expr>0 * * * *</cron_expr></schedule><!-- kazdou hodinu v 0 minut se zkontroluji nove objednavky -->
256
+ <run><model>aukro/observer::refreshOrders</model></run>
257
+ </refresh_orders>
258
+ <refresh_products>
259
+ <schedule><cron_expr>10 * * * *</cron_expr></schedule><!-- kazdou hodinu v 10 minut se zkontroluji aukce. Po objednavce muze skoncit vystaveni -->
260
+ <run><model>aukro/observer::refreshAuctions</model></run>
261
+ </refresh_products>
262
+ </jobs>
263
+ </crontab>
264
+ </config>
app/code/community/Nostress/Aukro/etc/system.xml ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <aukro translate="label" module="aukro">
7
+ <label>Aukro</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>103</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>1</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>2</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <order_status translate="label">
32
+ <label>New order status</label>
33
+ <frontend_type>select</frontend_type>
34
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
35
+ <sort_order>90</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>0</show_in_store>
39
+ </order_status>
40
+ <sort_order translate="label">
41
+ <label>Sort order</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>100</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ </sort_order>
48
+ <allowspecific translate="label">
49
+ <label>Payment from applicable countries</label>
50
+ <frontend_type>allowspecific</frontend_type>
51
+ <sort_order>50</sort_order>
52
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </allowspecific>
57
+ <specificcountry translate="label">
58
+ <label>Payment from Specific countries</label>
59
+ <frontend_type>multiselect</frontend_type>
60
+ <sort_order>51</sort_order>
61
+ <source_model>adminhtml/system_config_source_country</source_model>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </specificcountry>
66
+ </fields>
67
+ </aukro>
68
+ </groups>
69
+ </payment>
70
+ <carriers>
71
+ <groups>
72
+ <aukro translate="label" module="aukro">
73
+ <label>Aukro</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>5</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ <fields>
80
+ <active translate="label">
81
+ <label>Enabled</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_yesno</source_model>
84
+ <sort_order>1</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>0</show_in_store>
88
+ </active>
89
+ <name translate="label">
90
+ <label>Method Name</label>
91
+ <frontend_type>text</frontend_type>
92
+ <sort_order>3</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </name>
97
+ <title translate="label">
98
+ <label>Title</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>2</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ </title>
105
+ <sort_order translate="label">
106
+ <label>Sort Order</label>
107
+ <frontend_type>text</frontend_type>
108
+ <sort_order>100</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>0</show_in_store>
112
+ </sort_order>
113
+ <showmethod translate="label">
114
+ <label>Show Method if Not Applicable</label>
115
+ <frontend_type>select</frontend_type>
116
+ <sort_order>92</sort_order>
117
+ <source_model>adminhtml/system_config_source_yesno</source_model>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>0</show_in_store>
121
+ </showmethod>
122
+ </fields>
123
+ </aukro>
124
+ </groups>
125
+ </carriers>
126
+ <aukro translate="label" module="aukro">
127
+ <label>Aukro Connector</label>
128
+ <tab>sales</tab>
129
+ <frontend_type>text</frontend_type>
130
+ <sort_order>30</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ <groups>
135
+ <activation translate="label">
136
+ <label>Activation</label>
137
+ <frontend_type>text</frontend_type>
138
+ <sort_order>1</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ <fields>
143
+ <license_key translate="label">
144
+ <label>License Key</label>
145
+ <frontend_type>text</frontend_type>
146
+ <sort_order>10</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ </license_key>
151
+ </fields>
152
+ </activation>
153
+ <connection_settings translate="label">
154
+ <label>Connection settings</label>
155
+ <frontend_type>text</frontend_type>
156
+ <sort_order>2</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>1</show_in_store>
160
+ <fields>
161
+ <username translate="label">
162
+ <label>Username</label>
163
+ <frontend_type>text</frontend_type>
164
+ <sort_order>10</sort_order>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>1</show_in_store>
168
+ </username>
169
+ <password translate="label">
170
+ <label>Password</label>
171
+ <frontend_type>password</frontend_type>
172
+ <sort_order>20</sort_order>
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
+ </password>
177
+ <webapi_key translate="label">
178
+ <label>WebAPI key</label>
179
+ <frontend_type>text</frontend_type>
180
+ <sort_order>30</sort_order>
181
+ <show_in_default>1</show_in_default>
182
+ <show_in_website>1</show_in_website>
183
+ <show_in_store>1</show_in_store>
184
+ </webapi_key>
185
+ <city translate="label">
186
+ <label>City</label>
187
+ <frontend_type>text</frontend_type>
188
+ <sort_order>40</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>1</show_in_website>
191
+ <show_in_store>1</show_in_store>
192
+ </city>
193
+
194
+ <postcode translate="label">
195
+ <label>Zip</label>
196
+ <frontend_type>text</frontend_type>
197
+ <sort_order>60</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>1</show_in_website>
200
+ <show_in_store>1</show_in_store>
201
+ </postcode>
202
+ <county translate="label comment">
203
+ <label>Region</label>
204
+ <frontend_type>select</frontend_type>
205
+ <source_model>aukro/adminhtml_system_config_source_region</source_model>
206
+ <sort_order>50</sort_order>
207
+ <show_in_default>1</show_in_default>
208
+ <show_in_website>1</show_in_website>
209
+ <show_in_store>1</show_in_store>
210
+ <comment>Choose region from list</comment>
211
+ </county>
212
+ <country translate="label comment">
213
+ <label>Country</label>
214
+ <frontend_type>select</frontend_type>
215
+ <source_model>aukro/adminhtml_system_config_source_country</source_model>
216
+ <sort_order>70</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
+ <show_in_store>1</show_in_store>
220
+ <comment>Enter the country from which you are selling.</comment>
221
+ </country>
222
+ </fields>
223
+ </connection_settings>
224
+ <display_settings translate="label">
225
+ <label>Display settings</label>
226
+ <frontend_type>text</frontend_type>
227
+ <sort_order>40</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ <fields>
232
+ <offer_label translate="label comment">
233
+ <label>Offer label</label>
234
+ <comment>Text will be added after each product description.</comment>
235
+ <frontend_type>textarea</frontend_type>
236
+ <sort_order>10</sort_order>
237
+ <show_in_default>1</show_in_default>
238
+ <show_in_website>1</show_in_website>
239
+ <show_in_store>1</show_in_store>
240
+ </offer_label>
241
+ <display_duration translate="label comment">
242
+ <label>Display duration</label>
243
+ <comment>Days count of displaying a product.</comment>
244
+ <frontend_type>select</frontend_type>
245
+ <source_model>aukro/adminhtml_system_config_source_duration</source_model>
246
+ <sort_order>30</sort_order>
247
+ <show_in_default>1</show_in_default>
248
+ <show_in_website>1</show_in_website>
249
+ <show_in_store>1</show_in_store>
250
+ </display_duration>
251
+ <base_unit translate="label">
252
+ <label>Base unit</label>
253
+ <frontend_type>select</frontend_type>
254
+ <source_model>aukro/adminhtml_system_config_source_baseunit</source_model>
255
+ <sort_order>40</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>1</show_in_store>
259
+ </base_unit>
260
+ <auto_display translate="label comment">
261
+ <label>Autodisplay after offer ends</label>
262
+ <comment>The ability to automatically re-expose the subject</comment>
263
+ <frontend_type>select</frontend_type>
264
+ <source_model>aukro/adminhtml_system_config_source_autodisplay</source_model>
265
+ <sort_order>50</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
+ </auto_display>
270
+ <new_used translate="label">
271
+ <label>Product state</label>
272
+ <frontend_type>select</frontend_type>
273
+ <source_model>aukro/adminhtml_system_config_source_productnewused</source_model>
274
+ <sort_order>60</sort_order>
275
+ <show_in_default>1</show_in_default>
276
+ <show_in_website>1</show_in_website>
277
+ <show_in_store>1</show_in_store>
278
+ </new_used>
279
+ </fields>
280
+ </display_settings>
281
+ <shipping_and_payment translate="label">
282
+ <label>Shipping and payment</label>
283
+ <frontend_type>text</frontend_type>
284
+ <sort_order>50</sort_order>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>0</show_in_website>
287
+ <show_in_store></show_in_store>
288
+ <fields>
289
+ <payment_type translate="label">
290
+ <label>Payment type</label>
291
+ <frontend_type>multiselect</frontend_type>
292
+ <source_model>aukro/adminhtml_system_config_source_paymenttype</source_model>
293
+ <sort_order>10</sort_order>
294
+ <show_in_default>1</show_in_default>
295
+ <show_in_website>1</show_in_website>
296
+ <show_in_store>1</show_in_store>
297
+ </payment_type>
298
+
299
+ <wire_transfer translate="label comment">
300
+ <label>Payment type for wire transfer</label>
301
+ <comment>Choose magento payment type for aukro wire stransfer payment type.</comment>
302
+ <frontend_type>select</frontend_type>
303
+ <source_model>aukro/adminhtml_system_config_source_paymentmethods</source_model>
304
+ <sort_order>12</sort_order>
305
+ <show_in_default>1</show_in_default>
306
+ <show_in_website>1</show_in_website>
307
+ <show_in_store>1</show_in_store>
308
+ </wire_transfer >
309
+
310
+ <collect_on_delivery translate="label comment">
311
+ <label>Payment type for collect on delivery</label>
312
+ <comment>Choose magento payment type for aukro collect on delivery payment type.</comment>
313
+ <frontend_type>select</frontend_type>
314
+ <source_model>aukro/adminhtml_system_config_source_paymentmethods</source_model>
315
+ <sort_order>15</sort_order>
316
+ <show_in_default>1</show_in_default>
317
+ <show_in_website>1</show_in_website>
318
+ <show_in_store>1</show_in_store>
319
+ </collect_on_delivery>
320
+
321
+ <shipping_pricing translate="label">
322
+ <label>Shipping pricing</label>
323
+ <frontend_model>aukro/adminhtml_system_config_form_field_shipping</frontend_model>
324
+ <backend_model>aukro/adminhtml_system_config_form_shipping</backend_model>
325
+ <sort_order>20</sort_order>
326
+ <show_in_default>1</show_in_default>
327
+ <show_in_website>1</show_in_website>
328
+ <show_in_store>1</show_in_store>
329
+ </shipping_pricing>
330
+ <freeshipping translate="label">
331
+ <label>Freeshipping</label>
332
+ <frontend_type>multiselect</frontend_type>
333
+ <source_model>aukro/adminhtml_system_config_source_freeshipping</source_model>
334
+ <sort_order>30</sort_order>
335
+ <show_in_default>1</show_in_default>
336
+ <show_in_website>1</show_in_website>
337
+ <show_in_store>1</show_in_store>
338
+ </freeshipping>
339
+ <shipping_payer translate="label comment">
340
+ <label>Shipping payer</label>
341
+ <frontend_type>select</frontend_type>
342
+ <source_model>aukro/adminhtml_system_config_source_shippingpayer</source_model>
343
+ <sort_order>70</sort_order>
344
+ <show_in_default>1</show_in_default>
345
+ <show_in_website>1</show_in_website>
346
+ <show_in_store>1</show_in_store>
347
+ <comment>Choose who pays for the transport of goods.</comment>
348
+ </shipping_payer>
349
+ <shipping_conditions translate="label comment">
350
+ <label>Shipping conditions</label>
351
+ <frontend_type>multiselect</frontend_type>
352
+ <source_model>aukro/adminhtml_system_config_source_shippingconditions</source_model>
353
+ <sort_order>80</sort_order>
354
+ <show_in_default>1</show_in_default>
355
+ <show_in_website>1</show_in_website>
356
+ <show_in_store>1</show_in_store>
357
+ <comment>You can specify detailed conditions of carriage of goods, including the price of postage etc.</comment>
358
+ </shipping_conditions>
359
+ <additional_info translate="label comment">
360
+ <label>Shipping and payment informations</label>
361
+ <comment>Active if 'Others' is checked. You can fill an informations about shipping and payment (eg. bank account etc.).</comment>
362
+ <frontend_type>textarea</frontend_type>
363
+ <sort_order>90</sort_order>
364
+ <show_in_default>1</show_in_default>
365
+ <show_in_website>1</show_in_website>
366
+ <show_in_store>1</show_in_store>
367
+ </additional_info>
368
+ <deluxe_options translate="label comment">
369
+ <label>Premium options</label>
370
+ <comment>If you want your subject 'visible' and sell more effectively, we recommend you choose one of the options premium. Hold keyboard CTRL button to deativate all options.</comment>
371
+ <frontend_type>multiselect</frontend_type>
372
+ <source_model>aukro/adminhtml_system_config_source_deluxeoptions</source_model>
373
+ <sort_order>95</sort_order>
374
+ <show_in_default>1</show_in_default>
375
+ <show_in_website>1</show_in_website>
376
+ <show_in_store>1</show_in_store>
377
+ <can_be_empty>1</can_be_empty>
378
+ </deluxe_options>
379
+ </fields>
380
+ </shipping_and_payment>
381
+ </groups>
382
+ </aukro>
383
+ </sections>
384
+ </config>
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ $installer = $this;
26
+
27
+ $installer->startSetup();
28
+
29
+ $installer->run("
30
+
31
+ DROP TABLE IF EXISTS {$this->getTable('nostress_aukro_category_mapping')};
32
+ CREATE TABLE {$this->getTable('nostress_aukro_category_mapping')} (
33
+ `mapping_id` int(11) unsigned NOT NULL auto_increment,
34
+ `category` int(11) unsigned NOT NULL,
35
+ `aukrocategory` int(11) unsigned NOT NULL,
36
+ `connection_name` varchar(255),
37
+ `display_duration` int(11),
38
+ `auto_display` int(11),
39
+ `shipping_payment` varchar(1000),
40
+ `attributes` varchar(1000),
41
+ PRIMARY KEY (`mapping_id`)
42
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
43
+ ");
44
+
45
+ $installer->endSetup();
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.1.0-0.2.0.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ $installer = $this;
26
+
27
+ $installer->startSetup();
28
+
29
+ $installer->run("
30
+
31
+ DROP TABLE IF EXISTS {$this->getTable('nostress_aukro_attribute_mapping')};
32
+ CREATE TABLE {$this->getTable('nostress_aukro_attribute_mapping')} (
33
+ `code` int(11) unsigned NOT NULL,
34
+ `label` varchar(255),
35
+ `predefined` varchar(1000),
36
+ `magento` varchar(255),
37
+ `type` varchar(255),
38
+ `limit` int(11) unsigned,
39
+ `postproc` varchar(255),
40
+ `path` varchar(255) default 'ITEM ROOT',
41
+ `description` varchar(1000),
42
+ `prefix` varchar(255),
43
+ `constant` varchar(255),
44
+ `translate` varchar(1000),
45
+ `suffix` varchar(255),
46
+ `eppav` varchar(255),
47
+ PRIMARY KEY (`code`)
48
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
49
+ ");
50
+
51
+ $installer->getConnection()->addColumn(
52
+ $this->getTable('nostress_aukro_category_mapping'),
53
+ 'status',
54
+ 'int(1) NULL AFTER `attributes`'
55
+ );
56
+
57
+ $installer->endSetup();
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.2.0-0.3.0.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ *
21
+ * @category Nostress
22
+ * @package Nostress_Aukro
23
+ */
24
+
25
+ $installer = $this;
26
+
27
+ $installer->startSetup();
28
+
29
+ $installer->run("
30
+
31
+ DROP TABLE IF EXISTS {$this->getTable('nostress_aukro_shipping_pricing')};
32
+ CREATE TABLE {$this->getTable('nostress_aukro_shipping_pricing')} (
33
+ `id` int(11) unsigned NOT NULL,
34
+ `first` int(11),
35
+ `next` int(11),
36
+ `amount` int(11),
37
+ PRIMARY KEY (`id`)
38
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
39
+
40
+ ALTER TABLE {$this->getTable('nostress_aukro_category_mapping')}
41
+ MODIFY COLUMN `shipping_payment` varchar(10000),
42
+ MODIFY COLUMN `attributes` varchar(10000);
43
+ ");
44
+
45
+ $installer->endSetup();
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.3.0-0.4.0.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = $this;
28
+
29
+ $installer->startSetup();
30
+
31
+ $installer->run("
32
+
33
+ CREATE TABLE IF NOT EXISTS {$this->getTable('nostress_aukro_cache_categorypath')} (
34
+ `category_id` int(10) unsigned NOT NULL,
35
+ `store_id` smallint(5) unsigned NOT NULL,
36
+ `category_path` text CHARACTER SET utf8,
37
+ `ids_path` varchar(255) CHARACTER SET utf8 NOT NULL,
38
+ `level` int(11) NOT NULL,
39
+ PRIMARY KEY (`category_id`,`store_id`)
40
+ )ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
41
+
42
+ CREATE TABLE IF NOT EXISTS {$this->getTable('nostress_aukro_cache_categories')} (
43
+ `product_id` int(10) unsigned NOT NULL,
44
+ `store_id` smallint(5) unsigned NOT NULL,
45
+ `categories` text CHARACTER SET utf8,
46
+ PRIMARY KEY (`product_id`,`store_id`)
47
+ )ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
48
+
49
+ CREATE TABLE IF NOT EXISTS {$this->getTable('nostress_aukro_cache_superattributes')} (
50
+ `product_id` int(10) unsigned NOT NULL,
51
+ `store_id` smallint(5) unsigned NOT NULL,
52
+ `super_attributes` text CHARACTER SET utf8,
53
+ PRIMARY KEY (`product_id`,`store_id`)
54
+ )ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
55
+
56
+ CREATE TABLE IF NOT EXISTS {$this->getTable('nostress_aukro_cache_mediagallery')} (
57
+ `product_id` int(10) unsigned NOT NULL,
58
+ `store_id` smallint(5) unsigned NOT NULL,
59
+ `media_gallery` text CHARACTER SET utf8,
60
+ PRIMARY KEY (`product_id`,`store_id`)
61
+ )ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
62
+
63
+ CREATE TABLE IF NOT EXISTS {$this->getTable('nostress_aukro_cache_tax')} (
64
+ `tax_class_id` smallint(6) NOT NULL,
65
+ `store_id` smallint(5) unsigned NOT NULL,
66
+ `tax_percent` decimal(12,4) NOT NULL,
67
+ PRIMARY KEY (`tax_class_id`,`store_id`)
68
+ )ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
69
+ ");
70
+
71
+
72
+ $installer->endSetup();
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.4.0-0.5.0.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = $this;
28
+
29
+ $installer->startSetup();
30
+
31
+ $installer->run("
32
+ ALTER TABLE {$this->getTable('nostress_aukro_attribute_mapping')} ADD `label_code` VARCHAR( 255 ) NOT NULL AFTER `label`;
33
+ ");
34
+
35
+
36
+ $installer->endSetup();
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.0-0.5.1.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = Mage::getResourceModel('catalog/setup','core_setup');
28
+ $installer->startSetup();
29
+
30
+ $data=array(
31
+ 'type'=>'varchar',
32
+ 'input'=>'text',
33
+ 'label'=>'ID produktu na aukru',
34
+ 'group' => 'Aukro',
35
+ 'required' => 0,
36
+ 'used_in_product_listing' => true,
37
+ );
38
+
39
+ $installer->addAttribute('catalog_product','aukro_product_id',$data);
40
+ $installer->endSetup();
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.1-0.5.2.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = $this;
28
+ $installer->startSetup();
29
+
30
+ $installer->getConnection()->addColumn(
31
+ $this->getTable('sales_flat_order'),
32
+ 'aukro_order_id',
33
+ 'varchar(20)'
34
+ );
35
+
36
+ $installer->endSetup();
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.2-0.5.3.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = $this;
28
+ $installer->startSetup();
29
+
30
+ $data=array(
31
+ 'type'=>'int',
32
+ 'input'=>'boolean',
33
+ 'label'=>'Export na aukro',
34
+ 'group' => 'Aukro',
35
+ 'required' => 0,
36
+ 'sort_order' => 0
37
+ );
38
+
39
+ $model = Mage::getModel('eav/entity_setup','core_setup');
40
+ $model->addAttribute('catalog_product','export_to_aukro',$data);
41
+
42
+ $installer->endSetup();
43
+
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.3-0.5.4.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = Mage::getResourceModel('catalog/setup','core_setup');
28
+ $installer->startSetup();
29
+
30
+ // display_duration
31
+ $data = array(
32
+ 'type'=>'int',
33
+ 'input'=>'select',
34
+ 'label'=>'Délka trvání aukce',
35
+ 'group' => 'Aukro',
36
+ 'required' => 0,
37
+ 'default' => -1,
38
+ 'sort_order' => 5,
39
+ 'source' => 'aukro/adminhtml_system_config_source_duration',
40
+ 'used_in_product_listing' => true,
41
+ );
42
+ $installer->addAttribute('catalog_product','display_duration',$data);
43
+
44
+ // base_unit
45
+ $data = array(
46
+ 'type'=>'int',
47
+ 'input'=>'select',
48
+ 'label'=>'Základní měrná jednotka',
49
+ 'group' => 'Aukro',
50
+ 'required' => 0,
51
+ 'default' => -1,
52
+ 'sort_order' => 6,
53
+ 'source' => 'aukro/adminhtml_system_config_source_baseunit',
54
+ 'used_in_product_listing' => true,
55
+ );
56
+ $installer->addAttribute('catalog_product','base_unit',$data);
57
+
58
+ // auto_display
59
+ $data = array(
60
+ 'type'=>'int',
61
+ 'input'=>'select',
62
+ 'label'=>'Po skončení automaticky opětovně vystavit položky',
63
+ 'group' => 'Aukro',
64
+ 'required' => 0,
65
+ 'default' => -1,
66
+ 'sort_order' => 7,
67
+ 'source' => 'aukro/adminhtml_system_config_source_autodisplay',
68
+ 'used_in_product_listing' => true,
69
+ );
70
+ $installer->addAttribute('catalog_product','auto_display',$data);
71
+
72
+ // new_used
73
+ $data = array(
74
+ 'type'=>'int',
75
+ 'input'=>'select',
76
+ 'label'=>'Stav zboží',
77
+ 'group' => 'Aukro',
78
+ 'required' => 0,
79
+ 'default' => -1,
80
+ 'sort_order' => 8,
81
+ 'source' => 'aukro/adminhtml_system_config_source_productnewused',
82
+ 'used_in_product_listing' => true,
83
+ );
84
+ $installer->addAttribute('catalog_product','new_used',$data);
85
+
86
+ $installer->run("
87
+ ALTER TABLE {$this->getTable('nostress_aukro_category_mapping')}
88
+ ADD COLUMN `base_unit` int(11) DEFAULT -1 AFTER display_duration;
89
+ "
90
+ );
91
+
92
+ $installer->endSetup();
93
+
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.5.4-0.5.5.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = Mage::getResourceModel('catalog/setup','core_setup');
28
+ $installer->startSetup();
29
+
30
+ // create new status for aukro orders
31
+ $status = Mage::getModel('sales/order_status');
32
+ $status->setStatus('aukro_unfinished');
33
+ $status->setLabel('Aukro - Unfinished');
34
+ $status->assignState('new');
35
+ $status->save();
36
+
37
+ $installer->endSetup();
38
+
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.6.0-0.6.1.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = $this;
28
+ $installer->startSetup();
29
+
30
+ $model = Mage::getModel('eav/entity_setup','core_setup');
31
+ $model->removeAttribute('catalog_product','export_to_aukro');
32
+
33
+ $installer->endSetup();
34
+
app/code/community/Nostress/Aukro/sql/aukro_setup/mysql4-upgrade-0.6.1-0.6.2.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Module developed by NoStress Commerce
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to info@nostresscommerce.cz so we can send you a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2009 NoStress Commerce (http://www.nostresscommerce.cz)
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Sql instalation skript
21
+ *
22
+ * @category Nostress
23
+ * @package Nostress_Aukro
24
+ *
25
+ */
26
+
27
+ $installer = $this;
28
+ $installer->startSetup();
29
+
30
+ $installer->run("
31
+
32
+ DROP TABLE IF EXISTS `nostress_aukro_product`;
33
+ CREATE TABLE `nostress_aukro_product` (
34
+ `entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
35
+ `aukro_id` varchar(15) NOT NULL,
36
+ `product_id` int(10) unsigned NOT NULL,
37
+ `created_at` datetime DEFAULT NULL,
38
+ `ended_at` datetime DEFAULT NULL,
39
+ `current` tinyint(1) DEFAULT '0',
40
+ PRIMARY KEY (`entity_id`),
41
+ KEY `product_id_ffk` (`product_id`),
42
+ CONSTRAINT `product_id_ffk` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
43
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
44
+
45
+ ");
46
+
47
+ $installer->endSetup();
48
+
49
+ $productCollection = Mage::getModel( 'catalog/product')->getCollection();
50
+ $productCollection
51
+ ->addAttributeToFilter( 'aukro_product_id', array( 'notnull'=>true))
52
+ ;
53
+ $productCollection->load();
54
+ foreach( $productCollection as $product) {
55
+ Mage::getModel( 'aukro/product')->create( $product->aukro_product_id, $product->getId());
56
+ }
57
+
app/design/adminhtml/default/default/layout/nostress_aukro.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <aukro_adminhtml_default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_css</type><file>aukro.css</file></action>
6
+ </reference>
7
+ </aukro_adminhtml_default>
8
+
9
+ <aukro_adminhtml_activation_index>
10
+ <update handle="aukro_adminhtml_default" />
11
+ <reference name="content">
12
+ <block type="aukro/adminhtml_activation" name="aukro_activation" template="nostress_aukro/activation.phtml" />
13
+ </reference>
14
+ </aukro_adminhtml_activation_index>
15
+
16
+ <aukro_adminhtml_orders_index>
17
+ <update handle="aukro_adminhtml_default" />
18
+ <reference name="content">
19
+ <block type="aukro/adminhtml_orders" name="orders" template="nostress_aukro/grid/container.phtml"/>
20
+ </reference>
21
+ </aukro_adminhtml_orders_index>
22
+
23
+ <aukro_adminhtml_products_display_index>
24
+ <update handle="aukro_adminhtml_default" />
25
+ <reference name="content">
26
+ <block type="aukro/adminhtml_products_display" name="products_display" template="nostress_aukro/grid/container.phtml"/>
27
+ </reference>
28
+ </aukro_adminhtml_products_display_index>
29
+
30
+ <aukro_adminhtml_products_display_displayed>
31
+ <update handle="aukro_adminhtml_default" />
32
+ <reference name="content">
33
+ <block type="aukro/adminhtml_products_displayed" name="products_displayed" template="nostress_aukro/grid/container.phtml"/>
34
+ </reference>
35
+ </aukro_adminhtml_products_display_displayed>
36
+
37
+ <aukro_adminhtml_map_categories_index>
38
+ <update handle="aukro_adminhtml_default" />
39
+ <reference name="content">
40
+ <block type="aukro/adminhtml_map_categories" name="map_categories" template="nostress_aukro/grid/container.phtml" />
41
+ </reference>
42
+ </aukro_adminhtml_map_categories_index>
43
+ <aukro_adminhtml_map_attributes_index>
44
+ <update handle="aukro_adminhtml_default" />
45
+ <reference name="content">
46
+ <block type="aukro/adminhtml_map_attributes" name="map_attributes" />
47
+ </reference>
48
+ </aukro_adminhtml_map_attributes_index>
49
+ <aukro_adminhtml_log_index>
50
+ <update handle="aukro_adminhtml_default" />
51
+ <reference name="content">
52
+ <block type="aukro/adminhtml_log" name="log" template="nostress_aukro/grid/container.phtml" />
53
+ </reference>
54
+ </aukro_adminhtml_log_index>
55
+
56
+ <adminhtml_catalog_category_edit>
57
+ <reference name="head">
58
+ <action method="addItem"><type>js</type><name>nostress/aukro/aukro.js</name></action>
59
+ </reference>
60
+ </adminhtml_catalog_category_edit>
61
+ </layout>
app/design/adminhtml/default/default/template/nostress_aukro/activation.phtml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Nostress
16
+ * @package Nostress_Aukro
17
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ ?>
21
+
22
+ <?php
23
+ /**
24
+ * @see Nostress_Aukro_Block_Adminhtml_Activation
25
+ */
26
+ ?>
27
+ <?php echo $this->getFormInitScripts() ?>
28
+ <div class="content-header">
29
+ <?php echo $this->getHeaderHtml() ?>
30
+ <p class="form-buttons"><?php echo $this->getButtonsHtml('header') ?></p>
31
+ </div>
32
+ <div class="activation_form">
33
+ <?php echo $this->getFormHtml() ?>
34
+ </div>
35
+ <?php if ($this->hasFooterButtons()): ?>
36
+ <div class="content-footer">
37
+ <p class="form-buttons"><?php echo $this->getButtonsHtml('footer') ?></p>
38
+ </div>
39
+ <?php endif; ?>
40
+ <script type="text/javascript">
41
+ editForm = new varienForm('edit_form', '<?php echo $this->getValidationUrl() ?>');
42
+ contactForm = new varienForm('contact_form', '<?php echo $this->getValidationUrl() ?>');
43
+
44
+ function addOverlay()
45
+ {
46
+ // create overlay and append to page
47
+ var overlay = document.createElement("div");
48
+ overlay.setAttribute("id","overlay");
49
+ overlay.setAttribute("class", "overlay");
50
+
51
+ elem = document.getElementById('anchor-content');
52
+ elem.appendChild(overlay);
53
+ }
54
+ </script>
55
+ <?php echo $this->getFormScripts() ?>
56
+
57
+ <div id="loading-mask" style="display:none;">
58
+ <p class="loader" id="loading_mask_loader">
59
+ <?php echo $this->__('Activation in progress.') ?><br/><?php echo $this->__('The process may take up to 30 seconds.') ?><br/><br/>
60
+ <img src="<?php echo $this->getSkinUrl('images/ajax-loader-tr.gif') ?>" alt="<?php echo $this->__('Activation in progress.') ?>"/>
61
+ </p>
62
+ </div>
app/design/adminhtml/default/default/template/nostress_aukro/form.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <div class="entry-edit">
2
+ <?php echo $this->getFormHtml();?>
3
+ </div>
4
+ <?php echo $this->getChildHtml('form_after');?>
5
+ <script type="text/javascript">
6
+ reloadAukroAttributes(<?php echo $this->getAukroCategory() ?>,'<?php echo $this->getUrl('aukro/adminhtml_map_categories/getAukroCategoryAttributes') ?>','<?php echo $this->getAukroAttributes() ?>');
7
+ </script>
app/design/adminhtml/default/default/template/nostress_aukro/grid/container.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Nostress
16
+ * @package Nostress_Aukro
17
+ * @copyright Copyright (c) 2012 NoStress Commerce (http://www.nostresscommerce.cz)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ ?>
21
+ <?php
22
+ /**
23
+ * Template for Mage_Adminhtml_Block_Widget_Grid_Container
24
+ */
25
+
26
+ ?>
27
+
28
+ <?php if(Mage::helper('aukro/version')->isLicenseEmpty()): ?>
29
+ <div id="overlay" class="overlay"></div>
30
+ <div id="overlay-data" class="overlay-data">
31
+ <div class="container">
32
+ <div class="box">
33
+ <div class="koongo">
34
+ <div class="logo"></div>
35
+ <div class="line"></div>
36
+ <div class="btn-set">
37
+ <div class="l">
38
+ <?php
39
+ $title = $this->__('Activate Aukro Connector');
40
+ $url = Mage::helper("adminhtml")->getUrl( 'aukro/adminhtml_activation/index');
41
+ ?>
42
+ <button onclick="setLocation('<?php echo $url; ?>')" class="btn-koongo" type="button"
43
+ title="<?php echo $title; ?>" id="btn_activate_aukro">
44
+ <?php echo $title; ?>
45
+ </button>
46
+ <div class="destroy"></div>
47
+ <div class="info">
48
+ <?php echo $this->__("Aukro connector brings"); ?>
49
+ <a target="_blank" href="http://www.koongo.com/"><?php echo $this->__("Koongo - Feed Marketing Tool"); ?></a>
50
+ </div>
51
+ </div>
52
+ <div class="destroy"></div>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ <?php return; ?>
59
+ <?php endif;?>
60
+
61
+ <div class="content-header">
62
+ <table cellspacing="0">
63
+ <tr>
64
+ <td style="<?php echo $this->getHeaderWidth() ?>"><?php echo $this->getHeaderHtml() ?></td>
65
+ <td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
66
+ </tr>
67
+ </table>
68
+ </div>
69
+ <div>
70
+ <?php echo $this->getGridHtml() ?>
71
+ </div>
72
+
73
+ <script>
74
+ window.onload=function()
75
+ {
76
+ //Remove header js toolbar
77
+ $$('.' + 'content-header-floating')[0].remove();
78
+ }
79
+
80
+ </script>
app/design/adminhtml/default/default/template/nostress_aukro/payment/info.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see Mage_Payment_Block_Info
4
+ */
5
+ ?>
6
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
7
+
8
+ <?php if( $this->getInfo()->getAdditionalInformation( 'type')) {
9
+ echo " (".$this->getInfo()->getAdditionalInformation( 'type').")";
10
+ }
11
+ ?>
12
+
13
+ <?php if ($_specificInfo = $this->getSpecificInformation()):?>
14
+ <table>
15
+ <?php foreach ($_specificInfo as $_label => $_value):?>
16
+ <tr>
17
+ <td><?php echo $this->escapeHtml($_label)?>:</td>
18
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n"))?></td>
19
+ </tr>
20
+ <?php endforeach; ?>
21
+ </table>
22
+ <?php endif;?>
23
+
24
+ <?php echo $this->getChildHtml()?>
app/design/adminhtml/default/default/template/nostress_aukro/product.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * @see Mage_Adminhtml_Block_Catalog_Product
30
+ */
31
+ ?>
32
+ <div class="content-header">
33
+ <table cellspacing="0">
34
+ <tr>
35
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('aukro')->__('Exposing products on Aukro') ?></h3></td>
36
+ <td class="a-right">
37
+ <?php echo $this->getButtonsHtml() ?>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ </div>
42
+ <?php echo $this->getChildHtml('store_switcher');?>
43
+ <div>
44
+ <?php echo $this->getGridHtml() ?>
45
+ </div>
app/design/adminhtml/default/default/template/nostress_aukro/translate_array.phtml ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
30
+
31
+ $_colspan = 2;
32
+ if (!$this->_addAfter) {
33
+ $_colspan -= 1;
34
+ }
35
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
36
+ ?>
37
+
38
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
39
+ <table cellpadding="0" cellspacing="0" class="border">
40
+ <tbody>
41
+
42
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
43
+ <?php foreach ($this->_columns as $columnName => $column):?>
44
+ <th><?php echo $column['label'] ?></th>
45
+ <?php endforeach;?>
46
+ <th <?php echo $_colspan?>></th>
47
+ </tr>
48
+
49
+ <tr id="addRow<?php echo $_htmlId ?>">
50
+ <td colspan="<?php echo (count($this->_columns)-1) ?>"></td>
51
+ <td colspan="2">
52
+ <button style="float:right;" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
53
+ <span><?php echo $this->_addButtonLabel ?></span>
54
+ </button>
55
+ </td>
56
+ </tr>
57
+
58
+ </tbody>
59
+ </table>
60
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
61
+ </div>
62
+ <div id="empty<?php echo $_htmlId ?>">
63
+ <?php if ($this->rowDisabled() == true):?>
64
+ <button style="" disabled="disabled" onclick="" class="scalable add disabled" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
65
+ <?php else:?>
66
+ <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
67
+ <?php endif;?>
68
+ <span><?php echo $this->_addButtonLabel ?></span>
69
+ </button>
70
+ </div>
71
+
72
+ <script type="text/javascript">
73
+ //<![CDATA[
74
+ // create row creator
75
+ var arrayRow<?php echo $_htmlId ?> = {
76
+ // define row prototypeJS template
77
+ template : new Template(
78
+ '<tr id="#{_id}">'
79
+ <?php foreach ($this->_columns as $columnName => $column):?>
80
+ +'<td>'
81
+ +'<?php echo $this->_renderCellTemplate($columnName)?>'
82
+ +'<\/td>'
83
+ <?php endforeach;?>
84
+ <?php if ($this->_addAfter):?>
85
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><?php echo Mage::helper('adminhtml')->__('Add after') ?><\/span><\/button><\/td>'
86
+ <?php endif;?>
87
+ +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" style="width:25px;" type="button"><span><?php echo Mage::helper('adminhtml')->__(' ') ?><\/span><\/button><\/td>'
88
+ +'<\/tr>'
89
+ ),
90
+
91
+ rowsCount : 0,
92
+
93
+ add : function(templateData, insertAfterId)
94
+ {
95
+ // generate default template data
96
+ if ('' == templateData) {
97
+ var d = new Date();
98
+ var templateData = {
99
+ <?php foreach ($this->_columns as $columnName => $column):?>
100
+ <?php echo $columnName ?> : '',
101
+ <?php endforeach;?>
102
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
103
+ };
104
+ }
105
+
106
+ // insert before last row
107
+ if ('' == insertAfterId) {
108
+ Element.insert($('addRow<?php echo $_htmlId ?>'), {before: this.template.evaluate(templateData)});
109
+ }
110
+ // insert after specified row
111
+ else {
112
+ Element.insert($(insertAfterId), {after: this.template.evaluate(templateData)});
113
+ }
114
+
115
+ <?php if ($this->_addAfter):?>
116
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
117
+ <?php endif;?>
118
+
119
+ this.rowsCount += 1;
120
+ },
121
+
122
+ del : function(rowId)
123
+ {
124
+ $(rowId).remove();
125
+ this.rowsCount -= 1;
126
+ if (0 == this.rowsCount) {
127
+ this.showButtonOnly();
128
+ }
129
+ },
130
+
131
+ showButtonOnly : function()
132
+ {
133
+ $('grid<?php echo $_htmlId ?>').hide();
134
+ $('empty<?php echo $_htmlId ?>').show();
135
+ }
136
+ }
137
+
138
+ // bind add action to "Add" button in last row
139
+ Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
140
+
141
+ // add existing rows
142
+ <?php
143
+ $_addAfterId = "headings{$_htmlId}";
144
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
145
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
146
+ $_addAfterId = $_rowId;
147
+ }
148
+ ?>
149
+
150
+ // initialize standalone button
151
+ $('empty<?php echo $_htmlId ?>').hide();
152
+ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
153
+ $('grid<?php echo $_htmlId ?>').show();
154
+ $('empty<?php echo $_htmlId ?>').hide();
155
+ arrayRow<?php echo $_htmlId ?>.add('', '');
156
+ });
157
+
158
+ // if no rows, hide grid and show button only
159
+ <?php if (!$this->getArrayRows()):?>
160
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
161
+ <?php endif;?>
162
+
163
+ // toggle the grid, if element is disabled (depending on scope)
164
+ <?php if ($this->getElement()->getDisabled()):?>
165
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
166
+ <?php endif;?>
167
+ //]]>
168
+ </script>
app/design/adminhtml/default/default/template/nostress_aukro/widget/form/config/shipping.phtml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php
29
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
30
+
31
+ $_colspan = 2;
32
+ if (!$this->_addAfter) {
33
+ $_colspan -= 1;
34
+ }
35
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
36
+ $shipments = $this->getSavedValues();
37
+ ?>
38
+
39
+ <div class="grid" id="grid<?php echo $_htmlId ?>">
40
+ <table cellpadding="0" cellspacing="0" class="border">
41
+ <tbody>
42
+
43
+ <tr class="headings" id="headings<?php echo $_htmlId ?>">
44
+ <th>Název</th>
45
+ <?php foreach ($this->_columns as $columnName => $column):?>
46
+ <th><?php echo $column['label'] ?></th>
47
+ <?php endforeach;?>
48
+ </tr>
49
+ <?php foreach ($shipments as $key => $shipment):?>
50
+ <tr>
51
+ <td><?php echo $shipment['name'];?> </td>
52
+ <td><input id="aukro_display_settings_price_list" name="groups[shipping_pricing][<?php echo $key;?>][first]" value="<?php echo $shipment['first'];?>" class=" input-text" style="width:95%;" type="text"/></td>
53
+ <td><input id="aukro_display_settings_price_list" name="groups[shipping_pricing][<?php echo $key;?>][next]" value="<?php echo $shipment['next'];?>" class=" input-text" style="width:95%;" type="text"/></td>
54
+ <td><input id="aukro_display_settings_price_list" name="groups[shipping_pricing][<?php echo $key;?>][amount]" value="<?php echo $shipment['amount'];?>" class=" input-text" style="width:95%;" type="text"/></td>
55
+ </tr>
56
+ <?php endforeach;?>
57
+
58
+ </tbody>
59
+ </table>
60
+ <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
61
+ </div>
app/design/adminhtml/default/default/template/nostress_aukro/widget/form/renderer/element.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_element = $this->getElement();
3
+ $_note = $_element->getNote();
4
+ $_trId = $_element->getHtmlContainerId();
5
+ $_class = $_element->getFieldsetHtmlClass();
6
+ ?>
7
+ <?php if (!$_element->getNoDisplay()): ?>
8
+ <tr<?php if($_trId): ?> id="<?php echo $_trId ?>"<?php endif; ?>>
9
+ <?php if ($_element->getType()=='hidden'): ?>
10
+ <td colspan="2" class="hidden"><?php echo trim($_element->getElementHtml()) ?></td>
11
+ <?php else: ?>
12
+ <td class="<?php echo $_element->hasValueClass() ? $_element->getValueClass() : 'value' ?><?php echo $_class ? " {$_class}-value" : ''?>">
13
+ <?php echo trim($_element->getElementHtml()) ?>
14
+ <?php if ($_note): ?>
15
+ <p class="note<?php echo $_class ? " {$_class}-note" : ''?>" id="note_<?php echo $_element->getId()?>"><span><?php echo $_note ?></span></p>
16
+ <?php endif ?>
17
+ </td>
18
+ <?php endif; ?>
19
+ </tr>
20
+ <?php endif; ?>
app/design/adminhtml/default/default/template/nostress_aukro/widget/form/shipping/element.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $_element = $this->getElement();
29
+ $_note = $_element->getNote();
30
+ $_trId = $_element->getHtmlContainerId();
31
+ $_class = $_element->getFieldsetHtmlClass();
32
+ $_values = $_element->getDefaultvalues();
33
+ ?>
34
+ <?php if (!$_element->getNoDisplay()): ?>
35
+ <tr<?php if($_trId): ?> id="<?php echo $_trId ?>"<?php endif; ?>>
36
+ <?php if ($_element->getType()=='hidden'): ?>
37
+ <td colspan="2" class="hidden"><?php echo trim($_element->getElementHtml()) ?></td>
38
+ <?php else: ?>
39
+ <td class="label<?php echo $_class ? " {$_class}-label" : ''?>"><?php echo trim($_element->getLabelHtml()) ?></td>
40
+ <td class="<?php echo $_element->hasValueClass() ? $_element->getValueClass() : 'value' ?><?php echo $_class ? " {$_class}-value" : ''?>">
41
+ <table>
42
+ <tr>
43
+ <th><?php echo Mage::helper('aukro')->__('Title'); ?></th>
44
+ <th><?php echo Mage::helper('aukro')->__('First Item'); ?></th>
45
+ <th><?php echo Mage::helper('aukro')->__('Next Item'); ?></th>
46
+ <th><?php echo Mage::helper('aukro')->__('Quantity'); ?></th>
47
+ </tr>
48
+ <?php foreach ($_element->getShipment() as $params):?>
49
+ <tr>
50
+ <td><span style="width:100px;"><?php echo $params['shipmentName']; ?></span></td>
51
+ <td><input id="aukro_shipping_first_<?php echo $params['shipmentId']; ?>" name="general[aukro][aukro_shipping][<?php echo $params['shipmentId']; ?>][first]" value="<?php echo $_values[$params['shipmentId']]['first']; ?>" style="width:45px;" type="text" class="input-text"/></td>
52
+ <td><input id="aukro_shipping_next_<?php echo $params['shipmentId']; ?>" name="general[aukro][aukro_shipping][<?php echo $params['shipmentId']; ?>][next]" value="<?php echo $_values[$params['shipmentId']]['next']; ?>" style="width:45px;" type="text" class="input-text"/></td>
53
+ <td><input id="aukro_shipping_amount_<?php echo $params['shipmentId']; ?>" name="general[aukro][aukro_shipping][<?php echo $params['shipmentId']; ?>][amount]" value="<?php echo $_values[$params['shipmentId']]['amount']; ?>" style="width:45px;" type="text" class="input-text"/></td>
54
+ </tr>
55
+ <?php endforeach;?>
56
+ </table>
57
+ </td>
58
+ <?php endif; ?>
59
+ </tr>
60
+ <?php endif; ?>
app/etc/modules/Nostress_Aukro.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Nostress_Aukro>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>1.0.0</version>
8
+ </Nostress_Aukro>
9
+ </modules>
10
+ </config>
app/locale/cs_CZ/Nostress_Aukro.csv ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Aukro","Aukro"
2
+ "Aukro kategorie:","Aukro kategorie:"
3
+ "Connection Name:","Název napojení:"
4
+ "Display Duration:","Délka vystavení:"
5
+ "Base Unit:","Základní měrná jednotka:"
6
+ "Auto Display Setting:","Nastavení automatického vystavení:"
7
+ "Shipping and Payment Setting:","Nastavení dopravy a platby:"
8
+ "Aukro kategorie Attributes","Aukro atributy kategorie"
9
+ "Log #","Log #"
10
+ "Operation Date","Datum operace"
11
+ "Message Type","Typ zprávy"
12
+ "Message","Zpráva"
13
+ "Error Message","Chybová zpráva"
14
+ "Log","Log"
15
+ "Add new attribute","Přidat nová atribut"
16
+ "Remove last added attribute","Odebrat naposledy přidaný atribut"
17
+ "Action","Akce"
18
+ "#","#"
19
+ "Attribute","Atribut"
20
+ "Prefix","Prefix"
21
+ "Constant value","Konstanta"
22
+ "Magento attribute","Magento atribut"
23
+ "Translate attribute","Přeložit atribut"
24
+ "Suffix","Suffix"
25
+ "Export parent product<br> attribute value","Exportovat hodnotu<br> nadřazeného produktu"
26
+ "Chars limit","Znakový limit"
27
+ "Post-process value","Post-process hodnota"
28
+ "Delete","Smazat"
29
+ "Example: ","příklad: "
30
+ "Options: ","Močnosti: "
31
+ "From","Od"
32
+ "To","Do"
33
+ "Save Mapping","Uložit mapování"
34
+ "Attributes Mapping Table","Tabulka mapování atributů"
35
+ "Attribute #","Atribut #"
36
+ "Magento Attribute Name","Název Magento atributu"
37
+ "Aukro Attribute Name","Název Aukro atributu"
38
+ "Mapped Attributes","Namapované atributy"
39
+ "Load Attributes","načti atributy"
40
+ "Remove All Attributes","Smazat všechny atributy"
41
+ "Save","Uložit"
42
+ "Magento kategorie","Magento kategorie"
43
+ "Aukro kategorie","Aukro kategorie"
44
+ "Connection Name","Název napojení"
45
+ "Display Duration","Doba vystavení"
46
+ "Auto Display","Automatické vystavení"
47
+ "Mapped Categories","Namapované kategorie"
48
+ "Check Mapping","Zkontroluj mapování"
49
+ "Order #","Objednávka #"
50
+ "Purchased On","Objednáno"
51
+ "Bill to Name","Faktura na jméno"
52
+ "Ship to Name","Doručení na jméno"
53
+ "G.T. (Base)","G.T. (Base)"
54
+ "G.T. (Purchased)","G.T. (Purchased)"
55
+ "Status","Stav"
56
+ "View","Pohled"
57
+ "Aukro objednávky","Aukro objednávky"
58
+ "Refresh objednávky","Refresh objednávky"
59
+ "Grid load failed:","Načítání gridu selhalo:"
60
+ "ID","ID"
61
+ "Name","Název"
62
+ "Type","Typ"
63
+ "SKU","SKU"
64
+ "Price final include tax","Cena včetně DPH"
65
+ "Qty","Množství"
66
+ "Visibility","Viditelnost"
67
+ "kategorie name","Název kategorie"
68
+ "Aukrokategorie id","Aukrokategorie id"
69
+ "Aukro product id","Aukro product id"
70
+ "Edit","Editovat"
71
+ "Expose","Vystavit"
72
+ "Verify Exposure","Zkontrolovat vystavení"
73
+ "Products Exposure","Vystavit produkty"
74
+ "Exposing of Products","Vystavení produktů"
75
+ "Aukro Update","Aktualizovat"
76
+ "Remove","Smazat"
77
+ "Exposed Products","Vystavené produkty"
78
+ "Purchased From (Store)","Objednáno z (Obchod)"
79
+ "New Order RSS","RSS nových objednávek"
80
+ "CSV","CSV"
81
+ "Excel XML","Excel XML"
82
+ "Cancel","Cancel"
83
+ "Hold","Hold"
84
+ "Unhold","Unhold"
85
+ "Print Invoices","Print Invoices"
86
+ "Print Packingslips","Print Packingslips"
87
+ "Print Credit Memos","Print Credit Memos"
88
+ "Print All","Print All"
89
+ "Print Shipping Labels","Print Shipping Labels"
90
+ "First Item","První položka"
91
+ "Next Item","Další položka"
92
+ "Package Quantity","Množství v balení"
93
+ "Aukro Connector","Aukro konektor"
94
+ "Attributes Mapping","Mapování atributů"
95
+ "Attributes was loaded successfully.","Atributy byly úspěšně načteny."
96
+ "Attributes loading failed: ","Načtení atributů selhalo: "
97
+ "All attributes was removed.","Byly odstraněny všechny atributy."
98
+ "Attributes removing failed: ","Odstranění atributů selhalo: "
99
+ "Attributes mapping saved.","Mapování atributů bylo uloženo."
100
+ "Attributes mapping save failed: ","Mapování atributů selhalo: "
101
+ "Categories mapping","Mapování kategorií"
102
+ "Checking mapping completed successfully. Errors count: %s","Kontrola mapování byla úspěšně dokončena. Počet chyb: %s"
103
+ "Checking mapping failed: ","Kontrola mapování selhala: "
104
+ "Orders","Objednávka"
105
+ "Aukro Orders","Aukro objednávky",
106
+ "Refresh Orders","Načíst nové objednávky"
107
+ "Total of %d order(s) were successfully created from aukro.","Bylo vytvořeno %d nových objednávek z aukra."
108
+ "Total of %d order(s) were successfully paid from aukro.","Bylo zaplaceno %d objednávek z aukra."
109
+ "Products Exposing","Vystavení produktů"
110
+ "Please select product(s)","Vyberte produkty"
111
+ "Total of %d products(s) were successfully validated.","Bylo ověřeno celkem %d produktů."
112
+ "Total of %d products(s) were successfully uploaded to aukro.","Bylo nahráno celkem %d produktů na aukro."
113
+ "Total of %d products(s) were successfully removed from aukro.","Z aukra bylo smazáno celkem %d produktů."
114
+ "Total of %d products(s) were successfully updated on aukro.","Bylo aktualizováno celkem %d produktů z aukra."
115
+ "Enabled","Povoleno"
116
+ "Method Name","Název metody"
117
+ "Title","Název"
118
+ "Sort Order","Sort Order"
119
+ "Show Method if Not Applicable","Ukaž metodu, pokud je aplikovatelná"
120
+ "Connection settings","Nastavení připojení"
121
+ "Username","Uživatelské jméno"
122
+ "Password","Heslo"
123
+ "WebAPI key","WebAPI klíč"
124
+ "City","Město"
125
+ "Zip","PSČ"
126
+ "Region","Kraj"
127
+ "Country","Země"
128
+ "Display settings","Nastavení vystavení"
129
+ "Offer label","Společný text popisu nabídky"
130
+ "Text will be added after each product description.","Text bude přidán za popis každého produktu."
131
+ "Display duration","Délka vystavení"
132
+ "Payment type for wire transfer","Způsob platby pro 'Platba převodem (předem)'"
133
+ "Choose magento payment type for aukro wire stransfer payment type.","Vyberte, jaký způsob platby (magento) se namapuje na aukro způsob platby 'Platba převodem (předem)'."
134
+ "Payment type for collect on delivery","Způsob platby pro 'Dobírkou'"
135
+ "Choose magento payment type for aukro collect on delivery payment type.","Vyberte, jaký způsob platby (magento) se namapuje na aukro způsob platby 'Dobírkou'."
136
+ "Days count of displaying a product.","Délka vystavení produktu ve dnech."
137
+ "Base unit","Základní měrná jednotka"
138
+ "Autodisplay after offer ends","Po skončení automaticky opětovně vystavit položky"
139
+ "Product state","Stav zboží"
140
+ "Shipping and payment","Doprava a platba"
141
+ "Payment type","Způsob platby"
142
+ "Shipping pricing","Ceny dopravy"
143
+ "Freeshipping","Bezplatné možnosti přepravy"
144
+ "Shipping payer","Náklady na dopravu hradí"
145
+ "Shipping conditions","Dodatečné podmínky dopravy"
146
+ "Shipping and payment informations","Informace o dopravě a platbě"
147
+ "Premium options","Nadstandardní volby"
148
+ "If you want your subject 'visible' and sell more effectively, we recommend you choose one of the options premium. Hold keyboard CTRL button to deativate all options.","Pokud chcete aby Váš produkt byl lépe viditelný a efektivněji se prodával, doporučujeme Vám zvolit některé z nadstandartních voleb. Stiskněte CTRL na klávesnici pro deaktivaci všech položek."
149
+ "Active if 'Others' is checked. You can fill an informations about shipping and payment (eg. bank account etc.).","Pole se zohlední, pokud je v 'Dodatečných podmínkách dopravy' zaškrtnuté 'ostatní ...'. Můžete zde doplnit informace o přepravě a platbě (např. bankovní účet atd.)."
150
+ "Feeds configuration empty","Feeds configuration empty"
151
+ "Server error","Server error"
152
+ "Missing important response data","Missing important response data"
153
+ "Invalid or empty server response","Invalid or empty server response"
154
+ "Your License is not valid","Your License is not valid"
155
+ "Please select","Please select"
156
+ "Invalid Profile ID","Invalid Profile ID"
157
+ "Dot","Tečka"
158
+ "Comma","Čárka"
159
+ "Double quotes","Dvojité uvozovky"
160
+ "Quotes","uvozovky"
161
+ "Empty - no enclosure","Empty - no enclosure"
162
+ "Pipe","Pipe"
163
+ "Tab","Tabulator"
164
+ "Space","Space"
165
+ "Semicolon","Středník"
166
+ "Slash","Lomítko"
167
+ "Dash","Pomlčka"
168
+ "Star","Hvězdička"
169
+ "Backslash","Zpětné lomítko"
170
+ "Colon","Colon"
171
+ "Grid","Grid"
172
+ "Ampersand","Ampersand"
173
+ "PHP Extension ""%s"" must be loaded","PHP Extension ""%s"" must be loaded"
174
+ "Can't open file %s for writing","Can't open file %s for writing"
175
+ "Can't download file %s","Can't download file %s"
176
+ "The export profile-product relations has been updated.","The export profile-product relations has been updated."
177
+ "-- -- -- -- -- -- --","-- -- -- -- -- -- --"
178
+ "Not re-expose","Opětovně nevystavovat"
179
+ "Exposing all","Vystavovat vše"
180
+ "Exposing only unsold","Vystavovat pouze neprodané"
181
+ "-- -- --","-- -- --"
182
+ "pieces","kusy"
183
+ "sets","sady"
184
+ "pairs","páry"
185
+ "Bold title","Tučný titulek"
186
+ "Highlighting","Zvýraznění"
187
+ "Priority listing","Přednostní výpis"
188
+ "Category page","Strana kategorie"
189
+ "Main page","Hlavní strana"
190
+ "3","3"
191
+ "5","5"
192
+ "7","7"
193
+ "10","10"
194
+ "Personal","Osobní převzetí"
195
+ "Email","Email"
196
+ "--Please Select--","--Please Select--"
197
+ "Bank transfer (in advance)","Platba převodem (předem)"
198
+ "Payments via PayU","Platby přes PayU"
199
+ "Others","Ostatní"
200
+ "New","Nové"
201
+ "Used","Použité"
202
+ "Other (enter details below - in the section More information on shipment and payment)","Ostatní (podrobnosti vložte níže - v sekci Více informací o dopravě a platbě)"
203
+ "Agrees with sending items abroad","Souhlasí se zasláním předmětu do zahraničí"
204
+ "Seller","Prodávající"
205
+ "Buyer","Kupující"
206
+ "Unable to apply rules.","Unable to apply rules."
207
+ "Standard (Y-m-d H:i:s)","Standard (Y-m-d H:i:s)"
208
+ "ISO 8601 (Y-m-dTH:i:sO)","ISO 8601 (Y-m-dTH:i:sO)"
209
+ "Slash delimiter (Y/m/d H:M)","Slash delimiter (Y/m/d H:M)"
210
+ "ATOM,W3C (Y-m-d\TH:i:sP)","ATOM,W3C (Y-m-d\TH:i:sP)"
211
+ "COOKIE (l, d-M-y H:i:s T)","COOKIE (l, d-M-y H:i:s T)"
212
+ "RFC822 (D, d M Y H:i:s O)","RFC822 (D, d M Y H:i:s O)"
213
+ "RSS (D, d M Y H:i:s O)","RSS (D, d M Y H:i:s O)"
214
+ "Parents and childs","Parents and childs"
215
+ "Parents only","Parents only"
216
+ "Childs only","Childs only"
217
+ "Standard e.g. 149.99","Standard e.g. 149.99"
218
+ "Currency suffix e.g. 149.99 USD","Currency suffix e.g. 149.99 USD"
219
+ "Currency prefix e.g. USD 149.99","Currency prefix e.g. USD 149.99"
220
+ "Symbol suffix e.g 149.99 US$","Symbol suffix e.g 149.99 US$"
221
+ "Symbol prefix e.g US$ 149.99","Symbol prefix e.g US$ 149.99"
222
+ "1","1"
223
+ "30","30"
224
+ "50","50"
225
+ "100","100"
226
+ "300","300"
227
+ "500","500"
228
+ "1000","1000"
229
+ "2000","2000"
230
+ "5000","5000"
231
+ "10000","10000"
232
+ "20000","20000"
233
+ "30000","30000"
234
+ "40000","40000"
235
+ "50000","50000"
236
+ "Stock status & Qty","Stock status & Qty"
237
+ "Qty only","Qty only"
238
+ "Stock status only","Stock status only"
239
+ "Missing input data column %s","Missing input data column %s"
240
+ "Unable to open the file %s for reading (%s)","Unable to open the file %s for reading (%s)"
241
+ "Missing feed setup attribute '".self::COL_CODE."'","Missing feed setup attribute '".self::COL_CODE."'"
242
+ "{$this->_cacheName} cache reload has %s for store %s","{$this->_cacheName} cache reload has %s for store %s"
243
+ "Following attributes missing in {$flatCatalogType} flat catalog: %s","Following attributes missing in {$flatCatalogType} flat catalog: %s"
244
+ "Attribute with code %s doesn't exist","Attribute with code %s doesn't exist"
245
+ "Taxonomy table empty","Taxonomy table empty"
246
+ "Aukro categories mapping has been checked. No. of errors found: ","Mapování aukro kategorií bylo zkontrolováno. Počet nalezených chyb: "
247
+ "Total of %d order(s) were successfully created from aukro by cron action.","Total of %d order(s) were successfully created from aukro by cron action."
248
+ "Total of %d auctions(s) were successfully ended from aukro by cron action.","Total of %d auctions(s) were successfully ended from aukro by cron action."
249
+ "XML file doesnt exist","Soubor XML nexistuje."
250
+ "Disabled","Vypnuté"
251
+ "Aukro upload status: ","Aukro upload status: "
252
+ "Products: %s Time: %s Memory: %s ","Products: %s Time: %s Memory: %s "
253
+ "s","s"
254
+ "MB","MB"
255
+ "Shipping form was not filled in. Contact customer!","Shipping form was not filled in. Contact customer!"
256
+ "Error in paying order: ", "Chyba při placení objednávky"
257
+ "Error in creating order: ", "Chyba při vytváření objednávky"
258
+ "The order was NOT paid through Aukro system yet!","Objednávka zatím nebyla zaplacena přes systém Aukra!",
259
+ "The order was paid through Aukro system!","Objednávka byla zaplacena před systém Aukra!"
260
+ "The order has wrong payment method during paying process! It's %s but should be %s.", "Objednávka má zvolenou špatnou metodu během placení. Platební metoda je %s, ale měla by být %s."
261
+ "%d products was removed.","%d produktů bylo smazáno."
262
+ "Exposing products on Aukro","Vystavení produktů na aukro"
263
+ "Add after","Vložit potom"
264
+ " "," "
265
+ "Quantity","Množství"
266
+ "Error: Product '%s (%s)' %s","Chyba: Produkt '%s (%s)' %s"
267
+ "Error: Product '%s (%s)' does not have any items in stock!","Chyba: Produkt '%s (%s)' nemá naskladněné žádné položky!"
268
+ "Error: Product '%s (%s)' is out of stock!","Chyba: Produkt '%s (%s)' není na skladě!"
269
+ "does not have specify aukrocategory!","nemá specifikovanou aukrokategorii!"
270
+ "Category name","Kategorie"
271
+ "Aukrocategory id","ID aukrokategorie"
272
+ "Aukro product id","ID produktu na aukru"
273
+ "Magento Category","Magento kategorie"
274
+ "Aukro Category","Aukro kategorie"
275
+ "Specify aukrocategory","Vyber aukrokategorii"
276
+ "No items in stock","Žádné položky na skladě"
277
+ "Out of stock","Vyprodáno"
278
+ "Price must be higher than 1 Kč","Cena musí být vyšší než 1 Kč"
279
+ "Choose region from list","Zvolte region ze seznamu"
280
+ "Enter the country from which you are selling.","Zadejte zemi, ze které předmět prodáváte."
281
+ "Choose who pays for the transport of goods.","Zde zvolte, kdo hradí dopravu zboží."
282
+ "You can specify detailed conditions of carriage of goods, including the price of postage etc.","Zde můžete uvést podrobné podmínky dopravy zboží včetně ceny za poštovné atd."
283
+ "The ability to automatically re-expose the subject","Možnost automaticky opětovně vystavit předmět"
284
+ "Refresh Auctions","Aktualizovat aukce"
285
+ "Total of %d product(s) were closed on aukro.","U %d produktů bylo ukončeno vystavení."
286
+ "No products were closed on aukro.","Nebyla nalezena žádná skončená aukce."
287
+ "Total of %d product(s) were re-exposed on aukro.","%d produktů bylo opětovně vystaveno."
288
+ "No products were re-exposed on aukro.","Nebyla nalezena žádná opětovně vystavená aukce."
289
+ "Ready for exposing","Připraven pro vystavení"
290
+ "Exposed on Aukro","Vystaven na Aukru",
291
+ "Activate Aukro Connector","Aktivovat Aukro konektor",
292
+ "Activation Form","Aktivační formulář"
293
+ "I accept Aukro Connector License Conditions","Souhlasím s podmínkami Aukro konektoru",
294
+ "Name:","Jméno:"
295
+ "See","viz"
296
+ "Aukro Connector License Condtions","Licenční podmínky Aukro konektoru"
297
+ "Activation","Aktivace"
298
+ "Aukro Connector has been activated with license key %s .","Aukro konektor byl aktivován s licenčním klíčem %s ."
299
+ "Activation in progress.","Probíhá aktivace."
300
+ "The process may take up to 30 seconds.","Tento proces může trvat až 30 sekund."
301
+ "Aukro connector brings","Aukro konektor Vám přináší"
302
+ "License Key","Licenční klíč"
303
+ "Configuration","Konfigurace"
app/locale/en_US/Nostress_Aukro.csv ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Aukro","Aukro"
2
+ "Aukro category:","Aukro category:"
3
+ "Connection Name:","Connection Name:"
4
+ "Display Duration:","Display Duration:"
5
+ "Base Unit:","Base Unit:"
6
+ "Auto Display Setting:","Auto Display Setting:"
7
+ "Shipping and Payment Setting:","Shipping and Payment Setting:"
8
+ "Aukro Category Attributes","Aukro Category Attributes"
9
+ "Log #","Log #"
10
+ "Operation Date","Operation Date"
11
+ "Message Type","Message Type"
12
+ "Message","Message"
13
+ "Error Message","Error Message"
14
+ "Log","Log"
15
+ "Add new attribute","Add new attribute"
16
+ "Remove last added attribute","Remove last added attribute"
17
+ "Action","Action"
18
+ "#","#"
19
+ "Attribute","Attribute"
20
+ "Prefix","Prefix"
21
+ "Constant value","Constant value"
22
+ "Magento attribute","Magento attribute"
23
+ "Translate attribute","Translate attribute"
24
+ "Suffix","Suffix"
25
+ "Export parent product<br> attribute value","Export parent product<br> attribute value"
26
+ "Chars limit","Chars limit"
27
+ "Post-process value","Post-process value"
28
+ "Delete","Delete"
29
+ "Example: ","Example: "
30
+ "Options: ","Options: "
31
+ "From","From"
32
+ "To","To"
33
+ "Save Mapping","Save Mapping"
34
+ "Attributes Mapping Table","Attributes Mapping Table"
35
+ "Attribute #","Attribute #"
36
+ "Magento Attribute Name","Magento Attribute Name"
37
+ "Aukro Attribute Name","Aukro Attribute Name"
38
+ "Mapped attributes","Mapped attributes"
39
+ "Load Attributes","Load Attributes"
40
+ "Remove All Attributes","Remove All Attributes"
41
+ "Save","Save"
42
+ "Magento Category","Magento Category"
43
+ "Aukro Category","Aukro Category"
44
+ "Connection Name","Connection Name"
45
+ "Display Duration","Display Duration"
46
+ "Auto Display","Auto Display"
47
+ "Mapped Categories","Mapped Categories"
48
+ "Check Mapping","Check Mapping"
49
+ "Order #","Order #"
50
+ "Purchased On","Purchased On"
51
+ "Bill to Name","Bill to Name"
52
+ "Ship to Name","Ship to Name"
53
+ "G.T. (Base)","G.T. (Base)"
54
+ "G.T. (Purchased)","G.T. (Purchased)"
55
+ "Status","Status"
56
+ "View","View"
57
+ "Aukro Orders","Aukro Orders"
58
+ "Refresh Orders","Refresh Orders"
59
+ "Grid load failed:","Grid load failed:"
60
+ "ID","ID"
61
+ "Name","Name"
62
+ "Type","Type"
63
+ "SKU","SKU"
64
+ "Price final include tax","Price final include tax"
65
+ "Qty","Qty"
66
+ "Visibility","Visibility"
67
+ "Category name","Category name"
68
+ "Aukrocategory id","Aukrocategory id"
69
+ "Aukro product id","Aukro product id"
70
+ "Edit","Edit"
71
+ "Expose","Expose"
72
+ "Verify Exposure","Verify Exposure"
73
+ "Products Exposure","Products Exposure"
74
+ "Aukro Update","Aukro Update"
75
+ "Remove","Remove"
76
+ "Exposured Products","Exposured Products"
77
+ "Purchased From (Store)","Purchased From (Store)"
78
+ "New Order RSS","New Order RSS"
79
+ "CSV","CSV"
80
+ "Excel XML","Excel XML"
81
+ "Cancel","Cancel"
82
+ "Hold","Hold"
83
+ "Unhold","Unhold"
84
+ "Print Invoices","Print Invoices"
85
+ "Print Packingslips","Print Packingslips"
86
+ "Print Credit Memos","Print Credit Memos"
87
+ "Print All","Print All"
88
+ "Print Shipping Labels","Print Shipping Labels"
89
+ "First Item","First Item"
90
+ "Next Item","Next Item"
91
+ "Package Quantity","Package Quantity"
92
+ "Aukro connector","Aukro connector"
93
+ "Attributes Mapping","Attributes Mapping"
94
+ "Attributes was loaded successfully.","Attributes was loaded successfully."
95
+ "Attributes loading failed: ","Attributes loading failed: "
96
+ "All attributes was removed.","All attributes was removed."
97
+ "Attributes removing failed: ","Attributes removing failed: "
98
+ "Attributes mapping saved.","Attributes mapping saved."
99
+ "Attributes mapping save failed: ","Attributes mapping save failed: "
100
+ "Categories mapping","Categories mapping"
101
+ "Mapovaní kategorií","Mapovaní kategorií"
102
+ "Checking mapping completed successfully. Errors count: %s","Checking mapping completed successfully. Errors count: %s"
103
+ "Checking mapping failed: ","Checking mapping failed: "
104
+ "Orders","Orders"
105
+ "Aukro orders","Aukro orders"
106
+ "Total of %d order(s) were successfully created from aukro.","Total of %d order(s) were successfully created from aukro."
107
+ "Aukro conektor","Aukro conektor"
108
+ "Products Exposing","Products Exposing"
109
+ "Please select product(s)","Please select product(s)"
110
+ "Total of %d products(s) were successfully validated.","Total of %d products(s) were successfully validated."
111
+ "Total of %d products(s) were successfully uploaded to aukro.","Total of %d products(s) were successfully uploaded to aukro."
112
+ "Total of %d products(s) were successfully removed from aukro.","Total of %d products(s) were successfully removed from aukro."
113
+ "Total of %d products(s) were successfully updated on aukro.","Total of %d products(s) were successfully updated on aukro."
114
+ "Enabled","Enabled"
115
+ "Method Name","Method Name"
116
+ "Title","Title"
117
+ "Sort Order","Sort Order"
118
+ "Show Method if Not Applicable","Show Method if Not Applicable"
119
+ "Connection settings","Connection settings"
120
+ "Username","Username"
121
+ "Password","Password"
122
+ "WebAPI key","WebAPI key"
123
+ "City","City"
124
+ "Zip","Zip"
125
+ "Region","Region"
126
+ "Country","Country"
127
+ "Display settings","Display settings"
128
+ "Offer label","Offer label"
129
+ "Display duration","Display duration"
130
+ "Base unit","Base unit"
131
+ "Autodisplay after offer ends","Autodisplay after offer ends"
132
+ "Product state","Product state"
133
+ "Shipping and payment","Shipping and payment"
134
+ "Payment type","Payment type"
135
+ "Shipping pricing","Shipping pricing"
136
+ "Freeshipping","Freeshipping"
137
+ "Shipping payer","Shipping payer"
138
+ "Shipping conditions","Shipping conditions"
139
+ "Shipping and payment informations","Shipping and payment informations"
140
+ "Premium options","Premium options"
141
+ "Feeds configuration empty","Feeds configuration empty"
142
+ "Server error","Server error"
143
+ "Missing important response data","Missing important response data"
144
+ "Invalid or empty server response","Invalid or empty server response"
145
+ "Your License is not valid","Your License is not valid"
146
+ "Please select","Please select"
147
+ "Invalid Profile ID","Invalid Profile ID"
148
+ "Dot","Dot"
149
+ "Comma","Comma"
150
+ "Double quotes","Double quotes"
151
+ "Quotes","Quotes"
152
+ "Empty - no enclosure","Empty - no enclosure"
153
+ "Pipe","Pipe"
154
+ "Tab","Tab"
155
+ "Space","Space"
156
+ "Semicolon","Semicolon"
157
+ "Slash","Slash"
158
+ "Dash","Dash"
159
+ "Star","Star"
160
+ "Backslash","Backslash"
161
+ "Colon","Colon"
162
+ "Grid","Grid"
163
+ "Ampersand","Ampersand"
164
+ "PHP Extension ""%s"" must be loaded","PHP Extension ""%s"" must be loaded"
165
+ "Can't open file %s for writing","Can't open file %s for writing"
166
+ "Can't download file %s","Can't download file %s"
167
+ "The export profile-product relations has been updated.","The export profile-product relations has been updated."
168
+ "-- -- -- -- -- -- --","-- -- -- -- -- -- --"
169
+ "Re-expose","Re-expose"
170
+ "Exposing all","Exposing all"
171
+ "Exposing only unsold","Exposing only unsold"
172
+ "-- -- --","-- -- --"
173
+ "pieces","pieces"
174
+ "sets","sets"
175
+ "pairs","pairs"
176
+ "Bold title","Bold title"
177
+ "Highlighting","Highlighting"
178
+ "Priority listing","Priority listing"
179
+ "Category page","Category page"
180
+ "Main page","Main page"
181
+ "3","3"
182
+ "5","5"
183
+ "7","7"
184
+ "10","10"
185
+ "Personal","Personal"
186
+ "Email","Email"
187
+ "--Please Select--","--Please Select--"
188
+ "Bank transfer (in advance)","Bank transfer (in advance)"
189
+ "Payments via PayU","Payments via PayU"
190
+ "Others","Others"
191
+ "New","New"
192
+ "Used","Used"
193
+ "Other (enter details below - in the section More information on shipment and payment)","Other (enter details below - in the section More information on shipment and payment)"
194
+ "Agrees with sending items abroad","Agrees with sending items abroad"
195
+ "Seller","Seller"
196
+ "Buyer","Buyer"
197
+ "Unable to apply rules.","Unable to apply rules."
198
+ "Standard (Y-m-d H:i:s)","Standard (Y-m-d H:i:s)"
199
+ "ISO 8601 (Y-m-dTH:i:sO)","ISO 8601 (Y-m-dTH:i:sO)"
200
+ "Slash delimiter (Y/m/d H:M)","Slash delimiter (Y/m/d H:M)"
201
+ "ATOM,W3C (Y-m-d\TH:i:sP)","ATOM,W3C (Y-m-d\TH:i:sP)"
202
+ "COOKIE (l, d-M-y H:i:s T)","COOKIE (l, d-M-y H:i:s T)"
203
+ "RFC822 (D, d M Y H:i:s O)","RFC822 (D, d M Y H:i:s O)"
204
+ "RSS (D, d M Y H:i:s O)","RSS (D, d M Y H:i:s O)"
205
+ "Parents and childs","Parents and childs"
206
+ "Parents only","Parents only"
207
+ "Childs only","Childs only"
208
+ "Standard e.g. 149.99","Standard e.g. 149.99"
209
+ "Currency suffix e.g. 149.99 USD","Currency suffix e.g. 149.99 USD"
210
+ "Currency prefix e.g. USD 149.99","Currency prefix e.g. USD 149.99"
211
+ "Symbol suffix e.g 149.99 US$","Symbol suffix e.g 149.99 US$"
212
+ "Symbol prefix e.g US$ 149.99","Symbol prefix e.g US$ 149.99"
213
+ "1","1"
214
+ "30","30"
215
+ "50","50"
216
+ "100","100"
217
+ "300","300"
218
+ "500","500"
219
+ "1000","1000"
220
+ "2000","2000"
221
+ "5000","5000"
222
+ "10000","10000"
223
+ "20000","20000"
224
+ "30000","30000"
225
+ "40000","40000"
226
+ "50000","50000"
227
+ "Stock status & Qty","Stock status & Qty"
228
+ "Qty only","Qty only"
229
+ "Stock status only","Stock status only"
230
+ "Missing input data column %s","Missing input data column %s"
231
+ "Unable to open the file %s for reading (%s)","Unable to open the file %s for reading (%s)"
232
+ "Missing feed setup attribute '".self::COL_CODE."'","Missing feed setup attribute '".self::COL_CODE."'"
233
+ "{$this->_cacheName} cache reload has %s for store %s","{$this->_cacheName} cache reload has %s for store %s"
234
+ "Following attributes missing in {$flatCatalogType} flat catalog: %s","Following attributes missing in {$flatCatalogType} flat catalog: %s"
235
+ "Attribute with code %s doesn't exist","Attribute with code %s doesn't exist"
236
+ "Taxonomy table empty","Taxonomy table empty"
237
+ "Aukro categories mapping has been checked. No. of errors found: ","Aukro categories mapping has been checked. No. of errors found: "
238
+ "Total of %d order(s) were successfully created from aukro by cron action.","Total of %d order(s) were successfully created from aukro by cron action."
239
+ "Total of %d auctions(s) were successfully ended from aukro by cron action.","Total of %d auctions(s) were successfully ended from aukro by cron action."
240
+ "XML file doesnt exist","XML file doesnt exist"
241
+ "Disabled","Disabled"
242
+ "Aukro upload status: ","Aukro upload status: "
243
+ "Products: %s Time: %s Memory: %s ","Products: %s Time: %s Memory: %s "
244
+ "s","s"
245
+ "MB","MB"
246
+ "Shipping form was not filled in. Contact customer!","Shipping form was not filled in. Contact customer!"
247
+ "%d products was removed.","%d products was removed."
248
+ "Exposing products on Aukro","Exposing products on Aukro"
249
+ "Add after","Add after"
250
+ " "," "
251
+ "Quantity","Quantity"
js/nostress/aukro/aukro.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ function reloadAukroAttributes(value,url,attributes) {
2
+ if (value != -1) {
3
+ new Ajax.Request(url, {
4
+ method: 'Post',
5
+ onSuccess: function(response) {
6
+ document.getElementById('aukro_aukro_attributes_fieldset').update(response.responseText);
7
+ },
8
+ parameters: {'category': value,'attributes':attributes}
9
+ });
10
+ }
11
+ }
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Nostress_Aukro</name>
4
+ <version>1.0.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">osl</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Aukro Connector - Connector to Aukro Authority</summary>
10
+ <description>Aukro Connector - Connector to Aukro Authority</description>
11
+ <notes>Aukro Conector 1.0.0.0 for Magento 1.5+</notes>
12
+ <authors><author><name>Tomas Friedrich</name><user>tomiiq</user><email>tomas.f@koongo.com</email></author></authors>
13
+ <date>2015-01-02</date>
14
+ <time>11:11:48</time>
15
+ <contents><target name="magecommunity"><dir name="Nostress"><dir name="Aukro"><dir name="Block"><dir name="Adminhtml"><dir name="Activation"><file name="Form.php" hash="3dddd770af70bd76f3cccd850c7184e6"/></dir><file name="Activation.php" hash="03d9211294424f3a20e5b763aa96a9d8"/><dir name="Catalog"><dir name="Category"><dir name="Tab"><dir name="Aukro"><file name="Field.php" hash="bf4d93ecb9c9b3bf277d81f605627830"/></dir><file name="Aukro.php" hash="2200eedaeac049c02c3b6496a40497e8"/></dir><file name="Tabs.php" hash="6a47a438bcc13895441254c38297c254"/></dir></dir><file name="Log.php" hash="0b25a323d46e48e282326d605589be2e"/><dir name="Map"><dir name="Attributes"><dir name="Form"><file name="Attributeselect.php" hash="d15dc67b171ba1b6c8a09f429bd47f00"/><file name="Element.php" hash="b136b14a89822ae88ef3063b3ec64bbb"/><dir name="Renderer"><dir name="Fieldset"><file name="Element.php" hash="d14498289572beb2beff6fda0bd953a3"/></dir></dir><file name="Translate.php" hash="a8436a72772dc134e92aae370efef44a"/></dir><file name="Form.php" hash="df0122dce5e025713c2e3d65af4d0e51"/><file name="Grid.php" hash="f73e468f5c8245637e8bbaff32ea8e3b"/></dir><file name="Attributes.php" hash="2dab8f4b34403547f4bf7a7af8bd6758"/><dir name="Categories"><file name="Grid.php" hash="acc5e519550dd06c9a47f2d98483b7e0"/></dir><file name="Categories.php" hash="a2d4597f0da29890045e794162a81123"/></dir><dir name="Orders"><file name="Grid.php" hash="2093881501da86bce6243ef169da28ef"/></dir><file name="Orders.php" hash="04070370e9d9949899692b6a5308485c"/><dir name="Products"><dir name="Display"><file name="Grid.php" hash="b33907a2ec8e6e16fe2888815ee03b4d"/><dir name="Renderer"><file name="Status.php" hash="ac47cad1cc1472d2179a3486b159e69f"/></dir></dir><file name="Display.php" hash="454bbcca2b108b0029b6ecd6965e7078"/><dir name="Displayed"><file name="Grid.php" hash="6bf86c4755e190b39c46830112d59cd8"/></dir><file name="Displayed.php" hash="14dd740f096b1325ddfbc32bd79f2ee9"/></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="13dbafb3a0c22fc6c133f89f0cec4ece"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Shipping.php" hash="eeadde298181e58625e34f8b32a572c5"/></dir></dir></dir></dir></dir><dir name="Payment"><file name="Info.php" hash="dc28340a2720333f76b9169cd728de3f"/></dir></dir><dir name="Helper"><dir name="Data"><file name="Client.php" hash="e35a6d048d9e7f9e1c14f3630ae88eb5"/><dir name="Feed"><file name="Description.php" hash="d14edf7d5be31a1da42afa4f0924ef20"/></dir><file name="Feed.php" hash="da13304966bc96abfdcd8019019b6fa5"/><file name="Loader.php" hash="9fe89bcb314604619f02783da3a3125d"/><file name="Product.php" hash="7811818f45ef30352c00a93306069076"/><file name="Profile.php" hash="0052ee43bd2da505a28623238f16a182"/><file name="Source.php" hash="c452b4623f13fb4d75d45fa47058285b"/></dir><file name="Data.php" hash="d4383f8eb3b9a825b132e135eccd99a2"/><file name="Mapping.php" hash="eb1e66a95882e0ee54ff6b38e52fcb13"/><file name="Version.php" hash="90561893253db4a0240c0b8d623bc46a"/></dir><dir name="Model"><file name="Abstract.php" hash="ce7e85a9cfb1006dddc6b7ae7e5c714f"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Shipping.php" hash="9655a60edd0b268157c0bcffb277abfc"/></dir><dir name="Source"><file name="Abstract.php" hash="87cb02a8157409d79622c334a8067b3c"/><file name="Autodisplay.php" hash="7508c62973bfc447fa16483f902676a6"/><file name="Baseunit.php" hash="53938d578cb4e3ce8de203c5ba73bc39"/><file name="Country.php" hash="a88f8d50c29d7c97c4d3561707138ed0"/><file name="Deluxeoptions.php" hash="48dfad0a8778e2db3a0d689886d80309"/><file name="Duration.php" hash="f70fba6bd07a4ebcc5bd791b395f2b44"/><file name="Freeshipping.php" hash="5e940abd9e6e3d22f4fa3b3f6bab0d74"/><file name="Paymentmethods.php" hash="66347b1400b5fc40fa490a890fab9104"/><file name="Paymenttype.php" hash="361d3c572d9d93dd069fc9581284d3f7"/><file name="Productnewused.php" hash="2ca8e61d7538b83a4f37133eeea94133"/><file name="Region.php" hash="e726d9e52ceed911e81bec5e2b29526a"/><file name="Shippingconditions.php" hash="d71e1165750c58b83effbba393981c55"/><file name="Shippingpayer.php" hash="c4489072641f6d6e1c9d6d577e07d97e"/></dir></dir></dir></dir><dir name="Cache"><file name="Categories.php" hash="9533bc01134f3e95695c82ff8c662539"/><file name="Categorypath.php" hash="baf6f0aa7455f0c0865a43724be6f136"/><file name="Mediagallery.php" hash="e4c22ab7d49464f1aca0ec16da273704"/><file name="Superattributes.php" hash="60088c12c5e2dd6762afdddc3f5ecdaf"/><file name="Tax.php" hash="a97b54948be4e2ced000e17ba0b8c578"/></dir><file name="Cache.php" hash="ae8fc87221cf00a270162fc82fec4ec5"/><file name="Categoryproducts.php" hash="10699d6db08d93ec790441c8d89f9ebd"/><dir name="Config"><dir name="Source"><file name="Datetimeformat.php" hash="bb9af24a01322866de389afdc2a315f5"/><file name="Encoding.php" hash="520a683923a6d9a147ffbf520ef1f1eb"/><file name="Parentschilds.php" hash="298048105628fbfdc8cc03dd87e2faff"/><file name="Priceformat.php" hash="9ba9febc3c2378e08c62e3111485c1d5"/><file name="Productgroupsize.php" hash="b5e6fc12c5ab9ab39c84853845e8b072"/><file name="Stockdependence.php" hash="c60bc11c961b5b10963a54a6cbfb6534"/></dir></dir><dir name="Data"><dir name="Loader"><dir name="Product"><file name="Aukro.php" hash="2e40cdbf80991e922fe61697a662ac73"/></dir><file name="Product.php" hash="78842cd2962634ffccfe500a330d08b2"/></dir><file name="Loader.php" hash="a6b49683553bf8fe04184fe6d0fd0ec2"/><dir name="Reader"><dir name="Abstract"><file name="Csv.php" hash="94b1b9d39813c0cda4add1ab0b7ed7b5"/><file name="Text.php" hash="cb236ee3677547a0b25139d4738177de"/></dir><file name="Abstract.php" hash="9bc9326c23893f1156319359eea165c2"/></dir><file name="Reader.php" hash="b6ff79ce41b03e419bbdafbabaf4ceb1"/><dir name="Transformation"><dir name="Xml"><file name="Array.php" hash="2ef80727aa28d66e83da1f15e22ff49a"/></dir><file name="Xml.php" hash="c302940c79d294fb65ef204607e1712b"/><file name="Xslt.php" hash="68b30c2042dffc24578061aa099c512a"/></dir><file name="Transformation.php" hash="7be142acb6d71b75142b2e1e94f298f2"/><file name="Writer.php" hash="91f83be72882a8c086c13eaaf4e9a4f4"/></dir><file name="Feed.php" hash="a622892d58e3631638b1ff503e7333a1"/><dir name="Mapping"><file name="Attribute.php" hash="cdc7c92aa84e09dde6aa9dedd550703e"/><file name="Category.php" hash="3ef49f3942c70aefabb77e0daecb671b"/></dir><dir name="Mysql4"><file name="Abstract.php" hash="b983fa983186e7031ecf9c66991c44bc"/><dir name="Cache"><dir name="Categories"><file name="Collection.php" hash="8de2dbbb2a9c4047ef568530893823fe"/></dir><file name="Categories.php" hash="d1732e6b52e00d591d98305feea0cfe7"/><dir name="Categorypath"><file name="Collection.php" hash="a138e9e46f18b076c571eadc8043aa5b"/></dir><file name="Categorypath.php" hash="1e5e47a1e4c42fd15bdb1ed7eeca22da"/><dir name="Mediagallery"><file name="Collection.php" hash="1e35b166faa6fc6190567615fce98db8"/></dir><file name="Mediagallery.php" hash="327dec687455eaa9419e28e8c24121df"/><dir name="Superattributes"><file name="Collection.php" hash="518eb6d26633e72411f8bb50c39a024f"/></dir><file name="Superattributes.php" hash="83a0ca15c2071e33124a65271753d464"/><dir name="Tax"><file name="Collection.php" hash="efbbb1069b75b6188580e9c8fdf38de1"/></dir><file name="Tax.php" hash="5cc8d0aa0baa891261217a6cee0b0ffe"/></dir><file name="Cache.php" hash="dfc7c3d4aef448483c1faeee0ecc18af"/><file name="Categoryproducts.php" hash="5f714991d321b952239c462c4f829b7c"/><dir name="Data"><dir name="Loader"><dir name="Product"><dir name="Aukro"><file name="Collection.php" hash="6730504b0420d617676a53d63447ae8a"/></dir><file name="Aukro.php" hash="2debeabc8b64f5f8d20d49f59c253142"/></dir><file name="Product.php" hash="de0e5694852e6ec34c2c465c9fbf54b2"/></dir><file name="Loader.php" hash="5afe5be41c12d72ea684f779ca5e7846"/></dir><file name="Enginecategory.php" hash="23f2177cf64bb4b722cf18551e31ed6e"/><dir name="Mapping"><dir name="Attribute"><file name="Collection.php" hash="4e87d02ad671cbe6762c30cae23235ea"/></dir><file name="Attribute.php" hash="b79528355757576372cbddc5cad38125"/><dir name="Category"><file name="Collection.php" hash="99326d419965e3333813ed3097d72496"/></dir><file name="Category.php" hash="d2aece7d05fabe0d85e25058dae6f75f"/></dir><dir name="Product"><file name="Collection.php" hash="db606be4aaad4e1a5c07c867804ea960"/></dir><file name="Product.php" hash="5a1cbcd4563bd6964b5bd27493faa4f8"/><dir name="Shipping"><dir name="Pricing"><file name="Collection.php" hash="aa843b108da8608b1dedce4c43d5986a"/></dir><file name="Pricing.php" hash="8a184a3a36b93cf141bbdcb73b7f67d4"/></dir></dir><file name="Observer.php" hash="5d928d54bd29cf22064c91733390ed7b"/><file name="Payment.php" hash="0ec996a2a2b51c1f6481ddcad4c56daf"/><file name="Product.php" hash="01bd8839c8f5a17e37731f94936b5193"/><file name="Profile.php" hash="d2c79db3afb2c493bb52ded7ffef8cd1"/><dir name="Shipping"><dir name="Carrier"><file name="Aukro.php" hash="207c7790de23d02357e7598e29839de9"/></dir><file name="Pricing.php" hash="e99499da21b51eecdbcde8411916bf42"/></dir><file name="Status.php" hash="ff3e35152731a030c4eb631bde3f47ca"/><file name="Taxonomy.php" hash="3644a91b942629f4197f5f23d45cdbeb"/><dir name="Unit"><file name="Control.php" hash="01c7193a7994e6681e3ce51aa6f86520"/></dir><file name="Unit.php" hash="ec44e9237f3688f4435927498d129698"/><dir name="Webapi"><file name="Abstract.php" hash="c6abcf808eb6d5ca9c4a3ef7cba61e04"/><file name="Config.php" hash="065502b5c1d31f5c0491b101ddde3c1d"/><file name="Order.php" hash="c2ba0a4bdf74beabc1414f3e8bd71874"/><file name="Product.php" hash="8e872df143629164d5c72239b2c0f5ac"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ActivationController.php" hash="d0c2e3743c17063586ddfa19b0be5ad0"/><file name="LogController.php" hash="e88c57a59725460dd6198ccec0e3e152"/><dir name="Map"><file name="AttributesController.php" hash="aa336556826ac6d307567bf20a3fa587"/><file name="CategoriesController.php" hash="fcfd00f29aa156518456ccc2cdfdfce9"/></dir><file name="OrdersController.php" hash="a0d3b791921bc51baac6fce74350fe7b"/><dir name="Products"><file name="DisplayController.php" hash="905d3f21bad46194b798af87614692df"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="c7ece8b994f89b364bd00227164c72b8"/><file name="system.xml" hash="fdf47a9d9d195d01378c98598e39e3d7"/></dir><dir name="sql"><dir name="aukro_setup"><file name="mysql4-install-0.1.0.php" hash="d266efa3fd19e986a1b2e0f05a2dee57"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="25b23ee1fc9eae3d3f1567f8c6fa7b20"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="44a1e2acd12a835b7bd5cbdb2b922bf1"/><file name="mysql4-upgrade-0.3.0-0.4.0.php" hash="241a2964b654c2a5bd173a00681fb7ff"/><file name="mysql4-upgrade-0.4.0-0.5.0.php" hash="6d10cf1e152a43a30a5aba43cf91b365"/><file name="mysql4-upgrade-0.5.0-0.5.1.php" hash="c70730db35d18ec9e336458664b6a107"/><file name="mysql4-upgrade-0.5.1-0.5.2.php" hash="d20c2f143b60b3b7b0212ea9bdefcd19"/><file name="mysql4-upgrade-0.5.2-0.5.3.php" hash="40597fe0497774fdaf162dc4f2b27267"/><file name="mysql4-upgrade-0.5.3-0.5.4.php" hash="5e4bd3e6dc2ed356109147e3bb86c524"/><file name="mysql4-upgrade-0.5.4-0.5.5.php" hash="4a70a0d747ec6de9da10b87e36e00d11"/><file name="mysql4-upgrade-0.6.0-0.6.1.php" hash="6368d282b872be8bf384f21056d1fe9e"/><file name="mysql4-upgrade-0.6.1-0.6.2.php" hash="6479314135ddece97710b578fa4ac6df"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="nostress_aukro"><file name="activation.phtml" hash="858a28f636269fc6c22e280af8195b83"/><file name="form.phtml" hash="edc02b8bf579a97ca059d8aac80c066f"/><dir name="grid"><file name="container.phtml" hash="ee763279f568689ed74ad2b15ac9f804"/></dir><dir name="payment"><file name="info.phtml" hash="0d3f5a1b44c46df6c6cc48e00f6001f2"/></dir><file name="product.phtml" hash="2514a7a603c21001b1c5fe2fea93cbd5"/><file name="translate_array.phtml" hash="a640b834234568fbd54021bbcaa7b639"/><dir name="widget"><dir name="form"><dir name="config"><file name="shipping.phtml" hash="9782cb3e878777a5d43315511efd462f"/></dir><dir name="renderer"><file name="element.phtml" hash="d94bd89782a84c62e7bc8f9d83fa6edd"/></dir><dir name="shipping"><file name="element.phtml" hash="294b95d084ae88fc39eeb383becb6e87"/></dir></dir></dir></dir></dir><dir name="layout"><file name="nostress_aukro.xml" hash="a0116c952f3fdd0f574937a69cb352ca"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Nostress_Aukro.xml" hash="dd549c1b4a3cec78df5ad0dac79b2878"/></dir></target><target name="magelocale"><dir name="cs_CZ"><file name="Nostress_Aukro.csv" hash="e26bc1bd86de40d73848e17f5fb3a0cb"/></dir><dir name="en_US"><file name="Nostress_Aukro.csv" hash="ebdc244377bc0c9fdd5046b7b2d9ff3f"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="aukro.css" hash="0ed5279e0affa8d6ac1b3f638a70044a"/><dir name="images"><dir name="aukro"><file name="aukro_logo.png" hash="afbedeb3a040b12b559700fff156bb1a"/><file name="box_top.png" hash="b136959d229b0f10937389a75bddd826"/><file name="close.png" hash="4278a8b021acb550ad96cdddb2db6d8f"/><file name="preload.gif" hash="bf3ec68db23e93ba2ec795ef558e96da"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="nostress"><dir name="aukro"><file name="aukro.js" hash="d4742034acbcf7c652abb2f956a713d6"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.3.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/aukro.css ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #anchor-content {
2
+ position: relative;
3
+ }
4
+
5
+ .overlay {
6
+ background-color: #000;
7
+ opacity: .7;
8
+ filter: alpha(opacity = 70);
9
+ position: absolute;
10
+ top: 0;
11
+ left: 0;
12
+ bottom: 0;
13
+ right: 0;
14
+ height: 200%;
15
+ z-index: 10;
16
+ }
17
+ .btn_activate {
18
+ color: green;
19
+ }
20
+
21
+ .overlay {
22
+ opacity: 0.9;
23
+ height: 200%;
24
+ }
25
+
26
+ .overlay-data {
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ bottom: 0;
31
+ right: 0;
32
+ z-index: 15;
33
+ }
34
+
35
+ .overlay-data .container {
36
+ width: 450px;
37
+ position: relative;
38
+ margin: 80px auto 20px auto;
39
+ }
40
+
41
+ .overlay-data .box {
42
+ border: 0px solid #dddddd;
43
+ background: #fff url('images/aukro/box_top.png') repeat-x top center;
44
+ margin: 25px 0;
45
+ border-radius: 5px 5px;
46
+ -webkit-box-shadow: 0 1px 1px 0 #cfcfcf;
47
+ box-shadow: 0 1px 1px 0 #cfcfcf;
48
+ padding: 0px;
49
+ padding-top: 10px;
50
+ }
51
+
52
+ .overlay-data .box .koongo .logo {
53
+ width: 302px;
54
+ height: 75px;
55
+ background: #fff url('images/aukro/aukro_logo.png') no-repeat top
56
+ center;
57
+ margin: 12px auto 14px auto;
58
+ float: none;
59
+ }
60
+
61
+ .overlay-data .box .koongo .line {
62
+ width: 100%;
63
+ height: 1px;
64
+ margin: 10px 0;
65
+ background-color: #eaeaea;
66
+ }
67
+
68
+ .overlay-data .box .btn-set .l {
69
+ float: left;
70
+ text-align: right;
71
+ margin: 0 25px 0 42px;
72
+ }
73
+
74
+ .overlay-data .box .btn-set .r {
75
+ width: 325px;
76
+ float: left;
77
+ text-align: left;
78
+ margin: 0 42px 0 25px;
79
+ }
80
+
81
+ .overlay-data .box .btn-set {
82
+ margin: 21px 0 30px 0;
83
+ }
84
+
85
+ .overlay-data .box .btn-set .info {
86
+ text-align: center;
87
+ margin: 13px 0px;
88
+ font-style: italic;
89
+ font-size: 14px;
90
+ }
91
+
92
+ .overlay-data .box .btn-set .info span {
93
+ color: #f86a00;
94
+ }
95
+
96
+ .overlay-data .box .btn-set button {
97
+ width: 100%;
98
+ }
99
+
100
+ .overlay-data .box .unit .logo {
101
+ width: 120px;
102
+ height: 60px;
103
+ margin: 12px 15px 14px 35px;
104
+ float: left;
105
+ }
106
+
107
+ .overlay-data .box .unit .logo.custom {
108
+ margin-top: 52px;
109
+ }
110
+
111
+ .overlay-data .box .unit .logo.custom img {
112
+ width: 100%;
113
+ }
114
+
115
+ .overlay-data .box .line {
116
+ width: 100%;
117
+ height: 1px;
118
+ margin: 10px 0;
119
+ background-color: #eaeaea;
120
+ }
121
+
122
+ .overlay-data .box .unit .line {
123
+ width: 1px;
124
+ height: 87px;
125
+ float: left;
126
+ margin: 15px 16px;
127
+ background-color: #eaeaea;
128
+ }
129
+
130
+ .overlay-data .box .unit .info {
131
+ text-align: left;
132
+ float: left;
133
+ width: 255px;
134
+ margin: 13px 30px 13px 15px;
135
+ font-style: italic;
136
+ font-size: 13px;
137
+ color: #525252;
138
+ }
139
+
140
+ .overlay-data .box .unit .btn-one {
141
+ float: left;
142
+ width: 239px;
143
+ }
144
+
145
+ .overlay-data .box .unit .btn-one .sub-info {
146
+ padding: 0px 0px 10px 0;
147
+ text-align: center;
148
+ font-style: italic;
149
+ }
150
+
151
+ .overlay-data .btn-koongo {
152
+ font-size: 22px;
153
+ font-weight: bold;
154
+ color: #000000;
155
+ text-shadow: 1px 1px 0px #ffc68f;
156
+ background: #ffcd9b; /* Old browsers */
157
+ background: -moz-linear-gradient(top, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
158
+ /* FF3.6+ */
159
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffcd9b),
160
+ color-stop(1%, #ffac59), color-stop(100%, #ff840c) );
161
+ /* Chrome,Safari4+ */
162
+ background: -webkit-linear-gradient(top, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
163
+ /* Chrome10+,Safari5.1+ */
164
+ background: -o-linear-gradient(top, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
165
+ /* Opera 11.10+ */
166
+ background: -ms-linear-gradient(top, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
167
+ /* IE10+ */
168
+ background: linear-gradient(to bottom, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
169
+ /* W3C */
170
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffcd9b',
171
+ endColorstr='#ff840c', GradientType=0 ); /* IE6-9 */
172
+ border-color: #dc7839 #c89509 #bd5f2c;
173
+ padding: 21px 32px;
174
+ border-radius: 6px;
175
+ }
176
+
177
+ .overlay-data .btn-koongo:hover {
178
+ background: #ffcd9b; /* Old browsers */
179
+ background: -moz-linear-gradient(top, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
180
+ /* FF3.6+ */
181
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffcd9b),
182
+ color-stop(1%, #ff9730), color-stop(100%, #ff7b00) );
183
+ /* Chrome,Safari4+ */
184
+ background: -webkit-linear-gradient(top, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
185
+ /* Chrome10+,Safari5.1+ */
186
+ background: -o-linear-gradient(top, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
187
+ /* Opera 11.10+ */
188
+ background: -ms-linear-gradient(top, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
189
+ /* IE10+ */
190
+ background: linear-gradient(to bottom, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
191
+ /* W3C */
192
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffcd9b',
193
+ endColorstr='#ff7b00', GradientType=0 ); /* IE6-9 */
194
+ }
195
+
196
+ .overlay-data .btn {
197
+ margin: 17px 0 10px 0;
198
+ width: 100%;
199
+ font-size: 17px;
200
+ font-weight: bold;
201
+ color: #303030;
202
+ text-shadow: 1px 1px 0px #ffe18c;
203
+ background: #ffef9b;
204
+ background: -moz-linear-gradient(top, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
205
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #ffef9b),
206
+ color-stop(3%, #ffe357), color-stop(100%, #ffb90c) );
207
+ background: -webkit-linear-gradient(top, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
208
+ background: -o-linear-gradient(top, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
209
+ background: -ms-linear-gradient(top, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
210
+ background: linear-gradient(to bottom, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
211
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffef9b',
212
+ endColorstr='#ffb90c', GradientType=0 );
213
+ border-color: #dc7839 #c89509 #bd5f2c;
214
+ padding: 10px 10px;
215
+ border-radius: 6px;
216
+ }
217
+
218
+ .overlay-data .btn:hover {
219
+ color: #000;
220
+ background: #ffef9b;
221
+ background: -moz-linear-gradient(top, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
222
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #ffef9b),
223
+ color-stop(3%, #ffdb3f), color-stop(100%, #ffb200) );
224
+ background: -webkit-linear-gradient(top, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
225
+ background: -o-linear-gradient(top, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
226
+ background: -ms-linear-gradient(top, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
227
+ background: linear-gradient(to bottom, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
228
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffef9b',
229
+ endColorstr='#ffb200', GradientType=0 );
230
+ }
231
+
232
+ .overlay-data .destroy {
233
+ clear: both;
234
+ }
235
+
236
+ .btn-koongo-submit-orange {
237
+ font-size: 14px;
238
+ font-weight: bold;
239
+ color: #000000;
240
+ text-shadow: 1px 1px 0px #ffc68f;
241
+ background: #ffcd9b; /* Old browsers */
242
+ background: -moz-linear-gradient(top, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
243
+ /* FF3.6+ */
244
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffcd9b),
245
+ color-stop(1%, #ffac59), color-stop(100%, #ff840c) );
246
+ /* Chrome,Safari4+ */
247
+ background: -webkit-linear-gradient(top, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
248
+ /* Chrome10+,Safari5.1+ */
249
+ background: -o-linear-gradient(top, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
250
+ /* Opera 11.10+ */
251
+ background: -ms-linear-gradient(top, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
252
+ /* IE10+ */
253
+ background: linear-gradient(to bottom, #ffcd9b 0%, #ffac59 1%, #ff840c 100%);
254
+ /* W3C */
255
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffcd9b',
256
+ endColorstr='#ff840c', GradientType=0 ); /* IE6-9 */
257
+ border-color: #dc7839 #c89509 #bd5f2c;
258
+ padding: 9px 18px;
259
+ border-width: 1px;
260
+ border-radius: 6px;
261
+ min-width: 280px;
262
+ }
263
+
264
+ .btn-koongo-submit-orange:hover {
265
+ cursor: pointer;
266
+ background: #ffcd9b; /* Old browsers */
267
+ background: -moz-linear-gradient(top, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
268
+ /* FF3.6+ */
269
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffcd9b),
270
+ color-stop(1%, #ff9730), color-stop(100%, #ff7b00) );
271
+ /* Chrome,Safari4+ */
272
+ background: -webkit-linear-gradient(top, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
273
+ /* Chrome10+,Safari5.1+ */
274
+ background: -o-linear-gradient(top, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
275
+ /* Opera 11.10+ */
276
+ background: -ms-linear-gradient(top, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
277
+ /* IE10+ */
278
+ background: linear-gradient(to bottom, #ffcd9b 0%, #ff9730 1%, #ff7b00 100%);
279
+ /* W3C */
280
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffcd9b',
281
+ endColorstr='#ff7b00', GradientType=0 ); /* IE6-9 */
282
+ }
283
+
284
+ .btn-koongo-submit-yellow {
285
+ font-size: 14px;
286
+ font-weight: bold;
287
+ color: #303030;
288
+ text-shadow: 1px 1px 0px #ffe18c;
289
+ background: #ffef9b;
290
+ background: -moz-linear-gradient(top, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
291
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #ffef9b),
292
+ color-stop(3%, #ffe357), color-stop(100%, #ffb90c) );
293
+ background: -webkit-linear-gradient(top, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
294
+ background: -o-linear-gradient(top, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
295
+ background: -ms-linear-gradient(top, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
296
+ background: linear-gradient(to bottom, #ffef9b 1%, #ffe357 3%, #ffb90c 100%);
297
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffef9b',
298
+ endColorstr='#ffb90c', GradientType=0 );
299
+ border-color: #dc7839 #c89509 #bd5f2c;
300
+ padding: 9px 18px;
301
+ border-width: 1px;
302
+ border-radius: 6px;
303
+ min-width: 280px;
304
+ }
305
+
306
+ .btn-koongo-submit-yellow:hover {
307
+ cursor: pointer;
308
+ color: #000;
309
+ background: #ffef9b;
310
+ background: -moz-linear-gradient(top, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
311
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #ffef9b),
312
+ color-stop(3%, #ffdb3f), color-stop(100%, #ffb200) );
313
+ background: -webkit-linear-gradient(top, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
314
+ background: -o-linear-gradient(top, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
315
+ background: -ms-linear-gradient(top, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
316
+ background: linear-gradient(to bottom, #ffef9b 1%, #ffdb3f 3%, #ffb200 100%);
317
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffef9b',
318
+ endColorstr='#ffb200', GradientType=0 );
319
+ }
320
+
321
+ .activation_form {
322
+ float: left;
323
+ width: 49%;
324
+ margin: 0px 2% 0px 0px;
325
+ min-width: 522px;
326
+ }
327
+
328
+ .contact_form {
329
+ float: left;
330
+ width: 49%;
331
+ margin: 0px 0px 0px 0px;
332
+ min-width: 522px;
333
+ }
334
+
335
+ button.livechat {
336
+ background: none;
337
+ border: 0;
338
+ }
skin/adminhtml/default/default/images/aukro/aukro_logo.png ADDED
Binary file
skin/adminhtml/default/default/images/aukro/box_top.png ADDED
Binary file
skin/adminhtml/default/default/images/aukro/close.png ADDED
Binary file
skin/adminhtml/default/default/images/aukro/preload.gif ADDED
Binary file