d7db67d0d012350a01ce05c31f91754d - Version 2.3.4

Version Notes

Anymarket product and order Integration.

Download this release

Release Info

Developer AnyMarket
Extension d7db67d0d012350a01ce05c31f91754d
Version 2.3.4
Comparing to
See all releases


Version 2.3.4

Files changed (129) hide show
  1. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes.php +43 -0
  2. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit.php +75 -0
  3. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Form.php +51 -0
  4. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Form.php +102 -0
  5. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Stores.php +50 -0
  6. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tabs.php +79 -0
  7. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Grid.php +174 -0
  8. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories.php +48 -0
  9. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit.php +82 -0
  10. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Form.php +52 -0
  11. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Form.php +114 -0
  12. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Stores.php +58 -0
  13. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tabs.php +87 -0
  14. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Grid.php +287 -0
  15. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog.php +44 -0
  16. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit.php +56 -0
  17. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Form.php +51 -0
  18. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Form.php +99 -0
  19. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Stores.php +58 -0
  20. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tabs.php +74 -0
  21. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Grid.php +189 -0
  22. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders.php +53 -0
  23. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit.php +82 -0
  24. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Form.php +52 -0
  25. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Form.php +109 -0
  26. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Stores.php +58 -0
  27. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tabs.php +87 -0
  28. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Grid.php +242 -0
  29. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts.php +53 -0
  30. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit.php +82 -0
  31. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Form.php +52 -0
  32. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Form.php +132 -0
  33. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Stores.php +58 -0
  34. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tabs.php +87 -0
  35. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Grid.php +271 -0
  36. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue.php +41 -0
  37. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit.php +81 -0
  38. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Form.php +51 -0
  39. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Form.php +119 -0
  40. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Stores.php +57 -0
  41. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tabs.php +86 -0
  42. app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Grid.php +223 -0
  43. app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusammg/Values.php +55 -0
  44. app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusmgam/Values.php +53 -0
  45. app/code/community/DB1/AnyMarket/Block/System/Config/Source/Products/Values.php +54 -0
  46. app/code/community/DB1/AnyMarket/Controller/Adminhtml/AnyMarket.php +61 -0
  47. app/code/community/DB1/AnyMarket/Helper/Category.php +114 -0
  48. app/code/community/DB1/AnyMarket/Helper/Customergenerator.php +152 -0
  49. app/code/community/DB1/AnyMarket/Helper/Data.php +214 -0
  50. app/code/community/DB1/AnyMarket/Helper/Order.php +888 -0
  51. app/code/community/DB1/AnyMarket/Helper/Ordergenerator.php +404 -0
  52. app/code/community/DB1/AnyMarket/Helper/Product.php +1311 -0
  53. app/code/community/DB1/AnyMarket/Helper/Productgenerator.php +289 -0
  54. app/code/community/DB1/AnyMarket/Helper/Queue.php +148 -0
  55. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketattributes.php +60 -0
  56. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketlog.php +60 -0
  57. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketorders.php +60 -0
  58. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketproducts.php +60 -0
  59. app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketqueue.php +60 -0
  60. app/code/community/DB1/AnyMarket/Model/Anymarketattributes.php +104 -0
  61. app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api.php +162 -0
  62. app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api/V2.php +33 -0
  63. app/code/community/DB1/AnyMarket/Model/Anymarketcategories.php +104 -0
  64. app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api.php +162 -0
  65. app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api/V2.php +33 -0
  66. app/code/community/DB1/AnyMarket/Model/Anymarketlog.php +104 -0
  67. app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api.php +162 -0
  68. app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api/V2.php +33 -0
  69. app/code/community/DB1/AnyMarket/Model/Anymarketorders.php +104 -0
  70. app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api.php +162 -0
  71. app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api/V2.php +33 -0
  72. app/code/community/DB1/AnyMarket/Model/Anymarketproducts.php +104 -0
  73. app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api.php +162 -0
  74. app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api/V2.php +33 -0
  75. app/code/community/DB1/AnyMarket/Model/Anymarketqueue.php +103 -0
  76. app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api.php +162 -0
  77. app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api/V2.php +33 -0
  78. app/code/community/DB1/AnyMarket/Model/Cron.php +66 -0
  79. app/code/community/DB1/AnyMarket/Model/Observer.php +178 -0
  80. app/code/community/DB1/AnyMarket/Model/PaymentMethod.php +38 -0
  81. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes.php +133 -0
  82. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes/Collection.php +136 -0
  83. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories.php +133 -0
  84. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories/Collection.php +136 -0
  85. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog.php +133 -0
  86. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog/Collection.php +136 -0
  87. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders.php +133 -0
  88. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders/Collection.php +136 -0
  89. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts.php +133 -0
  90. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts/Collection.php +136 -0
  91. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue.php +132 -0
  92. app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue/Collection.php +135 -0
  93. app/code/community/DB1/AnyMarket/Model/Resource/Setup.php +26 -0
  94. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Group/Values.php +15 -0
  95. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Values.php +17 -0
  96. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Values.php +21 -0
  97. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Categories/Values.php +67 -0
  98. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Massunit/Values.php +13 -0
  99. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Orders/Values.php +18 -0
  100. app/code/community/DB1/AnyMarket/Model/System/Config/Source/Typesync/Order/Values.php +12 -0
  101. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketattributesController.php +328 -0
  102. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketcategoriesController.php +350 -0
  103. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketlogController.php +328 -0
  104. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketordersController.php +457 -0
  105. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketproductsController.php +505 -0
  106. app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketqueueController.php +327 -0
  107. app/code/community/DB1/AnyMarket/etc/adminhtml.xml +104 -0
  108. app/code/community/DB1/AnyMarket/etc/api.xml +432 -0
  109. app/code/community/DB1/AnyMarket/etc/config.xml +319 -0
  110. app/code/community/DB1/AnyMarket/etc/system.xml +428 -0
  111. app/code/community/DB1/AnyMarket/etc/wsdl.xml +889 -0
  112. app/code/community/DB1/AnyMarket/etc/wsi.xml +1357 -0
  113. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-install-1.0.0.php +621 -0
  114. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.0.0-1.1.0.php +66 -0
  115. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.1.0-1.2.0 .php +8 -0
  116. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.2.0-1.3.0.php +68 -0
  117. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.3.0-1.4.0.php +14 -0
  118. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.4.0-1.5.0.php +117 -0
  119. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.5.0-1.6.0.php +13 -0
  120. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.6.0-1.7.0.php +9 -0
  121. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.7.0-1.8.0.php +10 -0
  122. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.8.0-2.0.0.php +1 -0
  123. app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.0.0-2.1.0.php +12 -0
  124. app/design/adminhtml/default/default/layout/db1_anymarket.xml +220 -0
  125. app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/array_dropdown.phtml +175 -0
  126. app/etc/modules/DB1_AnyMarket.xml +30 -0
  127. app/locale/en_US/DB1_AnyMarket.csv +318 -0
  128. app/locale/pt_BR/DB1_AnyMarket.csv +272 -0
  129. package.xml +33 -0
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Attributes admin block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketattributes extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ */
32
+ public function __construct()
33
+ {
34
+ $this->_controller = 'adminhtml_anymarketattributes';
35
+ $this->_blockGroup = 'db1_anymarket';
36
+ parent::__construct();
37
+ $this->_headerText = Mage::helper('db1_anymarket')->__('Anymarket Attributes');
38
+ $this->_removeButton('add');
39
+
40
+ Mage::helper('db1_anymarket')->massInsertAttribute();
41
+
42
+ }
43
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * @category DB1
6
+ * @package DB1_AnyMarket
7
+ * @copyright Copyright (c) 2015
8
+ * @license http://opensource.org/licenses/mit-license.php MIT License
9
+ */
10
+ /**
11
+ * Anymarket Attributes admin edit form
12
+ *
13
+ * @category DB1
14
+ * @package DB1_AnyMarket
15
+
16
+ */
17
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
18
+ {
19
+ /**
20
+ * constructor
21
+ *
22
+ * @access public
23
+ * @return void
24
+
25
+ */
26
+ public function __construct()
27
+ {
28
+ parent::__construct();
29
+ $this->_blockGroup = 'db1_anymarket';
30
+ $this->_controller = 'adminhtml_anymarketattributes';
31
+ $this->_updateButton(
32
+ 'save',
33
+ 'label',
34
+ Mage::helper('db1_anymarket')->__('Save Anymarket Attributes')
35
+ );
36
+ $this->_updateButton(
37
+ 'delete',
38
+ 'label',
39
+ Mage::helper('db1_anymarket')->__('Delete Anymarket Attributes')
40
+ );
41
+ $this->_addButton(
42
+ 'saveandcontinue',
43
+ array(
44
+ 'label' => Mage::helper('db1_anymarket')->__('Save And Continue Edit'),
45
+ 'onclick' => 'saveAndContinueEdit()',
46
+ 'class' => 'save',
47
+ ),
48
+ -100
49
+ );
50
+ $this->_formScripts[] = "
51
+ function saveAndContinueEdit() {
52
+ editForm.submit($('edit_form').action+'back/edit/');
53
+ }
54
+ ";
55
+ }
56
+
57
+ /**
58
+ * get the edit form header
59
+ *
60
+ * @access public
61
+ * @return string
62
+
63
+ */
64
+ public function getHeaderText()
65
+ {
66
+ if (Mage::registry('current_anymarketattributes') && Mage::registry('current_anymarketattributes')->getId()) {
67
+ return Mage::helper('db1_anymarket')->__(
68
+ "Edit Anymarket Attributes '%s'",
69
+ $this->escapeHtml(Mage::registry('current_anymarketattributes')->getNmaDesc())
70
+ );
71
+ } else {
72
+ return Mage::helper('db1_anymarket')->__('Add Anymarket Attributes');
73
+ }
74
+ }
75
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Form.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Attributes edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
24
+ {
25
+ /**
26
+ * prepare form
27
+ *
28
+ * @access protected
29
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit_Form
30
+
31
+ */
32
+ protected function _prepareForm()
33
+ {
34
+ $form = new Varien_Data_Form(
35
+ array(
36
+ 'id' => 'edit_form',
37
+ 'action' => $this->getUrl(
38
+ '*/*/save',
39
+ array(
40
+ 'id' => $this->getRequest()->getParam('id')
41
+ )
42
+ ),
43
+ 'method' => 'post',
44
+ 'enctype' => 'multipart/form-data'
45
+ )
46
+ );
47
+ $form->setUseContainer(true);
48
+ $this->setForm($form);
49
+ return parent::_prepareForm();
50
+ }
51
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Form.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ *
6
+ * @category DB1
7
+ * @package DB1_AnyMarket
8
+ * @copyright Copyright (c) 2015
9
+ * @license http://opensource.org/licenses/mit-license.php MIT License
10
+ */
11
+ /**
12
+ * Anymarket Attributes edit form tab
13
+ *
14
+ * @category DB1
15
+ * @package DB1_AnyMarket
16
+ */
17
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ /**
20
+ * prepare the form
21
+ *
22
+ * @access protected
23
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit_Tab_Form
24
+
25
+ */
26
+ protected function _prepareForm()
27
+ {
28
+ $form = new Varien_Data_Form();
29
+ $form->setHtmlIdPrefix('anymarketattributes_');
30
+ $form->setFieldNameSuffix('anymarketattributes');
31
+ $this->setForm($form);
32
+ $fieldset = $form->addFieldset(
33
+ 'anymarketattributes_form',
34
+ array('legend' => Mage::helper('db1_anymarket')->__('Anymarket Attributes'))
35
+ );
36
+
37
+ $fieldset->addField(
38
+ 'nma_id_attr',
39
+ 'text',
40
+ array(
41
+ 'label' => Mage::helper('db1_anymarket')->__('Attribute Code'),
42
+ 'name' => 'nma_id_attr',
43
+ 'required' => true,
44
+ 'class' => 'required-entry',
45
+
46
+ )
47
+ );
48
+
49
+ $fieldset->addField(
50
+ 'nma_desc',
51
+ 'text',
52
+ array(
53
+ 'label' => Mage::helper('db1_anymarket')->__('Attribute Description'),
54
+ 'name' => 'nma_desc',
55
+ 'required' => true,
56
+ 'class' => 'required-entry',
57
+
58
+ )
59
+ );
60
+ $fieldset->addField(
61
+ 'status',
62
+ 'select',
63
+ array(
64
+ 'label' => Mage::helper('db1_anymarket')->__('Status'),
65
+ 'name' => 'status',
66
+ 'values' => array(
67
+ array(
68
+ 'value' => 1,
69
+ 'label' => Mage::helper('db1_anymarket')->__('Enabled'),
70
+ ),
71
+ array(
72
+ 'value' => 0,
73
+ 'label' => Mage::helper('db1_anymarket')->__('Disabled'),
74
+ ),
75
+ ),
76
+ )
77
+ );
78
+ if (Mage::app()->isSingleStoreMode()) {
79
+ $fieldset->addField(
80
+ 'store_id',
81
+ 'hidden',
82
+ array(
83
+ 'name' => 'stores[]',
84
+ 'value' => Mage::app()->getStore(true)->getId()
85
+ )
86
+ );
87
+ Mage::registry('current_anymarketattributes')->setStoreId(Mage::app()->getStore(true)->getId());
88
+ }
89
+ $formValues = Mage::registry('current_anymarketattributes')->getDefaultValues();
90
+ if (!is_array($formValues)) {
91
+ $formValues = array();
92
+ }
93
+ if (Mage::getSingleton('adminhtml/session')->getAnymarketattributesData()) {
94
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getAnymarketattributesData());
95
+ Mage::getSingleton('adminhtml/session')->setAnymarketattributesData(null);
96
+ } elseif (Mage::registry('current_anymarketattributes')) {
97
+ $formValues = array_merge($formValues, Mage::registry('current_anymarketattributes')->getData());
98
+ }
99
+ $form->setValues($formValues);
100
+ return parent::_prepareForm();
101
+ }
102
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * @category DB1
6
+ * @package DB1_AnyMarket
7
+ * @copyright Copyright (c) 2015
8
+ * @license http://opensource.org/licenses/mit-license.php MIT License
9
+ */
10
+ /**
11
+ * store selection tab
12
+ *
13
+ * @category DB1
14
+ * @package DB1_AnyMarket
15
+ */
16
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
17
+ {
18
+ /**
19
+ * prepare the form
20
+ *
21
+ * @access protected
22
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit_Tab_Stores
23
+
24
+ */
25
+ protected function _prepareForm()
26
+ {
27
+ $form = new Varien_Data_Form();
28
+ $form->setFieldNameSuffix('anymarketattributes');
29
+ $this->setForm($form);
30
+ $fieldset = $form->addFieldset(
31
+ 'anymarketattributes_stores_form',
32
+ array('legend' => Mage::helper('db1_anymarket')->__('Store views'))
33
+ );
34
+ $field = $fieldset->addField(
35
+ 'store_id',
36
+ 'multiselect',
37
+ array(
38
+ 'name' => 'stores[]',
39
+ 'label' => Mage::helper('db1_anymarket')->__('Store Views'),
40
+ 'title' => Mage::helper('db1_anymarket')->__('Store Views'),
41
+ 'required' => true,
42
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
43
+ )
44
+ );
45
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
46
+ $field->setRenderer($renderer);
47
+ $form->addValues(Mage::registry('current_anymarketattributes')->getData());
48
+ return parent::_prepareForm();
49
+ }
50
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Edit/Tabs.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * @category DB1
6
+ * @package DB1_AnyMarket
7
+ * @copyright Copyright (c) 2015
8
+ * @license http://opensource.org/licenses/mit-license.php MIT License
9
+ */
10
+ /**
11
+ * Anymarket Attributes admin edit tabs
12
+ *
13
+ * @category DB1
14
+ * @package DB1_AnyMarket
15
+ */
16
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
17
+ {
18
+ /**
19
+ * Initialize Tabs
20
+ *
21
+ * @access public
22
+
23
+ */
24
+ public function __construct()
25
+ {
26
+ parent::__construct();
27
+ $this->setId('anymarketattributes_tabs');
28
+ $this->setDestElementId('edit_form');
29
+ $this->setTitle(Mage::helper('db1_anymarket')->__('Anymarket Attributes'));
30
+ }
31
+
32
+ /**
33
+ * before render html
34
+ *
35
+ * @access protected
36
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Edit_Tabs
37
+
38
+ */
39
+ protected function _beforeToHtml()
40
+ {
41
+ $this->addTab(
42
+ 'form_anymarketattributes',
43
+ array(
44
+ 'label' => Mage::helper('db1_anymarket')->__('Anymarket Attributes'),
45
+ 'title' => Mage::helper('db1_anymarket')->__('Anymarket Attributes'),
46
+ 'content' => $this->getLayout()->createBlock(
47
+ 'db1_anymarket/adminhtml_anymarketattributes_edit_tab_form'
48
+ )
49
+ ->toHtml(),
50
+ )
51
+ );
52
+ if (!Mage::app()->isSingleStoreMode()) {
53
+ $this->addTab(
54
+ 'form_store_anymarketattributes',
55
+ array(
56
+ 'label' => Mage::helper('db1_anymarket')->__('Store views'),
57
+ 'title' => Mage::helper('db1_anymarket')->__('Store views'),
58
+ 'content' => $this->getLayout()->createBlock(
59
+ 'db1_anymarket/adminhtml_anymarketattributes_edit_tab_stores'
60
+ )
61
+ ->toHtml(),
62
+ )
63
+ );
64
+ }
65
+ return parent::_beforeToHtml();
66
+ }
67
+
68
+ /**
69
+ * Retrieve anymarket attributes entity
70
+ *
71
+ * @access public
72
+ * @return DB1_AnyMarket_Model_Anymarketattributes
73
+
74
+ */
75
+ public function getAnymarketattributes()
76
+ {
77
+ return Mage::registry('current_anymarketattributes');
78
+ }
79
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketattributes/Grid.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Attributes admin grid block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Grid extends Mage_Adminhtml_Block_Widget_Grid
24
+ {
25
+ /**
26
+ * constructor
27
+ *
28
+ * @access public
29
+ */
30
+ public function __construct()
31
+ {
32
+ parent::__construct();
33
+ $this->setId('anymarketattributesGrid');
34
+ $this->setDefaultSort('entity_id');
35
+ $this->setDefaultDir('ASC');
36
+ $this->setSaveParametersInSession(true);
37
+ $this->setUseAjax(true);
38
+ }
39
+
40
+ /**
41
+ * prepare collection
42
+ *
43
+ * @access protected
44
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Grid
45
+ */
46
+ protected function _prepareCollection()
47
+ {
48
+ $collection = Mage::getModel('db1_anymarket/anymarketattributes')
49
+ ->getCollection();
50
+
51
+ $this->setCollection($collection);
52
+ return parent::_prepareCollection();
53
+ }
54
+
55
+ /**
56
+ * prepare grid collection
57
+ *
58
+ * @access protected
59
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Grid
60
+ */
61
+ protected function _prepareColumns()
62
+ {
63
+ $this->addColumn(
64
+ 'nma_desc',
65
+ array(
66
+ 'header' => Mage::helper('db1_anymarket')->__('Descrição do Atributo'),
67
+ 'align' => 'left',
68
+ 'index' => 'nma_desc',
69
+ )
70
+ );
71
+
72
+ $this->addColumn(
73
+ 'status',
74
+ array(
75
+ 'header' => Mage::helper('db1_anymarket')->__('Status'),
76
+ 'index' => 'status',
77
+ 'type' => 'options',
78
+ 'options' => array(
79
+ '1' => Mage::helper('db1_anymarket')->__('Enabled'),
80
+ '0' => Mage::helper('db1_anymarket')->__('Disabled'),
81
+ )
82
+ )
83
+ );
84
+ $this->addExportType('*/*/exportCsv', Mage::helper('db1_anymarket')->__('CSV'));
85
+ $this->addExportType('*/*/exportExcel', Mage::helper('db1_anymarket')->__('Excel'));
86
+ $this->addExportType('*/*/exportXml', Mage::helper('db1_anymarket')->__('XML'));
87
+ return parent::_prepareColumns();
88
+ }
89
+
90
+ /**
91
+ * prepare mass action
92
+ *
93
+ * @access protected
94
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Grid
95
+ */
96
+ protected function _prepareMassaction()
97
+ {
98
+ $this->setMassactionIdField('entity_id');
99
+ $this->getMassactionBlock()->setFormFieldName('anymarketattributes');
100
+ $this->getMassactionBlock()->addItem(
101
+ 'status',
102
+ array(
103
+ 'label' => Mage::helper('db1_anymarket')->__('Change status'),
104
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
105
+ 'additional' => array(
106
+ 'status' => array(
107
+ 'name' => 'status',
108
+ 'type' => 'select',
109
+ 'class' => 'required-entry',
110
+ 'label' => Mage::helper('db1_anymarket')->__('Status'),
111
+ 'values' => array(
112
+ '1' => Mage::helper('db1_anymarket')->__('Enabled'),
113
+ '0' => Mage::helper('db1_anymarket')->__('Disabled'),
114
+ )
115
+ )
116
+ )
117
+ )
118
+ );
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * get the row url
124
+ *
125
+ * @access public
126
+ * @param DB1_AnyMarket_Model_Anymarketattributes
127
+ * @return string
128
+ */
129
+ public function getRowUrl($row)
130
+ {
131
+ //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
132
+ return Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product_attribute/edit', array('attribute_id' => $row->getNmaIdAttr() ));
133
+ }
134
+
135
+ /**
136
+ * get the grid url
137
+ *
138
+ * @access public
139
+ * @return string
140
+ */
141
+ public function getGridUrl()
142
+ {
143
+ return $this->getUrl('*/*/grid', array('_current'=>true));
144
+ }
145
+
146
+ /**
147
+ * after collection load
148
+ *
149
+ * @access protected
150
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Grid
151
+ */
152
+ protected function _afterLoadCollection()
153
+ {
154
+ $this->getCollection()->walk('afterLoad');
155
+ parent::_afterLoadCollection();
156
+ }
157
+
158
+ /**
159
+ * filter store column
160
+ *
161
+ * @access protected
162
+ * @param DB1_AnyMarket_Model_Resource_Anymarketattributes_Collection $collection
163
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
164
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketattributes_Grid
165
+ */
166
+ protected function _filterStoreCondition($collection, $column)
167
+ {
168
+ if (!$value = $column->getFilter()->getValue()) {
169
+ return;
170
+ }
171
+ $collection->addStoreFilter($value);
172
+ return $this;
173
+ }
174
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories admin block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->_controller = 'adminhtml_anymarketcategories';
36
+ $this->_blockGroup = 'db1_anymarket';
37
+ parent::__construct();
38
+ $this->_headerText = Mage::helper('db1_anymarket')->__('Anymarket Categories');
39
+ // $this->_updateButton('add', 'label', Mage::helper('db1_anymarket')->__('Add Anymarket Categories'));
40
+ $this->_removeButton('add');
41
+
42
+ $this->_addButton('add_new', array(
43
+ 'label' => Mage::helper('db1_anymarket')->__('Sincronizar Categorias'),
44
+ 'onclick' => "setLocation('{$this->getUrl('*/*/sincCategs')}')",
45
+ 'class' => 'add'
46
+ ));
47
+ }
48
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories admin edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_blockGroup = 'db1_anymarket';
37
+ $this->_controller = 'adminhtml_anymarketcategories';
38
+ $this->_updateButton(
39
+ 'save',
40
+ 'label',
41
+ Mage::helper('db1_anymarket')->__('Save Anymarket Categories')
42
+ );
43
+ $this->_updateButton(
44
+ 'delete',
45
+ 'label',
46
+ Mage::helper('db1_anymarket')->__('Delete Anymarket Categories')
47
+ );
48
+ $this->_addButton(
49
+ 'saveandcontinue',
50
+ array(
51
+ 'label' => Mage::helper('db1_anymarket')->__('Save And Continue Edit'),
52
+ 'onclick' => 'saveAndContinueEdit()',
53
+ 'class' => 'save',
54
+ ),
55
+ -100
56
+ );
57
+ $this->_formScripts[] = "
58
+ function saveAndContinueEdit() {
59
+ editForm.submit($('edit_form').action+'back/edit/');
60
+ }
61
+ ";
62
+ }
63
+
64
+ /**
65
+ * get the edit form header
66
+ *
67
+ * @access public
68
+ * @return string
69
+
70
+ */
71
+ public function getHeaderText()
72
+ {
73
+ if (Mage::registry('current_anymarketcategories') && Mage::registry('current_anymarketcategories')->getId()) {
74
+ return Mage::helper('db1_anymarket')->__(
75
+ "Edit Anymarket Categories '%s'",
76
+ $this->escapeHtml(Mage::registry('current_anymarketcategories')->getNmcCatDesc())
77
+ );
78
+ } else {
79
+ return Mage::helper('db1_anymarket')->__('Add Anymarket Categories');
80
+ }
81
+ }
82
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Form
31
+
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form(
36
+ array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl(
39
+ '*/*/save',
40
+ array(
41
+ 'id' => $this->getRequest()->getParam('id')
42
+ )
43
+ ),
44
+ 'method' => 'post',
45
+ 'enctype' => 'multipart/form-data'
46
+ )
47
+ );
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Form.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ *
6
+ * @category DB1
7
+ * @package DB1_AnyMarket
8
+ * @copyright Copyright (c) 2015
9
+ * @license http://opensource.org/licenses/mit-license.php MIT License
10
+ */
11
+ /**
12
+ * Anymarket Categories edit form tab
13
+ *
14
+ * @category DB1
15
+ * @package DB1_AnyMarket
16
+ */
17
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
18
+ {
19
+ /**
20
+ * prepare the form
21
+ *
22
+ * @access protected
23
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Tab_Form
24
+
25
+ */
26
+ protected function _prepareForm()
27
+ {
28
+ $form = new Varien_Data_Form();
29
+ $form->setHtmlIdPrefix('anymarketcategories_');
30
+ $form->setFieldNameSuffix('anymarketcategories');
31
+ $this->setForm($form);
32
+ $fieldset = $form->addFieldset(
33
+ 'anymarketcategories_form',
34
+ array('legend' => Mage::helper('db1_anymarket')->__('Anymarket Categories'))
35
+ );
36
+
37
+ $fieldset->addField(
38
+ 'nmc_cat_id',
39
+ 'text',
40
+ array(
41
+ 'label' => Mage::helper('db1_anymarket')->__('Complete code Category'),
42
+ 'name' => 'nmc_cat_id',
43
+ 'required' => true,
44
+ 'class' => 'required-entry',
45
+
46
+ )
47
+ );
48
+
49
+ $fieldset->addField(
50
+ 'nmc_cat_root_id',
51
+ 'text',
52
+ array(
53
+ 'label' => Mage::helper('db1_anymarket')->__('Code of predecessor category'),
54
+ 'name' => 'nmc_cat_root_id',
55
+ 'required' => true,
56
+ 'class' => 'required-entry',
57
+
58
+ )
59
+ );
60
+
61
+ $fieldset->addField(
62
+ 'nmc_cat_desc',
63
+ 'text',
64
+ array(
65
+ 'label' => Mage::helper('db1_anymarket')->__('Category description'),
66
+ 'name' => 'nmc_cat_desc',
67
+ 'required' => true,
68
+ 'class' => 'required-entry',
69
+
70
+ )
71
+ );
72
+ $fieldset->addField(
73
+ 'status',
74
+ 'select',
75
+ array(
76
+ 'label' => Mage::helper('db1_anymarket')->__('Status'),
77
+ 'name' => 'status',
78
+ 'values' => array(
79
+ array(
80
+ 'value' => 1,
81
+ 'label' => Mage::helper('db1_anymarket')->__('Enabled'),
82
+ ),
83
+ array(
84
+ 'value' => 0,
85
+ 'label' => Mage::helper('db1_anymarket')->__('Disabled'),
86
+ ),
87
+ ),
88
+ )
89
+ );
90
+ if (Mage::app()->isSingleStoreMode()) {
91
+ $fieldset->addField(
92
+ 'store_id',
93
+ 'hidden',
94
+ array(
95
+ 'name' => 'stores[]',
96
+ 'value' => Mage::app()->getStore(true)->getId()
97
+ )
98
+ );
99
+ Mage::registry('current_anymarketcategories')->setStoreId(Mage::app()->getStore(true)->getId());
100
+ }
101
+ $formValues = Mage::registry('current_anymarketcategories')->getDefaultValues();
102
+ if (!is_array($formValues)) {
103
+ $formValues = array();
104
+ }
105
+ if (Mage::getSingleton('adminhtml/session')->getAnymarketcategoriesData()) {
106
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getAnymarketcategoriesData());
107
+ Mage::getSingleton('adminhtml/session')->setAnymarketcategoriesData(null);
108
+ } elseif (Mage::registry('current_anymarketcategories')) {
109
+ $formValues = array_merge($formValues, Mage::registry('current_anymarketcategories')->getData());
110
+ }
111
+ $form->setValues($formValues);
112
+ return parent::_prepareForm();
113
+ }
114
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * store selection tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Tab_Stores
31
+
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setFieldNameSuffix('anymarketcategories');
37
+ $this->setForm($form);
38
+ $fieldset = $form->addFieldset(
39
+ 'anymarketcategories_stores_form',
40
+ array('legend' => Mage::helper('db1_anymarket')->__('Store views'))
41
+ );
42
+ $field = $fieldset->addField(
43
+ 'store_id',
44
+ 'multiselect',
45
+ array(
46
+ 'name' => 'stores[]',
47
+ 'label' => Mage::helper('db1_anymarket')->__('Store Views'),
48
+ 'title' => Mage::helper('db1_anymarket')->__('Store Views'),
49
+ 'required' => true,
50
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
51
+ )
52
+ );
53
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
54
+ $field->setRenderer($renderer);
55
+ $form->addValues(Mage::registry('current_anymarketcategories')->getData());
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Edit/Tabs.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories admin edit tabs
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ /**
27
+ * Initialize Tabs
28
+ *
29
+ * @access public
30
+
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('anymarketcategories_tabs');
36
+ $this->setDestElementId('edit_form');
37
+ $this->setTitle(Mage::helper('db1_anymarket')->__('Anymarket Categories'));
38
+ }
39
+
40
+ /**
41
+ * before render html
42
+ *
43
+ * @access protected
44
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Edit_Tabs
45
+
46
+ */
47
+ protected function _beforeToHtml()
48
+ {
49
+ $this->addTab(
50
+ 'form_anymarketcategories',
51
+ array(
52
+ 'label' => Mage::helper('db1_anymarket')->__('Anymarket Categories'),
53
+ 'title' => Mage::helper('db1_anymarket')->__('Anymarket Categories'),
54
+ 'content' => $this->getLayout()->createBlock(
55
+ 'db1_anymarket/adminhtml_anymarketcategories_edit_tab_form'
56
+ )
57
+ ->toHtml(),
58
+ )
59
+ );
60
+ if (!Mage::app()->isSingleStoreMode()) {
61
+ $this->addTab(
62
+ 'form_store_anymarketcategories',
63
+ array(
64
+ 'label' => Mage::helper('db1_anymarket')->__('Store views'),
65
+ 'title' => Mage::helper('db1_anymarket')->__('Store views'),
66
+ 'content' => $this->getLayout()->createBlock(
67
+ 'db1_anymarket/adminhtml_anymarketcategories_edit_tab_stores'
68
+ )
69
+ ->toHtml(),
70
+ )
71
+ );
72
+ }
73
+ return parent::_beforeToHtml();
74
+ }
75
+
76
+ /**
77
+ * Retrieve anymarket categories entity
78
+ *
79
+ * @access public
80
+ * @return DB1_AnyMarket_Model_Anymarketcategories
81
+
82
+ */
83
+ public function getAnymarketcategories()
84
+ {
85
+ return Mage::registry('current_anymarketcategories');
86
+ }
87
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketcategories/Grid.php ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories admin grid block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('anymarketcategoriesGrid');
36
+ $this->setDefaultSort('entity_id');
37
+ $this->setDefaultDir('ASC');
38
+ $this->setSaveParametersInSession(true);
39
+ $this->setUseAjax(true);
40
+ }
41
+
42
+ /**
43
+ * get current store scope
44
+ *
45
+ * @access protected
46
+ * @return store view
47
+
48
+ */
49
+ protected function _getStore()
50
+ {
51
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
52
+ return Mage::app()->getStore($storeId);
53
+ }
54
+
55
+ /**
56
+ * prepare collection
57
+ *
58
+ * @access protected
59
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Grid
60
+
61
+ */
62
+ protected function _prepareCollection()
63
+ {
64
+ $store_id = $this->_getStore();
65
+ Mage::app()->setCurrentStore($store_id);
66
+ $store_id = Mage::app()->getStore()->getId();
67
+ Mage::getSingleton('core/session')->setStoreCategVariable($store_id);
68
+ $collection = Mage::getModel('db1_anymarket/anymarketcategories')
69
+ ->getCollection();
70
+
71
+ $this->setCollection($collection);
72
+ return parent::_prepareCollection();
73
+ }
74
+
75
+ /**
76
+ * prepare grid collection
77
+ *
78
+ * @access protected
79
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Grid
80
+
81
+ */
82
+ protected function _prepareColumns()
83
+ {
84
+ $this->addColumn(
85
+ 'entity_id',
86
+ array(
87
+ 'header' => Mage::helper('db1_anymarket')->__('Id'),
88
+ 'index' => 'entity_id',
89
+ 'type' => 'number'
90
+ )
91
+ );
92
+ $this->addColumn(
93
+ 'nmc_cat_desc',
94
+ array(
95
+ 'header' => Mage::helper('db1_anymarket')->__('Category description'),
96
+ 'align' => 'left',
97
+ 'index' => 'nmc_cat_desc',
98
+ )
99
+ );
100
+
101
+ $this->addColumn(
102
+ 'status',
103
+ array(
104
+ 'header' => Mage::helper('db1_anymarket')->__('Status'),
105
+ 'index' => 'status',
106
+ 'type' => 'options',
107
+ 'options' => array(
108
+ '1' => Mage::helper('db1_anymarket')->__('Enabled'),
109
+ '0' => Mage::helper('db1_anymarket')->__('Disabled'),
110
+ )
111
+ )
112
+ );
113
+ $this->addColumn(
114
+ 'nmc_cat_id',
115
+ array(
116
+ 'header' => Mage::helper('db1_anymarket')->__('Complete code Category'),
117
+ 'index' => 'nmc_cat_id',
118
+ 'type'=> 'text',
119
+
120
+ )
121
+ );
122
+ $this->addColumn(
123
+ 'nmc_cat_root_id',
124
+ array(
125
+ 'header' => Mage::helper('db1_anymarket')->__('Code of predecessor category'),
126
+ 'index' => 'nmc_cat_root_id',
127
+ 'type'=> 'text',
128
+
129
+ )
130
+ );
131
+ if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
132
+ $this->addColumn(
133
+ 'store_id',
134
+ array(
135
+ 'header' => Mage::helper('db1_anymarket')->__('Store Views'),
136
+ 'index' => 'store_id',
137
+ 'type' => 'store',
138
+ 'store_all' => true,
139
+ 'store_view' => true,
140
+ 'sortable' => false,
141
+ 'filter_condition_callback'=> array($this, '_filterStoreCondition'),
142
+ )
143
+ );
144
+ }
145
+ $this->addColumn(
146
+ 'created_at',
147
+ array(
148
+ 'header' => Mage::helper('db1_anymarket')->__('Created at'),
149
+ 'index' => 'created_at',
150
+ 'width' => '120px',
151
+ 'type' => 'datetime',
152
+ )
153
+ );
154
+ $this->addColumn(
155
+ 'updated_at',
156
+ array(
157
+ 'header' => Mage::helper('db1_anymarket')->__('Updated at'),
158
+ 'index' => 'updated_at',
159
+ 'width' => '120px',
160
+ 'type' => 'datetime',
161
+ )
162
+ );
163
+ $this->addColumn(
164
+ 'action',
165
+ array(
166
+ 'header' => Mage::helper('db1_anymarket')->__('Action'),
167
+ 'width' => '100',
168
+ 'type' => 'action',
169
+ 'getter' => 'getId',
170
+ 'actions' => array(
171
+ array(
172
+ 'caption' => Mage::helper('db1_anymarket')->__('Edit'),
173
+ 'url' => array('base'=> '*/*/edit'),
174
+ 'field' => 'id'
175
+ )
176
+ ),
177
+ 'filter' => false,
178
+ 'is_system' => true,
179
+ 'sortable' => false,
180
+ )
181
+ );
182
+
183
+ $this->addExportType('*/*/exportCsv', Mage::helper('db1_anymarket')->__('CSV'));
184
+ $this->addExportType('*/*/exportExcel', Mage::helper('db1_anymarket')->__('Excel'));
185
+ $this->addExportType('*/*/exportXml', Mage::helper('db1_anymarket')->__('XML'));
186
+ return parent::_prepareColumns();
187
+ }
188
+
189
+ /**
190
+ * prepare mass action
191
+ *
192
+ * @access protected
193
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Grid
194
+
195
+ */
196
+ protected function _prepareMassaction()
197
+ {
198
+
199
+ $this->setMassactionIdField('entity_id');
200
+ $this->getMassactionBlock()->setFormFieldName('anymarketcategories');
201
+ $this->getMassactionBlock()->addItem(
202
+ 'delete',
203
+ array(
204
+ 'label'=> Mage::helper('db1_anymarket')->__('Delete'),
205
+ 'url' => $this->getUrl('*/*/massDelete'),
206
+ 'confirm' => Mage::helper('db1_anymarket')->__('Are you sure?')
207
+ )
208
+ );
209
+ $this->getMassactionBlock()->addItem(
210
+ 'status',
211
+ array(
212
+ 'label' => Mage::helper('db1_anymarket')->__('Change status'),
213
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
214
+ 'additional' => array(
215
+ 'status' => array(
216
+ 'name' => 'status',
217
+ 'type' => 'select',
218
+ 'class' => 'required-entry',
219
+ 'label' => Mage::helper('db1_anymarket')->__('Status'),
220
+ 'values' => array(
221
+ '1' => Mage::helper('db1_anymarket')->__('Enabled'),
222
+ '0' => Mage::helper('db1_anymarket')->__('Disabled'),
223
+ )
224
+ )
225
+ )
226
+ )
227
+ );
228
+
229
+ return $this;
230
+ }
231
+
232
+ /**
233
+ * get the row url
234
+ *
235
+ * @access public
236
+ * @param DB1_AnyMarket_Model_Anymarketcategories
237
+ * @return string
238
+
239
+ */
240
+ public function getRowUrl($row)
241
+ {
242
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
243
+ }
244
+
245
+ /**
246
+ * get the grid url
247
+ *
248
+ * @access public
249
+ * @return string
250
+
251
+ */
252
+ public function getGridUrl()
253
+ {
254
+ return $this->getUrl('*/*/grid', array('_current'=>true));
255
+ }
256
+
257
+ /**
258
+ * after collection load
259
+ *
260
+ * @access protected
261
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Grid
262
+
263
+ */
264
+ protected function _afterLoadCollection()
265
+ {
266
+ $this->getCollection()->walk('afterLoad');
267
+ parent::_afterLoadCollection();
268
+ }
269
+
270
+ /**
271
+ * filter store column
272
+ *
273
+ * @access protected
274
+ * @param DB1_AnyMarket_Model_Resource_Anymarketcategories_Collection $collection
275
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
276
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketcategories_Grid
277
+
278
+ */
279
+ protected function _filterStoreCondition($collection, $column)
280
+ {
281
+ if (!$value = $column->getFilter()->getValue()) {
282
+ return;
283
+ }
284
+ $collection->addStoreFilter($value);
285
+ return $this;
286
+ }
287
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log admin block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketlog extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ *
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->_controller = 'adminhtml_anymarketlog';
36
+ $this->_blockGroup = 'db1_anymarket';
37
+ parent::__construct();
38
+ $this->_headerText = Mage::helper('db1_anymarket')->__('Log Description');
39
+ $this->_removeButton('add');
40
+
41
+ //$this->_updateButton('add', 'label', Mage::helper('db1_anymarket')->__('Add AnyMarket Log'));
42
+
43
+ }
44
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log admin edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ *
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_blockGroup = 'db1_anymarket';
37
+ $this->_controller = 'adminhtml_anymarketlog';
38
+ $this->_removeButton('save');
39
+ $this->_removeButton('delete');
40
+ $this->_removeButton('reset');
41
+ }
42
+
43
+ /**
44
+ * get the edit form header
45
+ *
46
+ * @access public
47
+ * @return string
48
+ *
49
+ */
50
+ public function getHeaderText()
51
+ {
52
+ if (Mage::registry('current_anymarketlog') && Mage::registry('current_anymarketlog')->getId()) {
53
+ return Mage::helper('db1_anymarket')->__('Log of ID Order/Product: '. $this->escapeHtml(Mage::registry('current_anymarketlog')->getLogId()));
54
+ }
55
+ }
56
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Form.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
24
+ {
25
+ /**
26
+ * prepare form
27
+ *
28
+ * @access protected
29
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit_Form
30
+ *
31
+ */
32
+ protected function _prepareForm()
33
+ {
34
+ $form = new Varien_Data_Form(
35
+ array(
36
+ 'id' => 'edit_form',
37
+ 'action' => $this->getUrl(
38
+ '*/*/save',
39
+ array(
40
+ 'id' => $this->getRequest()->getParam('id')
41
+ )
42
+ ),
43
+ 'method' => 'post',
44
+ 'enctype' => 'multipart/form-data'
45
+ )
46
+ );
47
+ $form->setUseContainer(true);
48
+ $this->setForm($form);
49
+ return parent::_prepareForm();
50
+ }
51
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Form.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log edit form tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit_Tab_Form
31
+ *
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setHtmlIdPrefix('anymarketlog_');
37
+ $form->setFieldNameSuffix('anymarketlog');
38
+ $this->setForm($form);
39
+ $fieldset = $form->addFieldset(
40
+ 'anymarketlog_form',
41
+ array('legend' => Mage::helper('db1_anymarket')->__('AnyMarket Log'))
42
+ );
43
+
44
+ $fieldset->addField(
45
+ 'created_at',
46
+ 'text',
47
+ array(
48
+ 'label' => Mage::helper('db1_anymarket')->__('Created At'),
49
+ 'name' => 'created_at',
50
+ 'readonly' => true,
51
+ )
52
+ );
53
+
54
+ $fieldset->addField(
55
+ 'log_desc',
56
+ 'textarea',
57
+ array(
58
+ 'label' => Mage::helper('db1_anymarket')->__('Log Description'),
59
+ 'name' => 'log_desc',
60
+ 'readonly' => true,
61
+ 'style' => "width: 600px",
62
+ )
63
+ );
64
+
65
+ $fieldset->addField(
66
+ 'log_json',
67
+ 'textarea',
68
+ array(
69
+ 'label' => Mage::helper('db1_anymarket')->__('JSON'),
70
+ 'name' => 'log_json',
71
+ 'readonly' => true,
72
+ 'style' => "width: 600px",
73
+ )
74
+ );
75
+ if (Mage::app()->isSingleStoreMode()) {
76
+ $fieldset->addField(
77
+ 'store_id',
78
+ 'hidden',
79
+ array(
80
+ 'name' => 'stores[]',
81
+ 'value' => Mage::app()->getStore(true)->getId()
82
+ )
83
+ );
84
+ Mage::registry('current_anymarketlog')->setStoreId(Mage::app()->getStore(true)->getId());
85
+ }
86
+ $formValues = Mage::registry('current_anymarketlog')->getDefaultValues();
87
+ if (!is_array($formValues)) {
88
+ $formValues = array();
89
+ }
90
+ if (Mage::getSingleton('adminhtml/session')->getAnymarketlogData()) {
91
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getAnymarketlogData());
92
+ Mage::getSingleton('adminhtml/session')->setAnymarketlogData(null);
93
+ } elseif (Mage::registry('current_anymarketlog')) {
94
+ $formValues = array_merge($formValues, Mage::registry('current_anymarketlog')->getData());
95
+ }
96
+ $form->setValues($formValues);
97
+ return parent::_prepareForm();
98
+ }
99
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * store selection tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit_Tab_Stores
31
+ *
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setFieldNameSuffix('anymarketlog');
37
+ $this->setForm($form);
38
+ $fieldset = $form->addFieldset(
39
+ 'anymarketlog_stores_form',
40
+ array('legend' => Mage::helper('db1_anymarket')->__('Store views'))
41
+ );
42
+ $field = $fieldset->addField(
43
+ 'store_id',
44
+ 'multiselect',
45
+ array(
46
+ 'name' => 'stores[]',
47
+ 'label' => Mage::helper('db1_anymarket')->__('Store Views'),
48
+ 'title' => Mage::helper('db1_anymarket')->__('Store Views'),
49
+ 'required' => true,
50
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
51
+ )
52
+ );
53
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
54
+ $field->setRenderer($renderer);
55
+ $form->addValues(Mage::registry('current_anymarketlog')->getData());
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Edit/Tabs.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log admin edit tabs
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ /**
27
+ * Initialize Tabs
28
+ *
29
+ * @access public
30
+ *
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('anymarketlog_tabs');
36
+ $this->setDestElementId('edit_form');
37
+ $this->setTitle(Mage::helper('db1_anymarket')->__('AnyMarket Log'));
38
+ }
39
+
40
+ /**
41
+ * before render html
42
+ *
43
+ * @access protected
44
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Edit_Tabs
45
+ *
46
+ */
47
+ protected function _beforeToHtml()
48
+ {
49
+ $this->addTab(
50
+ 'form_anymarketlog',
51
+ array(
52
+ 'label' => Mage::helper('db1_anymarket')->__('AnyMarket Log'),
53
+ 'title' => Mage::helper('db1_anymarket')->__('AnyMarket Log'),
54
+ 'content' => $this->getLayout()->createBlock(
55
+ 'db1_anymarket/adminhtml_anymarketlog_edit_tab_form'
56
+ )
57
+ ->toHtml(),
58
+ )
59
+ );
60
+ return parent::_beforeToHtml();
61
+ }
62
+
63
+ /**
64
+ * Retrieve anymarket log entity
65
+ *
66
+ * @access public
67
+ * @return DB1_AnyMarket_Model_Anymarketlog
68
+ *
69
+ */
70
+ public function getAnymarketlog()
71
+ {
72
+ return Mage::registry('current_anymarketlog');
73
+ }
74
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketlog/Grid.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log admin grid block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ *
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('anymarketlogGrid');
36
+ $this->setDefaultSort('entity_id');
37
+ $this->setDefaultDir('ASC');
38
+ $this->setSaveParametersInSession(true);
39
+ $this->setUseAjax(true);
40
+ }
41
+
42
+ /**
43
+ * prepare collection
44
+ *
45
+ * @access protected
46
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Grid
47
+ *
48
+ */
49
+ protected function _prepareCollection()
50
+ {
51
+ $collection = Mage::getModel('db1_anymarket/anymarketlog')
52
+ ->getCollection();
53
+
54
+ $this->setCollection($collection);
55
+ return parent::_prepareCollection();
56
+ }
57
+
58
+ /**
59
+ * prepare grid collection
60
+ *
61
+ * @access protected
62
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Grid
63
+ *
64
+ */
65
+ protected function _prepareColumns()
66
+ {
67
+ $this->addColumn(
68
+ 'log_id',
69
+ array(
70
+ 'header' => Mage::helper('db1_anymarket')->__('#ID PED/PROD'),
71
+ 'align' => 'left',
72
+ 'index' => 'log_id',
73
+ )
74
+ );
75
+ $this->addColumn(
76
+ 'log_desc',
77
+ array(
78
+ 'header' => Mage::helper('db1_anymarket')->__('Log Description'),
79
+ 'align' => 'left',
80
+ 'index' => 'log_desc',
81
+ )
82
+ );
83
+ $this->addColumn(
84
+ 'log_json',
85
+ array(
86
+ 'header' => Mage::helper('db1_anymarket')->__('Log Json'),
87
+ 'align' => 'left',
88
+ 'index' => 'log_json',
89
+ )
90
+ );
91
+
92
+ if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
93
+ $this->addColumn(
94
+ 'store_id',
95
+ array(
96
+ 'header' => Mage::helper('db1_anymarket')->__('Store Views'),
97
+ 'index' => 'store_id',
98
+ 'type' => 'store',
99
+ 'store_all' => true,
100
+ 'store_view' => true,
101
+ 'sortable' => false,
102
+ 'filter_condition_callback'=> array($this, '_filterStoreCondition'),
103
+ )
104
+ );
105
+ }
106
+ $this->addColumn(
107
+ 'created_at',
108
+ array(
109
+ 'header' => Mage::helper('db1_anymarket')->__('Created at'),
110
+ 'index' => 'created_at',
111
+ 'width' => '120px',
112
+ 'type' => 'datetime',
113
+ )
114
+ );
115
+ $this->addExportType('*/*/exportCsv', Mage::helper('db1_anymarket')->__('CSV'));
116
+ $this->addExportType('*/*/exportExcel', Mage::helper('db1_anymarket')->__('Excel'));
117
+ $this->addExportType('*/*/exportXml', Mage::helper('db1_anymarket')->__('XML'));
118
+ return parent::_prepareColumns();
119
+ }
120
+
121
+ /**
122
+ * prepare mass action
123
+ *
124
+ * @access protected
125
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Grid
126
+ *
127
+ */
128
+ protected function _prepareMassaction()
129
+ {
130
+ return $this;
131
+
132
+ }
133
+
134
+ /**
135
+ * get the row url
136
+ *
137
+ * @access public
138
+ * @param DB1_AnyMarket_Model_Anymarketlog
139
+ * @return string
140
+ *
141
+ */
142
+ public function getRowUrl($row)
143
+ {
144
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
145
+ }
146
+
147
+ /**
148
+ * get the grid url
149
+ *
150
+ * @access public
151
+ * @return string
152
+ *
153
+ */
154
+ public function getGridUrl()
155
+ {
156
+ return $this->getUrl('*/*/grid', array('_current'=>true));
157
+ }
158
+
159
+ /**
160
+ * after collection load
161
+ *
162
+ * @access protected
163
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Grid
164
+ *
165
+ */
166
+ protected function _afterLoadCollection()
167
+ {
168
+ $this->getCollection()->walk('afterLoad');
169
+ parent::_afterLoadCollection();
170
+ }
171
+
172
+ /**
173
+ * filter store column
174
+ *
175
+ * @access protected
176
+ * @param DB1_AnyMarket_Model_Resource_Anymarketlog_Collection $collection
177
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
178
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketlog_Grid
179
+ *
180
+ */
181
+ protected function _filterStoreCondition($collection, $column)
182
+ {
183
+ if (!$value = $column->getFilter()->getValue()) {
184
+ return;
185
+ }
186
+ $collection->addStoreFilter($value);
187
+ return $this;
188
+ }
189
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders admin block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ */
32
+ public function __construct()
33
+ {
34
+ $this->_controller = 'adminhtml_anymarketorders';
35
+ $this->_blockGroup = 'db1_anymarket';
36
+ parent::__construct();
37
+ $this->_headerText = Mage::helper('db1_anymarket')->__('Anymarket Orders');
38
+ $this->_removeButton('add');
39
+
40
+ // $this->_addButton('sinc_orders', array(
41
+ // 'label' => Mage::helper('db1_anymarket')->__('Sync Orders'),
42
+ // 'onclick' => "setLocation('{$this->getUrl('*/*/sincOrders')}')",
43
+ // 'class' => 'add'
44
+ // ));
45
+
46
+ $this->_addButton('list_orders', array(
47
+ 'label' => Mage::helper('db1_anymarket')->__('Orders list'),
48
+ 'onclick' => "setLocation('{$this->getUrl('*/*/listOrders')}')",
49
+ 'class' => 'add'
50
+ ));
51
+
52
+ }
53
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders admin edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_blockGroup = 'db1_anymarket';
37
+ $this->_controller = 'adminhtml_anymarketorders';
38
+ $this->_updateButton(
39
+ 'save',
40
+ 'label',
41
+ Mage::helper('db1_anymarket')->__('Save Anymarket Orders')
42
+ );
43
+ $this->_updateButton(
44
+ 'delete',
45
+ 'label',
46
+ Mage::helper('db1_anymarket')->__('Delete Anymarket Orders')
47
+ );
48
+ $this->_addButton(
49
+ 'saveandcontinue',
50
+ array(
51
+ 'label' => Mage::helper('db1_anymarket')->__('Save And Continue Edit'),
52
+ 'onclick' => 'saveAndContinueEdit()',
53
+ 'class' => 'save',
54
+ ),
55
+ -100
56
+ );
57
+ $this->_formScripts[] = "
58
+ function saveAndContinueEdit() {
59
+ editForm.submit($('edit_form').action+'back/edit/');
60
+ }
61
+ ";
62
+ }
63
+
64
+ /**
65
+ * get the edit form header
66
+ *
67
+ * @access public
68
+ * @return string
69
+
70
+ */
71
+ public function getHeaderText()
72
+ {
73
+ if (Mage::registry('current_anymarketorders') && Mage::registry('current_anymarketorders')->getId()) {
74
+ return Mage::helper('db1_anymarket')->__(
75
+ "Edit Anymarket Orders '%s'",
76
+ $this->escapeHtml(Mage::registry('current_anymarketorders')->getNmoIdOrder())
77
+ );
78
+ } else {
79
+ return Mage::helper('db1_anymarket')->__('Add Anymarket Orders');
80
+ }
81
+ }
82
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Form
31
+
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form(
36
+ array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl(
39
+ '*/*/save',
40
+ array(
41
+ 'id' => $this->getRequest()->getParam('id')
42
+ )
43
+ ),
44
+ 'method' => 'post',
45
+ 'enctype' => 'multipart/form-data'
46
+ )
47
+ );
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Form.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders edit form tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Tab_Form
31
+
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setHtmlIdPrefix('anymarketorders_');
37
+ $form->setFieldNameSuffix('anymarketorders');
38
+ $this->setForm($form);
39
+ $fieldset = $form->addFieldset(
40
+ 'anymarketorders_form',
41
+ array('legend' => Mage::helper('db1_anymarket')->__('Anymarket Orders'))
42
+ );
43
+
44
+ $fieldset->addField(
45
+ 'nmo_id_anymarket',
46
+ 'text',
47
+ array(
48
+ 'label' => Mage::helper('db1_anymarket')->__('Code Anymarket'),
49
+ 'name' => 'nmo_id_anymarket',
50
+ 'required' => true,
51
+ 'class' => 'required-entry',
52
+
53
+ )
54
+ );
55
+
56
+ $fieldset->addField(
57
+ 'nmo_id_order',
58
+ 'text',
59
+ array(
60
+ 'label' => Mage::helper('db1_anymarket')->__('Code Order Magento'),
61
+ 'name' => 'nmo_id_order',
62
+ 'required' => true,
63
+ 'class' => 'required-entry',
64
+
65
+ )
66
+ );
67
+ $fieldset->addField(
68
+ 'status',
69
+ 'select',
70
+ array(
71
+ 'label' => Mage::helper('db1_anymarket')->__('Status'),
72
+ 'name' => 'status',
73
+ 'values' => array(
74
+ array(
75
+ 'value' => 1,
76
+ 'label' => Mage::helper('db1_anymarket')->__('Enabled'),
77
+ ),
78
+ array(
79
+ 'value' => 0,
80
+ 'label' => Mage::helper('db1_anymarket')->__('Disabled'),
81
+ ),
82
+ ),
83
+ )
84
+ );
85
+ if (Mage::app()->isSingleStoreMode()) {
86
+ $fieldset->addField(
87
+ 'store_id',
88
+ 'hidden',
89
+ array(
90
+ 'name' => 'stores[]',
91
+ 'value' => Mage::app()->getStore(true)->getId()
92
+ )
93
+ );
94
+ Mage::registry('current_anymarketorders')->setStoreId(Mage::app()->getStore(true)->getId());
95
+ }
96
+ $formValues = Mage::registry('current_anymarketorders')->getDefaultValues();
97
+ if (!is_array($formValues)) {
98
+ $formValues = array();
99
+ }
100
+ if (Mage::getSingleton('adminhtml/session')->getAnymarketordersData()) {
101
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getAnymarketordersData());
102
+ Mage::getSingleton('adminhtml/session')->setAnymarketordersData(null);
103
+ } elseif (Mage::registry('current_anymarketorders')) {
104
+ $formValues = array_merge($formValues, Mage::registry('current_anymarketorders')->getData());
105
+ }
106
+ $form->setValues($formValues);
107
+ return parent::_prepareForm();
108
+ }
109
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * store selection tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Tab_Stores
31
+
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setFieldNameSuffix('anymarketorders');
37
+ $this->setForm($form);
38
+ $fieldset = $form->addFieldset(
39
+ 'anymarketorders_stores_form',
40
+ array('legend' => Mage::helper('db1_anymarket')->__('Store views'))
41
+ );
42
+ $field = $fieldset->addField(
43
+ 'store_id',
44
+ 'multiselect',
45
+ array(
46
+ 'name' => 'stores[]',
47
+ 'label' => Mage::helper('db1_anymarket')->__('Store Views'),
48
+ 'title' => Mage::helper('db1_anymarket')->__('Store Views'),
49
+ 'required' => true,
50
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
51
+ )
52
+ );
53
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
54
+ $field->setRenderer($renderer);
55
+ $form->addValues(Mage::registry('current_anymarketorders')->getData());
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Edit/Tabs.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders admin edit tabs
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ /**
27
+ * Initialize Tabs
28
+ *
29
+ * @access public
30
+
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('anymarketorders_tabs');
36
+ $this->setDestElementId('edit_form');
37
+ $this->setTitle(Mage::helper('db1_anymarket')->__('Anymarket Orders'));
38
+ }
39
+
40
+ /**
41
+ * before render html
42
+ *
43
+ * @access protected
44
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Edit_Tabs
45
+
46
+ */
47
+ protected function _beforeToHtml()
48
+ {
49
+ $this->addTab(
50
+ 'form_anymarketorders',
51
+ array(
52
+ 'label' => Mage::helper('db1_anymarket')->__('Anymarket Orders'),
53
+ 'title' => Mage::helper('db1_anymarket')->__('Anymarket Orders'),
54
+ 'content' => $this->getLayout()->createBlock(
55
+ 'db1_anymarket/adminhtml_anymarketorders_edit_tab_form'
56
+ )
57
+ ->toHtml(),
58
+ )
59
+ );
60
+ if (!Mage::app()->isSingleStoreMode()) {
61
+ $this->addTab(
62
+ 'form_store_anymarketorders',
63
+ array(
64
+ 'label' => Mage::helper('db1_anymarket')->__('Store views'),
65
+ 'title' => Mage::helper('db1_anymarket')->__('Store views'),
66
+ 'content' => $this->getLayout()->createBlock(
67
+ 'db1_anymarket/adminhtml_anymarketorders_edit_tab_stores'
68
+ )
69
+ ->toHtml(),
70
+ )
71
+ );
72
+ }
73
+ return parent::_beforeToHtml();
74
+ }
75
+
76
+ /**
77
+ * Retrieve anymarket orders entity
78
+ *
79
+ * @access public
80
+ * @return DB1_AnyMarket_Model_Anymarketorders
81
+
82
+ */
83
+ public function getAnymarketorders()
84
+ {
85
+ return Mage::registry('current_anymarketorders');
86
+ }
87
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketorders/Grid.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders admin grid block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('anymarketordersGrid');
36
+ $this->setDefaultSort('entity_id');
37
+ $this->setDefaultDir('ASC');
38
+ $this->setSaveParametersInSession(true);
39
+ $this->setUseAjax(true);
40
+ }
41
+
42
+ /**
43
+ * get current store scope
44
+ *
45
+ * @access protected
46
+ * @return store view
47
+
48
+ */
49
+ protected function _getStore()
50
+ {
51
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
52
+ return Mage::app()->getStore($storeId);
53
+ }
54
+
55
+ /**
56
+ * prepare collection
57
+ *
58
+ * @access protected
59
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Grid
60
+
61
+ */
62
+ protected function _prepareCollection()
63
+ {
64
+ $store_id = $this->_getStore();
65
+ Mage::app()->setCurrentStore($store_id);
66
+ $store_id = Mage::app()->getStore()->getId();
67
+ Mage::getSingleton('core/session')->setStoreListOrderVariable($store_id);
68
+ $collection = Mage::getModel('db1_anymarket/anymarketorders')
69
+ ->getCollection();
70
+
71
+ $this->setCollection($collection);
72
+ return parent::_prepareCollection();
73
+ }
74
+
75
+ /**
76
+ * prepare grid collection
77
+ *
78
+ * @access protected
79
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Grid
80
+
81
+ */
82
+ protected function _prepareColumns()
83
+ {
84
+ $this->addColumn(
85
+ 'nmo_id_order',
86
+ array(
87
+ 'header' => Mage::helper('db1_anymarket')->__('Code Order Magento'),
88
+ 'align' => 'left',
89
+ 'index' => 'nmo_id_order',
90
+ )
91
+ );
92
+ $this->addColumn(
93
+ 'nmo_id_anymarket',
94
+ array(
95
+ 'header' => Mage::helper('db1_anymarket')->__('Code Anymarket'),
96
+ 'index' => 'nmo_id_anymarket',
97
+ 'type'=> 'text',
98
+
99
+ )
100
+ );
101
+ $this->addColumn(
102
+ 'nmo_status_int',
103
+ array(
104
+ 'header' => Mage::helper('db1_anymarket')->__('Integration status'),
105
+ 'index' => 'nmo_status_int',
106
+ 'type'=> 'text',
107
+
108
+ )
109
+ );
110
+ $this->addColumn(
111
+ 'nmo_desc_error',
112
+ array(
113
+ 'header' => Mage::helper('db1_anymarket')->__('Error Message'),
114
+ 'index' => 'nmo_desc_error',
115
+ 'type'=> 'text',
116
+
117
+ )
118
+ );
119
+ if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
120
+ $this->addColumn(
121
+ 'store_id',
122
+ array(
123
+ 'header' => Mage::helper('db1_anymarket')->__('Store Views'),
124
+ 'index' => 'store_id',
125
+ 'type' => 'store',
126
+ 'store_all' => true,
127
+ 'store_view' => true,
128
+ 'sortable' => false,
129
+ 'filter_condition_callback'=> array($this, '_filterStoreCondition'),
130
+ )
131
+ );
132
+ }
133
+ $this->addColumn(
134
+ 'created_at',
135
+ array(
136
+ 'header' => Mage::helper('db1_anymarket')->__('Created at'),
137
+ 'index' => 'created_at',
138
+ 'width' => '120px',
139
+ 'type' => 'datetime',
140
+ )
141
+ );
142
+ $this->addColumn(
143
+ 'updated_at',
144
+ array(
145
+ 'header' => Mage::helper('db1_anymarket')->__('Updated at'),
146
+ 'index' => 'updated_at',
147
+ 'width' => '120px',
148
+ 'type' => 'datetime',
149
+ )
150
+ );
151
+ $this->addExportType('*/*/exportCsv', Mage::helper('db1_anymarket')->__('CSV'));
152
+ $this->addExportType('*/*/exportExcel', Mage::helper('db1_anymarket')->__('Excel'));
153
+ $this->addExportType('*/*/exportXml', Mage::helper('db1_anymarket')->__('XML'));
154
+ return parent::_prepareColumns();
155
+ }
156
+
157
+ /**
158
+ * prepare mass action
159
+ *
160
+ * @access protected
161
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Grid
162
+
163
+ */
164
+ protected function _prepareMassaction()
165
+ {
166
+
167
+ $this->setMassactionIdField('entity_id');
168
+ $this->getMassactionBlock()->setFormFieldName('anymarketorders');
169
+
170
+ $this->getMassactionBlock()->addItem(
171
+ 'sincronizar',
172
+ array(
173
+ 'label'=> Mage::helper('db1_anymarket')->__('Synchronize'),
174
+ 'url' => $this->getUrl('*/*/massSincOrder'),
175
+ 'confirm' => Mage::helper('db1_anymarket')->__('Are you sure you want to sync?')
176
+ )
177
+ );
178
+
179
+ return $this;
180
+ }
181
+
182
+ /**
183
+ * get the row url
184
+ *
185
+ * @access public
186
+ * @param DB1_AnyMarket_Model_Anymarketorders
187
+ * @return string
188
+
189
+ */
190
+ public function getRowUrl($row)
191
+ {
192
+ $_pullOrder = Mage::getModel('sales/order')->loadByIncrementId( $row->getNmoIdOrder() );
193
+ if($_pullOrder != null){
194
+ return Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id' => $_pullOrder->getId()));
195
+ }else{
196
+ return null;
197
+ }
198
+ }
199
+
200
+ /**
201
+ * get the grid url
202
+ *
203
+ * @access public
204
+ * @return string
205
+
206
+ */
207
+ public function getGridUrl()
208
+ {
209
+ return $this->getUrl('*/*/grid', array('_current'=>true));
210
+ }
211
+
212
+ /**
213
+ * after collection load
214
+ *
215
+ * @access protected
216
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Grid
217
+
218
+ */
219
+ protected function _afterLoadCollection()
220
+ {
221
+ $this->getCollection()->walk('afterLoad');
222
+ parent::_afterLoadCollection();
223
+ }
224
+
225
+ /**
226
+ * filter store column
227
+ *
228
+ * @access protected
229
+ * @param DB1_AnyMarket_Model_Resource_Anymarketorders_Collection $collection
230
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
231
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketorders_Grid
232
+
233
+ */
234
+ protected function _filterStoreCondition($collection, $column)
235
+ {
236
+ if (!$value = $column->getFilter()->getValue()) {
237
+ return;
238
+ }
239
+ $collection->addStoreFilter($value);
240
+ return $this;
241
+ }
242
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products admin block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketproducts extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ */
32
+ public function __construct()
33
+ {
34
+ $this->_controller = 'adminhtml_anymarketproducts';
35
+ $this->_blockGroup = 'db1_anymarket';
36
+ parent::__construct();
37
+ $this->_headerText = Mage::helper('db1_anymarket')->__('Anymarket Products');
38
+ $this->_removeButton('add');
39
+
40
+ // $this->_addButton('sinc_prods', array(
41
+ // 'label' => Mage::helper('db1_anymarket')->__('Sync Products'),
42
+ // 'onclick' => "setLocation('{$this->getUrl('*/*/sincProds')}')",
43
+ // 'class' => 'add'
44
+ // ));
45
+
46
+ $this->_addButton('list_prods', array(
47
+ 'label' => Mage::helper('db1_anymarket')->__('Products list'),
48
+ 'onclick' => "setLocation('{$this->getUrl('*/*/listProds')}')",
49
+ 'class' => 'add'
50
+ ));
51
+
52
+ }
53
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products admin edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ *
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_blockGroup = 'db1_anymarket';
37
+ $this->_controller = 'adminhtml_anymarketproducts';
38
+ $this->_updateButton(
39
+ 'save',
40
+ 'label',
41
+ Mage::helper('db1_anymarket')->__('Save Anymarket Products')
42
+ );
43
+ $this->_updateButton(
44
+ 'delete',
45
+ 'label',
46
+ Mage::helper('db1_anymarket')->__('Delete Anymarket Products')
47
+ );
48
+ $this->_addButton(
49
+ 'saveandcontinue',
50
+ array(
51
+ 'label' => Mage::helper('db1_anymarket')->__('Save And Continue Edit'),
52
+ 'onclick' => 'saveAndContinueEdit()',
53
+ 'class' => 'save',
54
+ ),
55
+ -100
56
+ );
57
+ $this->_formScripts[] = "
58
+ function saveAndContinueEdit() {
59
+ editForm.submit($('edit_form').action+'back/edit/');
60
+ }
61
+ ";
62
+ }
63
+
64
+ /**
65
+ * get the edit form header
66
+ *
67
+ * @access public
68
+ * @return string
69
+ *
70
+ */
71
+ public function getHeaderText()
72
+ {
73
+ if (Mage::registry('current_anymarketproducts') && Mage::registry('current_anymarketproducts')->getId()) {
74
+ return Mage::helper('db1_anymarket')->__(
75
+ "Edit Anymarket Products '%s'",
76
+ $this->escapeHtml(Mage::registry('current_anymarketproducts')->getNmpDescError())
77
+ );
78
+ } else {
79
+ return Mage::helper('db1_anymarket')->__('Add Anymarket Products');
80
+ }
81
+ }
82
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit_Form
31
+ *
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form(
36
+ array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl(
39
+ '*/*/save',
40
+ array(
41
+ 'id' => $this->getRequest()->getParam('id')
42
+ )
43
+ ),
44
+ 'method' => 'post',
45
+ 'enctype' => 'multipart/form-data'
46
+ )
47
+ );
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Form.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products edit form tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit_Tab_Form
31
+ *
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setHtmlIdPrefix('anymarketproducts_');
37
+ $form->setFieldNameSuffix('anymarketproducts');
38
+ $this->setForm($form);
39
+ $fieldset = $form->addFieldset(
40
+ 'anymarketproducts_form',
41
+ array('legend' => Mage::helper('db1_anymarket')->__('Anymarket Products'))
42
+ );
43
+
44
+ $fieldset->addField(
45
+ 'nmp_sku',
46
+ 'text',
47
+ array(
48
+ 'label' => Mage::helper('db1_anymarket')->__('Product SKU'),
49
+ 'name' => 'nmp_sku',
50
+ 'required' => true,
51
+ 'class' => 'required-entry',
52
+
53
+ )
54
+ );
55
+
56
+ $fieldset->addField(
57
+ 'nmp_name',
58
+ 'text',
59
+ array(
60
+ 'label' => Mage::helper('db1_anymarket')->__('Product Name'),
61
+ 'name' => 'nmp_name',
62
+ 'required' => true,
63
+ 'class' => 'required-entry',
64
+
65
+ )
66
+ );
67
+
68
+ $fieldset->addField(
69
+ 'nmp_desc_error',
70
+ 'text',
71
+ array(
72
+ 'label' => Mage::helper('db1_anymarket')->__('Error Description'),
73
+ 'name' => 'nmp_desc_error',
74
+ 'required' => true,
75
+ 'class' => 'required-entry',
76
+
77
+ )
78
+ );
79
+ $fieldset->addField(
80
+ 'nmp_status_int',
81
+ 'text',
82
+ array(
83
+ 'label' => Mage::helper('db1_anymarket')->__('Integration status'),
84
+ 'name' => 'nmp_status_int',
85
+ 'required' => true,
86
+ 'class' => 'required-entry',
87
+
88
+ )
89
+ );
90
+ $fieldset->addField(
91
+ 'status',
92
+ 'select',
93
+ array(
94
+ 'label' => Mage::helper('db1_anymarket')->__('Status'),
95
+ 'name' => 'status',
96
+ 'values' => array(
97
+ array(
98
+ 'value' => 1,
99
+ 'label' => Mage::helper('db1_anymarket')->__('Enabled'),
100
+ ),
101
+ array(
102
+ 'value' => 0,
103
+ 'label' => Mage::helper('db1_anymarket')->__('Disabled'),
104
+ ),
105
+ ),
106
+ )
107
+ );
108
+ if (Mage::app()->isSingleStoreMode()) {
109
+ $fieldset->addField(
110
+ 'store_id',
111
+ 'hidden',
112
+ array(
113
+ 'name' => 'stores[]',
114
+ 'value' => Mage::app()->getStore(true)->getId()
115
+ )
116
+ );
117
+ Mage::registry('current_anymarketproducts')->setStoreId(Mage::app()->getStore(true)->getId());
118
+ }
119
+ $formValues = Mage::registry('current_anymarketproducts')->getDefaultValues();
120
+ if (!is_array($formValues)) {
121
+ $formValues = array();
122
+ }
123
+ if (Mage::getSingleton('adminhtml/session')->getAnymarketproductsData()) {
124
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getAnymarketproductsData());
125
+ Mage::getSingleton('adminhtml/session')->setAnymarketproductsData(null);
126
+ } elseif (Mage::registry('current_anymarketproducts')) {
127
+ $formValues = array_merge($formValues, Mage::registry('current_anymarketproducts')->getData());
128
+ }
129
+ $form->setValues($formValues);
130
+ return parent::_prepareForm();
131
+ }
132
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * store selection tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit_Tab_Stores
31
+ *
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setFieldNameSuffix('anymarketproducts');
37
+ $this->setForm($form);
38
+ $fieldset = $form->addFieldset(
39
+ 'anymarketproducts_stores_form',
40
+ array('legend' => Mage::helper('db1_anymarket')->__('Store views'))
41
+ );
42
+ $field = $fieldset->addField(
43
+ 'store_id',
44
+ 'multiselect',
45
+ array(
46
+ 'name' => 'stores[]',
47
+ 'label' => Mage::helper('db1_anymarket')->__('Store Views'),
48
+ 'title' => Mage::helper('db1_anymarket')->__('Store Views'),
49
+ 'required' => true,
50
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
51
+ )
52
+ );
53
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
54
+ $field->setRenderer($renderer);
55
+ $form->addValues(Mage::registry('current_anymarketproducts')->getData());
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Edit/Tabs.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products admin edit tabs
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ /**
27
+ * Initialize Tabs
28
+ *
29
+ * @access public
30
+ *
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('anymarketproducts_tabs');
36
+ $this->setDestElementId('edit_form');
37
+ $this->setTitle(Mage::helper('db1_anymarket')->__('Anymarket Products'));
38
+ }
39
+
40
+ /**
41
+ * before render html
42
+ *
43
+ * @access protected
44
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Edit_Tabs
45
+ *
46
+ */
47
+ protected function _beforeToHtml()
48
+ {
49
+ $this->addTab(
50
+ 'form_anymarketproducts',
51
+ array(
52
+ 'label' => Mage::helper('db1_anymarket')->__('Anymarket Products'),
53
+ 'title' => Mage::helper('db1_anymarket')->__('Anymarket Products'),
54
+ 'content' => $this->getLayout()->createBlock(
55
+ 'db1_anymarket/adminhtml_anymarketproducts_edit_tab_form'
56
+ )
57
+ ->toHtml(),
58
+ )
59
+ );
60
+ if (!Mage::app()->isSingleStoreMode()) {
61
+ $this->addTab(
62
+ 'form_store_anymarketproducts',
63
+ array(
64
+ 'label' => Mage::helper('db1_anymarket')->__('Store views'),
65
+ 'title' => Mage::helper('db1_anymarket')->__('Store views'),
66
+ 'content' => $this->getLayout()->createBlock(
67
+ 'db1_anymarket/adminhtml_anymarketproducts_edit_tab_stores'
68
+ )
69
+ ->toHtml(),
70
+ )
71
+ );
72
+ }
73
+ return parent::_beforeToHtml();
74
+ }
75
+
76
+ /**
77
+ * Retrieve anymarket products entity
78
+ *
79
+ * @access public
80
+ * @return DB1_AnyMarket_Model_Anymarketproducts
81
+ *
82
+ */
83
+ public function getAnymarketproducts()
84
+ {
85
+ return Mage::registry('current_anymarketproducts');
86
+ }
87
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketproducts/Grid.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products admin grid block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ *
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('anymarketproductsGrid');
36
+ $this->setDefaultSort('entity_id');
37
+ $this->setDefaultDir('ASC');
38
+ $this->setSaveParametersInSession(true);
39
+ $this->setUseAjax(true);
40
+ }
41
+
42
+ /**
43
+ * get current store scope
44
+ *
45
+ * @access protected
46
+ * @return store view
47
+
48
+ */
49
+ protected function _getStore()
50
+ {
51
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
52
+ return Mage::app()->getStore($storeId);
53
+ }
54
+
55
+ /**
56
+ * prepare collection
57
+ *
58
+ * @access protected
59
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Grid
60
+ *
61
+ */
62
+ protected function _prepareCollection()
63
+ {
64
+ $store_id = $this->_getStore();
65
+ Mage::app()->setCurrentStore($store_id);
66
+ $store_id = Mage::app()->getStore()->getId();
67
+ Mage::getSingleton('core/session')->setStoreListProdVariable($store_id);
68
+ $collection = Mage::getModel('db1_anymarket/anymarketproducts')
69
+ ->getCollection();
70
+
71
+ $this->setCollection($collection);
72
+ return parent::_prepareCollection();
73
+ }
74
+
75
+ /**
76
+ * prepare grid collection
77
+ *
78
+ * @access protected
79
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Grid
80
+ *
81
+ */
82
+ protected function _prepareColumns()
83
+ {
84
+ $this->addColumn(
85
+ 'nmp_sku',
86
+ array(
87
+ 'header' => Mage::helper('db1_anymarket')->__('Product SKU'),
88
+ 'index' => 'nmp_sku',
89
+ 'type'=> 'text',
90
+
91
+ )
92
+ );
93
+ $this->addColumn(
94
+ 'nmp_name',
95
+ array(
96
+ 'header' => Mage::helper('db1_anymarket')->__('Product Name'),
97
+ 'index' => 'nmp_name',
98
+ 'type'=> 'text',
99
+
100
+ )
101
+ );
102
+ $this->addColumn(
103
+ 'status',
104
+ array(
105
+ 'header' => Mage::helper('db1_anymarket')->__('Will be integrated'),
106
+ 'index' => 'status',
107
+ 'type' => 'options',
108
+ 'options' => array(
109
+ '1' => Mage::helper('db1_anymarket')->__('Yes'),
110
+ '0' => Mage::helper('db1_anymarket')->__('No'),
111
+ )
112
+ )
113
+ );
114
+ $this->addColumn(
115
+ 'nmp_status_int',
116
+ array(
117
+ 'header' => Mage::helper('db1_anymarket')->__('Integration status'),
118
+ 'align' => 'left',
119
+ 'index' => 'nmp_status_int',
120
+ )
121
+ );
122
+ $this->addColumn(
123
+ 'nmp_desc_error',
124
+ array(
125
+ 'header' => Mage::helper('db1_anymarket')->__('Integration message'),
126
+ 'align' => 'left',
127
+ 'index' => 'nmp_desc_error',
128
+ )
129
+ );
130
+ if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
131
+ $this->addColumn(
132
+ 'store_id',
133
+ array(
134
+ 'header' => Mage::helper('db1_anymarket')->__('Store Views'),
135
+ 'index' => 'store_id',
136
+ 'type' => 'store',
137
+ 'store_all' => true,
138
+ 'store_view' => true,
139
+ 'sortable' => false,
140
+ 'filter_condition_callback'=> array($this, '_filterStoreCondition'),
141
+ )
142
+ );
143
+ }
144
+ $this->addColumn(
145
+ 'created_at',
146
+ array(
147
+ 'header' => Mage::helper('db1_anymarket')->__('Created at'),
148
+ 'index' => 'created_at',
149
+ 'width' => '120px',
150
+ 'type' => 'datetime',
151
+ )
152
+ );
153
+ $this->addColumn(
154
+ 'updated_at',
155
+ array(
156
+ 'header' => Mage::helper('db1_anymarket')->__('Updated at'),
157
+ 'index' => 'updated_at',
158
+ 'width' => '120px',
159
+ 'type' => 'datetime',
160
+ )
161
+ );
162
+ $this->addExportType('*/*/exportCsv', Mage::helper('db1_anymarket')->__('CSV'));
163
+ $this->addExportType('*/*/exportExcel', Mage::helper('db1_anymarket')->__('Excel'));
164
+ $this->addExportType('*/*/exportXml', Mage::helper('db1_anymarket')->__('XML'));
165
+ return parent::_prepareColumns();
166
+ }
167
+
168
+ /**
169
+ * prepare mass action
170
+ *
171
+ * @access protected
172
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Grid
173
+ *
174
+ */
175
+ protected function _prepareMassaction()
176
+ {
177
+ $this->setMassactionIdField('entity_id');
178
+ $this->getMassactionBlock()->setFormFieldName('anymarketproducts');
179
+
180
+ $this->getMassactionBlock()->addItem(
181
+ 'sincronizar',
182
+ array(
183
+ 'label'=> Mage::helper('db1_anymarket')->__('Synchronize'),
184
+ 'url' => $this->getUrl('*/*/massSincProduct'),
185
+ 'confirm' => Mage::helper('db1_anymarket')->__('Are you sure you want to sync?')
186
+ )
187
+ );
188
+
189
+ $this->getMassactionBlock()->addItem(
190
+ 'status',
191
+ array(
192
+ 'label' => Mage::helper('db1_anymarket')->__('Status change Integration'),
193
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
194
+ 'additional' => array(
195
+ 'status' => array(
196
+ 'name' => 'status',
197
+ 'type' => 'select',
198
+ 'class' => 'required-entry',
199
+ 'label' => Mage::helper('db1_anymarket')->__('Status'),
200
+ 'values' => array(
201
+ '1' => Mage::helper('db1_anymarket')->__('Yes'),
202
+ '0' => Mage::helper('db1_anymarket')->__('No'),
203
+ )
204
+ )
205
+ )
206
+ )
207
+ );
208
+ return $this;
209
+ }
210
+
211
+ /**
212
+ * get the row url
213
+ *
214
+ * @access public
215
+ * @param DB1_AnyMarket_Model_Anymarketproducts
216
+ * @return string
217
+ *
218
+ */
219
+ public function getRowUrl($row)
220
+ {
221
+ $_pullProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $row->getNmpSku());
222
+ if($_pullProduct != null){
223
+ return Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit', array('id' => $_pullProduct->getId()));
224
+ }else{
225
+ return null;
226
+ }
227
+ }
228
+
229
+ /**
230
+ * get the grid url
231
+ *
232
+ * @access public
233
+ * @return string
234
+ *
235
+ */
236
+ public function getGridUrl()
237
+ {
238
+ return $this->getUrl('*/*/grid', array('_current'=>true));
239
+ }
240
+
241
+ /**
242
+ * after collection load
243
+ *
244
+ * @access protected
245
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Grid
246
+ *
247
+ */
248
+ protected function _afterLoadCollection()
249
+ {
250
+ $this->getCollection()->walk('afterLoad');
251
+ parent::_afterLoadCollection();
252
+ }
253
+
254
+ /**
255
+ * filter store column
256
+ *
257
+ * @access protected
258
+ * @param DB1_AnyMarket_Model_Resource_Anymarketproducts_Collection $collection
259
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
260
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketproducts_Grid
261
+ *
262
+ */
263
+ protected function _filterStoreCondition($collection, $column)
264
+ {
265
+ if (!$value = $column->getFilter()->getValue()) {
266
+ return;
267
+ }
268
+ $collection->addStoreFilter($value);
269
+ return $this;
270
+ }
271
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue admin block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketqueue extends Mage_Adminhtml_Block_Widget_Grid_Container
24
+ {
25
+ /**
26
+ * constructor
27
+ *
28
+ * @access public
29
+ * @return void
30
+
31
+ */
32
+ public function __construct()
33
+ {
34
+ $this->_controller = 'adminhtml_anymarketqueue';
35
+ $this->_blockGroup = 'db1_anymarket';
36
+ parent::__construct();
37
+ $this->_headerText = Mage::helper('db1_anymarket')->__('Anymarket Queue');
38
+ $this->_removeButton('add');
39
+
40
+ }
41
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue admin edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
24
+ {
25
+ /**
26
+ * constructor
27
+ *
28
+ * @access public
29
+ * @return void
30
+
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->_blockGroup = 'db1_anymarket';
36
+ $this->_controller = 'adminhtml_anymarketqueue';
37
+ $this->_updateButton(
38
+ 'save',
39
+ 'label',
40
+ Mage::helper('db1_anymarket')->__('Save Anymarket Queue')
41
+ );
42
+ $this->_updateButton(
43
+ 'delete',
44
+ 'label',
45
+ Mage::helper('db1_anymarket')->__('Delete Anymarket Queue')
46
+ );
47
+ $this->_addButton(
48
+ 'saveandcontinue',
49
+ array(
50
+ 'label' => Mage::helper('db1_anymarket')->__('Save And Continue Edit'),
51
+ 'onclick' => 'saveAndContinueEdit()',
52
+ 'class' => 'save',
53
+ ),
54
+ -100
55
+ );
56
+ $this->_formScripts[] = "
57
+ function saveAndContinueEdit() {
58
+ editForm.submit($('edit_form').action+'back/edit/');
59
+ }
60
+ ";
61
+ }
62
+
63
+ /**
64
+ * get the edit form header
65
+ *
66
+ * @access public
67
+ * @return string
68
+
69
+ */
70
+ public function getHeaderText()
71
+ {
72
+ if (Mage::registry('current_anymarketqueue') && Mage::registry('current_anymarketqueue')->getId()) {
73
+ return Mage::helper('db1_anymarket')->__(
74
+ "Edit Anymarket Queue '%s'",
75
+ $this->escapeHtml(Mage::registry('current_anymarketqueue')->getNmqId())
76
+ );
77
+ } else {
78
+ return Mage::helper('db1_anymarket')->__('Add Anymarket Queue');
79
+ }
80
+ }
81
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Form.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue edit form
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
24
+ {
25
+ /**
26
+ * prepare form
27
+ *
28
+ * @access protected
29
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit_Form
30
+
31
+ */
32
+ protected function _prepareForm()
33
+ {
34
+ $form = new Varien_Data_Form(
35
+ array(
36
+ 'id' => 'edit_form',
37
+ 'action' => $this->getUrl(
38
+ '*/*/save',
39
+ array(
40
+ 'id' => $this->getRequest()->getParam('id')
41
+ )
42
+ ),
43
+ 'method' => 'post',
44
+ 'enctype' => 'multipart/form-data'
45
+ )
46
+ );
47
+ $form->setUseContainer(true);
48
+ $this->setForm($form);
49
+ return parent::_prepareForm();
50
+ }
51
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Form.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue edit form tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
24
+ {
25
+ /**
26
+ * prepare the form
27
+ *
28
+ * @access protected
29
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit_Tab_Form
30
+
31
+ */
32
+ protected function _prepareForm()
33
+ {
34
+ $form = new Varien_Data_Form();
35
+ $form->setHtmlIdPrefix('anymarketqueue_');
36
+ $form->setFieldNameSuffix('anymarketqueue');
37
+ $this->setForm($form);
38
+ $fieldset = $form->addFieldset(
39
+ 'anymarketqueue_form',
40
+ array('legend' => Mage::helper('db1_anymarket')->__('Anymarket Queue'))
41
+ );
42
+
43
+ $fieldset->addField(
44
+ 'nmq_id',
45
+ 'text',
46
+ array(
47
+ 'label' => Mage::helper('db1_anymarket')->__('Item code that is waiting in the queue'),
48
+ 'name' => 'nmq_id',
49
+ 'required' => true,
50
+ 'class' => 'required-entry',
51
+
52
+ )
53
+ );
54
+
55
+ $fieldset->addField(
56
+ 'nmq_type',
57
+ 'select',
58
+ array(
59
+ 'label' => Mage::helper('db1_anymarket')->__('Type of Operation'),
60
+ 'name' => 'nmq_type',
61
+ 'required' => true,
62
+ 'values' => array(
63
+ array(
64
+ 'value' => 'IMP',
65
+ 'label' => Mage::helper('db1_anymarket')->__('IMP'),
66
+ ),
67
+ array(
68
+ 'value' => 'EXP',
69
+ 'label' => Mage::helper('db1_anymarket')->__('EXP'),
70
+ ),
71
+ ),
72
+ )
73
+ );
74
+
75
+ $fieldset->addField(
76
+ 'nmq_table',
77
+ 'select',
78
+ array(
79
+ 'label' => Mage::helper('db1_anymarket')->__('Source table'),
80
+ 'name' => 'nmq_table',
81
+ 'required' => true,
82
+ 'values' => array(
83
+ array(
84
+ 'value' => 'ORDER',
85
+ 'label' => Mage::helper('db1_anymarket')->__('Order'),
86
+ ),
87
+ array(
88
+ 'value' => 'PRODUCT',
89
+ 'label' => Mage::helper('db1_anymarket')->__('Product'),
90
+ ),
91
+ ),
92
+ )
93
+ );
94
+
95
+ if (Mage::app()->isSingleStoreMode()) {
96
+ $fieldset->addField(
97
+ 'store_id',
98
+ 'hidden',
99
+ array(
100
+ 'name' => 'stores[]',
101
+ 'value' => Mage::app()->getStore(true)->getId()
102
+ )
103
+ );
104
+ Mage::registry('current_anymarketqueue')->setStoreId(Mage::app()->getStore(true)->getId());
105
+ }
106
+ $formValues = Mage::registry('current_anymarketqueue')->getDefaultValues();
107
+ if (!is_array($formValues)) {
108
+ $formValues = array();
109
+ }
110
+ if (Mage::getSingleton('adminhtml/session')->getAnymarketqueueData()) {
111
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getAnymarketqueueData());
112
+ Mage::getSingleton('adminhtml/session')->setAnymarketqueueData(null);
113
+ } elseif (Mage::registry('current_anymarketqueue')) {
114
+ $formValues = array_merge($formValues, Mage::registry('current_anymarketqueue')->getData());
115
+ }
116
+ $form->setValues($formValues);
117
+ return parent::_prepareForm();
118
+ }
119
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * store selection tab
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
24
+ {
25
+ /**
26
+ * prepare the form
27
+ *
28
+ * @access protected
29
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit_Tab_Stores
30
+
31
+ */
32
+ protected function _prepareForm()
33
+ {
34
+ $form = new Varien_Data_Form();
35
+ $form->setFieldNameSuffix('anymarketqueue');
36
+ $this->setForm($form);
37
+ $fieldset = $form->addFieldset(
38
+ 'anymarketqueue_stores_form',
39
+ array('legend' => Mage::helper('db1_anymarket')->__('Store views'))
40
+ );
41
+ $field = $fieldset->addField(
42
+ 'store_id',
43
+ 'multiselect',
44
+ array(
45
+ 'name' => 'stores[]',
46
+ 'label' => Mage::helper('db1_anymarket')->__('Store Views'),
47
+ 'title' => Mage::helper('db1_anymarket')->__('Store Views'),
48
+ 'required' => true,
49
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
50
+ )
51
+ );
52
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
53
+ $field->setRenderer($renderer);
54
+ $form->addValues(Mage::registry('current_anymarketqueue')->getData());
55
+ return parent::_prepareForm();
56
+ }
57
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Edit/Tabs.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue admin edit tabs
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
24
+ {
25
+ /**
26
+ * Initialize Tabs
27
+ *
28
+ * @access public
29
+
30
+ */
31
+ public function __construct()
32
+ {
33
+ parent::__construct();
34
+ $this->setId('anymarketqueue_tabs');
35
+ $this->setDestElementId('edit_form');
36
+ $this->setTitle(Mage::helper('db1_anymarket')->__('Anymarket Queue'));
37
+ }
38
+
39
+ /**
40
+ * before render html
41
+ *
42
+ * @access protected
43
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Edit_Tabs
44
+
45
+ */
46
+ protected function _beforeToHtml()
47
+ {
48
+ $this->addTab(
49
+ 'form_anymarketqueue',
50
+ array(
51
+ 'label' => Mage::helper('db1_anymarket')->__('Anymarket Queue'),
52
+ 'title' => Mage::helper('db1_anymarket')->__('Anymarket Queue'),
53
+ 'content' => $this->getLayout()->createBlock(
54
+ 'db1_anymarket/adminhtml_anymarketqueue_edit_tab_form'
55
+ )
56
+ ->toHtml(),
57
+ )
58
+ );
59
+ if (!Mage::app()->isSingleStoreMode()) {
60
+ $this->addTab(
61
+ 'form_store_anymarketqueue',
62
+ array(
63
+ 'label' => Mage::helper('db1_anymarket')->__('Store views'),
64
+ 'title' => Mage::helper('db1_anymarket')->__('Store views'),
65
+ 'content' => $this->getLayout()->createBlock(
66
+ 'db1_anymarket/adminhtml_anymarketqueue_edit_tab_stores'
67
+ )
68
+ ->toHtml(),
69
+ )
70
+ );
71
+ }
72
+ return parent::_beforeToHtml();
73
+ }
74
+
75
+ /**
76
+ * Retrieve anymarket queue entity
77
+ *
78
+ * @access public
79
+ * @return DB1_AnyMarket_Model_Anymarketqueue
80
+
81
+ */
82
+ public function getAnymarketqueue()
83
+ {
84
+ return Mage::registry('current_anymarketqueue');
85
+ }
86
+ }
app/code/community/DB1/AnyMarket/Block/Adminhtml/Anymarketqueue/Grid.php ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue admin grid block
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Grid extends Mage_Adminhtml_Block_Widget_Grid
24
+ {
25
+ /**
26
+ * constructor
27
+ *
28
+ * @access public
29
+
30
+ */
31
+ public function __construct()
32
+ {
33
+ parent::__construct();
34
+ $this->setId('anymarketqueueGrid');
35
+ $this->setDefaultSort('entity_id');
36
+ $this->setDefaultDir('ASC');
37
+ $this->setSaveParametersInSession(true);
38
+ $this->setUseAjax(true);
39
+ }
40
+
41
+ /**
42
+ * prepare collection
43
+ *
44
+ * @access protected
45
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Grid
46
+
47
+ */
48
+ protected function _prepareCollection()
49
+ {
50
+ $collection = Mage::getModel('db1_anymarket/anymarketqueue')
51
+ ->getCollection();
52
+
53
+ $this->setCollection($collection);
54
+ return parent::_prepareCollection();
55
+ }
56
+
57
+ /**
58
+ * prepare grid collection
59
+ *
60
+ * @access protected
61
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Grid
62
+
63
+ */
64
+ protected function _prepareColumns()
65
+ {
66
+ $this->addColumn(
67
+ 'entity_id',
68
+ array(
69
+ 'header' => Mage::helper('db1_anymarket')->__('Id'),
70
+ 'index' => 'entity_id',
71
+ 'type' => 'number'
72
+ )
73
+ );
74
+ $this->addColumn(
75
+ 'nmq_id',
76
+ array(
77
+ 'header' => Mage::helper('db1_anymarket')->__('Item code that is waiting in the queue'),
78
+ 'align' => 'left',
79
+ 'index' => 'nmq_id',
80
+ )
81
+ );
82
+ $this->addColumn(
83
+ 'nmq_type',
84
+ array(
85
+ 'header' => Mage::helper('db1_anymarket')->__('Type of Operation (Import/Emport)'),
86
+ 'index' => 'nmq_type',
87
+ 'type' => 'options',
88
+ 'options' => array(
89
+ 'IMP' => Mage::helper('db1_anymarket')->__('Import'),
90
+ 'EXP' => Mage::helper('db1_anymarket')->__('Export'),
91
+ )
92
+
93
+ )
94
+ );
95
+ $this->addColumn(
96
+ 'nmq_table',
97
+ array(
98
+ 'header' => Mage::helper('db1_anymarket')->__('Source table'),
99
+ 'index' => 'nmq_table',
100
+ 'type' => 'options',
101
+ 'options' => array(
102
+ 'ORDER' => Mage::helper('db1_anymarket')->__('Order'),
103
+ 'PRODUCT' => Mage::helper('db1_anymarket')->__('Product'),
104
+ )
105
+
106
+ )
107
+ );
108
+ if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
109
+ $this->addColumn(
110
+ 'store_id',
111
+ array(
112
+ 'header' => Mage::helper('db1_anymarket')->__('Store Views'),
113
+ 'index' => 'store_id',
114
+ 'type' => 'store',
115
+ 'store_all' => true,
116
+ 'store_view' => true,
117
+ 'sortable' => false,
118
+ 'filter_condition_callback'=> array($this, '_filterStoreCondition'),
119
+ )
120
+ );
121
+ }
122
+ $this->addColumn(
123
+ 'created_at',
124
+ array(
125
+ 'header' => Mage::helper('db1_anymarket')->__('Created at'),
126
+ 'index' => 'created_at',
127
+ 'width' => '120px',
128
+ 'type' => 'datetime',
129
+ )
130
+ );
131
+ $this->addColumn(
132
+ 'updated_at',
133
+ array(
134
+ 'header' => Mage::helper('db1_anymarket')->__('Updated at'),
135
+ 'index' => 'updated_at',
136
+ 'width' => '120px',
137
+ 'type' => 'datetime',
138
+ )
139
+ );
140
+ $this->addExportType('*/*/exportCsv', Mage::helper('db1_anymarket')->__('CSV'));
141
+ $this->addExportType('*/*/exportExcel', Mage::helper('db1_anymarket')->__('Excel'));
142
+ $this->addExportType('*/*/exportXml', Mage::helper('db1_anymarket')->__('XML'));
143
+ return parent::_prepareColumns();
144
+ }
145
+
146
+ /**
147
+ * prepare mass action
148
+ *
149
+ * @access protected
150
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Grid
151
+
152
+ */
153
+ protected function _prepareMassaction()
154
+ {
155
+ $this->setMassactionIdField('entity_id');
156
+ $this->getMassactionBlock()->setFormFieldName('anymarketqueue');
157
+ $this->getMassactionBlock()->addItem(
158
+ 'delete',
159
+ array(
160
+ 'label'=> Mage::helper('db1_anymarket')->__('Delete'),
161
+ 'url' => $this->getUrl('*/*/massDelete'),
162
+ 'confirm' => Mage::helper('db1_anymarket')->__('Are you sure?')
163
+ )
164
+ );
165
+ return $this;
166
+ }
167
+
168
+ /**
169
+ * get the row url
170
+ *
171
+ * @access public
172
+ * @param DB1_AnyMarket_Model_Anymarketqueue
173
+ * @return string
174
+
175
+ */
176
+ public function getRowUrl($row)
177
+ {
178
+ return null;
179
+ }
180
+
181
+ /**
182
+ * get the grid url
183
+ *
184
+ * @access public
185
+ * @return string
186
+
187
+ */
188
+ public function getGridUrl()
189
+ {
190
+ return $this->getUrl('*/*/grid', array('_current'=>true));
191
+ }
192
+
193
+ /**
194
+ * after collection load
195
+ *
196
+ * @access protected
197
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Grid
198
+
199
+ */
200
+ protected function _afterLoadCollection()
201
+ {
202
+ $this->getCollection()->walk('afterLoad');
203
+ parent::_afterLoadCollection();
204
+ }
205
+
206
+ /**
207
+ * filter store column
208
+ *
209
+ * @access protected
210
+ * @param DB1_AnyMarket_Model_Resource_Anymarketqueue_Collection $collection
211
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
212
+ * @return DB1_AnyMarket_Block_Adminhtml_Anymarketqueue_Grid
213
+
214
+ */
215
+ protected function _filterStoreCondition($collection, $column)
216
+ {
217
+ if (!$value = $column->getFilter()->getValue()) {
218
+ return;
219
+ }
220
+ $collection->addStoreFilter($value);
221
+ return $this;
222
+ }
223
+ }
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusammg/Values.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Block_System_Config_Source_Orders_Statusammg_Values extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $magentoAttributes;
6
+
7
+ // public function _prepareToRender()
8
+ public function __construct()
9
+ {
10
+ $this->addColumn('orderStatusAM', array(
11
+ 'label' => Mage::helper('adminhtml')->__('Status Order Anymarket'),
12
+ 'size' => 28
13
+ ));
14
+
15
+ $this->addColumn('orderStatusMG', array(
16
+ 'label' => Mage::helper('adminhtml')->__('Status Order Magento'),
17
+ 'size' => 28,
18
+ ));
19
+
20
+ $this->_addAfter = false;
21
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add new Status');
22
+
23
+ parent::__construct();
24
+ $this->setTemplate('db1/anymarket/system/config/form/field/array_dropdown.phtml');
25
+ }
26
+
27
+ protected function _renderCellTemplate($columnName)
28
+ {
29
+ if (empty($this->_columns[$columnName])) {
30
+ throw new Exception('Wrong column name specified.');
31
+ }
32
+ $column = $this->_columns[$columnName];
33
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
34
+
35
+ $rendered = '<select name="'.$inputName.'">';
36
+ if ($columnName == 'orderStatusAM') {
37
+ $rendered .= '<option value="CONCLUDED">Concluido (CONCLUDED)</option>';
38
+ $rendered .= '<option value="PENDING">Pendente (PENDING)</option>';
39
+ $rendered .= '<option value="INVOICED">Faturado (INVOICED)</option>';
40
+ $rendered .= '<option value="PAID_WAITING_DELIVERY">Enviado (PAID_WAITING_DELIVERY)</option>';
41
+ $rendered .= '<option value="PAID_WAITING_SHIP">Pago (PAID_WAITING_SHIP)</option>';
42
+ $rendered .= '<option value="CANCELED">Cancelado (CANCELED)</option>';
43
+ } else {
44
+ $orderStatusCollection = Mage::getModel('sales/order_status')->getResourceCollection()->getData();
45
+ foreach($orderStatusCollection as $orderStatus) {
46
+ $rendered .= '<option value="'.$orderStatus['status'].'">'.$orderStatus['label'].' ('.$orderStatus['status'].')</option>';
47
+ }
48
+ $rendered .= '<option value="new">New (new)</option>';
49
+ }
50
+ $rendered .= '</select>';
51
+
52
+ return $rendered;
53
+ }
54
+
55
+ }
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Orders/Statusmgam/Values.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Block_System_Config_Source_Orders_Statusmgam_Values extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $magentoAttributes;
6
+
7
+ // public function _prepareToRender()
8
+ public function __construct()
9
+ {
10
+ $this->addColumn('orderStatusMG', array(
11
+ 'label' => Mage::helper('adminhtml')->__('Status Order Magento'),
12
+ 'size' => 28,
13
+ ));
14
+ $this->addColumn('orderStatusAM', array(
15
+ 'label' => Mage::helper('adminhtml')->__('Status Order Anymarket'),
16
+ 'size' => 28
17
+ ));
18
+ $this->_addAfter = false;
19
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add new Status');
20
+
21
+ parent::__construct();
22
+ $this->setTemplate('db1/anymarket/system/config/form/field/array_dropdown.phtml');
23
+ }
24
+
25
+ protected function _renderCellTemplate($columnName)
26
+ {
27
+ if (empty($this->_columns[$columnName])) {
28
+ throw new Exception('Wrong column name specified.');
29
+ }
30
+ $column = $this->_columns[$columnName];
31
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
32
+
33
+ $rendered = '<select name="'.$inputName.'">';
34
+ if ($columnName == 'orderStatusAM') {
35
+ $rendered .= '<option value="CONCLUDED">Concluido (CONCLUDED)</option>';
36
+ $rendered .= '<option value="PENDING">Pendente (PENDING)</option>';
37
+ $rendered .= '<option value="INVOICED">Faturado (INVOICED)</option>';
38
+ $rendered .= '<option value="PAID_WAITING_DELIVERY">Enviado (PAID_WAITING_DELIVERY)</option>';
39
+ $rendered .= '<option value="PAID_WAITING_SHIP">Pago (PAID_WAITING_SHIP)</option>';
40
+ $rendered .= '<option value="CANCELED">Cancelado (CANCELED)</option>';
41
+ } else {
42
+ $orderStatusCollection = Mage::getModel('sales/order_status')->getResourceCollection()->getData();
43
+ foreach($orderStatusCollection as $orderStatus) {
44
+ $rendered .= '<option value="'.$orderStatus['status'].'">'.$orderStatus['label'].' ('.$orderStatus['status'].')</option>';
45
+ }
46
+ $rendered .= '<option value="new">New (new)</option>';
47
+ }
48
+ $rendered .= '</select>';
49
+
50
+ return $rendered;
51
+ }
52
+
53
+ }
app/code/community/DB1/AnyMarket/Block/System/Config/Source/Products/Values.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Block_System_Config_Source_Products_Values extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $magentoAttributes;
6
+
7
+ // public function _prepareToRender()
8
+ public function __construct()
9
+ {
10
+ $this->addColumn('descProduct', array(
11
+ 'label' => Mage::helper('adminhtml')->__('Description Product'),
12
+ 'size' => 28
13
+ ));
14
+
15
+ $this->_addAfter = false;
16
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add new Field');
17
+
18
+ parent::__construct();
19
+ $this->setTemplate('db1/anymarket/system/config/form/field/array_dropdown.phtml');
20
+ }
21
+
22
+ protected function _renderCellTemplate($columnName)
23
+ {
24
+ if (empty($this->_columns[$columnName])) {
25
+ throw new Exception('Wrong column name specified.');
26
+ }
27
+ $column = $this->_columns[$columnName];
28
+ $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
29
+
30
+ $rendered = '<select name="'.$inputName.'">';
31
+ if ($columnName == 'descProduct') {
32
+ $productAttrs = Mage::getResourceModel('catalog/product_attribute_collection');
33
+
34
+ foreach ($productAttrs as $productAttr) {
35
+ if($productAttr->getFrontendLabel() != null){
36
+ $attrCheck = Mage::getModel('db1_anymarket/anymarketattributes')->load($productAttr->getAttributeCode(), 'nma_id_attr');
37
+
38
+ if($attrCheck->getData('nma_id_attr') == null){
39
+ $descAttr = $productAttr->getFrontendLabel();
40
+ if($descAttr != ''){
41
+ $descAttr = str_replace("'", "", $descAttr);
42
+ $rendered .= '<option value="'.$productAttr->getAttributeCode().'">'.$descAttr.' ('.$productAttr->getAttributeCode().')</option>';
43
+ }
44
+ }
45
+ }
46
+
47
+ }
48
+ }
49
+ $rendered .= '</select>';
50
+
51
+ return $rendered;
52
+ }
53
+
54
+ }
app/code/community/DB1/AnyMarket/Controller/Adminhtml/AnyMarket.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * module base admin controller
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Controller_Adminhtml_AnyMarket extends Mage_Adminhtml_Controller_Action
25
+ {
26
+
27
+ /**
28
+ * upload file and get the uploaded name
29
+ *
30
+ * @access public
31
+ * @param string $input
32
+ * @param string $destinationFolder
33
+ * @param array $data
34
+ * @return string
35
+ *
36
+ */
37
+ protected function _uploadAndGetName($input, $destinationFolder, $data)
38
+ {
39
+ try {
40
+ if (isset($data[$input]['delete'])) {
41
+ return '';
42
+ } else {
43
+ $uploader = new Varien_File_Uploader($input);
44
+ $uploader->setAllowRenameFiles(true);
45
+ $uploader->setFilesDispersion(true);
46
+ $uploader->setAllowCreateFolders(true);
47
+ $result = $uploader->save($destinationFolder);
48
+ return $result['file'];
49
+ }
50
+ } catch (Exception $e) {
51
+ if ($e->getCode() != Varien_File_Uploader::TMP_NAME_EMPTY) {
52
+ throw $e;
53
+ } else {
54
+ if (isset($data[$input]['value'])) {
55
+ return $data[$input]['value'];
56
+ }
57
+ }
58
+ }
59
+ return '';
60
+ }
61
+ }
app/code/community/DB1/AnyMarket/Helper/Category.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Helper_Category extends DB1_AnyMarket_Helper_Data
4
+ {
5
+
6
+ /**
7
+ * get all root category of AM
8
+ *
9
+ * @access public
10
+ * @return void
11
+ *
12
+ */
13
+ public function getCategories(){
14
+ $storeID = Mage::app()->getStore()->getId();
15
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
16
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
17
+
18
+ $headers = array(
19
+ "Content-type: application/json",
20
+ "Accept: */*",
21
+ "gumgaToken: ".$TOKEN
22
+ );
23
+
24
+ $startRec = 0;
25
+ $countRec = 1;
26
+ $arrOrderCod = null;
27
+
28
+ while ($startRec <= $countRec) {
29
+ $returnCat = $this->CallAPICurl("GET", $HOST."/rest/api/v2/categories/?offset=".$startRec."&limit=30", $headers, null);
30
+
31
+ if($returnCat['error'] == '1'){
32
+ $startRec = 1;
33
+ $countRec = 0;
34
+
35
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
36
+ $anymarketlog->setLogDesc( 'Error on Sincronize Category '. $returnCat['return'] );
37
+ $anymarketlog->setStatus("1");
38
+ $anymarketlog->save();
39
+ }else{
40
+ $CatJSON = $returnCat['return'];
41
+
42
+ $startRec = $startRec + $CatJSON->page->size;
43
+ $countRec = $CatJSON->page->totalElements;
44
+
45
+ foreach ($CatJSON->content as $category) {
46
+ $IDCat = $category->id;
47
+
48
+ $anymarketcategoriesUpdt = Mage::getModel('db1_anymarket/anymarketcategories')->load($IDCat, 'nmc_cat_id');
49
+ if($anymarketcategoriesUpdt->getData('nmc_cat_id') == null){
50
+ $anymarketcategories = Mage::getModel('db1_anymarket/anymarketcategories');
51
+ $anymarketcategories->setNmcCatId( $IDCat );
52
+ $anymarketcategories->setNmcCatRootId( '000' );
53
+ $anymarketcategories->setStatus('1');
54
+ $anymarketcategories->setNmcCatDesc( $category->name );
55
+ $anymarketcategories->setStores(array($storeID));
56
+ $anymarketcategories->save();
57
+ }else{
58
+ $anymarketcategoriesUpdt->setNmcCatDesc( $category->name );
59
+ $anymarketcategoriesUpdt->save();
60
+ }
61
+
62
+ $this->getChildCat($HOST, $headers, $category->id, $IDCat, $storeID);
63
+ }
64
+
65
+ }
66
+
67
+ }
68
+
69
+ }
70
+
71
+
72
+ /**
73
+ * get all child category of AM
74
+ *
75
+ * @access private
76
+ * @param $HOST, $headers, $catID, $IDCatRoot
77
+ * @return void
78
+ *
79
+ */
80
+ private function getChildCat($HOST, $headers, $catID, $IDCatRoot, $id_store){
81
+ $returnCatSpecific = $this->CallAPICurl("GET", $HOST."/rest/api/v2/categories/".$catID, $headers, null);
82
+ $CatSpecifivJSON = $returnCatSpecific['return'];
83
+ if($returnCatSpecific['error'] == '0'){
84
+ if( isset($CatSpecifivJSON->children) ){
85
+ foreach ($CatSpecifivJSON->children as $catChild) {
86
+
87
+ $anymarketcategoriesUpdt = Mage::getModel('db1_anymarket/anymarketcategories')->load($catChild->id, 'nmc_cat_id');
88
+ if($anymarketcategoriesUpdt->getData('nmc_cat_id') == null){
89
+ $anymarketcategories = Mage::getModel('db1_anymarket/anymarketcategories');
90
+ $anymarketcategories->setNmcCatId( $catChild->id );
91
+ $anymarketcategories->setNmcCatRootId( $IDCatRoot );
92
+ $anymarketcategories->setStatus('1');
93
+ $anymarketcategories->setNmcCatDesc( $catChild->name );
94
+ $anymarketcategories->setStores(array($id_store));
95
+ $anymarketcategories->save();
96
+ }else{
97
+ $anymarketcategoriesUpdt->setNmcCatDesc( $catChild->name );
98
+ $anymarketcategoriesUpdt->save();
99
+ }
100
+
101
+ $this->getChildCat($HOST, $headers, $catChild->id, $catChild->id, $id_store);
102
+ }
103
+ }
104
+ }else{
105
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
106
+ $anymarketlog->setLogDesc( $returnCatSpecific['return'] );
107
+ $anymarketlog->setLogId( $IDCatRoot );
108
+ $anymarketlog->setStatus("1");
109
+ $anymarketlog->save();
110
+ }
111
+ }
112
+
113
+
114
+ }
app/code/community/DB1/AnyMarket/Helper/Customergenerator.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Helper_CustomerGenerator extends DB1_AnyMarket_Helper_Data
4
+ {
5
+ protected $_defaultData = array (
6
+ 'account' => array(
7
+ 'website_id' => '1',
8
+ 'group_id' => '1',
9
+ 'prefix' => '',
10
+ 'firstname' => 'Firstname{id}',
11
+ 'middlename' => '',
12
+ 'lastname' => 'Lastname',
13
+ 'suffix' => '',
14
+ 'email' => 'email{id}@example.net',
15
+ 'dob' => '',
16
+ 'taxvat' => '',
17
+ 'gender' => '',
18
+ 'sendemail_store_id' => '1',
19
+ 'password' => 'a111111',
20
+ 'default_billing' => '_item1',
21
+ 'default_shipping' => '_item1',
22
+ ),
23
+ 'address' => array(
24
+ '_item1' => array(
25
+ 'prefix' => '',
26
+ 'firstname' => 'Firstname',
27
+ 'middlename' => '',
28
+ 'lastname' => 'Lastname',
29
+ 'suffix' => '',
30
+ 'company' => '',
31
+ 'street' => array(
32
+ 0 => 'Address',
33
+ 1 => '',
34
+ ),
35
+ 'city' => 'City',
36
+ 'country_id' => 'US',
37
+ 'region_id' => '12',
38
+ 'region' => '',
39
+ 'postcode' => '123123',
40
+ 'telephone' => '123123123',
41
+ 'fax' => '',
42
+ 'vat_id' => '',
43
+ ),
44
+ ),
45
+ );
46
+
47
+ /**
48
+ * @var Mage_Core_Model_Resource_Resource $_resource
49
+ */
50
+ protected $_resource;
51
+ /**
52
+ * @var Varien_Db_Adapter_Interface $_adapter
53
+ */
54
+ protected $_adapter;
55
+
56
+ public function __construct()
57
+ {
58
+ $this->_resource = Mage::getResourceSingleton('core/resource');
59
+ $this->_adapter = $this->_resource->getReadConnection();
60
+ }
61
+
62
+ protected function _processTemplates(&$data)
63
+ {
64
+ $config = $this->_adapter->getConfig();
65
+
66
+ $select = $this->_adapter->select();
67
+ $select
68
+ ->from('information_schema.tables', 'AUTO_INCREMENT')
69
+ ->where('table_schema = ?', $config['dbname'])
70
+ ->where(
71
+ 'table_name = ?',
72
+ $this->_adapter->getTableName('customer_entity')
73
+ );
74
+
75
+ $nextId = $this->_adapter->fetchOne($select);
76
+
77
+ foreach ($data['account'] as &$field){
78
+ $field = str_replace('{id}', $nextId, $field);
79
+ }
80
+
81
+ foreach ($data['address'] as &$address) {
82
+ foreach ($address as &$field) {
83
+ $field = str_replace('{id}', $nextId, $field);
84
+ }
85
+ }
86
+ }
87
+
88
+ /**
89
+ * create customer
90
+ *
91
+ * @access public
92
+ * @param $data
93
+ * @return customer
94
+ *
95
+ */
96
+ public function createCustomer($data = array())
97
+ {
98
+ $data = array_replace_recursive($this->_defaultData, $data);
99
+
100
+ $this->_processTemplates($data);
101
+
102
+ /** @var $customer Mage_Customer_Model_Customer */
103
+ $customer = Mage::getModel('customer/customer');
104
+
105
+ $customer->setData($data['account']);
106
+
107
+ foreach (array_keys($data['address']) as $index) {
108
+ $address = Mage::getModel('customer/address');
109
+
110
+ $addressData = array_merge($data['account'], $data['address'][$index]);
111
+
112
+ // Set default billing and shipping flags to address
113
+ $isDefaultBilling = isset($data['account']['default_billing'])
114
+ && $data['account']['default_billing'] == $index;
115
+ $address->setIsDefaultBilling($isDefaultBilling);
116
+ $isDefaultShipping = isset($data['account']['default_shipping'])
117
+ && $data['account']['default_shipping'] == $index;
118
+ $address->setIsDefaultShipping($isDefaultShipping);
119
+
120
+ $address->addData($addressData);
121
+
122
+ // Set post_index for detect default billing and shipping addresses
123
+ $address->setPostIndex($index);
124
+
125
+ $customer->addAddress($address);
126
+ }
127
+
128
+ // Default billing and shipping
129
+ if (isset($data['account']['default_billing'])) {
130
+ $customer->setData('default_billing', $data['account']['default_billing']);
131
+ }
132
+ if (isset($data['account']['default_shipping'])) {
133
+ $customer->setData('default_shipping', $data['account']['default_shipping']);
134
+ }
135
+ if (isset($data['account']['confirmation'])) {
136
+ $customer->setData('confirmation', $data['account']['confirmation']);
137
+ }
138
+
139
+ if (isset($data['account']['sendemail_store_id'])) {
140
+ $customer->setSendemailStoreId($data['account']['sendemail_store_id']);
141
+ }
142
+
143
+ $customer
144
+ ->setPassword($data['account']['password'])
145
+ ->setForceConfirmed(true)
146
+ ->save()
147
+ ->cleanAllAddresses()
148
+ ;
149
+
150
+ return $customer;
151
+ }
152
+ }
app/code/community/DB1/AnyMarket/Helper/Data.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * AnyMarket default helper
4
+ *
5
+ * @category DB1
6
+ * @package DB1_AnyMarket
7
+ */
8
+ class DB1_AnyMarket_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+ /**
11
+ * convert array to options
12
+ *
13
+ * @access public
14
+ * @param $options
15
+ * @return array
16
+ *
17
+ */
18
+ public function convertOptions($options)
19
+ {
20
+ $converted = array();
21
+ foreach ($options as $option) {
22
+ if (isset($option['value']) && !is_array($option['value']) &&
23
+ isset($option['label']) && !is_array($option['label'])) {
24
+ $converted[$option['value']] = $option['label'];
25
+ }
26
+ }
27
+ return $converted;
28
+ }
29
+
30
+ /**
31
+ * check if module is enabled
32
+ *
33
+ * @access public
34
+ * @return boolean
35
+ *
36
+ */
37
+ public function anymarketModuleIsEnabled()
38
+ {
39
+ $outputPath = "advanced/modules_disable_output/DB1_AnyMarket";
40
+
41
+ $enableConfig = new Mage_Core_Model_Config();
42
+ $enableConfig->saveConfig($outputPath, "1");
43
+ unset($enableConfig);
44
+ }
45
+
46
+ /**
47
+ * get substring between two caracter
48
+ *
49
+ * @access public
50
+ * @return string
51
+ *
52
+ */
53
+ public function getBetweenCaract($content, $start, $end)
54
+ {
55
+ $r = explode($start, $content);
56
+ if (isset($r[1])){
57
+ $r = explode($end, $r[1]);
58
+ return $r[0];
59
+ }
60
+ return '';
61
+ }
62
+
63
+ /**
64
+ * get all store data
65
+ *
66
+ * @access public
67
+ * @return array
68
+ *
69
+ */
70
+ public function getAllStores($websiteID = null)
71
+ {
72
+ $arrStores = array();
73
+ if(!$websiteID){
74
+ foreach (Mage::app()->getWebsites() as $website) {
75
+ foreach ($website->getGroups() as $group) {
76
+ $stores = $group->getStores();
77
+ foreach ($stores as $store) {
78
+ array_push($arrStores, $store->getData());
79
+ }
80
+ }
81
+ }
82
+ }else{
83
+ $website = Mage::getModel('core/website')->load($websiteID);
84
+
85
+ foreach ($website->getStoreIds() as $storeid) {
86
+ $storeDat = Mage::getModel('core/store')->load($storeid);
87
+ array_push($arrStores, $storeDat->getData());
88
+ }
89
+ }
90
+ return $arrStores;
91
+ }
92
+
93
+ /**
94
+ * call curl
95
+ *
96
+ * @access public
97
+ * @param $options
98
+ * @return json
99
+ *
100
+ */
101
+ public function CallAPICurl($method, $url, $headers, $params){
102
+ $curl = curl_init($url);
103
+
104
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
105
+ $data_string = "";
106
+ if ($method == "POST"){
107
+ $data_string = json_encode($params);
108
+ curl_setopt($curl, CURLOPT_POST, true);
109
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
110
+ }else if($method == "PUT"){
111
+ $data_string = json_encode($params);
112
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
113
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
114
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
115
+ }
116
+
117
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT ,0);
118
+ curl_setopt($curl, CURLOPT_TIMEOUT, 400);
119
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
120
+ $curl_response = curl_exec($curl);
121
+ $err = curl_error($curl);
122
+
123
+ $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
124
+
125
+ if ( $status == 200 ) {
126
+ $retorno = array("error" => "0", "json" => $data_string, "return" => json_decode($curl_response) );
127
+ }else{
128
+ if($err){
129
+ $retorno = array("error" => "1", "json" => $data_string,"return" => 'Error Curl: '.$err );
130
+ }else{
131
+ $retJsonCurlResp = json_decode($curl_response);
132
+
133
+ $retString = '';
134
+ if( isset($retJsonCurlResp->message) ){
135
+ $retString = 'Message: '.utf8_encode($retJsonCurlResp->message);
136
+ }
137
+
138
+ if( isset($retJsonCurlResp->details) ){
139
+ $retString .= '; Details: '.utf8_encode($retJsonCurlResp->details);
140
+ }
141
+
142
+ if( isset($retJsonCurlResp->fieldErrors) ){
143
+ $retString .= '; Field Erros: (';
144
+ foreach ($retJsonCurlResp->fieldErrors as $error) {
145
+ $retString .= 'Field: '.utf8_encode($error->field);
146
+ $retString .= ', Message: '.utf8_encode($error->message).';';
147
+ }
148
+ $retString .= ')';
149
+ }
150
+
151
+ if($retString != ''){
152
+ $retorno = array("error" => "1", "json" => $data_string, "return" => $retString );
153
+ }else{
154
+ $retorno = array("error" => "1", "json" => $data_string, "return" => utf8_encode($curl_response) );
155
+ }
156
+ }
157
+
158
+ }
159
+ if($retorno == ""){
160
+ $retorno = $data_string;
161
+ }
162
+
163
+ curl_close($curl);
164
+
165
+ return $retorno;
166
+ }
167
+
168
+ /**
169
+ * add message inbox of magento
170
+ *
171
+ * @access public
172
+ * @param $title, $Desc, $URL
173
+ * @return void
174
+ *
175
+ */
176
+ public function addMessageInBox($title, $Desc, $URL){
177
+ $AdminNotice = Mage::getModel('adminnotification/inbox');
178
+ $AdminNotice->setSeverity('2');
179
+ $AdminNotice->setTitle( $title );
180
+ $AdminNotice->setDescription( $Desc );
181
+ $AdminNotice->setUrl( $URL );
182
+ $AdminNotice->setDateAdded( date('Y-m-d H:i:s') );
183
+ $AdminNotice->save();
184
+ }
185
+
186
+ /**
187
+ * add message inbox of magento
188
+ *
189
+ * @access public
190
+ * @return void
191
+ *
192
+ */
193
+ public function massInsertAttribute(){
194
+ $productAttrs = Mage::getResourceModel('catalog/product_attribute_collection');
195
+ $storeID = Mage::app()->getStore()->getId();
196
+
197
+ foreach ($productAttrs as $productAttr) {
198
+ if($productAttr->getFrontendLabel() != null){
199
+ $attrCheck = Mage::getModel('db1_anymarket/anymarketattributes')->load($productAttr->getAttributeId(), 'nma_id_attr');
200
+
201
+ if($attrCheck->getData('nma_id_attr') == null){
202
+ $anymarketattribute = Mage::getModel('db1_anymarket/anymarketattributes');
203
+ $anymarketattribute->setNmaIdAttr( $productAttr->getAttributeId() );
204
+ $anymarketattribute->setNmaDesc( $productAttr->getFrontendLabel() );
205
+ $anymarketattribute->setStatus( "0" );
206
+ $anymarketattribute->setStores(array($storeID));
207
+ $anymarketattribute->save();
208
+ }
209
+ }
210
+ }
211
+ }
212
+
213
+
214
+ }
app/code/community/DB1/AnyMarket/Helper/Order.php ADDED
@@ -0,0 +1,888 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Helper_Order extends DB1_AnyMarket_Helper_Data
4
+ {
5
+ /**
6
+ * get status order AM to MG from configs
7
+ *
8
+ * @access private
9
+ * @param $OrderRowData
10
+ * @return string
11
+ *
12
+ */
13
+ private function getStatusAnyMarketToMageOrderConfig($OrderRowData){
14
+ $storeID = Mage::app()->getStore()->getId();
15
+ $StatusOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_status_am_mg_field', $storeID);
16
+ $OrderReturn = 'ERROR: Não há uma configuração válida para '.$OrderRowData;
17
+ if ($StatusOrder && $StatusOrder != 'a:0:{}') {
18
+ $StatusOrder = unserialize($StatusOrder);
19
+ if (is_array($StatusOrder)) {
20
+ foreach($StatusOrder as $StatusOrderRow) {
21
+ if($StatusOrderRow['orderStatusAM'] == $OrderRowData){
22
+ $OrderReturn = $StatusOrderRow['orderStatusMG'];
23
+ break;
24
+ }
25
+ }
26
+ }
27
+ }
28
+
29
+ return $OrderReturn;
30
+ }
31
+
32
+ /**
33
+ * get status order MG to AM from configs
34
+ *
35
+ * @access private
36
+ * @param $OrderRowData
37
+ * @return string
38
+ *
39
+ */
40
+ private function getStatusMageToAnyMarketOrderConfig($OrderRowData){
41
+ $StatusOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_status_mg_am_field', Mage::app()->getStore()->getId());
42
+ $OrderReturn = '';
43
+ if ($StatusOrder && $StatusOrder != 'a:0:{}') {
44
+ $StatusOrder = unserialize($StatusOrder);
45
+ if (is_array($StatusOrder)) {
46
+ foreach($StatusOrder as $StatusOrderRow) {
47
+ if($StatusOrderRow['orderStatusMG'] == $OrderRowData){
48
+ $OrderReturn = $StatusOrderRow['orderStatusAM'];
49
+ break;
50
+ }
51
+
52
+ }
53
+ }
54
+ }else{
55
+ $OrderReturn = 'ERROR: Não há uma configuração válida para '.$OrderRowData;
56
+ }
57
+
58
+ return $OrderReturn;
59
+ }
60
+
61
+ /**
62
+ * create order in MG
63
+ *
64
+ * @access private
65
+ * @param $products, $customer, $IDAnyMarket, $IDSeqAnyMarket, $infoMetPag, $Billing, $Shipping
66
+ * @return order
67
+ *
68
+ */
69
+ private function create_order($products, $customer, $IDAnyMarket, $IDSeqAnyMarket, $infoMetPag, $Billing, $Shipping, $shippValue)
70
+ {
71
+ $orderGenerator = Mage::helper('db1_anymarket/ordergenerator');
72
+ $orderGenerator->_storeId = 1;
73
+
74
+ $orderGenerator->setShippingMethod('freeshipping_freeshipping');
75
+ $orderGenerator->setPaymentMethod('db1_anymarket');
76
+ $orderGenerator->setAdditionalInformation($infoMetPag);
77
+ $orderGenerator->setShippingValue($shippValue);
78
+ $orderGenerator->setShipAddress($Shipping);
79
+ $orderGenerator->setBillAddress($Billing);
80
+ $orderGenerator->setCustomer($customer);
81
+
82
+ $CodOrder = $orderGenerator->createOrder( $products );
83
+
84
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
85
+ $anymarketorders->setStatus("1");
86
+ $anymarketorders->setNmoStatusInt('Integrado');
87
+ $anymarketorders->setNmoDescError('');
88
+ $anymarketorders->setNmoIdAnymarket($IDAnyMarket);
89
+ $anymarketorders->setNmoIdSeqAnymarket($IDSeqAnyMarket);
90
+ $anymarketorders->setNmoIdOrder($CodOrder);
91
+ $anymarketorders->save();
92
+
93
+ return $CodOrder;
94
+ }
95
+
96
+ public function getFeedOrdersFromAnyMarket(){
97
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', Mage::app()->getStore()->getId());
98
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', Mage::app()->getStore()->getId());
99
+
100
+ $headers = array(
101
+ "Content-type: application/json",
102
+ "Accept: */*",
103
+ "gumgaToken: ".$TOKEN
104
+ );
105
+
106
+ $returnProd = $this->CallAPICurl("GET", "http://sandbox-api.anymarket.com.br/v2/orders/feeds/", $headers, null);
107
+
108
+ if($returnProd['error'] == '1'){
109
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
110
+ $anymarketlog->setLogDesc( 'Error on get feed orders '. $returnProd['return'] );
111
+ $anymarketlog->setStatus("1");
112
+ $anymarketlog->save();
113
+ }else{
114
+ $listOrders = $returnProd['return'];
115
+ foreach ($listOrders as $order) {
116
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($order->id, 'nmo_id_seq_anymarket');
117
+ $this->getSpecificOrderFromAnyMarket($anymarketorders->getData('nmo_id_anymarket'), $order->id, $anymarketorders->getData('nmo_id_order'));
118
+ }
119
+ }
120
+ }
121
+
122
+ /**
123
+ * get all orders from AM
124
+ *
125
+ * @access public
126
+ * @return array
127
+ *
128
+ */
129
+ public function getOrdersFromAnyMarket(){
130
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', Mage::app()->getStore()->getId());
131
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', Mage::app()->getStore()->getId());
132
+ $STATUSIMPORT = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_stauts_order_field', Mage::app()->getStore()->getId());
133
+
134
+ $headers = array(
135
+ "Content-type: application/json",
136
+ "Accept: */*",
137
+ "gumgaToken: ".$TOKEN
138
+ );
139
+
140
+ $startRec = 0;
141
+ $countRec = 1;
142
+ $arrOrderCod = null;
143
+ while ($startRec <= $countRec) {
144
+ $returnOrder = $this->CallAPICurl("GET", $HOST."/rest/api/v1/erp/orders/?start=".$startRec."&pageSize=30", $headers, null);
145
+ $JsonReturn = $returnOrder['return'];
146
+ if($returnOrder['error'] != '0'){
147
+ $startRec = $JsonReturn->start+$JsonReturn->pageSize;
148
+ $countRec = $JsonReturn->count;
149
+
150
+ foreach ($JsonReturn->values as $value) {
151
+ $IDOrderAnyMarket = $value->idInMarketPlace;
152
+ if (strpos($STATUSIMPORT, $value->status) !== false) {
153
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($IDOrderAnyMarket, 'nmo_id_anymarket');
154
+ if( ($anymarketorders->getData('nmo_status_int') == 'ERROR 01') || ($anymarketorders->getData('nmo_status_int') == 'Não integrado (AnyMarket)') ){
155
+ $anymarketorders->delete();
156
+ }
157
+
158
+ $idAnyMarket = $value->id;
159
+ $this->getSpecificOrderFromAnyMarket($idAnyMarket, $IDOrderAnyMarket, $anymarketorders->getData('nmo_id_order'));
160
+ }
161
+ }
162
+ }else{
163
+ $startRec = 1;
164
+ $countRec = 0;
165
+
166
+ if(!isset($JsonReturn->count)){
167
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
168
+ $anymarketlog->setLogDesc( 'Error on Sinc Orders' );
169
+ $anymarketlog->setLogId('');
170
+ $anymarketlog->setStatus("1");
171
+ $anymarketlog->save();
172
+ }
173
+
174
+ }
175
+ }
176
+ return $arrOrderCod;
177
+
178
+ }
179
+
180
+ /**
181
+ * get specific order from AM
182
+ *
183
+ * @access public
184
+ * @param $idAnyMarket, $IDOrderAnyMarket, $IDOrderMagento
185
+ * @return void
186
+ *
187
+ */
188
+ public function getSpecificOrderFromAnyMarket($idSeqAnyMarket, $IDOrderAnyMarket, $IDOrderMagento){
189
+ $storeID = Mage::app()->getStore()->getId();
190
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
191
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
192
+
193
+ $headers = array(
194
+ "Content-type: application/json",
195
+ "Accept: */*",
196
+ "gumgaToken: ".$TOKEN
197
+ );
198
+
199
+ $stateProds = true;
200
+ $returnOrderItens = $this->CallAPICurl("GET", $HOST."/rest/api/v1/erp/orders/".$idSeqAnyMarket, $headers, null);
201
+ $OrderJSON = $returnOrderItens['return'];
202
+
203
+ if($IDOrderMagento == null){
204
+ $statusMage = $this->getStatusAnyMarketToMageOrderConfig( $OrderJSON->status );
205
+
206
+ if (strpos($statusMage, 'ERROR:') === false) {
207
+ //TRATA OS PRODUTOS
208
+ $_products = array();
209
+ foreach ($OrderJSON->items as $item) {
210
+ $productLoaded = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->skuInClient);
211
+ if($productLoaded){
212
+ $arrayTMP = array(
213
+ 'product' => $productLoaded->getId(),
214
+ 'price' => $item->unitValue,
215
+ 'qty' => $item->amount,
216
+ );
217
+ array_push($_products, $arrayTMP);
218
+ }else{
219
+ $productId = $item->productId;
220
+
221
+ $returnProd = Mage::helper('db1_anymarket')->CallAPICurl("GET", $HOST."/rest/api/v1/products/".$productId, $headers, null);
222
+ $ProdsJSON = $returnProd['return'];
223
+ if($returnProd['error'] == '0'){
224
+ Mage::helper('db1_anymarket/product')->createProducts($ProdsJSON);
225
+
226
+ if($item->skuInClient != null){
227
+ $skuSearch = $item->skuInClient;
228
+ }else{
229
+ $skuSearch = $item->productId;
230
+ }
231
+
232
+ $productLoaded = Mage::getModel('catalog/product')->loadByAttribute('sku', $skuSearch);
233
+ if(!$productLoaded){
234
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
235
+ $anymarketorders->setStatus("0");
236
+ $anymarketorders->setNmoStatusInt('ERROR 01');
237
+ $anymarketorders->setNmoDescError('Erro no produto('.$skuSearch.'), verifique os logs.');
238
+ $anymarketorders->setNmoIdSeqAnymarket($idSeqAnyMarket);
239
+ $anymarketorders->setNmoIdAnymarket( $IDOrderAnyMarket );
240
+ $anymarketorders->setNmoIdOrder('');
241
+ $anymarketorders->setStores(array($storeID));
242
+ $anymarketorders->save();
243
+ $stateProds = false;
244
+ }else{
245
+ $IDProdCrt = $productLoaded->getId();
246
+ $arrayTMP = array(
247
+ 'product' => $IDProdCrt,
248
+ 'price' => $item->unitValue,
249
+ 'qty' => $item->amount,
250
+ );
251
+ array_push($_products, $arrayTMP);
252
+ }
253
+
254
+ }else{
255
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
256
+ $anymarketlog->setLogDesc( 'Error on get product '.$productId );
257
+ $anymarketlog->setLogId( $productId );
258
+ $anymarketlog->setStores(array($storeID));
259
+ $anymarketlog->setStatus("1");
260
+ $anymarketlog->save();
261
+ }
262
+ }
263
+ }
264
+
265
+ //verifica se criou o produto
266
+ if($stateProds){
267
+ //TRATA O CLIENTE
268
+ $document = $OrderJSON->buyer->document;
269
+ if($document != null){
270
+ try{
271
+ $AttrToDoc = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_doc_type_field', $storeID));
272
+ $groupCustomer = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_customer_group_field', $storeID);
273
+
274
+ $email = $OrderJSON->buyer->email->value;
275
+ $customer = Mage::getModel('customer/customer')
276
+ ->getCollection()
277
+ ->addFieldToFilter('website_id', Mage::app()->getWebsite()->getId())
278
+ ->addFieldToFilter($AttrToDoc, $document)->load()->getFirstItem();
279
+
280
+ $AddressShipBill = null;
281
+ if($customer->getId() == null){
282
+ $_DataCustomer = array (
283
+ 'account' => array(
284
+ 'firstname' => $OrderJSON->buyer->name,
285
+ 'lastname' => 'Lastname', //OBRIGATORIO
286
+ 'email' => $email,
287
+ 'taxvat' => '',
288
+ $AttrToDoc => $document,
289
+ 'password' => 'a111111',
290
+ 'default_billing' => '_item1',
291
+ 'default_shipping' => '_item1',
292
+ 'store_id' => $storeID,
293
+ 'website_id' => Mage::app()->getWebsite()->getId(),
294
+ 'group_id' => $groupCustomer,
295
+ ),
296
+ 'address' => array(
297
+ '_item1' => array(
298
+ 'firstname' => $OrderJSON->buyer->name,
299
+ 'lastname' => 'Lastname', //OBRIGATORIO
300
+ 'street' => array(
301
+ 0 => $OrderJSON->shipping->address,
302
+ 1 => '',
303
+ ),
304
+ 'city' => $OrderJSON->shipping->city,
305
+ 'country_id' => 'BR',
306
+ 'region_id' => '12',
307
+ 'region' => $OrderJSON->shipping->state,
308
+ 'postcode' => $OrderJSON->shipping->zipCode,
309
+ 'telephone' => $OrderJSON->buyer->phone,
310
+ ),
311
+ ),
312
+ );
313
+
314
+ $customer = Mage::helper('db1_anymarket/customergenerator')->createCustomer($_DataCustomer);
315
+ }else{
316
+ //PERCORRE OS ENDERECOS PARA VER SE JA HA CADASTRADO O INFORMADO
317
+ $needRegister = true;
318
+ foreach ($customer->getAddresses() as $address){
319
+ if( ($address->postcode == $OrderJSON->shipping->zipCode) && ($address->street == $OrderJSON->shipping->address) ){
320
+ $AddressShipBill = $address;
321
+ $needRegister = false;
322
+ break;
323
+ }
324
+ }
325
+
326
+ //CRIA O ENDERECO CASO NAO TENHA O INFORMADO
327
+ if($needRegister){
328
+ $address = Mage::getModel('customer/address');
329
+
330
+ $addressData = array(
331
+ 'firstname' => $OrderJSON->buyer->name,
332
+ 'lastname' => 'Lastname', //OBRIGATORIO
333
+ 'street' => $OrderJSON->shipping->address,
334
+ 'city' => $OrderJSON->shipping->city,
335
+ 'country_id' => 'BR',
336
+ 'region' => $OrderJSON->shipping->state,
337
+ 'region_id' => '12',
338
+ 'postcode' => $OrderJSON->shipping->zipCode,
339
+ 'telephone' => $OrderJSON->buyer->phone
340
+ );
341
+
342
+ $address->setIsDefaultBilling(1);
343
+ $address->setIsDefaultShipping(1);
344
+ $address->addData($addressData);
345
+ $address->setPostIndex('_item1');
346
+ $customer->addAddress($address);
347
+ $customer->save();
348
+ }
349
+
350
+ }
351
+
352
+ $infoMetPag = 'ANYMARKET';
353
+ foreach ($OrderJSON->payments as $payment) {
354
+ $infoMetPag = $payment->method;
355
+ }
356
+
357
+ if ( $OrderJSON->shipping->zipCode != null ) {
358
+ $OrderIDMage = $this->create_order($_products, $customer, $IDOrderAnyMarket, $idSeqAnyMarket, $infoMetPag, $AddressShipBill, $AddressShipBill, $OrderJSON->shipValue);
359
+ $OrderCheck = Mage::getModel('sales/order')->loadByIncrementId($OrderIDMage);
360
+
361
+ if( $OrderCheck->getId() ){
362
+ $this->changeStatusOrder($OrderJSON, $OrderIDMage);
363
+ }
364
+ }else{
365
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
366
+ $anymarketorders->setStatus("0");
367
+ $anymarketorders->setNmoStatusInt('ERROR 01');
368
+ $anymarketorders->setNmoDescError( 'Venda nao possui um endereço de entrega válido.' );
369
+ $anymarketorders->setNmoIdSeqAnymarket($idSeqAnyMarket);
370
+ $anymarketorders->setNmoIdAnymarket( $IDOrderAnyMarket );
371
+ $anymarketorders->setStores(array($storeID));
372
+ $anymarketorders->setNmoIdOrder('');
373
+ $anymarketorders->save();
374
+ }
375
+ }catch(Exception $e){
376
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
377
+ $anymarketorders->setStatus("0");
378
+ $anymarketorders->setNmoStatusInt('ERROR 01');
379
+ $anymarketorders->setNmoDescError('System: '. $e->getMessage() );
380
+ $anymarketorders->setNmoIdSeqAnymarket($idSeqAnyMarket);
381
+ $anymarketorders->setNmoIdAnymarket( $IDOrderAnyMarket );
382
+ $anymarketorders->setStores(array($storeID));
383
+ $anymarketorders->setNmoIdOrder('');
384
+ $anymarketorders->save();
385
+ }
386
+ }else{
387
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
388
+ $anymarketorders->setStatus("0");
389
+ $anymarketorders->setNmoStatusInt('ERROR 01');
390
+ $anymarketorders->setNmoDescError('Cliente com Documento inválido ou em branco.');
391
+ $anymarketorders->setNmoIdSeqAnymarket($idSeqAnyMarket);
392
+ $anymarketorders->setNmoIdAnymarket( $IDOrderAnyMarket );
393
+ $anymarketorders->setStores(array($storeID));
394
+ $anymarketorders->setNmoIdOrder('');
395
+ $anymarketorders->save();
396
+ }
397
+ }else{
398
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
399
+ $anymarketlog->setLogDesc('Not registered product in magento.');
400
+ $anymarketlog->setLogId( $IDOrderAnyMarket );
401
+ $anymarketlog->setStatus("1");
402
+ $anymarketlog->save();
403
+ }
404
+ }else{
405
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
406
+ $anymarketorders->setStatus("0");
407
+ $anymarketorders->setNmoStatusInt('ERROR 01');
408
+ $anymarketorders->setNmoDescError($statusMage);
409
+ $anymarketorders->setNmoIdSeqAnymarket($idSeqAnyMarket);
410
+ $anymarketorders->setNmoIdAnymarket( $IDOrderAnyMarket );
411
+ $anymarketorders->setNmoIdOrder('');
412
+ $anymarketorders->setStores(array($storeID));
413
+ $anymarketorders->save();
414
+
415
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
416
+ $anymarketlog->setLogDesc( $statusMage );
417
+ $anymarketlog->setLogId( $IDOrderAnyMarket );
418
+ $anymarketlog->setStatus("1");
419
+ $anymarketlog->save();
420
+ }
421
+ }else{
422
+ $this->changeStatusOrder($OrderJSON, $IDOrderMagento);
423
+ }
424
+
425
+ }
426
+
427
+ /**
428
+ * change status order
429
+ *
430
+ * @access private
431
+ * @param $JSON, $IDOrderMagento
432
+ * @return void
433
+ *
434
+ */
435
+ private function changeStatusOrder($JSON, $IDOrderMagento){
436
+ $StatusPedAnyMarket = $JSON->status;
437
+ $statusMage = $this->getStatusAnyMarketToMageOrderConfig( $StatusPedAnyMarket );
438
+
439
+ if (strpos($statusMage, 'ERROR:') === false) {
440
+ $order = Mage::getModel('sales/order')->loadByIncrementId( $IDOrderMagento );
441
+ $itemsarray = null;
442
+ if($JSON->invoice){
443
+ if( $order->canInvoice() ){
444
+ $nfe = $JSON->invoice->accessKey;
445
+ $dateNfe = $JSON->invoice->date;
446
+
447
+ $DateTime = strtotime($dateNfe);
448
+ $fixedDate = date('d/m/Y H:i:s', $DateTime);
449
+
450
+ $orderItems = $order->getAllItems();
451
+ foreach ($orderItems as $_eachItem) {
452
+ $opid = $_eachItem->getId();
453
+ $qty = $_eachItem->getQtyOrdered();
454
+ $itemsarray[$opid] = $qty;
455
+ }
456
+
457
+ if($order->canInvoice()) {
458
+ $nfeString = 'nfe:'.$nfe.', emissao:'.$fixedDate;
459
+ Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(), $itemsarray ,$nfeString ,0,0);
460
+ }
461
+ }
462
+
463
+ }
464
+
465
+ if($JSON->tracking){
466
+ if( $order->canShip() ){
467
+ $TrNumber = $JSON->tracking->number;
468
+ $TrCarrier = strtolower($JSON->tracking->carrier);
469
+
470
+ $shipmentId = Mage::getModel('sales/order_shipment_api')->create($order->getIncrementId(), $itemsarray ,'Create by AnyMarket' ,false,1);
471
+
472
+ $TracCodeArr = Mage::getModel('sales/order_shipment_api')->getCarriers($order->getIncrementId());
473
+ if(isset($TracCodeArr[$TrCarrier]) ){
474
+ $trackmodel = Mage::getModel('sales/order_shipment_api')->addTrack($shipmentId, $TrCarrier, $TrCarrier, $TrNumber);
475
+ }else{
476
+ $arrVar = array_keys($TracCodeArr);
477
+ $trackmodel = Mage::getModel('sales/order_shipment_api')->addTrack($shipmentId, array_shift($arrVar), 'Não Econtrado('.$TrCarrier.')', $TrNumber);
478
+ }
479
+ }
480
+ }
481
+
482
+ if($statusMage == Mage_Sales_Model_Order::STATE_COMPLETE){
483
+ $order->setData('state', "complete");
484
+ $order->setStatus("complete");
485
+ $history = $order->addStatusHistoryComment('Finalizado pelo AnyMarket.', false);
486
+ $history->setIsCustomerNotified(false);
487
+ $order->save();
488
+ }else{
489
+ $order->setState($statusMage, true);
490
+ $order->save();
491
+ }
492
+
493
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($IDOrderMagento, 'nmo_id_order');
494
+ $anymarketorders->setStatus("0");
495
+ $anymarketorders->setNmoStatusInt('Integrado');
496
+ $anymarketorders->setNmoDescError('');
497
+ $anymarketorders->setNmoIdSeqAnymarket( $JSON->id );
498
+ $anymarketorders->setNmoIdAnymarket( $JSON->idInMarketPlace );
499
+ $anymarketorders->setNmoIdOrder($IDOrderMagento);
500
+ $anymarketorders->save();
501
+
502
+ }else{
503
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
504
+ $anymarketlog->setLogDesc( $statusMage );
505
+ $anymarketlog->setLogId( $IDOrderMagento );
506
+ $anymarketlog->setStatus("1");
507
+ $anymarketlog->save();
508
+ }
509
+ }
510
+
511
+ /**
512
+ * get invoice order
513
+ *
514
+ * @access public
515
+ * @param $Order
516
+ * @return array
517
+ *
518
+ */
519
+ public function getInvoiceOrder($Order){
520
+ $nfeID = "";
521
+ $date = "";
522
+ if ($Order->hasInvoices()) {
523
+ foreach ($Order->getInvoiceCollection() as $inv) {
524
+ $invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId( $inv->getIncrementId() );
525
+ foreach ($invoice->getCommentsCollection() as $item) {
526
+ $CommentCurr = $item->getComment();
527
+
528
+ $nfeCount = strpos($CommentCurr, 'nfe:');
529
+ $emissaoCount = strpos($CommentCurr, 'emiss');
530
+ if( (strpos($CommentCurr, 'nfe:') !== false) && (strpos($CommentCurr, 'emiss') !== false) ) {
531
+ $caracts = array("/", "-", ".");
532
+ $nfeTmp = str_replace($caracts, "", $CommentCurr );
533
+ $nfeID = substr( $nfeTmp, $nfeCount+4, 44);
534
+
535
+ $date = substr( $CommentCurr, $emissaoCount+8, 19);
536
+ $dateTmp = str_replace("/", "-", $date );
537
+ $date = gmdate('Y-m-d\TH:i:s\Z', strtotime( $dateTmp ));
538
+ }
539
+ }
540
+ }
541
+ }
542
+
543
+ return array("number" => $nfeID, "date" => $date );
544
+ }
545
+
546
+ /**
547
+ * get tracking order
548
+ *
549
+ * @access public
550
+ * @param $Order
551
+ * @return array
552
+ *
553
+ */
554
+ public function getTrackingOrder($Order){
555
+ $TrackNum = '';
556
+ $TrackCode = '';
557
+ $TrackCreate = '';
558
+ $dateTrack = '';
559
+
560
+ $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
561
+ ->setOrderFilter($Order)
562
+ ->load();
563
+ foreach ($shipmentCollection as $shipment){
564
+ foreach($shipment->getAllTracks() as $tracknum){
565
+ $TrackNum = $tracknum->getNumber();
566
+ $TrackCode = $tracknum->getCarrierCode();
567
+ $TrackCreate = $tracknum->getCreatedAt();
568
+
569
+ $dateTmp = str_replace("/", "-", $TrackCreate );
570
+ $dateTrack = gmdate('Y-m-d\TH:i:s\Z', strtotime( $dateTmp ));
571
+ }
572
+ }
573
+
574
+ return array("number" => $TrackNum, "carrier" => $TrackCode, "date" => $dateTrack, "url" => "");
575
+ }
576
+
577
+ /**
578
+ * update order in AM
579
+ *
580
+ * @access public
581
+ * @param $Order
582
+ * @return void
583
+ *
584
+ */
585
+ public function updateOrderAnyMarket($Order){
586
+ $storeID = Mage::app()->getStore()->getId();
587
+ $ImportOrderSession = Mage::getSingleton('core/session')->getImportOrdersVariable();
588
+ if( $ImportOrderSession != 'false' ) {
589
+ $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
590
+ $idOrder = $Order->getIncrementId();
591
+ $status = $Order->getStatus();
592
+ $anymarketorderupdt = Mage::getModel('db1_anymarket/anymarketorders')->load($idOrder, 'nmo_id_order');
593
+ if( ($ConfigOrder == 0) || ($anymarketorderupdt->getData('nmo_status_int') == 'Integrado') ){
594
+
595
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
596
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
597
+
598
+ $headers = array(
599
+ "Content-type: application/json",
600
+ "Accept: */*",
601
+ "gumgaToken: ".$TOKEN
602
+ );
603
+
604
+ if( ($anymarketorderupdt->getData('nmo_id_order') != null) && ($anymarketorderupdt->getData('nmo_id_anymarket') != null) ){
605
+ $statuAM = $this->getStatusMageToAnyMarketOrderConfig($status);
606
+ if (strpos($statuAM, 'ERROR:') === false) {
607
+ $params = array(
608
+ "status" => $statuAM
609
+ );
610
+
611
+ $invoiceData = $this->getInvoiceOrder($Order);
612
+ $trackingData = $this->getTrackingOrder($Order);
613
+
614
+ if( ($invoiceData['number'] != "") && ($statuAM == 'INVOICED') ){
615
+ $params["invoice"] = $invoiceData;
616
+ }else{
617
+ $params["tracking"] = $trackingData;
618
+ }
619
+
620
+ $IDOrderAnyMarket = $anymarketorderupdt->getData('nmo_id_seq_anymarket');
621
+ $returnOrder = $this->CallAPICurl("PUT", $HOST."/rest/api/v1/erp/orders/".$IDOrderAnyMarket, $headers, $params);
622
+
623
+ if($returnOrder['error'] == '1'){
624
+ $anymarketorderupdt->setStatus("0");
625
+ $anymarketorderupdt->setNmoStatusInt('ERROR 02');
626
+ $anymarketorderupdt->setNmoDescError($returnOrder['return']);
627
+ $anymarketorderupdt->save();
628
+ }
629
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
630
+ $anymarketlog->setLogDesc( $returnOrder['return'] );
631
+ $anymarketlog->setLogId( $idOrder );
632
+ $anymarketlog->setLogJson( $returnOrder['json'] );
633
+ $anymarketlog->setStores(array($storeID));
634
+ $anymarketlog->setStatus("1");
635
+ $anymarketlog->save();
636
+
637
+ }else{
638
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
639
+ $anymarketlog->setStatus("1");
640
+ $anymarketlog->setLogDesc( $statuAM );
641
+ $anymarketlog->setLogId( $idOrder );
642
+ $anymarketlog->setStores(array($storeID));
643
+ $anymarketlog->save();
644
+
645
+ $anymarketorderupdt->setStatus("0");
646
+ $anymarketorderupdt->setNmoStatusInt('ERROR 02');
647
+ $anymarketorderupdt->setNmoDescError( $statuAM );
648
+ $anymarketorderupdt->save();
649
+ }
650
+ }else{
651
+ $this->sendOrderToAnyMarket($idOrder, $HOST, $TOKEN);
652
+ }
653
+ }
654
+ }
655
+
656
+ }
657
+
658
+
659
+ /**
660
+ * send order to AM
661
+ *
662
+ * @access private
663
+ * @param $Order, $HOST, $TOKEN
664
+ * @return void
665
+ *
666
+ */
667
+ private function sendOrderToAnyMarket($idOrder, $HOST, $TOKEN){
668
+ $storeID = Mage::app()->getStore()->getId();
669
+ $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
670
+ if($ConfigOrder == 0){
671
+ $Order = Mage::getModel('sales/order')->setStoreId($storeID)->loadByIncrementId( $idOrder );
672
+
673
+ //TRATA OS ITEMS
674
+ $orderedItems = $Order->getAllVisibleItems();
675
+ $orderedProductIds = array();
676
+
677
+ foreach ($orderedItems as $item) {
678
+ $orderedProductIds[] = array(
679
+ "skuId" => $item->getData('sku'),
680
+ "amount" => $item->getData('qty_ordered'),
681
+ "unitValue" => $item->getData('original_price'),
682
+ "discountValue" => $item->getData('discount_amount')
683
+ );
684
+ }
685
+
686
+ //OBTEM OS DADOS DO PAGAMENTO
687
+ $payment = $Order->getPayment();
688
+
689
+ //OBTEM OS DADOS DA ENTREGA
690
+ $shipping = $Order->getShippingAddress();
691
+
692
+ $docField = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_doc_type_field', $storeID));
693
+ if($Order->getCustomerIsGuest()){
694
+ $customer = Mage::getModel("customer/customer")->load($Order->getCustomerId());
695
+ $docData = $customer->getData( $docField );
696
+ }else{
697
+ $docData = '';
698
+ }
699
+
700
+ $statusOrder = $Order->getStatus();
701
+ if($statusOrder == 'pending'){
702
+ $statuAM = $this->getStatusMageToAnyMarketOrderConfig('new');
703
+ }else{
704
+ $statuAM = $this->getStatusMageToAnyMarketOrderConfig($statusOrder);
705
+ }
706
+
707
+ if( (strpos($statuAM, 'ERROR:') === false) && ($statuAM != '') ) {
708
+ $params = array(
709
+ 'id' => $idOrder,
710
+ "creation" => gmdate('Y-m-d\TH:i:s\Z', strtotime( $Order->getData('created_at') )),
711
+ "status" => $statuAM,
712
+ "statusInMarketplace" => $statuAM,
713
+ "url" => null,
714
+ "shipping" => array(
715
+ "city" => $shipping->getCity(),
716
+ "state" => $shipping->getRegion(),
717
+ "country" => $shipping->getCountry(),
718
+ "address" => $shipping->getStreetFull(), //$shipping->getStreet(4)
719
+ "zipCode" => $shipping->getPostcode()
720
+ ),
721
+ "buyer" => array(
722
+ "id" => '123456',
723
+ "name" => $Order->getCustomerFirstname()." ".$Order->getCustomerLastname(),
724
+ "email" => $Order->getCustomerEmail(),
725
+ "document" => $docData,
726
+ "documentType" => "OTHER",
727
+ "phone" => $shipping->getTelephone(),
728
+ ),
729
+ "items" => $orderedProductIds,
730
+ "payments" => array(
731
+ array(
732
+ "method" => $payment->getMethodInstance()->getTitle(),
733
+ "status" => "Pago",
734
+ "value" => $Order->getBaseGrandTotal()
735
+ ),
736
+ ),
737
+ "discountValue" => $Order->getDiscountAmount(),
738
+ "shipValue" => $Order->getShippingAmount(),
739
+ "grossValue" => $Order->getBaseGrandTotal(),
740
+ "totalValue" => $Order->getBaseGrandTotal()
741
+ );
742
+
743
+ $arrTracking = $this->getTrackingOrder($Order);
744
+ $arrInvoice = $this->getInvoiceOrder($Order);
745
+
746
+ if($arrTracking["number"] != ''){
747
+ $params["tracking"] = $arrTracking;
748
+ };
749
+
750
+ if($arrInvoice["number"] != ''){
751
+ $params["invoice"] = $arrInvoice;
752
+ };
753
+
754
+ $headers = array(
755
+ "Content-type: application/json",
756
+ "Accept: */*",
757
+ "gumgaToken: ".$TOKEN
758
+ );
759
+
760
+ $returnOrder = $this->CallAPICurl("POST", $HOST."/rest/api/v1/ecommerce/orders/", $headers, $params);
761
+
762
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($idOrder, 'nmo_id_order');
763
+ if($anymarketorders->getData('nmo_id_order') == null){
764
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
765
+ }
766
+
767
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
768
+ $anymarketlog->setLogDesc( $returnOrder['return'] );
769
+
770
+ $anymarketorders->setStatus("1");
771
+ if($returnOrder['error'] == '1'){
772
+ $anymarketorders->setNmoStatusInt('ERROR 02');
773
+ $anymarketorders->setNmoDescError($returnOrder['return']);
774
+ }else{
775
+ $retOrderJSON = $returnOrder['return'];
776
+ $anymarketorders->setNmoStatusInt('Integrado');
777
+ $anymarketorders->setNmoDescError('');
778
+ $anymarketorders->setNmoIdAnymarket( $retOrderJSON->marketPlaceId );
779
+ $anymarketorders->setNmoIdSeqAnymarket( $retOrderJSON->id );
780
+
781
+ $anymarketlog->setLogId( $retOrderJSON->marketPlaceId );
782
+ }
783
+
784
+ $anymarketlog->setStores(array(Mage::app()->getStore()->getId()));
785
+ $anymarketlog->setLogJson( $returnOrder['json'] );
786
+ $anymarketlog->setStatus("1");
787
+ $anymarketlog->save();
788
+
789
+ }else{
790
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($idOrder, 'nmo_id_order');
791
+ if($anymarketorders->getData('nmo_id_order') == null){
792
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
793
+ }
794
+
795
+ $anymarketorders->setNmoStatusInt('ERROR 02');
796
+ if($statuAM != ''){
797
+ $anymarketorders->setNmoDescError( $statuAM );
798
+ }else{
799
+ $anymarketorders->setNmoDescError( 'Status new não foi referenciado.' );
800
+ }
801
+ }
802
+
803
+ $anymarketorders->setNmoIdOrder($idOrder);
804
+ $anymarketorders->save();
805
+ }
806
+
807
+ }
808
+
809
+
810
+ /**
811
+ * send order to AM
812
+ *
813
+ * @access public
814
+ * @param $idOrder, $HOST, $TOKEN
815
+ * @return void
816
+ *
817
+ */
818
+ public function listOrdersFromAnyMarketMagento(){
819
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', Mage::app()->getStore()->getId());
820
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', Mage::app()->getStore()->getId());
821
+ $STATUSIMPORT = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_stauts_order_field', Mage::app()->getStore()->getId());
822
+
823
+ $headers = array(
824
+ "Content-type: application/json",
825
+ "Accept: */*",
826
+ "gumgaToken: ".$TOKEN
827
+ );
828
+
829
+ $startRec = 0;
830
+ $countRec = 1;
831
+ $arrOrderCod = null;
832
+
833
+ $contPed = 0;
834
+ while ($startRec <= $countRec) {
835
+ $returnOrder = $this->CallAPICurl("GET", $HOST."/rest/api/v1/erp/orders/?start=".$startRec."&pageSize=30", $headers, null);
836
+ $JsonReturn = $returnOrder['return'];
837
+
838
+ $startRec = $JsonReturn->start+$JsonReturn->pageSize;
839
+ $countRec = $JsonReturn->count;
840
+
841
+ foreach ($JsonReturn->values as $value) {
842
+ $IDOrderAnyMarket = $value->idInMarketPlace;
843
+
844
+ if (strpos($STATUSIMPORT, $value->status) !== false) {
845
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($IDOrderAnyMarket, 'nmo_id_anymarket');
846
+ if($anymarketorders->getData('nmo_id_anymarket') == null){
847
+ $idAnyMarket = $value->id;
848
+
849
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
850
+ $anymarketorders->setStatus("0");
851
+ $anymarketorders->setNmoStatusInt('Não integrado (AnyMarket)');
852
+ $anymarketorders->setNmoDescError('');
853
+ $anymarketorders->setNmoIdSeqAnymarket($idAnyMarket);
854
+ $anymarketorders->setNmoIdAnymarket( $IDOrderAnyMarket );
855
+ $anymarketorders->setNmoIdOrder('');
856
+ $anymarketorders->save();
857
+
858
+ $contPed = $contPed+1;
859
+ }
860
+
861
+ }
862
+ }
863
+ }
864
+
865
+ $salesCollection = Mage::getModel("sales/order")->getCollection();
866
+ foreach($salesCollection as $order){
867
+ $orderId = $order->getIncrementId();
868
+
869
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($orderId, 'nmo_id_order');
870
+ if($anymarketorders->getData('nmo_id_order') == null){
871
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
872
+ $anymarketorders->setStatus("0");
873
+ $anymarketorders->setNmoStatusInt('Não integrado (Magento)');
874
+ $anymarketorders->setNmoDescError('');
875
+ $anymarketorders->setNmoIdSeqAnymarket('');
876
+ $anymarketorders->setNmoIdAnymarket('');
877
+ $anymarketorders->setNmoIdOrder( $orderId );
878
+ $anymarketorders->save();
879
+
880
+ $contPed = $contPed+1;
881
+ }
882
+ }
883
+
884
+ return $contPed;
885
+
886
+ }
887
+
888
+ }
app/code/community/DB1/AnyMarket/Helper/Ordergenerator.php ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Helper_OrderGenerator extends DB1_AnyMarket_Helper_Data
4
+ {
5
+ const CUSTOMER_RANDOM = null;
6
+
7
+ protected $_shippingMethod = 'freeshipping_freeshipping';
8
+ protected $_AdditionalInformation = 'anymarket';
9
+ protected $_paymentMethod = 'cashondelivery';
10
+ protected $_shippingDescription = 'À Combinar - A forma de entrega será definida no momento do fechamento do pedido.'; //ALTERADO POR JOSE EDUARDO
11
+ protected $_billing = null;
12
+ protected $_shipping = null;
13
+ protected $_shippingValue = 0;
14
+
15
+ protected $_customer = self::CUSTOMER_RANDOM;
16
+
17
+ protected $_subTotal = 0;
18
+ protected $_order;
19
+ public $_storeId;
20
+
21
+ public function setShippingValue($value)
22
+ {
23
+ $this->_shippingValue = $value;
24
+ }
25
+
26
+ public function setShippingMethod($methodName)
27
+ {
28
+ $this->_shippingMethod = $methodName;
29
+ }
30
+
31
+ public function setPaymentMethod($methodName)
32
+ {
33
+ $this->_paymentMethod = $methodName;
34
+ }
35
+
36
+ public function setBillAddress($billing)
37
+ {
38
+ $this->_billing = $billing;
39
+ }
40
+
41
+ public function setShipAddress($shipping)
42
+ {
43
+ $this->_shipping = $shipping;
44
+ }
45
+
46
+ public function setAdditionalInformation($addInfo)
47
+ {
48
+ $this->_AdditionalInformation = $addInfo;
49
+ }
50
+
51
+ public function setShippingDescription($shippingDesc)
52
+ {
53
+ $this->_shippingDescription = $shippingDesc;
54
+ }
55
+
56
+ /**
57
+ * set customer of order
58
+ *
59
+ * @access public
60
+ * @param $custome
61
+ * @return void
62
+ *
63
+ */
64
+ public function setCustomer($customer)
65
+ {
66
+ if ($customer instanceof Mage_Customer_Model_Customer){
67
+ $this->_customer = $customer;
68
+ }
69
+ if (is_numeric($customer)){
70
+ $this->_customer = Mage::getModel('customer/customer')->load($customer);
71
+ }
72
+ else if ($customer === self::CUSTOMER_RANDOM){
73
+ $customers = Mage::getResourceModel('customer/customer_collection');
74
+
75
+ $customers
76
+ ->getSelect()
77
+ ->limit(1)
78
+ ->order('RAND()');
79
+
80
+ $id = $customers->getFirstItem()->getId();
81
+
82
+ $this->_customer = Mage::getModel('customer/customer')->load($id);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * create order in MG
88
+ *
89
+ * @access public
90
+ * @param $products
91
+ * @return string
92
+ *
93
+ */
94
+ public function createOrder($products)
95
+ {
96
+ if (!($this->_customer instanceof Mage_Customer_Model_Customer)){
97
+ $this->setCustomer(self::CUSTOMER_RANDOM);
98
+ }
99
+
100
+ $transaction = Mage::getModel('core/resource_transaction');
101
+
102
+ if(!$this->_storeId){
103
+ $this->_storeId = $this->_customer->getStoreId();
104
+ }
105
+
106
+ $reservedOrderId = Mage::getSingleton('eav/config')
107
+ ->getEntityType('order')
108
+ ->fetchNewIncrementId($this->_storeId);
109
+
110
+ $currencyCode = Mage::app()->getBaseCurrencyCode();
111
+ $this->_order = Mage::getModel('sales/order')
112
+ ->setIncrementId($reservedOrderId)
113
+ ->setStoreId($this->_storeId)
114
+ ->setQuoteId(0)
115
+ ->setDiscountAmount(0)
116
+ ->setShippingAmount((float)$this->_shippingValue)//
117
+ ->setShippingTaxAmount(0)
118
+ ->setBaseDiscountAmount(0)
119
+ ->setIsVirtual(0)
120
+ ->setBaseShippingAmount(0)
121
+ ->setBaseShippingTaxAmount(0)
122
+ ->setBaseTaxAmount(0)
123
+ ->setBaseToGlobalRate(1)
124
+ ->setBaseToOrderRate(1)
125
+ ->setStoreToBaseRate(1)
126
+ ->setStoreToOrderRate(1)
127
+ ->setTaxAmount(0)//
128
+ ->setGlobalCurrencyCode($currencyCode)
129
+ ->setBaseCurrencyCode($currencyCode)
130
+ ->setStoreCurrencyCode($currencyCode)
131
+ ->setOrderCurrencyCode($currencyCode);
132
+
133
+
134
+ $this->_order->setCustomerEmail($this->_customer->getEmail())
135
+ ->setCustomerFirstname($this->_customer->getFirstname())
136
+ ->setCustomerLastname($this->_customer->getLastname())
137
+ ->setCustomerGroupId($this->_customer->getGroupId())
138
+ ->setCustomerIsGuest(0)
139
+ ->setCustomer($this->_customer);
140
+
141
+ if($this->_billing == null){
142
+ $billing = $this->_customer->getDefaultBillingAddress();
143
+ }else{
144
+ $billing = $this->_billing;
145
+ }
146
+
147
+ $billingAddress = Mage::getModel('sales/order_address')
148
+ ->setStoreId($this->_storeId)
149
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
150
+ ->setCustomerId($this->_customer->getId())
151
+ ->setCustomerAddressId($this->_customer->getDefaultBilling())
152
+ ->setCustomerAddress_id($billing->getEntityId())
153
+ ->setPrefix($billing->getPrefix())
154
+ ->setFirstname($billing->getFirstname())
155
+ ->setMiddlename($billing->getMiddlename())
156
+ ->setLastname($billing->getLastname())
157
+ ->setSuffix($billing->getSuffix())
158
+ ->setCompany($billing->getCompany())
159
+ ->setStreet($billing->getStreet())
160
+ ->setCity($billing->getCity())
161
+ ->setCountry_id($billing->getCountryId())
162
+ ->setRegion($billing->getRegion())
163
+ ->setRegion_id($billing->getRegionId())
164
+ ->setPostcode($billing->getPostcode())
165
+ ->setTelephone($billing->getTelephone())
166
+ ->setFax($billing->getFax());
167
+ $this->_order->setBillingAddress($billingAddress);
168
+
169
+ if($this->_shipping == null){
170
+ $shipping = $this->_customer->getDefaultShippingAddress();
171
+ }else{
172
+ $shipping = $this->_shipping;
173
+ }
174
+ $shippingAddress = Mage::getModel('sales/order_address')
175
+ ->setStoreId($this->_storeId)
176
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
177
+ ->setCustomerId($this->_customer->getId())
178
+ ->setCustomerAddressId($this->_customer->getDefaultShipping())
179
+ ->setCustomer_address_id($shipping->getEntityId())
180
+ ->setPrefix($shipping->getPrefix())
181
+ ->setFirstname($shipping->getFirstname())
182
+ ->setMiddlename($shipping->getMiddlename())
183
+ ->setLastname($shipping->getLastname())
184
+ ->setSuffix($shipping->getSuffix())
185
+ ->setCompany($shipping->getCompany())
186
+ ->setStreet($shipping->getStreet())
187
+ ->setCity($shipping->getCity())
188
+ ->setCountry_id($shipping->getCountryId())
189
+ ->setRegion($shipping->getRegion())
190
+ ->setRegion_id($shipping->getRegionId())
191
+ ->setPostcode($shipping->getPostcode())
192
+ ->setTelephone($shipping->getTelephone())
193
+ ->setFax($shipping->getFax());
194
+
195
+ $this->_order->setShippingAddress($shippingAddress)
196
+ ->setShippingMethod($this->_shippingMethod)
197
+ ->setShippingDescription($this->_shippingDescription); //ALTERADO POR JOSE EDUARDO
198
+
199
+ $orderPayment = Mage::getModel('sales/order_payment')
200
+ ->setStoreId($this->_storeId)
201
+ ->setCustomerPaymentId(0)
202
+ ->setMethod($this->_paymentMethod)
203
+ ->setAdditionalInformation('metodo', $this->_AdditionalInformation)
204
+ ->setPoNumber(' – ');
205
+
206
+ $this->_order->setPayment($orderPayment);
207
+
208
+ $this->_addProducts($products);
209
+
210
+ $this->_order->setSubtotal($this->_subTotal)
211
+ ->setBaseSubtotal($this->_subTotal)
212
+ ->setGrandTotal( (float)$this->_subTotal+(float)$this->_shippingValue )
213
+ ->setBaseGrandTotal($this->_subTotal);
214
+
215
+ $transaction->addObject($this->_order);
216
+ $transaction->addCommitCallback(array($this->_order, 'place'));
217
+ $transaction->addCommitCallback(array($this->_order, 'save'));
218
+ $transaction->save();
219
+
220
+ return $reservedOrderId;
221
+ }
222
+
223
+ /**
224
+ * add products in order
225
+ *
226
+ * @access protected
227
+ * @param $products
228
+ * @return void
229
+ *
230
+ */
231
+ protected function _addProducts($products)
232
+ {
233
+ $this->_subTotal = 0;
234
+
235
+ foreach ($products as $productRequest) {
236
+ if ($productRequest['product'] == 'rand') {
237
+
238
+ $productsCollection = Mage::getResourceModel('catalog/product_collection');
239
+ $productsCollection->addFieldToFilter('type_id', 'simple');
240
+
241
+ Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($productsCollection);
242
+
243
+ $productsCollection->getSelect()
244
+ ->order('RAND()')
245
+ ->limit(rand($productRequest['min'], $productRequest['max']));
246
+
247
+ foreach ($productsCollection as $product){
248
+ $this->_addProduct(array(
249
+ 'product' => $product->getId(),
250
+ 'qty' => rand(1, 2)
251
+ ));
252
+ }
253
+ }
254
+ else {
255
+ $this->_addProduct($productRequest);
256
+ }
257
+ }
258
+ }
259
+
260
+ /**
261
+ * add product in order
262
+ *
263
+ * @access protected
264
+ * @param $requestData
265
+ * @return array
266
+ *
267
+ */
268
+ protected function _addProduct($requestData)
269
+ {
270
+ $request = new Varien_Object();
271
+ $request->setData($requestData);
272
+
273
+ $product = Mage::getModel('catalog/product')->load($request['product']);
274
+
275
+
276
+ $cartCandidates = $product->getTypeInstance(true)
277
+ ->prepareForCartAdvanced($request, $product);
278
+
279
+ if (is_string($cartCandidates)) {
280
+ throw new Exception($cartCandidates);
281
+ }
282
+
283
+ if (!is_array($cartCandidates)) {
284
+ $cartCandidates = array($cartCandidates);
285
+ }
286
+
287
+ $parentItem = null;
288
+ $errors = array();
289
+ $items = array();
290
+ foreach ($cartCandidates as $candidate) {
291
+
292
+ $item = $this->_productToOrderItem($candidate, $candidate->getCartQty(), $request['price']);
293
+
294
+ $items[] = $item;
295
+
296
+ /**
297
+ * As parent item we should always use the item of first added product
298
+ */
299
+ if (!$parentItem) {
300
+ $parentItem = $item;
301
+ }
302
+ if ($parentItem && $candidate->getParentProductId()) {
303
+ $item->setParentItem($parentItem);
304
+ }
305
+ /**
306
+ * We specify qty after we know about parent (for stock)
307
+ */
308
+ $item->setQty($item->getQty() + $candidate->getCartQty());
309
+
310
+ // collect errors instead of throwing first one
311
+ if ($item->getHasError()) {
312
+ $message = $item->getMessage();
313
+ if (!in_array($message, $errors)) { // filter duplicate messages
314
+ $errors[] = $message;
315
+ }
316
+ }
317
+ }
318
+ if (!empty($errors)) {
319
+ Mage::throwException(implode("\n", $errors));
320
+ }
321
+
322
+ foreach ($items as $item){
323
+ $this->_order->addItem($item);
324
+ }
325
+
326
+ return $items;
327
+ }
328
+
329
+ /**
330
+ * add product in order
331
+ *
332
+ * @access protected
333
+ * @param $product, $qty, $price
334
+ * @return order object
335
+ *
336
+ */
337
+ function _productToOrderItem(Mage_Catalog_Model_Product $product, $qty = 1, $price)
338
+ {
339
+
340
+ if($price){
341
+ $finalPrice = $price;
342
+ }else{
343
+ $finalPrice = $product->getFinalPrice();
344
+ }
345
+
346
+ $rowTotal = $finalPrice * $qty;
347
+
348
+ $options = $product->getCustomOptions();
349
+
350
+ $optionsByCode = array();
351
+
352
+ foreach ($options as $option)
353
+ {
354
+ $quoteOption = Mage::getModel('sales/quote_item_option')->setData($option->getData())
355
+ ->setProduct($option->getProduct());
356
+
357
+ $optionsByCode[$quoteOption->getCode()] = $quoteOption;
358
+ }
359
+
360
+ $product->setCustomOptions($optionsByCode);
361
+
362
+ // DECREMENTE O STOCK
363
+ $stockItem =Mage::getModel('cataloginventory/stock_item')->loadByProduct( $product->getId() );
364
+ if( $stockItem->getManageStock() ){
365
+ $stockItem->setData('qty', $stockItem->getQty()-$product['qty']);
366
+ }
367
+ $stockItem->save();
368
+
369
+ $options = $product->getTypeInstance(true)->getOrderOptions($product);
370
+
371
+ $orderItem = Mage::getModel('sales/order_item')
372
+ ->setStoreId($this->_storeId)
373
+ ->setQuoteItemId(0)
374
+ ->setQuoteParentItemId(NULL)
375
+ ->setProductId($product->getId())
376
+ ->setProductType($product->getTypeId())
377
+ ->setQtyBackordered(NULL)
378
+ ->setTotalQtyOrdered($product['rqty'])
379
+ ->setQtyOrdered($product['qty'])
380
+ ->setName($product->getName())
381
+ ->setSku($product->getSku())
382
+ ->setPrice( $finalPrice )
383
+ ->setBasePrice( $finalPrice )
384
+ ->setOriginalPrice( $finalPrice )
385
+ ->setRowTotal($rowTotal)
386
+ ->setBaseRowTotal($rowTotal)
387
+
388
+ ->setWeeeTaxApplied(serialize(array()))
389
+ ->setBaseWeeeTaxDisposition(0)
390
+ ->setWeeeTaxDisposition(0)
391
+ ->setBaseWeeeTaxRowDisposition(0)
392
+ ->setWeeeTaxRowDisposition(0)
393
+ ->setBaseWeeeTaxAppliedAmount(0)
394
+ ->setBaseWeeeTaxAppliedRowAmount(0)
395
+ ->setWeeeTaxAppliedAmount(0)
396
+ ->setWeeeTaxAppliedRowAmount(0)
397
+
398
+ ->setProductOptions($options);
399
+
400
+ $this->_subTotal += $rowTotal;
401
+
402
+ return $orderItem;
403
+ }
404
+ }
app/code/community/DB1/AnyMarket/Helper/Product.php ADDED
@@ -0,0 +1,1311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Helper_Product extends DB1_AnyMarket_Helper_Data
4
+ {
5
+ private function checkArrayAttributes($arrAttr, $key, $value){
6
+ foreach ($arrAttr as $arrVal) {
7
+ if( $arrVal[$key] == $value ){
8
+ return true;
9
+ }
10
+ }
11
+ return false;
12
+ }
13
+
14
+ public function getConfigs($IDStore){
15
+ $ConfigsReturn = array(
16
+ "REQUIRED_NBM" => Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_NBM_required_field', $IDStore),
17
+ "REQUIRED_EAN" => Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_EAN_required_field', $IDStore),
18
+
19
+ "brand" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_brand_field', $IDStore),
20
+ "model" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_model_field', $IDStore),
21
+
22
+ "volume_comprimento" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_comp_field', $IDStore),
23
+ "volume_altura" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_alt_field', $IDStore),
24
+ "volume_largura" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_larg_field', $IDStore),
25
+ "video_url" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_video_url_field', $IDStore),
26
+ "nbm" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_nbm_field', $IDStore),
27
+ "nbm_origin" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_nbm_origin_field', $IDStore),
28
+ "ean" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_ean_field', $IDStore),
29
+ "warranty_text" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_warranty_text_field', $IDStore),
30
+ "warranty_time" => Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_warranty_time_field', $IDStore)
31
+ );
32
+
33
+ return $ConfigsReturn;
34
+ }
35
+
36
+ public function getFullDescription($product){
37
+ $ConfigDescProd = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_desc_field', Mage::app()->getStore()->getId());
38
+ $descComplete = "";
39
+ if ($ConfigDescProd && $ConfigDescProd != 'a:0:{}') {
40
+ $ConfigDescProd = unserialize($ConfigDescProd);
41
+ if (is_array($ConfigDescProd)) {
42
+ foreach($ConfigDescProd as $ConfigDescProdRow) {
43
+ $descComplete .= $product->getData( $ConfigDescProdRow['descProduct'] ).' ';
44
+ }
45
+ }
46
+ }else{
47
+ $descComplete = $product->getDescription();
48
+ }
49
+
50
+ return trim($descComplete);
51
+ }
52
+
53
+ //GERA LOG DOS PRODUTOS
54
+ public function saveLogsProds($returnProd, $product){
55
+ $storeID = Mage::app()->getStore()->getId();
56
+ $anymarketproductsUpdt = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($product->getId(), 'nmp_id');
57
+
58
+ if(is_array($anymarketproductsUpdt->getData('store_id'))){
59
+ $arrValuesProds = array_values($anymarketproductsUpdt->getData('store_id'));
60
+ $StoreIDAmProd = array_shift($arrValuesProds);
61
+ }else{
62
+ $StoreIDAmProd = $anymarketproductsUpdt->getData('store_id');
63
+ }
64
+
65
+ $returnMet = "";
66
+ if($returnProd['error'] == '1'){ //RETORNOU ERRO
67
+
68
+ $JSONError = $returnProd['return'];
69
+ if( ($anymarketproductsUpdt->getData('nmp_sku') == null) || ($StoreIDAmProd != $storeID) ){
70
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
71
+ $anymarketproducts->setNmpId( $product->getId() );
72
+ $anymarketproducts->setNmpSku( $product->getSku() );
73
+ $anymarketproducts->setNmpName( $product->getName() );
74
+ $anymarketproducts->setNmpDescError( $returnProd['return'] );
75
+ $anymarketproducts->setNmpStatusInt("Erro");
76
+ $anymarketproducts->setStatus("1");
77
+ $anymarketproducts->setStores(array($storeID));
78
+ $anymarketproducts->save();
79
+ }else{
80
+ $anymarketproductsUpdt->setNmpId( $product->getId() );
81
+ $anymarketproductsUpdt->setNmpSku( $product->getSku() );
82
+ $anymarketproductsUpdt->setNmpName( $product->getName() );
83
+ $anymarketproductsUpdt->setNmpDescError( $returnProd['return'] );
84
+ $anymarketproductsUpdt->setNmpStatusInt("Erro");
85
+ $anymarketproductsUpdt->setStatus("1");
86
+ $anymarketproductsUpdt->setStores(array($storeID));
87
+ $anymarketproductsUpdt->save();
88
+ }
89
+
90
+ $URL = Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit', array('id' => $product->getId() ));
91
+ $this->addMessageInBox('Erro ao sincronizar produtos AnyMarket', $returnProd['return'], $URL);
92
+ $returnMet = $returnProd['return'];
93
+ }else{ //FOI BEM SUCEDIDO
94
+ if($anymarketproductsUpdt->getData('nmp_sku') == null){
95
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
96
+ $anymarketproducts->setNmpId( $product->getId() );
97
+ $anymarketproducts->setNmpSku( $product->getSku() );
98
+ $anymarketproducts->setNmpName( $product->getName() );
99
+ $anymarketproducts->setNmpDescError("");
100
+ $anymarketproducts->setNmpStatusInt("Integrado");
101
+ $anymarketproducts->setStatus("1");
102
+ $anymarketproducts->setStores(array($storeID));
103
+ $anymarketproducts->save();
104
+ }else{
105
+ $anymarketproductsUpdt->setNmpId( $product->getId() );
106
+ $anymarketproductsUpdt->setNmpSku( $product->getSku() );
107
+ $anymarketproductsUpdt->setNmpName( $product->getName() );
108
+ $anymarketproductsUpdt->setNmpDescError("");
109
+ $anymarketproductsUpdt->setNmpStatusInt("Integrado");
110
+ $anymarketproductsUpdt->setStatus("1");
111
+ $anymarketproductsUpdt->setStores(array($storeID));
112
+ $anymarketproductsUpdt->save();
113
+ }
114
+
115
+ $returnMet = $returnProd['return'];
116
+ }
117
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
118
+ if(is_array($returnMet)){
119
+ $anymarketlog->setLogDesc( json_encode($returnMet) );
120
+ }else{
121
+ $anymarketlog->setLogDesc( $returnMet );
122
+ }
123
+
124
+ $anymarketlog->setLogId( $product->getSku() );
125
+ if(is_array($returnProd['json'])){
126
+ $anymarketlog->setLogJson( json_encode($returnProd['json']) );
127
+ }else{
128
+ $anymarketlog->setLogJson( $returnProd['json'] );
129
+ }
130
+
131
+ $anymarketlog->setStatus("1");
132
+ $anymarketlog->setStores(array($storeID));
133
+ $anymarketlog->save();
134
+ }
135
+
136
+ private function compareArrayImage($var_1, $var_2){
137
+ $arrayReturn = array();
138
+ foreach ($var_1 as $value_1) {
139
+ $hSamVal = false;
140
+ foreach ($var_2 as $value_2) {
141
+ $ArrtratValue1 = explode("_", $value_1['ctrl']);
142
+ $ArrtratValue2 = explode("_", $value_2['ctrl']);
143
+
144
+ $tratval1 = array_values($ArrtratValue1);
145
+ $tratValue1 = array_shift($tratval1);
146
+ $tratval2 = array_values($ArrtratValue2);
147
+ $tratValue2 = array_shift($tratval2);
148
+ if( $tratValue1 == $tratValue2 ){
149
+ $hSamVal = true;
150
+ break;
151
+ }
152
+ }
153
+ if(!$hSamVal){
154
+ $arrayReturn[] = $value_1;
155
+ }
156
+ }
157
+ return $arrayReturn;
158
+ }
159
+
160
+ //CRIA PRODUTO CONFIG MG - TODO
161
+ private function create_configurable_product($dataProdConfig, $simpleProducts, $AttributeIds){
162
+ $productGenerator = Mage::helper('db1_anymarket/productgenerator');
163
+ $product = $productGenerator->createConfigurableProduct($dataProdConfig, $simpleProducts, $AttributeIds);
164
+
165
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Configurable product Created');
166
+ $returnProd['error'] = '0';
167
+ $returnProd['json'] = '';
168
+ $this->saveLogsProds($returnProd, $product);
169
+
170
+ return $product;
171
+ }
172
+
173
+ //UPDATE PRODUTO CONFIG MG - TODO
174
+ private function update_configurable_product($idProd, $dataProdConfig, $simpleProducts, $AttributeIds){
175
+ $productGenerator = Mage::helper('db1_anymarket/productgenerator');
176
+ $product = $productGenerator->updateConfigurableProduct($idProd, $dataProdConfig, $simpleProducts, $AttributeIds);
177
+
178
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Configurable product Updated');
179
+ $returnProd['error'] = '0';
180
+ $returnProd['json'] = '';
181
+ $this->saveLogsProds($returnProd, $product);
182
+
183
+ return $product;
184
+ }
185
+
186
+ //CRIA PRODUTO SIMPLES MG
187
+ function create_simple_product($data){
188
+ $productGenerator = Mage::helper('db1_anymarket/productgenerator');
189
+ $product = $productGenerator->createSimpleProduct($data);
190
+
191
+ if(!$product){
192
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Simple product Created');
193
+ $returnProd['error'] = '0';
194
+ $returnProd['json'] = '';
195
+ $this->saveLogsProds($returnProd, $product);
196
+ }
197
+
198
+ return $product;
199
+ }
200
+
201
+ public function procAttrConfig($attrCode, $attrVal, $typeProc){
202
+ $_product = Mage::getModel('catalog/product');
203
+ $attr = $_product->getResource()->getAttribute($attrCode);
204
+
205
+ if($attr){
206
+ if ($attr->usesSource()) {
207
+ if($typeProc == 0){
208
+ $returnAttr = $attr->getSource()->getOptionId((string)$attrVal);
209
+ if($returnAttr){
210
+ return $returnAttr;
211
+ }else{
212
+ return $attrVal;
213
+ }
214
+ }else{
215
+ $returnAttr = $attr->getSource()->getOptionText($attrVal);
216
+ if($returnAttr){
217
+ return $returnAttr;
218
+ }else{
219
+ return $attrVal;
220
+ }
221
+ }
222
+ }else{
223
+ return $attrVal;
224
+ }
225
+ }else{
226
+ return $attrVal;
227
+ }
228
+
229
+ }
230
+
231
+ //ATUALIZA AS IMAGENS DE UM PROD
232
+ public function update_image_product($Prod, $ProdsJSON, $idClient){
233
+ $mediaApi = Mage::getModel("catalog/product_attribute_media_api");
234
+ $items = $mediaApi->items($Prod->getId());
235
+ $imagesGalleryMG = array();
236
+ foreach($items as $item) {
237
+ $crltImg = basename($item['file']);
238
+ $crltImg = str_replace(strrchr($crltImg,"."), "", $crltImg);
239
+ $imagesGalleryMG[] = array('ctrl' => $crltImg, 'img' => $item['url'], 'file' => $item['file'] );
240
+ }
241
+
242
+ $imagesGalleryAM = array();
243
+ foreach ($ProdsJSON->photos as $image) {
244
+ $crltImgAM = basename($image->original);
245
+ $crltImgAM = str_replace(strrchr($crltImgAM,"."), "", $crltImgAM);
246
+ $imagesGalleryAM[] = array('ctrl' => md5($crltImgAM . $idClient), 'img' => $image->standard_resolution, 'main' => $image->main);
247
+ }
248
+
249
+ //COMPARA IMG AM COM MG SE TIVER DIVERGENCIA ADD NO PRODUTO
250
+ $diffAM = $this->compareArrayImage($imagesGalleryAM, $imagesGalleryMG);
251
+ if ($diffAM) {
252
+ foreach ($diffAM as $diffAM_value) {
253
+ $imagesGallery[] = array('img' => $diffAM_value['img'], 'main' => $diffAM_value['main']);
254
+ }
255
+
256
+ $dataImgs = array('images' => $imagesGallery, 'sku' => $idClient);
257
+ $productGenerator = Mage::helper('db1_anymarket/productgenerator');
258
+ $productGenerator->updateImages($Prod, $dataImgs);
259
+ }
260
+
261
+ //COMPARA IMG AM COM MG SE TIVER DIVERCIA REMOVE DO PRODUTO
262
+ $diffMG = $this->compareArrayImage($imagesGalleryMG, $imagesGalleryAM);
263
+ if ($diffMG) {
264
+ foreach ($diffMG as $diffMG_value) {
265
+ $mediaApi->remove($Prod->getId(), $diffMG_value['file']);
266
+ //remover arquivo fisicamente
267
+ }
268
+ }
269
+ }
270
+
271
+ //ENVIA PRODUTO PARA O ANYMARKET
272
+ public function sendProductToAnyMarket($idProduct){
273
+ //obter configuracoes
274
+ $storeID = Mage::app()->getStore()->getId();
275
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load($idProduct);
276
+
277
+ //Obtem os parametros dos attr para subir para o AM
278
+ $brand = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_brand_field', $storeID);
279
+ $model = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_model_field', $storeID);
280
+
281
+ $volume_comprimento = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_comp_field', $storeID);
282
+ $volume_altura = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_alt_field', $storeID);
283
+ $volume_largura = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_larg_field', $storeID);
284
+ $video_url = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_video_url_field', $storeID);
285
+ $nbm = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_nbm_field', $storeID);
286
+ $nbm_origin = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_nbm_origin_field', $storeID);
287
+ $ean = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_ean_field', $storeID);
288
+ $warranty_text = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_warranty_text_field', $storeID);
289
+ $warranty_time = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_warranty_time_field', $storeID);
290
+
291
+ $arrProd = array();
292
+ // verifica categoria null ou em branco
293
+ $categProd = $product->getData('categoria_anymarket');
294
+ if($categProd == null || $categProd == ''){
295
+ array_push($arrProd, 'AnyMarket_Category');
296
+ }
297
+
298
+ // verifica Origin null ou em branco
299
+ $originData = $this->procAttrConfig($nbm_origin, $product->getData( $nbm_origin ), 1);
300
+ if($originData == null || $originData == ''){
301
+ array_push($arrProd, 'AnyMarket_Origin');
302
+ }
303
+
304
+ //trata para nao enviar novamente solicitacao quando o erro for o mesmo
305
+ if( ($product->getData('id_anymarket') == '') || ($product->getData('id_anymarket') == '0') ){
306
+ $prodErrorCtrl = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)
307
+ ->load($product->getId(), 'nmp_id');
308
+ if( $prodErrorCtrl->getData('nmp_id') != null ){
309
+ $descError = $prodErrorCtrl->getData('nmp_desc_error');
310
+
311
+ // Trata para nao ficar disparando em cima da Duplicadade de SKU
312
+ $mesgDuplSku = strrpos($descError, "Duplicidade de SKU:");
313
+ if ($mesgDuplSku !== false) {
314
+ $oldSkuErr = $this->getBetweenCaract($descError, '"', '"');
315
+
316
+ if($oldSkuErr == $product->getSku()){
317
+ array_push($arrProd, 'Duplicidade de SKU: '.Mage::helper('db1_anymarket')->__('Already existing SKU in anymarket').' "'.$oldSkuErr.'".');
318
+ }
319
+ }
320
+ }
321
+ }
322
+
323
+ if( !empty($arrProd) ){
324
+ $returnProd['error'] = '1';
325
+ $returnProd['json'] = '';
326
+
327
+ $emptyFields = ' ';
328
+ foreach ($arrProd as $field) {
329
+ $emptyFields .= $field.', ';
330
+ }
331
+
332
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Product with inconsistency:').$emptyFields;
333
+ $this->saveLogsProds($returnProd, $product);
334
+
335
+ return false;
336
+ }else{
337
+ $arrProd = array();
338
+
339
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
340
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
341
+
342
+ $REQUIRED_NBM = Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_NBM_required_field', $storeID);
343
+ $REQUIRED_EAN = Mage::getStoreConfig('anymarket_section/anymarket_general_group/anymarket_EAN_required_field', $storeID);
344
+
345
+ $MassUnit = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_weight_field', $storeID);
346
+
347
+ //verifica se o produto e configurable
348
+ $confID = "";
349
+ $Weight = "";
350
+ if($product->getTypeID() == "configurable"){
351
+ $confID = $product->getId();
352
+ }else{
353
+ // verifica se é um simples pertecente a um Configurable
354
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
355
+ $Weight = $product->getWeight();
356
+ if (isset($parentIds[0])) {
357
+ $confID = $parentIds[0];
358
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load($confID);
359
+ }
360
+ }
361
+
362
+
363
+ //obtem os produtos configs - verifica se e configurable
364
+ $ArrSimpleConfigProd = array();
365
+ $ArrayVariations = array();
366
+ if($confID != ""){
367
+ $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
368
+ $attributesConf = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
369
+
370
+ //obter as variacoes
371
+ $attrs = $product->getTypeInstance(true)->getConfigurableAttributesAsArray($product);
372
+ foreach($attrs as $attr) {
373
+ $ArrayVariations[] = array(
374
+ "id" => null,
375
+ "name" => $attr['label']
376
+ );
377
+ }
378
+
379
+ foreach($childProducts as $child) {
380
+ $SimpleConfigProd = Mage::getModel('catalog/product')->load( $child->getId() );
381
+
382
+ if($Weight == ""){
383
+ $Weight = $SimpleConfigProd->getWeight();
384
+ }
385
+
386
+ //obtem as imagens do produto
387
+ $galleryDataSimp = $SimpleConfigProd->getMediaGalleryImages();
388
+ $itemsIMGSimp = array();
389
+ foreach($galleryDataSimp as $g_imageSimp) {
390
+ $infoImg = getimagesize($g_imageSimp['url']);
391
+ $imgSize = filesize($g_imageSimp['path']);
392
+
393
+ if( (float)$infoImg[0] < 400 || (float)$infoImg[1] < 400 || $imgSize > 4100000 ){
394
+ array_push($arrProd, 'Image('.$g_imageSimp['url'].')');
395
+ }else{
396
+ $itemsIMGSimp[] = $g_imageSimp['url'];
397
+ }
398
+ }
399
+
400
+ //obtem os atributos
401
+ $ArrVariationValues = array();
402
+ $qtyStore = $this->getAllStores();
403
+ if(count($qtyStore) > 1){
404
+ $storeIDAttrVar = $storeID;
405
+ }else{
406
+ $fArr = array_shift($qtyStore);
407
+ $storeIDAttrVar = $fArr['store_id'];
408
+ }
409
+ foreach ($attributesConf as $attribute){
410
+ $options = Mage::getResourceModel('eav/entity_attribute_option_collection');
411
+ $valuesAttr = $options->setAttributeFilter($attribute['attribute_id'])
412
+ ->setStoreFilter($storeIDAttrVar)
413
+ ->toOptionArray();
414
+
415
+ foreach ($valuesAttr as $value){
416
+ $childValue = $child->getData($attribute['attribute_code']);
417
+ if ($value['value'] == $childValue){
418
+ $ArrVariationValues[$attribute['store_label']] = $value['label'];
419
+ }
420
+ }
421
+ }
422
+
423
+ $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
424
+ $stkPrice = $SimpleConfigProd->getData($filter);
425
+ // verificacao dos dados de price
426
+ if(($stkPrice == null) || ($stkPrice == '') || ((float)$stkPrice <= 0)){
427
+ array_push($arrProd, 'Price');
428
+ }
429
+
430
+ $simpConfProdSku = $SimpleConfigProd->getSku();
431
+ // verificacao dos dados de SKU
432
+ $cValid = array('-', '_');
433
+ if(!ctype_alnum(str_replace($cValid, '', $simpConfProdSku))) {
434
+ array_push($arrProd, 'SKU');
435
+ }
436
+
437
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($SimpleConfigProd);
438
+ $ArrSimpleConfigProd[] = array(
439
+ "urlImages" => $itemsIMGSimp,
440
+ "variationValues" => $ArrVariationValues,
441
+ "stockPrice" => $stkPrice,
442
+ "stockAmount" => $stock->getQty(),
443
+ "ean" => $SimpleConfigProd->getData($ean),
444
+ "id" => null,
445
+ "title" => $SimpleConfigProd->getName(),
446
+ "idProduct" => null,
447
+ "internalId" => $simpConfProdSku,
448
+ );
449
+
450
+ }
451
+
452
+ }
453
+
454
+ //obtem as imagens do produto
455
+ $itemsIMG = array();
456
+ $galleryData = $product->getMediaGalleryImages();
457
+ foreach($galleryData as $g_image) {
458
+ $infoImg = getimagesize($g_image['url']);
459
+ $imgSize = filesize($g_image['path']);
460
+
461
+ if( (float)$infoImg[0] < 400 || (float)$infoImg[1] < 400 || $imgSize > 4100000 ){
462
+ array_push($arrProd, 'Image('.$g_image['url'].')');
463
+ }else{
464
+ $itemsIMG[] = $g_image['url'];
465
+ }
466
+ }
467
+
468
+ //ajusta o array de skus
469
+ if( count($ArrSimpleConfigProd) <= 0 ){
470
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
471
+
472
+ $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
473
+ $stkPrice = $product->getData($filter);
474
+
475
+ // verificacao dos dados de price
476
+ if(($stkPrice == null) || ($stkPrice == '') || ((float)$stkPrice <= 0)){
477
+ array_push($arrProd, 'Price');
478
+ }
479
+
480
+ $prodSkuJ = $product->getSku();
481
+
482
+ // verificacao dos dados de SKU
483
+ $cValid = array('-', '_');
484
+ if(!ctype_alnum(str_replace($cValid, '', $prodSkuJ))) {
485
+ array_push($arrProd, 'SKU');
486
+ }
487
+
488
+ $ArrSimpleConfigProd[] = array(
489
+ "urlImages" => null,
490
+ "variationValues" => null,
491
+ "stockPrice" => $stkPrice,
492
+ "stockAmount" => $stock->getQty(),
493
+ "ean" => $product->getData( $ean ), //esse
494
+ "id" => null,
495
+ "title" => $product->getName(),
496
+ "idProduct" => null,
497
+ "internalId" => $prodSkuJ,
498
+ );
499
+
500
+ $ArrayVariations = null;
501
+ }
502
+
503
+ $Requiredean = $REQUIRED_EAN != '1' ? 'false' : 'true';
504
+ $Requirednbm = $REQUIRED_NBM != '1' ? 'false' : 'true';
505
+
506
+ //cria os headers
507
+ $headers = array(
508
+ "Content-type: application/json",
509
+ "Cache-Control: no-cache",
510
+ "create_brand: true",
511
+ "crop_title: false",
512
+ "ignore_invalid_ean: ".$Requiredean,
513
+ "create_category: true",
514
+ "require_nbm: ".$Requirednbm,
515
+ "gumgaToken: ".$TOKEN
516
+ );
517
+
518
+ $idProductAnyMarket = null;
519
+ if($product->getData('id_anymarket') != ""){
520
+ $idProductAnyMarket = $product->getData('id_anymarket');
521
+ }
522
+
523
+
524
+ //cria os custom attributes
525
+ $attributeSetModel = Mage::getModel("eav/entity_attribute_set");
526
+ $attributeSetModel->load($product->getAttributeSetId());
527
+ $attributeSetName = $attributeSetModel->getAttributeSetId();
528
+
529
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
530
+ ->setAttributeSetFilter($attributeSetName)
531
+ ->getItems();
532
+
533
+ $ArrAttributes = array();
534
+ $contIndexAttr = 0;
535
+ foreach ($attributes as $attribute){
536
+ $attrCheck = Mage::getModel('db1_anymarket/anymarketattributes')->load($attribute->getAttributeId(), 'nma_id_attr');
537
+ if($attrCheck->getData('nma_id_attr') != null){
538
+ if($attrCheck->getData('status') == 1){
539
+ if( ($attribute->getAttributeCode() != $brand) && ($attribute->getAttributeCode() != $model) ){
540
+ if(!$this->checkArrayAttributes($ArrAttributes, "name", $attribute->getFrontendLabel())){
541
+ if($confID == ""){
542
+ $ArrAttributes[] = array("index" => $contIndexAttr, "name" => $attribute->getFrontendLabel(), "value" => $this->procAttrConfig($attribute->getAttributeCode(), $product->getData( $attribute->getAttributeCode() ), 1));
543
+ $contIndexAttr = $contIndexAttr+1;
544
+ }else{
545
+ foreach ($attributesConf as $attributeConf){
546
+ if(!in_array($attribute->getAttributeCode(), $attributeConf)){
547
+ if(!$this->checkArrayAttributes($ArrAttributes, "name", $attribute->getFrontendLabel())){
548
+ $ArrAttributes[] = array("index" => $contIndexAttr, "name" => $attribute->getFrontendLabel(), "value" => $this->procAttrConfig($attribute->getAttributeCode(), $product->getData( $attribute->getAttributeCode() ), 1));
549
+ $contIndexAttr = $contIndexAttr+1;
550
+ }
551
+ }
552
+ }
553
+ }
554
+ }
555
+ }
556
+ }
557
+ }
558
+ }
559
+
560
+ //busca a categoria
561
+ $anymarketCat = Mage::getModel('db1_anymarket/anymarketcategories')->load($product->getData('categoria_anymarket'), 'nmc_cat_id');
562
+ $catString = $anymarketCat->getData('nmc_cat_desc');
563
+
564
+ //Cria os params
565
+ $param = array(
566
+ 'id' => $idProductAnyMarket,
567
+ 'title' => $product->getName(),
568
+ 'description' => $this->getFullDescription($product),//$product->getDescription(),
569
+ 'nbm' => $this->procAttrConfig($nbm, $product->getData( $nbm ), 1),
570
+ 'nbmOrigin' => $this->procAttrConfig($nbm_origin, $product->getData( $nbm_origin ), 1),
571
+ "category" => array(
572
+ "id" => $product->getData('categoria_anymarket'),
573
+ "name" => $catString
574
+ ),
575
+ "brand" => array(
576
+ "id" => null,
577
+ "name" => $this->procAttrConfig($brand, $product->getData( $brand ), 1)
578
+ ),
579
+ "model" => array(
580
+ "id" => null,
581
+ "name" => $this->procAttrConfig($model, $product->getData( $model ), 1)
582
+ ),
583
+ "videoURL" => $this->procAttrConfig($video_url, $product->getData( $video_url ), 1),
584
+ "warrantyText" => $this->procAttrConfig($warranty_text, $product->getData( $warranty_text ), 1),
585
+ "warrantyTime" => $this->procAttrConfig($warranty_time, $product->getData( $warranty_time ), 1),
586
+ "weight" => $MassUnit == 0 ? $Weight/1 : $Weight/1000,
587
+ "height" => $this->procAttrConfig($volume_altura, $product->getData( $volume_altura ), 1),
588
+ "width" => $this->procAttrConfig($volume_largura, $product->getData( $volume_largura ), 1),
589
+ "length" => $this->procAttrConfig($volume_comprimento, $product->getData( $volume_comprimento ), 1),
590
+ "urlImages" => $itemsIMG,
591
+ // OBTER ATRIBUTOS CUSTOM
592
+ "attributes" => $ArrAttributes,
593
+ "skus" => $ArrSimpleConfigProd,
594
+ "variations" => $ArrayVariations
595
+ );
596
+
597
+ if( !empty($arrProd) ){
598
+ $returnProd['error'] = '1';
599
+ $returnProd['json'] = '';
600
+
601
+ $emptyFields = ' ';
602
+ foreach ($arrProd as $field) {
603
+ $emptyFields .= $field.', ';
604
+ }
605
+
606
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Product with inconsistency:').$emptyFields;
607
+ $this->saveLogsProds($returnProd, $product);
608
+
609
+ return false;
610
+ }else{
611
+ if( ($product->getData('id_anymarket') == '') || ($product->getData('id_anymarket') == '0') ){
612
+ $returnProd = $this->CallAPICurl("POST", $HOST."/rest/api/v1/products/", $headers, $param);
613
+
614
+ $IDinAnymarket = '0';
615
+ if($returnProd['error'] != '1'){
616
+ $SaveLog = $returnProd['return'];
617
+ $IDinAnymarket = json_encode($SaveLog->id);
618
+
619
+ if($IDinAnymarket != '0'){
620
+ $product->setIdAnymarket($IDinAnymarket);
621
+ }
622
+ $product->save();
623
+
624
+ if($product->getTypeID() == "configurable"){
625
+ $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
626
+
627
+ foreach($childProducts as $child) {
628
+ $productC = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $child->getId() );
629
+
630
+ if($productC->getIntegraAnymarket() != '1'){
631
+ $productC->setIntegraAnymarket('1');
632
+ }
633
+ if($IDinAnymarket != '0'){
634
+ $productC->setIdAnymarket($IDinAnymarket);
635
+ }
636
+ $productC->save();
637
+ }
638
+ }
639
+
640
+ if($IDinAnymarket != '0'){
641
+ $returnProd['error'] = '0';
642
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Successfully synchronized product.');
643
+ $this->saveLogsProds($returnProd, $product);
644
+ }else{
645
+ $returnProd['error'] = '1';
646
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Error synchronizing, code anymarket invalid.');
647
+ $this->saveLogsProds($returnProd, $product);
648
+ }
649
+
650
+ }else{
651
+ $this->saveLogsProds($returnProd, $product);
652
+ }
653
+
654
+ }else{
655
+ $returnProd = $this->CallAPICurl("PUT", $HOST."/rest/api/v1/products/".$product->getData('id_anymarket'), $headers, $param);
656
+
657
+ if($returnProd['error'] == '0'){
658
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Product Updated');
659
+ }
660
+
661
+ $this->saveLogsProds($returnProd, $product);
662
+ }
663
+ return true;
664
+ }
665
+ }
666
+
667
+ }
668
+
669
+ //OBTEM APENAS OS PRODUTOS QUE SOFRERAM MODIFICACOES
670
+ public function getFeedProdsFromAnyMarket(){
671
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', Mage::app()->getStore()->getId());
672
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', Mage::app()->getStore()->getId());
673
+
674
+ $headers = array(
675
+ "Content-type: application/json",
676
+ "Accept: */*",
677
+ "gumgaToken: ".$TOKEN
678
+ );
679
+
680
+ $returnProd = $this->CallAPICurl("GET", "http://sandbox-api.anymarket.com.br/v2/products/feeds/", $headers, null);
681
+
682
+ if($returnProd['error'] == '1'){
683
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
684
+ $anymarketlog->setLogDesc( Mage::helper('db1_anymarket')->__('Error on get feed products '). $returnProd['return'] );
685
+ $anymarketlog->setStatus("1");
686
+ $anymarketlog->save();
687
+ }else{
688
+ $listProds = $returnProd['return'];
689
+ foreach ($listProds as $product) {
690
+ $this->getSpecificProductAnyMarket($product->id);
691
+ }
692
+ }
693
+
694
+ }
695
+
696
+ //OBTEM OS PRODUTOS DO AM
697
+ public function getProdsFromAnyMarket(){
698
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', Mage::app()->getStore()->getId());
699
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', Mage::app()->getStore()->getId());
700
+
701
+ $headers = array(
702
+ "Content-type: application/json",
703
+ "Accept: */*",
704
+ "gumgaToken: ".$TOKEN
705
+ );
706
+
707
+ $startRec = 0;
708
+ $countRec = 1;
709
+ $arrOrderCod = null;
710
+
711
+ Mage::getSingleton('core/session')->setImportProdsVariable('false');
712
+ $cont = 0;
713
+ while ($startRec <= $countRec) {
714
+ $returnProd = $this->CallAPICurl("GET", $HOST."/rest/api/v1/products/?start=".$startRec."&pageSize=30", $headers, null);
715
+
716
+ if($returnProd['error'] == '1'){
717
+ $startRec = 1;
718
+ $countRec = 0;
719
+
720
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
721
+ $anymarketlog->setLogDesc( Mage::helper('db1_anymarket')->__('Error on import products from anymarket '). $returnProd['return'] );
722
+ $anymarketlog->setStatus("1");
723
+ $anymarketlog->save();
724
+ }else{
725
+ $ProdsJSON = $returnProd['return'];
726
+
727
+ $startRec = $ProdsJSON->pageable->start + $ProdsJSON->pageable->pageSize;
728
+ $countRec = $ProdsJSON->total;
729
+
730
+ foreach ($ProdsJSON->content as $product) {
731
+ $this->getSpecificProductAnyMarket($product->id);
732
+
733
+ $cont = $cont+1;
734
+ }
735
+ }
736
+ }
737
+ Mage::getSingleton('core/session')->setImportProdsVariable('true');
738
+
739
+ return $cont;
740
+ }
741
+
742
+ //OBTEM UM ITEM ESPECIFICO DO AM
743
+ public function getSpecificProductAnyMarket($IDProd){
744
+ $storeID = Mage::app()->getStore()->getId();
745
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
746
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
747
+
748
+ $headers = array(
749
+ "Content-type: application/json",
750
+ "Accept: */*",
751
+ "gumgaToken: ".$TOKEN
752
+ );
753
+
754
+ $productCreated = null;
755
+ $returnProdSpecific = $this->CallAPICurl("GET", $HOST."/rest/api/v1/products/".$IDProd, $headers, null);
756
+ if($returnProdSpecific['error'] == '0'){
757
+ $productCreated = $this->createProducts($returnProdSpecific['return']);
758
+
759
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
760
+ $anymarketlog->setLogDesc( Mage::helper('db1_anymarket')->__('Product Created') );
761
+ $anymarketlog->setLogId();
762
+ $anymarketlog->setStatus("1");
763
+ $anymarketlog->setStores(array($storeID));
764
+ $anymarketlog->save();
765
+ }else{
766
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
767
+ $anymarketlog->setLogDesc( $returnProdSpecific['return'] );
768
+ $anymarketlog->setLogId( $IDProd );
769
+ $anymarketlog->setStatus("1");
770
+ $anymarketlog->setStores(array($storeID));
771
+ $anymarketlog->save();
772
+
773
+ $anymarketproductsUpdt = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($IDProd, 'nmp_id');
774
+ $anymarketproductsUpdt->setNmpDescError( $returnProdSpecific['return'] );
775
+ $anymarketproductsUpdt->setNmpStatusInt("Erro");
776
+ $anymarketproductsUpdt->save();
777
+ }
778
+
779
+ return $productCreated;
780
+ }
781
+
782
+
783
+ //CRIA PRODUTO NO MG
784
+ public function createProducts($ProdsJSON){
785
+ $ProdCrt = null;
786
+ $storeID = Mage::app()->getStore()->getId();
787
+ $websiteID = Mage::getModel('core/store')->load($storeID)->getWebsiteId();
788
+
789
+ $priceField = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
790
+
791
+ $brand = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_brand_field', $storeID);
792
+ $model = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_model_field', $storeID);
793
+
794
+ $MassUnit = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_weight_field', $storeID);
795
+
796
+ $volume_comprimento = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_comp_field', $storeID);
797
+ $volume_altura = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_alt_field', $storeID);
798
+ $volume_largura = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_vol_larg_field', $storeID);
799
+ $video_url = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_video_url_field', $storeID);
800
+ $nbm = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_nbm_field', $storeID);
801
+ $nbm_origin = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_nbm_origin_field', $storeID);
802
+ $ean = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_ean_field', $storeID);
803
+ $warranty_text = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_warranty_text_field', $storeID);
804
+ $warranty_time = Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_warranty_time_field', $storeID);
805
+
806
+ //PROD CONFIGURABLE
807
+ if ( !empty( $ProdsJSON->variations ) ) {
808
+ $prodSimpleFromConfig = array();
809
+ $AttributeIds = array();
810
+ $AttributeOptions = array();
811
+
812
+ $variationArray = array();
813
+ $sinc = '';
814
+ foreach ($ProdsJSON->variations as $variation) {
815
+ $variationArray[$variation->id] = strtolower($variation->name);
816
+ $AttrCtlr = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', strtolower($variation->name));
817
+ if(!$AttrCtlr->getData()){
818
+ $sinc = strtolower($variation->name);
819
+ break;
820
+ }
821
+ }
822
+
823
+ if($sinc == ''){
824
+ foreach ($ProdsJSON->skus as $sku) {
825
+ $IDSKUProd = $sku->idInClient != null ? $sku->idInClient : $sku->idProduct;
826
+ $ProdCrt = '';
827
+ $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $IDSKUProd);
828
+
829
+ foreach ($sku->variations as $varValues) {
830
+ $descVar = $varValues->description;
831
+ $idVar = $varValues->variationTypeId;
832
+ }
833
+
834
+ $imagesGallery = array();
835
+ foreach ($ProdsJSON->photos as $image) {
836
+ if( $image->variationValue != null ){
837
+ if( $image->variationValue->description == $descVarAttr ){
838
+ $imagesGallery[] = array('img' => $image->standard_resolution, 'main' => $image->main);
839
+ break;
840
+ }
841
+ }
842
+ }
843
+
844
+ if(!$product){
845
+ $AttributeId = Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product', $variationArray[ $idVar ]);
846
+ if (!in_array($AttributeId, $AttributeIds)) {
847
+ $AttributeIds[] = $AttributeId;
848
+ $collectionAttr = Mage::getResourceModel('eav/entity_attribute_option_collection')
849
+ ->setPositionOrder('asc')
850
+ ->setAttributeFilter($AttributeId)
851
+ ->setStoreFilter(0)
852
+ ->load();
853
+
854
+ $AttributeOptions[$idVar] = $collectionAttr->toOptionArray();
855
+
856
+ }
857
+
858
+ $varAttr = '';
859
+ $descVarAttr = '';
860
+ foreach ( $AttributeOptions[$idVar] as $attrOpt) {
861
+ if($attrOpt['label'] == $descVar ){
862
+ $varAttr = $attrOpt['value'];
863
+ $descVarAttr = $attrOpt['label'];
864
+ break;
865
+ }
866
+ }
867
+
868
+ if($varAttr != ''){
869
+ $dataPrd = array(
870
+ 'type_id' => 'simple',
871
+ 'sku' => $IDSKUProd,
872
+ 'name' => $sku->title,
873
+ 'description' => $sku->title,
874
+ 'short_description' => $sku->title,
875
+ $priceField => $sku->price,
876
+ 'created_at' => strtotime('now'),
877
+ 'updated_at' => strtotime('now'),
878
+ 'id_anymarket' => $sku->idProduct,
879
+ 'weight' => $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight,
880
+ 'store_id' => $storeID,
881
+ 'website_ids' => array($websiteID),
882
+ $brand => $ProdsJSON->brand != null ? $this->procAttrConfig($brand, $ProdsJSON->brand->name, 0) : null,
883
+ $model => $this->procAttrConfig($model, $ProdsJSON->model, 0),
884
+ $video_url => $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0),
885
+ $volume_comprimento => $this->procAttrConfig($volume_comprimento, $ProdsJSON->length, 0),
886
+ $volume_altura => $this->procAttrConfig($volume_altura, $ProdsJSON->height, 0),
887
+ $volume_largura => $this->procAttrConfig($volume_largura, $ProdsJSON->width, 0),
888
+ $warranty_time => $this->procAttrConfig($warranty_time, $ProdsJSON->warrantyTime, 0),
889
+ $nbm => $this->procAttrConfig($nbm, $ProdsJSON->nbm, 0),
890
+ $nbm_origin => $this->procAttrConfig($nbm_origin, $ProdsJSON->originCode, 0),
891
+ $ean => $this->procAttrConfig($ean, $sku->ean, 0),
892
+ $warranty_text => $this->procAttrConfig($warranty_text, $ProdsJSON->warranty, 0),
893
+ 'msrp_enabled' => '2',
894
+ 'categoria_anymarket' => $ProdsJSON->category->id,
895
+ $variationArray[ $idVar ] => $varAttr,
896
+ );
897
+
898
+ foreach ($ProdsJSON->attributes as $attrProd) {
899
+ $dataPrd[ strtolower($attrProd->name) ] = $this->procAttrConfig(strtolower($attrProd->name), $attrProd->value, 0);
900
+ }
901
+
902
+ $dataPrdSimple = array(
903
+ 'product' => $dataPrd,
904
+ 'stock_item' => array(
905
+ 'is_in_stock' => $sku->stockAmount > 0 ? '1' : '0',
906
+ 'qty' => $sku->stockAmount,
907
+ ),
908
+ 'images' => $imagesGallery,
909
+ );
910
+
911
+ $ProdReturn = $this->create_simple_product($dataPrdSimple);
912
+ $ProdCrt = $ProdReturn->getEntityId();
913
+
914
+ }else{
915
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
916
+ $anymarketlog->setLogDesc( 'Opção de variação sem correspondente no magento ('.$variationArray[ $idVar ].') - '.$descVar );
917
+ $anymarketlog->setStatus("1");
918
+ $anymarketlog->setStores(array($storeID));
919
+ $anymarketlog->save();
920
+ }
921
+ }else{
922
+ //Atualiza Imagens
923
+ $this->update_image_product($product, $ProdsJSON, $IDSKUProd);
924
+
925
+ $webSiteIds = $product->getWebsiteIds();
926
+ if(!in_array($websiteID, $webSiteIds)){
927
+ array_push($webSiteIds, $websiteID);
928
+ $product->setWebsiteIds( $webSiteIds );
929
+ }
930
+
931
+ $product->setDescription( $sku->title );
932
+ $product->setShortDescription( $sku->title );
933
+ $product->setData('weight', $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight);
934
+
935
+ $product->setData($priceField, $sku->price);
936
+ $product->setData($brand, $ProdsJSON->brand != null ? $this->procAttrConfig($brand, $ProdsJSON->brand->name, 0) : null);
937
+ $product->setData($model, $this->procAttrConfig($model, $ProdsJSON->model, 0));
938
+ $product->setData($video_url, $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0));
939
+ $product->setData($volume_comprimento, $this->procAttrConfig($volume_comprimento, $ProdsJSON->length, 0));
940
+ $product->setData($volume_altura, $this->procAttrConfig($volume_altura, $ProdsJSON->height, 0));
941
+ $product->setData($volume_largura, $this->procAttrConfig($volume_largura, $ProdsJSON->width, 0));
942
+ $product->setData($warranty_time, $this->procAttrConfig($warranty_time, $ProdsJSON->warrantyTime, 0));
943
+ $product->setData($nbm, $this->procAttrConfig($nbm, $ProdsJSON->nbm, 0));
944
+ $product->setData($nbm_origin, $this->procAttrConfig($nbm_origin, $ProdsJSON->originCode, 0));
945
+ $product->setData($ean, $this->procAttrConfig($ean, $sku->ean, 0));
946
+ $product->setData($warranty_text, $this->procAttrConfig($warranty_text, $ProdsJSON->warranty, 0));
947
+ $product->setData('id_anymarket', $sku->idProduct);
948
+ $product->setData('categoria_anymarket', $ProdsJSON->category->id);
949
+
950
+ foreach ($ProdsJSON->attributes as $attrProd) {
951
+ $product->setData( strtolower($attrProd->name), $this->procAttrConfig(strtolower($attrProd->name), $attrProd->value, 0));
952
+ }
953
+
954
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
955
+ $stockItem->setData('is_in_stock', $ProdsJSON->skus[0]->stockAmount > 0 ? '1' : '0');
956
+ $stockItem->setData('qty', $ProdsJSON->skus[0]->stockAmount);
957
+ $stockItem->save();
958
+
959
+
960
+ $product->save();
961
+
962
+ $ProdCrt = $product->getId();
963
+ }
964
+
965
+ if($ProdCrt != ''){
966
+ $prodSimpleFromConfig[] = array('AttributeText' => $variationArray[ $idVar ], 'Id' => $ProdCrt);
967
+ $ProdCrt = '';
968
+ }
969
+ }
970
+
971
+ $prods = Mage::getModel('catalog/product')->getCollection()
972
+ ->addFieldToFilter('type_id', 'configurable')
973
+ ->addFieldToFilter('id_anymarket', $ProdsJSON->id);
974
+
975
+ $imagesGallery = array();
976
+ foreach ($ProdsJSON->photos as $image) {
977
+ $imagesGallery[] = array('img' => $image->standard_resolution, 'main' => $image->main);
978
+ }
979
+
980
+ if( !$prods->getData() ){
981
+ if($prodSimpleFromConfig){
982
+ $dataProdConfig = array(
983
+ 'stock' => '0',
984
+ 'price' => '0',
985
+ 'name' => $ProdsJSON->title,
986
+ 'short' => $ProdsJSON->description,
987
+ 'description' => $ProdsJSON->description,
988
+ 'brand' => '',
989
+ 'sku' => $ProdsJSON->id,
990
+ 'id_anymarket' => $ProdsJSON->id,
991
+ 'categoria_anymarket' => $ProdsJSON->category->id,
992
+ 'images' => $imagesGallery
993
+ );
994
+
995
+ $ProdCrt = $this->create_configurable_product($dataProdConfig, $prodSimpleFromConfig, $AttributeIds);
996
+ }
997
+ }else{
998
+ $dataProdConfig = array(
999
+ 'stock' => '0',
1000
+ 'price' => '0',
1001
+ 'name' => $ProdsJSON->title,
1002
+ 'short' => $ProdsJSON->description,
1003
+ 'description' => $ProdsJSON->description,
1004
+ 'brand' => '',
1005
+ 'sku' => $ProdsJSON->id,
1006
+ 'id_anymarket' => $ProdsJSON->id,
1007
+ 'categoria_anymarket' => $ProdsJSON->category->id
1008
+ );
1009
+
1010
+ foreach($prods as $prod) {
1011
+ $IdProdConfig = $prod->getId();
1012
+ }
1013
+
1014
+ $ProdCrt = $IdProdConfig;
1015
+ $this->update_configurable_product($ProdCrt, $dataProdConfig, $prodSimpleFromConfig, $AttributeIds);
1016
+ }
1017
+ }else{
1018
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
1019
+ $anymarketlog->setLogDesc( 'Variação sem correspondente no magento ('.utf8_decode($sinc).') - Produto: '.$ProdsJSON->id);
1020
+ $anymarketlog->setStatus("1");
1021
+ $anymarketlog->setStores(array($storeID));
1022
+ $anymarketlog->save();
1023
+ }
1024
+ // PROD SIMPLES
1025
+ }else{
1026
+ foreach ($ProdsJSON->skus as $ProdJSON) {
1027
+ $skuProd = $ProdJSON;
1028
+ }
1029
+
1030
+ $imagesGallery = array();
1031
+ foreach ($ProdsJSON->photos as $image) {
1032
+ $imagesGallery[] = array('img' => $image->standard_resolution, 'main' => $image->main);
1033
+ }
1034
+
1035
+ $IDSkuJsonProd = $skuProd->idInClient != null ? $skuProd->idInClient : $skuProd->idProduct;
1036
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $IDSkuJsonProd);
1037
+ foreach ($ProdsJSON->skus as $sku) {
1038
+ $skuEan = $sku->ean;
1039
+ }
1040
+
1041
+ if(!$product){
1042
+ $dataPrd = array(
1043
+ 'type_id' => 'simple',
1044
+ 'sku' => $IDSkuJsonProd,
1045
+ 'name' => $skuProd->title,
1046
+ 'description' => $ProdsJSON->description,
1047
+ 'short_description' => $ProdsJSON->description,
1048
+ $priceField => $skuProd->price,
1049
+ 'created_at' => strtotime('now'),
1050
+ 'updated_at' => strtotime('now'),
1051
+ 'id_anymarket' => $ProdsJSON->id,
1052
+ 'weight' => $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight,
1053
+ 'store_id' => $storeID,
1054
+ 'website_ids' => array($websiteID),
1055
+ $brand => $ProdsJSON->brand != null ? $this->procAttrConfig($brand, $ProdsJSON->brand->name, 0) : null,
1056
+ $model => $this->procAttrConfig($model, $ProdsJSON->model, 0),
1057
+ $video_url => $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0),
1058
+ $volume_comprimento => $this->procAttrConfig($volume_comprimento, $ProdsJSON->length, 0),
1059
+ $volume_altura => $this->procAttrConfig($volume_altura, $ProdsJSON->height, 0),
1060
+ $volume_largura => $this->procAttrConfig($volume_largura, $ProdsJSON->width, 0),
1061
+ $warranty_time => $this->procAttrConfig($warranty_time, $ProdsJSON->warrantyTime, 0),
1062
+ $nbm => $this->procAttrConfig($nbm, $ProdsJSON->nbm, 0),
1063
+ $nbm_origin => $this->procAttrConfig($nbm_origin, $ProdsJSON->originCode, 0),
1064
+ $ean => $this->procAttrConfig($ean, $skuEan, 0),
1065
+ $warranty_text => $this->procAttrConfig($warranty_text, $ProdsJSON->warranty, 0),
1066
+ 'msrp_enabled' => '2',
1067
+ 'categoria_anymarket' => $ProdsJSON->category->id,
1068
+ );
1069
+
1070
+ foreach ($ProdsJSON->attributes as $attrProd) {
1071
+ $dataPrd[ strtolower($attrProd->name) ] = $this->procAttrConfig(strtolower($attrProd->name), $attrProd->value, 0);
1072
+ }
1073
+
1074
+ $data = array(
1075
+ 'product' => $dataPrd,
1076
+ 'stock_item' => array(
1077
+ 'is_in_stock' => $skuProd->stockAmount > 0 ? '1' : '0',
1078
+ 'qty' => $skuProd->stockAmount,
1079
+ ),
1080
+ 'images' => $imagesGallery,
1081
+
1082
+ );
1083
+ $ProdCrt = $this->create_simple_product($data);
1084
+ }else{
1085
+ //Atualiza Imagens
1086
+ $this->update_image_product($product, $ProdsJSON, $IDSkuJsonProd);
1087
+
1088
+ $webSiteIds = $product->getWebsiteIds();
1089
+ if(!in_array($websiteID, $webSiteIds)){
1090
+ array_push($webSiteIds, $websiteID);
1091
+ $product->setWebsiteIds( $webSiteIds );
1092
+ }
1093
+
1094
+ $product->setDescription( $ProdsJSON->description );
1095
+ $product->setShortDescription( $ProdsJSON->description );
1096
+ $product->setData('weight', $MassUnit == 1 ? $ProdsJSON->weight*1000 : $ProdsJSON->weight);
1097
+
1098
+ $product->setData($brand, $ProdsJSON->brand != null ? $this->procAttrConfig($brand, $ProdsJSON->brand->name, 0) : null);
1099
+ $product->setData($model, $this->procAttrConfig($model, $ProdsJSON->model, 0));
1100
+ $product->setData($video_url, $this->procAttrConfig($video_url, $ProdsJSON->videoURL, 0));
1101
+ $product->setData($volume_comprimento, $this->procAttrConfig($volume_comprimento, $ProdsJSON->length, 0));
1102
+ $product->setData($volume_altura, $this->procAttrConfig($volume_altura, $ProdsJSON->height, 0));
1103
+ $product->setData($volume_largura, $this->procAttrConfig($volume_largura, $ProdsJSON->width, 0));
1104
+ $product->setData($warranty_time, $this->procAttrConfig($warranty_time, $ProdsJSON->warrantyTime, 0));
1105
+ $product->setData($nbm, $this->procAttrConfig($nbm, $ProdsJSON->nbm, 0));
1106
+ $product->setData($nbm_origin, $this->procAttrConfig($nbm_origin, $ProdsJSON->originCode, 0));
1107
+ $product->setData($ean, $this->procAttrConfig($ean, $skuEan, 0));
1108
+ $product->setData($warranty_text, $this->procAttrConfig($warranty_text, $ProdsJSON->warranty, 0));
1109
+ $product->setData('id_anymarket', $ProdsJSON->id);
1110
+ $product->setData('categoria_anymarket', $ProdsJSON->category->id);
1111
+
1112
+ foreach ($ProdsJSON->attributes as $attrProd) {
1113
+ $product->setData( strtolower($attrProd->name), $this->procAttrConfig(strtolower($attrProd->name), $attrProd->value, 0));
1114
+ }
1115
+
1116
+ $product->setData($priceField, $skuProd->price);
1117
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
1118
+ $stockItem->setData('is_in_stock', $skuProd->stockAmount > 0 ? '1' : '0');
1119
+ $stockItem->setData('qty', $skuProd->stockAmount);
1120
+ $stockItem->save();
1121
+
1122
+ $product->save();
1123
+
1124
+ $ProdCrt = $product;
1125
+ }
1126
+
1127
+ }
1128
+
1129
+ return $ProdCrt;
1130
+ }
1131
+
1132
+ public function massUpdtProds(){
1133
+ try {
1134
+ $storeID = Mage::app()->getStore()->getId();
1135
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
1136
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
1137
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
1138
+ if($typeSincProd == 0){
1139
+ $products = $products = Mage::getModel('catalog/product')
1140
+ ->getCollection()
1141
+ ->addAttributeToSelect('name');
1142
+ $cont = 0;
1143
+ foreach($products as $product) {
1144
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
1145
+
1146
+ if (!$parentIds) {
1147
+ $anymarketproductsUpdt = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($product->getId(), 'nmp_id');
1148
+ if(is_array($anymarketproductsUpdt->getData('store_id'))){
1149
+ $arrvar = array_values($anymarketproductsUpdt->getData('store_id'));
1150
+ $StoreIDAmProd = array_shift($arrvar);
1151
+ }else{
1152
+ $StoreIDAmProd = $anymarketproductsUpdt->getData('store_id');
1153
+ }
1154
+ if( ($anymarketproductsUpdt->getData('nmp_id') == null) || ($StoreIDAmProd != $storeID) ){
1155
+
1156
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
1157
+ if (!isset($parentIds[0])) {
1158
+ $name = $product->getName();
1159
+ $sku = $product->getSku();
1160
+ $IDProd = $product->getId();
1161
+
1162
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
1163
+ $anymarketproducts->setNmpId( $IDProd );
1164
+ $anymarketproducts->setNmpSku( $sku );
1165
+ $anymarketproducts->setNmpName( $name );
1166
+ $anymarketproducts->setNmpDescError("");
1167
+ $anymarketproducts->setNmpStatusInt("Não integrado (Magento)");
1168
+ $anymarketproducts->setStatus($product->getData('integra_anymarket'));
1169
+ $anymarketproducts->setStores(array($storeID));
1170
+ $anymarketproducts->save();
1171
+
1172
+ $cont = $cont+1;
1173
+ }
1174
+ }else{
1175
+ if( ($anymarketproductsUpdt->getData('nmp_sku') != $product->getSku() ) || ($anymarketproductsUpdt->getData('nmp_name') != $product->getName() ) ){
1176
+ $anymarketproductsUpdt->setNmpSku( $product->getSku() );
1177
+ $anymarketproductsUpdt->setNmpName( $product->getName() );
1178
+ $anymarketproductsUpdt->save();
1179
+
1180
+ $cont = $cont+1;
1181
+ }
1182
+ }
1183
+ }
1184
+
1185
+ }
1186
+ }else{
1187
+ $headers = array(
1188
+ "Content-type: application/json",
1189
+ "Accept: */*",
1190
+ "gumgaToken: ".$TOKEN
1191
+ );
1192
+
1193
+ $startRec = 0;
1194
+ $countRec = 1;
1195
+
1196
+ $cont = 0;
1197
+ while ($startRec <= $countRec) {
1198
+ $returnProd = $this->CallAPICurl("GET", $HOST."/rest/api/v1/products/?start=".$startRec."&pageSize=50", $headers, null);
1199
+ if($returnProd['error'] == '0'){
1200
+ $ProdsJSON = $returnProd['return'];
1201
+ $startRec = $ProdsJSON->pageable->start + $ProdsJSON->pageable->pageSize;
1202
+ $countRec = $ProdsJSON->total;
1203
+
1204
+ $cont = 0;
1205
+ foreach ($ProdsJSON->content as $product) {
1206
+ $anymarketproductsUpdt = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($product->id, 'nmp_id');
1207
+ if(is_array($anymarketproductsUpdt->getData('store_id'))){
1208
+ $varStore = array_values($anymarketproductsUpdt->getData('store_id'));
1209
+ $StoreIDAmProd = array_shift($varStore);
1210
+ }else{
1211
+ $StoreIDAmProd = $anymarketproductsUpdt->getData('store_id');
1212
+ }
1213
+
1214
+ if( ($anymarketproductsUpdt->getData('nmp_id') == null) || ($StoreIDAmProd != $storeID) ){
1215
+ $ProdLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('id_anymarket', $product->id );
1216
+ if(!$ProdLoaded){
1217
+ if (Mage::app()->isSingleStoreMode()){
1218
+ $anymarketproductsCheck = Mage::getModel('db1_anymarket/anymarketproducts')->load($product->id, 'nmp_id');
1219
+ }else{
1220
+ $anymarketproductsCheck = Mage::getModel('db1_anymarket/anymarketproducts')->setStoreId($storeID)->load($product->id, 'nmp_id');
1221
+ }
1222
+
1223
+ if( $anymarketproductsCheck->getData('nmp_id') == null ){
1224
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
1225
+ $anymarketproducts->setNmpId( $product->id );
1226
+ $anymarketproducts->setNmpSku( '' );
1227
+ $anymarketproducts->setNmpName( $product->title );
1228
+ $anymarketproducts->setNmpDescError("");
1229
+ $anymarketproducts->setNmpStatusInt("Não integrado (AnyMarket)");
1230
+ $anymarketproducts->setStatus(0);
1231
+ $anymarketproducts->setStores(array($storeID));
1232
+ $anymarketproducts->save();
1233
+ $cont = $cont+1;
1234
+ }
1235
+ }
1236
+ }
1237
+ }
1238
+ }else{
1239
+ $startRec = 1;
1240
+ $countRec = 0;
1241
+ }
1242
+
1243
+ }
1244
+ }
1245
+
1246
+ if($cont > 0){
1247
+ Mage::getSingleton('adminhtml/session')->addSuccess(
1248
+ Mage::helper('db1_anymarket')->__('Total %d products successfully listed.', $cont)
1249
+ );
1250
+ }
1251
+ } catch (Mage_Core_Exception $e) {
1252
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
1253
+ } catch (Exception $e) {
1254
+ Mage::getSingleton('adminhtml/session')->addError(
1255
+ Mage::helper('db1_anymarket')->__('There was an error updating the products.')
1256
+ );
1257
+ Mage::logException($e);
1258
+ }
1259
+ }
1260
+
1261
+ public function updatePriceStockAnyMarket($IDProd, $QtdStock, $Price){
1262
+ $ImportProdSession = Mage::getSingleton('core/session')->getImportProdsVariable();
1263
+ if( $ImportProdSession != 'false' ) {
1264
+ $storeID = Mage::app()->getStore()->getId();
1265
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $IDProd );
1266
+ if( ($product->getStatus() == 1) && ($product->getData('integra_anymarket') == 1) ){
1267
+ $anymarketproductsUpdt = Mage::getModel('db1_anymarket/anymarketproducts')->load($product->getId(), 'nmp_id');
1268
+ if( ($anymarketproductsUpdt->getData('nmp_status_int') != 'Não integrado (Magento)') ){
1269
+ $sincronize = true;
1270
+ if($product->getVisibility() == 1){ //nao exibido individualmente
1271
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
1272
+ if ($parentIds) {
1273
+ $sincronize = true;
1274
+ }else{
1275
+ $sincronize = false;
1276
+ }
1277
+ }
1278
+
1279
+ if ($sincronize == true) {
1280
+ if($product->getData('id_anymarket') != ""){
1281
+ $HOST = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_host_field', $storeID);
1282
+ $TOKEN = Mage::getStoreConfig('anymarket_section/anymarket_acesso_group/anymarket_token_field', $storeID);
1283
+
1284
+ $headers = array(
1285
+ "Content-type: application/json",
1286
+ "Accept: */*",
1287
+ "gumgaToken: ".$TOKEN
1288
+ );
1289
+ $params = array(
1290
+ "quantity" => $QtdStock,
1291
+ "cost" => $Price
1292
+ );
1293
+
1294
+ $skuPut = str_replace(" ", "%20", $product->getSku());
1295
+ $returnProd = $this->CallAPICurl("PUT", $HOST."/rest/api/v1/erp/stock/skuInClient/".$skuPut, $headers, $params);
1296
+
1297
+ if($returnProd['return'] == ''){
1298
+ $returnProd['return'] = Mage::helper('db1_anymarket')->__('Update Stock and Price');
1299
+ $returnProd['error'] = '0';
1300
+ $returnProd['json'] = json_encode($params);
1301
+ }
1302
+ $this->saveLogsProds($returnProd, $product);
1303
+ }
1304
+ }
1305
+ }
1306
+ }
1307
+ }
1308
+
1309
+ }
1310
+
1311
+ }
app/code/community/DB1/AnyMarket/Helper/Productgenerator.php ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Helper_ProductGenerator extends DB1_AnyMarket_Helper_Data
4
+ {
5
+ protected $_defaultData = array(
6
+ 'product' => array(
7
+ 'attribute_set_id' => '4',
8
+ 'type_id' => 'simple',
9
+ 'sku' => '0124ASF3',
10
+ 'has_options' => '0',
11
+ 'required_options' => '0',
12
+ 'created_at' => '',
13
+ 'updated_at' => '',
14
+ 'status' => '1',
15
+ 'visibility' => '4',
16
+ 'volume_comprimento' => null,
17
+ 'volume_altura' => null,
18
+ 'volume_largura' => null,
19
+ 'warranty_time' => null,
20
+ 'id_anymarket' => null,
21
+ 'tax_class_id' => '0',
22
+ 'is_recurring' => '0',
23
+ 'weight' => '1.0000',
24
+ 'price' => '10.0000',
25
+ 'cost' => '10.0000',
26
+ 'special_price' => null,
27
+ 'msrp' => null,
28
+ 'name' => 'teste' ,
29
+ 'url_key' => '',
30
+ 'coun1_of_manufacture' => null,
31
+ 'video_url' => null,
32
+ 'nbm' => '1',
33
+ 'nbm_origin' => '1',
34
+ 'ean' => '1',
35
+ 'warranty_text' => null,
36
+ 'msrp_enabled' => '2',
37
+ 'msrp_display_actual_price_type' => '4',
38
+ 'meta_title' => null,
39
+ 'meta_description' => null,
40
+ 'image' => 'no_selection',
41
+ 'small_image' => 'no_selection',
42
+ 'thumbnail' => 'no_selection',
43
+ 'custom_design' => null,
44
+ 'page_layout' => null,
45
+ 'options_container' => 'container1',
46
+ 'gift_message_available' => null,
47
+ 'url_path' => 'teste.html',
48
+ 'news_from_date' => null,
49
+ 'news_to_date' => null,
50
+ 'special_from_date' => null,
51
+ 'special_to_date' => null,
52
+ 'custom_design_from' => null,
53
+ 'custom_design_to' => null,
54
+ 'description' => 'teste',
55
+ 'short_description' => 'teste',
56
+ 'meta_keyword' => null,
57
+ 'custom_layout_update' => null,
58
+ 'is_salable' => '1',
59
+ 'integra_anymarket' => '1',
60
+ 'categoria_anymarket' => '',
61
+ ),
62
+ 'images' => array(),
63
+ 'stock_item' => array(
64
+ 'use_config_manage_stock' => '0',
65
+ 'manage_stock' => '1',
66
+ 'min_sale_qty' => '1',
67
+ 'max_sale_qty' => '',
68
+ 'is_in_stock' => '1',
69
+ 'qty' => '9999',
70
+ ),
71
+ 'category' => array(2,3,4),
72
+ );
73
+
74
+ /**
75
+ * update images in MG
76
+ *
77
+ * @access public
78
+ * @param $product, $data
79
+ * @return void
80
+ *
81
+ */
82
+ public function updateImages($product, $data){
83
+ $sku = $data['sku'];
84
+ foreach ($data['images'] as $image) {
85
+ $this->importImages($product, $image, $sku);
86
+ }
87
+ }
88
+
89
+ /**
90
+ * create simple prod in MG
91
+ *
92
+ * @access public
93
+ * @param $data
94
+ * @return product object
95
+ *
96
+ */
97
+ public function createSimpleProduct($data = array()){
98
+
99
+ $data = array_replace_recursive($this->_defaultData, $data);
100
+
101
+ $product = Mage::getModel('catalog/product');
102
+ $product->setData($data['product']);
103
+ $product->setStockData($data['stock_item']);
104
+ $product->setForceConfirmed(true);
105
+ $prodSaved = $product->save();
106
+
107
+ $sku = $data['product']['sku'];
108
+
109
+ if( array_key_exists("images", $data) ){
110
+ foreach ($data['images'] as $image) {
111
+ $this->importImages($prodSaved, $image, $sku);
112
+ }
113
+ }
114
+
115
+ return $prodSaved;
116
+ }
117
+
118
+ /**
119
+ * import images
120
+ *
121
+ * @access public
122
+ * @param $product, $image, $sku
123
+ * @return void
124
+ *
125
+ */
126
+ private function importImages($product, $image, $sku){
127
+
128
+ $image_url = $image['img'];
129
+ $image_url = str_replace("https://", "http://", $image_url);
130
+ $image_type = substr(strrchr($image_url,"."),1);
131
+ $split = explode("?", $image_type);
132
+ $image_type = $split[0];
133
+ $imgName = basename($image_url);
134
+ $imgName = str_replace('.'.$image_type, "", $imgName);
135
+ $filename = md5($imgName . $sku).'.'.$image_type;
136
+
137
+ $dirPath = Mage::getBaseDir('media') . DS . 'import';
138
+ if (!file_exists($dirPath)) {
139
+ mkdir($dirPath, 0777, true);
140
+ }
141
+
142
+ $filepath = $dirPath . DS . $filename;
143
+
144
+ $curl_handle = curl_init();
145
+ curl_setopt($curl_handle, CURLOPT_URL,$image_url);
146
+ curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
147
+ curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
148
+ curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Cirkel');
149
+ $query = curl_exec($curl_handle);
150
+ curl_close($curl_handle);
151
+
152
+ file_put_contents($filepath, $query);
153
+
154
+ if (file_exists($filepath)) {
155
+ $attrIMG = array();
156
+
157
+ if( array_key_exists('main', $image) ){
158
+ if($image['main'] == true){
159
+ $attrIMG = array('image', 'thumbnail', 'small_image');
160
+ }
161
+ }
162
+
163
+ $productMG = Mage::getModel('catalog/product')->loadByAttribute('sku', $product->getSku());
164
+ $productMG->addImageToMediaGallery( $filepath, $attrIMG, false, false);
165
+ $productMG->save();
166
+ }
167
+
168
+ }
169
+
170
+ /**
171
+ * create configurable product in MG
172
+ *
173
+ * @access public
174
+ * @param $dataProdConfig, $simpleProducts, $AttributeIds
175
+ * @return product object
176
+ *
177
+ */
178
+ public function createConfigurableProduct($dataProdConfig = array() ,$simpleProducts = array(), $AttributeIds = array()){
179
+ $storeID = Mage::app()->getStore()->getId();
180
+ $confProduct = Mage::getModel('catalog/product')->setSku($dataProdConfig['sku']);
181
+ $confProduct->setTypeId('configurable');
182
+
183
+ $confProduct->getTypeInstance()->setUsedProductAttributeIds($AttributeIds);
184
+
185
+ $configurableProductsData = array();
186
+ $configurableAttributesData = $confProduct->getTypeInstance()->getConfigurableAttributesAsArray();
187
+
188
+ foreach ($simpleProducts as $simpleProduct) {
189
+ $sProd = Mage::getModel('catalog/product')->load( $simpleProduct['Id'] );
190
+
191
+ $AttributeId = Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product', $simpleProduct['AttributeText'] );
192
+
193
+ $simpleProductsData = array(
194
+ 'label' => $sProd->getAttributeText( $simpleProduct['AttributeText'] ),
195
+ 'attribute_id' => $AttributeId,
196
+ 'value_index' => (int) $sProd->getData( $simpleProduct['AttributeText'] ),
197
+ 'is_percent' => 0,
198
+ 'pricing_value' => $sProd->getPrice(),
199
+ );
200
+
201
+ $configurableProductsData[ $sProd->getId() ] = $simpleProductsData;
202
+ $configurableAttributesData[0]['values'][] = $simpleProductsData;
203
+ }
204
+
205
+ $confProduct->setConfigurableProductsData($configurableProductsData);
206
+ $confProduct->setConfigurableAttributesData($configurableAttributesData);
207
+
208
+ $confProduct->setCanSaveConfigurableAttributes(true);
209
+ $confProduct->setStoreId($storeID)
210
+ ->setAttributeSetId(4)
211
+ ->setStockData($dataProdConfig['stock'])
212
+ ->setPrice($dataProdConfig['price'])
213
+ ->setName($dataProdConfig['name'])
214
+ ->setShortDescription($dataProdConfig['short'])
215
+ ->setDescription($dataProdConfig['description'])
216
+ ->setCategoryIds(array(3))
217
+ ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
218
+ ->setBrand($dataProdConfig['brand'])
219
+ ->setStatus(1)
220
+ ->setTaxClassId(0)
221
+ ->setIdAnymarket( $dataProdConfig['id_anymarket'] )
222
+ ->setCategoriaAnymarket( $dataProdConfig['categoria_anymarket'] )
223
+ ->save();
224
+
225
+ $sku = $dataProdConfig['sku'];
226
+ foreach ($dataProdConfig['images'] as $image) {
227
+ $this->importImages($confProduct, $image, $sku);
228
+ }
229
+
230
+ return $confProduct;
231
+ }
232
+
233
+ /**
234
+ * update configurable product in MG
235
+ *
236
+ * @access public
237
+ * @param $idProd, $dataProdConfig, $simpleProducts
238
+ * @return product object
239
+ *
240
+ */
241
+ public function updateConfigurableProduct($idProd, $dataProdConfig = array() ,$simpleProducts = array(), $AttributeIds = array()){
242
+ $storeID = Mage::app()->getStore()->getId();
243
+ $confProduct = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $idProd );
244
+ $confProduct->setTypeId('configurable');
245
+
246
+ $confProduct->getTypeInstance()->setUsedProductAttributeIds($AttributeIds);
247
+
248
+ $configurableProductsData = array();
249
+ $configurableAttributesData = $confProduct->getTypeInstance()->getConfigurableAttributesAsArray();
250
+
251
+ foreach ($simpleProducts as $simpleProduct) {
252
+ $sProd = Mage::getModel('catalog/product')->load( $simpleProduct['Id'] );
253
+
254
+ $AttributeId = Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product', $simpleProduct['AttributeText'] );
255
+
256
+ $simpleProductsData = array(
257
+ 'label' => $sProd->getAttributeText( $simpleProduct['AttributeText'] ),
258
+ 'attribute_id' => $AttributeId,
259
+ 'value_index' => (int) $sProd->getData( $simpleProduct['AttributeText'] ),
260
+ 'is_percent' => 0,
261
+ 'pricing_value' => $sProd->getPrice(),
262
+ );
263
+
264
+ $configurableProductsData[ $sProd->getId() ] = $simpleProductsData;
265
+ $configurableAttributesData[0]['values'][] = $simpleProductsData;
266
+ }
267
+
268
+ $confProduct->setConfigurableProductsData($configurableProductsData);
269
+ // $confProduct->setConfigurableAttributesData($configurableAttributesData);
270
+ $confProduct->setCanSaveConfigurableAttributes(true);
271
+ $confProduct->setStoreId($storeID)
272
+ ->setAttributeSetId(4)
273
+ ->setStockData($dataProdConfig['stock'])
274
+ ->setPrice($dataProdConfig['price'])
275
+ ->setName($dataProdConfig['name'])
276
+ ->setShortDescription($dataProdConfig['short'])
277
+ ->setDescription($dataProdConfig['description'])
278
+ ->setCategoryIds(array(3))
279
+ ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
280
+ ->setBrand($dataProdConfig['brand'])
281
+ ->setStatus(1)
282
+ ->setTaxClassId(0)
283
+ ->setIdAnymarket( $dataProdConfig['id_anymarket'] )
284
+ ->save();
285
+
286
+ return $confProduct;
287
+ }
288
+
289
+ }
app/code/community/DB1/AnyMarket/Helper/Queue.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Helper_Queue extends DB1_AnyMarket_Helper_Data
4
+ {
5
+
6
+ public function addQueue($IdItem, $typeItem, $tableItem){
7
+ $storeID = Mage::app()->getStore()->getId();
8
+
9
+ $queueItem = Mage::getModel('db1_anymarket/anymarketqueue');
10
+ $queueItem->setNmqId($IdItem);
11
+ $queueItem->setNmqType($typeItem);
12
+ $queueItem->setNmqTable($tableItem);
13
+ $queueItem->setStores(array($storeID));
14
+ $queueItem->save();
15
+ }
16
+
17
+ public function removeQueue($idItem){
18
+ $anymarketQueueDel = Mage::getModel('db1_anymarket/anymarketqueue');
19
+ $anymarketQueueDel->setId($idItem)->delete();
20
+ }
21
+
22
+ public function processQueue(){
23
+ $qtyItensImport = (int)Mage::getConfig()->getNode('default/queue_qty/qty');
24
+ $itens = Mage::getModel('db1_anymarket/anymarketqueue')
25
+ ->getCollection()
26
+ ->setPageSize($qtyItensImport)
27
+ ->setCurPage(1);
28
+
29
+ foreach($itens->getData() as $item) {
30
+ $IdItemQueue = $item['nmq_id'];
31
+
32
+ $anymarketQueue = Mage::getModel('db1_anymarket/anymarketqueue')->load($item['entity_id']);
33
+
34
+ $arrValueStore = array_values($anymarketQueue->getStoreId());
35
+ $storeID = array_shift($arrValueStore);
36
+ Mage::app()->setCurrentStore($storeID);
37
+ $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
38
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
39
+
40
+ if($item['nmq_table'] == 'ORDER'){
41
+ try {
42
+ Mage::getSingleton('core/session')->setImportOrdersVariable('true');
43
+
44
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
45
+ if($ConfigOrder == 1){
46
+ $anymarketorders->load($IdItemQueue, 'nmo_id_anymarket');
47
+ //Import
48
+ if( $anymarketorders->getNmoStatusInt() != "Não integrado (Magento)") {
49
+ $idAnyMarket = $anymarketorders->getNmoIdSeqAnymarket();
50
+ if($idAnyMarket){
51
+ $IDOrderAnyMarket = $anymarketorders->getNmoIdAnymarket();
52
+ $idReg = $anymarketorders->getId();
53
+ $idOrderMage = $anymarketorders->getNmoIdOrder();
54
+
55
+ $anymarketordersDel = Mage::getModel('db1_anymarket/anymarketorders');
56
+ $anymarketordersDel->setId( $idReg )->delete();
57
+
58
+ Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($idAnyMarket, $IDOrderAnyMarket, $idOrderMage);
59
+ }
60
+ }
61
+
62
+ }else{
63
+ $anymarketorders->load($IdItemQueue, 'nmo_id_order');
64
+ //Export
65
+ if( $anymarketorders->getNmoStatusInt() != "Não integrado (AnyMarket)" ){
66
+ $Order = Mage::getModel('sales/order')->loadByIncrementId( $anymarketorders->getNmoIdOrder() );
67
+ Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($Order);
68
+ }
69
+ }
70
+
71
+ } catch (Exception $e) {
72
+ Mage::logException($e);
73
+ }
74
+ Mage::getSingleton('core/session')->setImportProdsVariable('false');
75
+ }else if($item['nmq_table'] == 'PRODUCT'){
76
+ $typImp = $item['nmq_type'];
77
+ // IMPORT PRODUCT
78
+ if( ($typImp == 'IMP') && ($typeSincProd == 1) ){
79
+
80
+ try {
81
+ Mage::getSingleton('core/session')->setImportProdsVariable('false');
82
+
83
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
84
+ $anymarketproducts->load($IdItemQueue, 'nmp_id');
85
+
86
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load( $anymarketproducts->getNmpId() );
87
+ $needDel = false;
88
+
89
+ if($product->getIdAnymarket() != ''){
90
+ $idProd = $product->getIdAnymarket();
91
+ }else{
92
+ $needDel = true;
93
+ $idProd = $IdItemQueue;
94
+ }
95
+
96
+ $idReg = $anymarketproducts->getId();
97
+ $prod = Mage::helper('db1_anymarket/product')->getSpecificProductAnyMarket($idProd);
98
+ if($prod != null){
99
+ if($needDel){
100
+ //$anymarketproductsDel = Mage::getModel('db1_anymarket/anymarketproducts');
101
+ //$anymarketproductsDel->setId( $idReg )->delete();
102
+ $anymarketproductsUpdt = Mage::getModel('db1_anymarket/anymarketproducts')->load($idReg);
103
+ $anymarketproductsUpdt->setNmpStatusInt("Integrado");
104
+ $anymarketproductsUpdt->setNmpDescError("");
105
+ $anymarketproductsUpdt->setNmpSku( $prod->getSku() );
106
+ $anymarketproductsUpdt->save();
107
+ }
108
+ }
109
+ } catch (Exception $e) {
110
+ Mage::logException($e);
111
+ }
112
+ Mage::getSingleton('core/session')->setImportProdsVariable('true');
113
+
114
+ }else if( ($typImp == 'EXP') && ($typeSincProd == 0) ){
115
+ try {
116
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
117
+ $anymarketproducts->load($IdItemQueue, 'nmp_id');
118
+
119
+ $anymarketproducts->setStatus('1')->setIsMassupdate(true)->save();
120
+
121
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->loadByAttribute('sku', $anymarketproducts->getNmpSku());
122
+ if($product != null){
123
+ Mage::getSingleton('core/session')->setImportProdsVariable('false');
124
+ $amProd = Mage::helper('db1_anymarket/product');
125
+
126
+ $amProd->sendProductToAnyMarket( $product->getId() );
127
+ Mage::getSingleton('core/session')->setImportProdsVariable('true');
128
+
129
+ $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', Mage::app()->getStore()->getId()));
130
+ $ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
131
+ $amProd->updatePriceStockAnyMarket($product->getId(), $ProdStock->getQty(), $product->getData($filter));
132
+
133
+ }
134
+
135
+ } catch (Exception $e) {
136
+ Mage::logException($e);
137
+ }
138
+ Mage::getSingleton('core/session')->setImportProdsVariable('true');
139
+ }
140
+
141
+ }
142
+
143
+ $this->removeQueue($item['entity_id']);
144
+ }
145
+
146
+ }
147
+
148
+ }
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketattributes.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin search model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Adminhtml_Search_Anymarketattributes extends Varien_Object
25
+ {
26
+ /**
27
+ * Load search results
28
+ *
29
+ * @access public
30
+ * @return DB1_AnyMarket_Model_Adminhtml_Search_Anymarketattributes
31
+
32
+ */
33
+ public function load()
34
+ {
35
+ $arr = array();
36
+ if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
37
+ $this->setResults($arr);
38
+ return $this;
39
+ }
40
+ $collection = Mage::getResourceModel('db1_anymarket/anymarketattributes_collection')
41
+ ->addFieldToFilter('nma_desc', array('like' => $this->getQuery().'%'))
42
+ ->setCurPage($this->getStart())
43
+ ->setPageSize($this->getLimit())
44
+ ->load();
45
+ foreach ($collection->getItems() as $anymarketattributes) {
46
+ $arr[] = array(
47
+ 'id' => 'anymarketattributes/1/'.$anymarketattributes->getId(),
48
+ 'type' => Mage::helper('db1_anymarket')->__('Anymarket Attributes'),
49
+ 'name' => $anymarketattributes->getNmaDesc(),
50
+ 'description' => $anymarketattributes->getNmaDesc(),
51
+ 'url' => Mage::helper('adminhtml')->getUrl(
52
+ '*/anymarket_anymarketattributes/edit',
53
+ array('id'=>$anymarketattributes->getId())
54
+ ),
55
+ );
56
+ }
57
+ $this->setResults($arr);
58
+ return $this;
59
+ }
60
+ }
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketlog.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin search model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Adminhtml_Search_Anymarketlog extends Varien_Object
25
+ {
26
+ /**
27
+ * Load search results
28
+ *
29
+ * @access public
30
+ * @return DB1_AnyMarket_Model_Adminhtml_Search_Anymarketlog
31
+ *
32
+ */
33
+ public function load()
34
+ {
35
+ $arr = array();
36
+ if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
37
+ $this->setResults($arr);
38
+ return $this;
39
+ }
40
+ $collection = Mage::getResourceModel('db1_anymarket/anymarketlog_collection')
41
+ ->addFieldToFilter('log_desc', array('like' => $this->getQuery().'%'))
42
+ ->setCurPage($this->getStart())
43
+ ->setPageSize($this->getLimit())
44
+ ->load();
45
+ foreach ($collection->getItems() as $anymarketlog) {
46
+ $arr[] = array(
47
+ 'id' => 'anymarketlog/1/'.$anymarketlog->getId(),
48
+ 'type' => Mage::helper('db1_anymarket')->__('AnyMarket Log'),
49
+ 'name' => $anymarketlog->getLogDesc(),
50
+ 'description' => $anymarketlog->getLogDesc(),
51
+ 'url' => Mage::helper('adminhtml')->getUrl(
52
+ '*/anymarket_anymarketlog/edit',
53
+ array('id'=>$anymarketlog->getId())
54
+ ),
55
+ );
56
+ }
57
+ $this->setResults($arr);
58
+ return $this;
59
+ }
60
+ }
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketorders.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin search model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Adminhtml_Search_Anymarketorders extends Varien_Object
25
+ {
26
+ /**
27
+ * Load search results
28
+ *
29
+ * @access public
30
+ * @return DB1_AnyMarket_Model_Adminhtml_Search_Anymarketorders
31
+
32
+ */
33
+ public function load()
34
+ {
35
+ $arr = array();
36
+ if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
37
+ $this->setResults($arr);
38
+ return $this;
39
+ }
40
+ $collection = Mage::getResourceModel('db1_anymarket/anymarketorders_collection')
41
+ ->addFieldToFilter('nmo_id_order', array('like' => $this->getQuery().'%'))
42
+ ->setCurPage($this->getStart())
43
+ ->setPageSize($this->getLimit())
44
+ ->load();
45
+ foreach ($collection->getItems() as $anymarketorders) {
46
+ $arr[] = array(
47
+ 'id' => 'anymarketorders/1/'.$anymarketorders->getId(),
48
+ 'type' => Mage::helper('db1_anymarket')->__('Anymarket Orders'),
49
+ 'name' => $anymarketorders->getNmoIdOrder(),
50
+ 'description' => $anymarketorders->getNmoIdOrder(),
51
+ 'url' => Mage::helper('adminhtml')->getUrl(
52
+ '*/anymarket_anymarketorders/edit',
53
+ array('id'=>$anymarketorders->getId())
54
+ ),
55
+ );
56
+ }
57
+ $this->setResults($arr);
58
+ return $this;
59
+ }
60
+ }
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketproducts.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin search model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Adminhtml_Search_Anymarketproducts extends Varien_Object
25
+ {
26
+ /**
27
+ * Load search results
28
+ *
29
+ * @access public
30
+ * @return DB1_AnyMarket_Model_Adminhtml_Search_Anymarketproducts
31
+ *
32
+ */
33
+ public function load()
34
+ {
35
+ $arr = array();
36
+ if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
37
+ $this->setResults($arr);
38
+ return $this;
39
+ }
40
+ $collection = Mage::getResourceModel('db1_anymarket/anymarketproducts_collection')
41
+ ->addFieldToFilter('nmp_status_int', array('like' => $this->getQuery().'%'))
42
+ ->setCurPage($this->getStart())
43
+ ->setPageSize($this->getLimit())
44
+ ->load();
45
+ foreach ($collection->getItems() as $anymarketproducts) {
46
+ $arr[] = array(
47
+ 'id' => 'anymarketproducts/1/'.$anymarketproducts->getId(),
48
+ 'type' => Mage::helper('db1_anymarket')->__('Anymarket Products'),
49
+ 'name' => $anymarketproducts->getNmpStatusInt(),
50
+ 'description' => $anymarketproducts->getNmpStatusInt(),
51
+ 'url' => Mage::helper('adminhtml')->getUrl(
52
+ '*/anymarket_anymarketproducts/edit',
53
+ array('id'=>$anymarketproducts->getId())
54
+ ),
55
+ );
56
+ }
57
+ $this->setResults($arr);
58
+ return $this;
59
+ }
60
+ }
app/code/community/DB1/AnyMarket/Model/Adminhtml/Search/Anymarketqueue.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Admin search model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ "
23
+ */
24
+ class DB1_AnyMarket_Model_Adminhtml_Search_Anymarketqueue extends Varien_Object
25
+ {
26
+ /**
27
+ * Load search results
28
+ *
29
+ * @access public
30
+ * @return DB1_AnyMarket_Model_Adminhtml_Search_Anymarketqueue
31
+
32
+ */
33
+ public function load()
34
+ {
35
+ $arr = array();
36
+ if (!$this->hasStart() || !$this->hasLimit() || !$this->hasQuery()) {
37
+ $this->setResults($arr);
38
+ return $this;
39
+ }
40
+ $collection = Mage::getResourceModel('db1_anymarket/anymarketqueue_collection')
41
+ ->addFieldToFilter('nmq_id', array('like' => $this->getQuery().'%'))
42
+ ->setCurPage($this->getStart())
43
+ ->setPageSize($this->getLimit())
44
+ ->load();
45
+ foreach ($collection->getItems() as $anymarketqueue) {
46
+ $arr[] = array(
47
+ 'id' => 'anymarketqueue/1/'.$anymarketqueue->getId(),
48
+ 'type' => Mage::helper('db1_anymarket')->__('Anymarket Queue'),
49
+ 'name' => $anymarketqueue->getNmqId(),
50
+ 'description' => $anymarketqueue->getNmqId(),
51
+ 'url' => Mage::helper('adminhtml')->getUrl(
52
+ '*/anymarket_anymarketqueue/edit',
53
+ array('id'=>$anymarketqueue->getId())
54
+ ),
55
+ );
56
+ }
57
+ $this->setResults($arr);
58
+ return $this;
59
+ }
60
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketattributes.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Attributes model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Anymarketattributes extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'db1_anymarket_anymarketattributes';
31
+ const CACHE_TAG = 'db1_anymarket_anymarketattributes';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'db1_anymarket_anymarketattributes';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'anymarketattributes';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('db1_anymarket/anymarketattributes');
58
+ }
59
+
60
+ /**
61
+ * before save anymarket attributes
62
+ *
63
+ * @access protected
64
+ * @return DB1_AnyMarket_Model_Anymarketattributes
65
+
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * save anymarket attributes relation
80
+ *
81
+ * @access public
82
+ * @return DB1_AnyMarket_Model_Anymarketattributes
83
+
84
+ */
85
+ protected function _afterSave()
86
+ {
87
+ return parent::_afterSave();
88
+ }
89
+
90
+ /**
91
+ * get default values
92
+ *
93
+ * @access public
94
+ * @return array
95
+
96
+ */
97
+ public function getDefaultValues()
98
+ {
99
+ $values = array();
100
+ $values['status'] = 1;
101
+ return $values;
102
+ }
103
+
104
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketattributes_Api extends Mage_Api_Model_Resource_Abstract
18
+ {
19
+
20
+
21
+ /**
22
+ * init anymarket attributes
23
+ *
24
+ * @access protected
25
+ * @param $anymarketattributesId
26
+ * @return DB1_AnyMarket_Model_Anymarketattributes
27
+
28
+ */
29
+ protected function _initAnymarketattributes($anymarketattributesId)
30
+ {
31
+ $anymarketattributes = Mage::getModel('db1_anymarket/anymarketattributes')->load($anymarketattributesId);
32
+ if (!$anymarketattributes->getId()) {
33
+ $this->_fault('anymarketattributes_not_exists');
34
+ }
35
+ return $anymarketattributes;
36
+ }
37
+
38
+ /**
39
+ * get anymarket attributes
40
+ *
41
+ * @access public
42
+ * @param mixed $filters
43
+ * @return array
44
+
45
+ */
46
+ public function items($filters = null)
47
+ {
48
+ $collection = Mage::getModel('db1_anymarket/anymarketattributes')->getCollection();
49
+ $apiHelper = Mage::helper('api');
50
+ $filters = $apiHelper->parseFilters($filters);
51
+ try {
52
+ foreach ($filters as $field => $value) {
53
+ $collection->addFieldToFilter($field, $value);
54
+ }
55
+ } catch (Mage_Core_Exception $e) {
56
+ $this->_fault('filters_invalid', $e->getMessage());
57
+ }
58
+ $result = array();
59
+ foreach ($collection as $anymarketattributes) {
60
+ $result[] = $this->_getApiData($anymarketattributes);
61
+ }
62
+ return $result;
63
+ }
64
+
65
+ /**
66
+ * Add anymarket attributes
67
+ *
68
+ * @access public
69
+ * @param array $data
70
+ * @return array
71
+
72
+ */
73
+ public function add($data)
74
+ {
75
+ try {
76
+ if (is_null($data)) {
77
+ throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
78
+ }
79
+ $data = (array)$data;
80
+ $anymarketattributes = Mage::getModel('db1_anymarket/anymarketattributes')
81
+ ->setData((array)$data)
82
+ ->save();
83
+ } catch (Mage_Core_Exception $e) {
84
+ $this->_fault('data_invalid', $e->getMessage());
85
+ } catch (Exception $e) {
86
+ $this->_fault('data_invalid', $e->getMessage());
87
+ }
88
+ return $anymarketattributes->getId();
89
+ }
90
+
91
+ /**
92
+ * Change existing anymarket attributes information
93
+ *
94
+ * @access public
95
+ * @param int $anymarketattributesId
96
+ * @param array $data
97
+ * @return bool
98
+
99
+ */
100
+ public function update($anymarketattributesId, $data)
101
+ {
102
+ $anymarketattributes = $this->_initAnymarketattributes($anymarketattributesId);
103
+ try {
104
+ $data = (array)$data;
105
+ $anymarketattributes->addData($data);
106
+ $anymarketattributes->save();
107
+ }
108
+ catch (Mage_Core_Exception $e) {
109
+ $this->_fault('save_error', $e->getMessage());
110
+ }
111
+
112
+ return true;
113
+ }
114
+
115
+ /**
116
+ * remove anymarket attributes
117
+ *
118
+ * @access public
119
+ * @param int $anymarketattributesId
120
+ * @return bool
121
+
122
+ */
123
+ public function remove($anymarketattributesId)
124
+ {
125
+ $anymarketattributes = $this->_initAnymarketattributes($anymarketattributesId);
126
+ try {
127
+ $anymarketattributes->delete();
128
+ } catch (Mage_Core_Exception $e) {
129
+ $this->_fault('remove_error', $e->getMessage());
130
+ }
131
+ return true;
132
+ }
133
+
134
+ /**
135
+ * get info
136
+ *
137
+ * @access public
138
+ * @param int $anymarketattributesId
139
+ * @return array
140
+
141
+ */
142
+ public function info($anymarketattributesId)
143
+ {
144
+ $result = array();
145
+ $anymarketattributes = $this->_initAnymarketattributes($anymarketattributesId);
146
+ $result = $this->_getApiData($anymarketattributes);
147
+ return $result;
148
+ }
149
+
150
+ /**
151
+ * get data for api
152
+ *
153
+ * @access protected
154
+ * @param DB1_AnyMarket_Model_Anymarketattributes $anymarketattributes
155
+ * @return array()
156
+
157
+ */
158
+ protected function _getApiData(DB1_AnyMarket_Model_Anymarketattributes $anymarketattributes)
159
+ {
160
+ return $anymarketattributes->getData();
161
+ }
162
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketattributes/Api/V2.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketattributes_Api_V2 extends DB1_AnyMarket_Model_Anymarketattributes_Api
18
+ {
19
+ /**
20
+ * Anymarket Attributes info
21
+ *
22
+ * @access public
23
+ * @param int $anymarketattributesId
24
+ * @return object
25
+
26
+ */
27
+ public function info($anymarketattributesId)
28
+ {
29
+ $result = parent::info($anymarketattributesId);
30
+ $result = Mage::helper('api')->wsiArrayPacker($result);
31
+ return $result;
32
+ }
33
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketcategories.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Anymarketcategories extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'db1_anymarket_anymarketcategories';
31
+ const CACHE_TAG = 'db1_anymarket_anymarketcategories';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'db1_anymarket_anymarketcategories';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'anymarketcategories';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('db1_anymarket/anymarketcategories');
58
+ }
59
+
60
+ /**
61
+ * before save anymarket categories
62
+ *
63
+ * @access protected
64
+ * @return DB1_AnyMarket_Model_Anymarketcategories
65
+
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * save anymarket categories relation
80
+ *
81
+ * @access public
82
+ * @return DB1_AnyMarket_Model_Anymarketcategories
83
+
84
+ */
85
+ protected function _afterSave()
86
+ {
87
+ return parent::_afterSave();
88
+ }
89
+
90
+ /**
91
+ * get default values
92
+ *
93
+ * @access public
94
+ * @return array
95
+
96
+ */
97
+ public function getDefaultValues()
98
+ {
99
+ $values = array();
100
+ $values['status'] = 1;
101
+ return $values;
102
+ }
103
+
104
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketcategories_Api extends Mage_Api_Model_Resource_Abstract
18
+ {
19
+
20
+
21
+ /**
22
+ * init anymarket categories
23
+ *
24
+ * @access protected
25
+ * @param $anymarketcategoriesId
26
+ * @return DB1_AnyMarket_Model_Anymarketcategories
27
+
28
+ */
29
+ protected function _initAnymarketcategories($anymarketcategoriesId)
30
+ {
31
+ $anymarketcategories = Mage::getModel('db1_anymarket/anymarketcategories')->load($anymarketcategoriesId);
32
+ if (!$anymarketcategories->getId()) {
33
+ $this->_fault('anymarketcategories_not_exists');
34
+ }
35
+ return $anymarketcategories;
36
+ }
37
+
38
+ /**
39
+ * get anymarket categories
40
+ *
41
+ * @access public
42
+ * @param mixed $filters
43
+ * @return array
44
+
45
+ */
46
+ public function items($filters = null)
47
+ {
48
+ $collection = Mage::getModel('db1_anymarket/anymarketcategories')->getCollection();
49
+ $apiHelper = Mage::helper('api');
50
+ $filters = $apiHelper->parseFilters($filters);
51
+ try {
52
+ foreach ($filters as $field => $value) {
53
+ $collection->addFieldToFilter($field, $value);
54
+ }
55
+ } catch (Mage_Core_Exception $e) {
56
+ $this->_fault('filters_invalid', $e->getMessage());
57
+ }
58
+ $result = array();
59
+ foreach ($collection as $anymarketcategories) {
60
+ $result[] = $this->_getApiData($anymarketcategories);
61
+ }
62
+ return $result;
63
+ }
64
+
65
+ /**
66
+ * Add anymarket categories
67
+ *
68
+ * @access public
69
+ * @param array $data
70
+ * @return array
71
+
72
+ */
73
+ public function add($data)
74
+ {
75
+ try {
76
+ if (is_null($data)) {
77
+ throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
78
+ }
79
+ $data = (array)$data;
80
+ $anymarketcategories = Mage::getModel('db1_anymarket/anymarketcategories')
81
+ ->setData((array)$data)
82
+ ->save();
83
+ } catch (Mage_Core_Exception $e) {
84
+ $this->_fault('data_invalid', $e->getMessage());
85
+ } catch (Exception $e) {
86
+ $this->_fault('data_invalid', $e->getMessage());
87
+ }
88
+ return $anymarketcategories->getId();
89
+ }
90
+
91
+ /**
92
+ * Change existing anymarket categories information
93
+ *
94
+ * @access public
95
+ * @param int $anymarketcategoriesId
96
+ * @param array $data
97
+ * @return bool
98
+
99
+ */
100
+ public function update($anymarketcategoriesId, $data)
101
+ {
102
+ $anymarketcategories = $this->_initAnymarketcategories($anymarketcategoriesId);
103
+ try {
104
+ $data = (array)$data;
105
+ $anymarketcategories->addData($data);
106
+ $anymarketcategories->save();
107
+ }
108
+ catch (Mage_Core_Exception $e) {
109
+ $this->_fault('save_error', $e->getMessage());
110
+ }
111
+
112
+ return true;
113
+ }
114
+
115
+ /**
116
+ * remove anymarket categories
117
+ *
118
+ * @access public
119
+ * @param int $anymarketcategoriesId
120
+ * @return bool
121
+
122
+ */
123
+ public function remove($anymarketcategoriesId)
124
+ {
125
+ $anymarketcategories = $this->_initAnymarketcategories($anymarketcategoriesId);
126
+ try {
127
+ $anymarketcategories->delete();
128
+ } catch (Mage_Core_Exception $e) {
129
+ $this->_fault('remove_error', $e->getMessage());
130
+ }
131
+ return true;
132
+ }
133
+
134
+ /**
135
+ * get info
136
+ *
137
+ * @access public
138
+ * @param int $anymarketcategoriesId
139
+ * @return array
140
+
141
+ */
142
+ public function info($anymarketcategoriesId)
143
+ {
144
+ $result = array();
145
+ $anymarketcategories = $this->_initAnymarketcategories($anymarketcategoriesId);
146
+ $result = $this->_getApiData($anymarketcategories);
147
+ return $result;
148
+ }
149
+
150
+ /**
151
+ * get data for api
152
+ *
153
+ * @access protected
154
+ * @param DB1_AnyMarket_Model_Anymarketcategories $anymarketcategories
155
+ * @return array()
156
+
157
+ */
158
+ protected function _getApiData(DB1_AnyMarket_Model_Anymarketcategories $anymarketcategories)
159
+ {
160
+ return $anymarketcategories->getData();
161
+ }
162
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketcategories/Api/V2.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketcategories_Api_V2 extends DB1_AnyMarket_Model_Anymarketcategories_Api
18
+ {
19
+ /**
20
+ * Anymarket Categories info
21
+ *
22
+ * @access public
23
+ * @param int $anymarketcategoriesId
24
+ * @return object
25
+
26
+ */
27
+ public function info($anymarketcategoriesId)
28
+ {
29
+ $result = parent::info($anymarketcategoriesId);
30
+ $result = Mage::helper('api')->wsiArrayPacker($result);
31
+ return $result;
32
+ }
33
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketlog.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Anymarketlog extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'db1_anymarket_anymarketlog';
31
+ const CACHE_TAG = 'db1_anymarket_anymarketlog';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'db1_anymarket_anymarketlog';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'anymarketlog';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+ *
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('db1_anymarket/anymarketlog');
58
+ }
59
+
60
+ /**
61
+ * before save anymarket log
62
+ *
63
+ * @access protected
64
+ * @return DB1_AnyMarket_Model_Anymarketlog
65
+ *
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * save anymarket log relation
80
+ *
81
+ * @access public
82
+ * @return DB1_AnyMarket_Model_Anymarketlog
83
+ *
84
+ */
85
+ protected function _afterSave()
86
+ {
87
+ return parent::_afterSave();
88
+ }
89
+
90
+ /**
91
+ * get default values
92
+ *
93
+ * @access public
94
+ * @return array
95
+ *
96
+ */
97
+ public function getDefaultValues()
98
+ {
99
+ $values = array();
100
+ $values['status'] = 1;
101
+ return $values;
102
+ }
103
+
104
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketlog_Api extends Mage_Api_Model_Resource_Abstract
18
+ {
19
+
20
+
21
+ /**
22
+ * init anymarket log
23
+ *
24
+ * @access protected
25
+ * @param $anymarketlogId
26
+ * @return DB1_AnyMarket_Model_Anymarketlog
27
+
28
+ */
29
+ protected function _initAnymarketlog($anymarketlogId)
30
+ {
31
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog')->load($anymarketlogId);
32
+ if (!$anymarketlog->getId()) {
33
+ $this->_fault('anymarketlog_not_exists');
34
+ }
35
+ return $anymarketlog;
36
+ }
37
+
38
+ /**
39
+ * get anymarket log
40
+ *
41
+ * @access public
42
+ * @param mixed $filters
43
+ * @return array
44
+ *
45
+ */
46
+ public function items($filters = null)
47
+ {
48
+ $collection = Mage::getModel('db1_anymarket/anymarketlog')->getCollection();
49
+ $apiHelper = Mage::helper('api');
50
+ $filters = $apiHelper->parseFilters($filters);
51
+ try {
52
+ foreach ($filters as $field => $value) {
53
+ $collection->addFieldToFilter($field, $value);
54
+ }
55
+ } catch (Mage_Core_Exception $e) {
56
+ $this->_fault('filters_invalid', $e->getMessage());
57
+ }
58
+ $result = array();
59
+ foreach ($collection as $anymarketlog) {
60
+ $result[] = $this->_getApiData($anymarketlog);
61
+ }
62
+ return $result;
63
+ }
64
+
65
+ /**
66
+ * Add anymarket log
67
+ *
68
+ * @access public
69
+ * @param array $data
70
+ * @return array
71
+ *
72
+ */
73
+ public function add($data)
74
+ {
75
+ try {
76
+ if (is_null($data)) {
77
+ throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
78
+ }
79
+ $data = (array)$data;
80
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog')
81
+ ->setData((array)$data)
82
+ ->save();
83
+ } catch (Mage_Core_Exception $e) {
84
+ $this->_fault('data_invalid', $e->getMessage());
85
+ } catch (Exception $e) {
86
+ $this->_fault('data_invalid', $e->getMessage());
87
+ }
88
+ return $anymarketlog->getId();
89
+ }
90
+
91
+ /**
92
+ * Change existing anymarket log information
93
+ *
94
+ * @access public
95
+ * @param int $anymarketlogId
96
+ * @param array $data
97
+ * @return bool
98
+ *
99
+ */
100
+ public function update($anymarketlogId, $data)
101
+ {
102
+ $anymarketlog = $this->_initAnymarketlog($anymarketlogId);
103
+ try {
104
+ $data = (array)$data;
105
+ $anymarketlog->addData($data);
106
+ $anymarketlog->save();
107
+ }
108
+ catch (Mage_Core_Exception $e) {
109
+ $this->_fault('save_error', $e->getMessage());
110
+ }
111
+
112
+ return true;
113
+ }
114
+
115
+ /**
116
+ * remove anymarket log
117
+ *
118
+ * @access public
119
+ * @param int $anymarketlogId
120
+ * @return bool
121
+ *
122
+ */
123
+ public function remove($anymarketlogId)
124
+ {
125
+ $anymarketlog = $this->_initAnymarketlog($anymarketlogId);
126
+ try {
127
+ $anymarketlog->delete();
128
+ } catch (Mage_Core_Exception $e) {
129
+ $this->_fault('remove_error', $e->getMessage());
130
+ }
131
+ return true;
132
+ }
133
+
134
+ /**
135
+ * get info
136
+ *
137
+ * @access public
138
+ * @param int $anymarketlogId
139
+ * @return array
140
+ *
141
+ */
142
+ public function info($anymarketlogId)
143
+ {
144
+ $result = array();
145
+ $anymarketlog = $this->_initAnymarketlog($anymarketlogId);
146
+ $result = $this->_getApiData($anymarketlog);
147
+ return $result;
148
+ }
149
+
150
+ /**
151
+ * get data for api
152
+ *
153
+ * @access protected
154
+ * @param DB1_AnyMarket_Model_Anymarketlog $anymarketlog
155
+ * @return array()
156
+ *
157
+ */
158
+ protected function _getApiData(DB1_AnyMarket_Model_Anymarketlog $anymarketlog)
159
+ {
160
+ return $anymarketlog->getData();
161
+ }
162
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketlog/Api/V2.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketlog_Api_V2 extends DB1_AnyMarket_Model_Anymarketlog_Api
18
+ {
19
+ /**
20
+ * AnyMarket Log info
21
+ *
22
+ * @access public
23
+ * @param int $anymarketlogId
24
+ * @return object
25
+ *
26
+ */
27
+ public function info($anymarketlogId)
28
+ {
29
+ $result = parent::info($anymarketlogId);
30
+ $result = Mage::helper('api')->wsiArrayPacker($result);
31
+ return $result;
32
+ }
33
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketorders.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Anymarketorders extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'db1_anymarket_anymarketorders';
31
+ const CACHE_TAG = 'db1_anymarket_anymarketorders';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'db1_anymarket_anymarketorders';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'anymarketorders';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('db1_anymarket/anymarketorders');
58
+ }
59
+
60
+ /**
61
+ * before save anymarket orders
62
+ *
63
+ * @access protected
64
+ * @return DB1_AnyMarket_Model_Anymarketorders
65
+
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * save anymarket orders relation
80
+ *
81
+ * @access public
82
+ * @return DB1_AnyMarket_Model_Anymarketorders
83
+
84
+ */
85
+ protected function _afterSave()
86
+ {
87
+ return parent::_afterSave();
88
+ }
89
+
90
+ /**
91
+ * get default values
92
+ *
93
+ * @access public
94
+ * @return array
95
+
96
+ */
97
+ public function getDefaultValues()
98
+ {
99
+ $values = array();
100
+ $values['status'] = 1;
101
+ return $values;
102
+ }
103
+
104
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketorders_Api extends Mage_Api_Model_Resource_Abstract
18
+ {
19
+
20
+
21
+ /**
22
+ * init anymarket orders
23
+ *
24
+ * @access protected
25
+ * @param $anymarketordersId
26
+ * @return DB1_AnyMarket_Model_Anymarketorders
27
+
28
+ */
29
+ protected function _initAnymarketorders($anymarketordersId)
30
+ {
31
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')->load($anymarketordersId);
32
+ if (!$anymarketorders->getId()) {
33
+ $this->_fault('anymarketorders_not_exists');
34
+ }
35
+ return $anymarketorders;
36
+ }
37
+
38
+ /**
39
+ * get anymarket orders
40
+ *
41
+ * @access public
42
+ * @param mixed $filters
43
+ * @return array
44
+
45
+ */
46
+ public function items($filters = null)
47
+ {
48
+ $collection = Mage::getModel('db1_anymarket/anymarketorders')->getCollection();
49
+ $apiHelper = Mage::helper('api');
50
+ $filters = $apiHelper->parseFilters($filters);
51
+ try {
52
+ foreach ($filters as $field => $value) {
53
+ $collection->addFieldToFilter($field, $value);
54
+ }
55
+ } catch (Mage_Core_Exception $e) {
56
+ $this->_fault('filters_invalid', $e->getMessage());
57
+ }
58
+ $result = array();
59
+ foreach ($collection as $anymarketorders) {
60
+ $result[] = $this->_getApiData($anymarketorders);
61
+ }
62
+ return $result;
63
+ }
64
+
65
+ /**
66
+ * Add anymarket orders
67
+ *
68
+ * @access public
69
+ * @param array $data
70
+ * @return array
71
+
72
+ */
73
+ public function add($data)
74
+ {
75
+ try {
76
+ if (is_null($data)) {
77
+ throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
78
+ }
79
+ $data = (array)$data;
80
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders')
81
+ ->setData((array)$data)
82
+ ->save();
83
+ } catch (Mage_Core_Exception $e) {
84
+ $this->_fault('data_invalid', $e->getMessage());
85
+ } catch (Exception $e) {
86
+ $this->_fault('data_invalid', $e->getMessage());
87
+ }
88
+ return $anymarketorders->getId();
89
+ }
90
+
91
+ /**
92
+ * Change existing anymarket orders information
93
+ *
94
+ * @access public
95
+ * @param int $anymarketordersId
96
+ * @param array $data
97
+ * @return bool
98
+
99
+ */
100
+ public function update($anymarketordersId, $data)
101
+ {
102
+ $anymarketorders = $this->_initAnymarketorders($anymarketordersId);
103
+ try {
104
+ $data = (array)$data;
105
+ $anymarketorders->addData($data);
106
+ $anymarketorders->save();
107
+ }
108
+ catch (Mage_Core_Exception $e) {
109
+ $this->_fault('save_error', $e->getMessage());
110
+ }
111
+
112
+ return true;
113
+ }
114
+
115
+ /**
116
+ * remove anymarket orders
117
+ *
118
+ * @access public
119
+ * @param int $anymarketordersId
120
+ * @return bool
121
+
122
+ */
123
+ public function remove($anymarketordersId)
124
+ {
125
+ $anymarketorders = $this->_initAnymarketorders($anymarketordersId);
126
+ try {
127
+ $anymarketorders->delete();
128
+ } catch (Mage_Core_Exception $e) {
129
+ $this->_fault('remove_error', $e->getMessage());
130
+ }
131
+ return true;
132
+ }
133
+
134
+ /**
135
+ * get info
136
+ *
137
+ * @access public
138
+ * @param int $anymarketordersId
139
+ * @return array
140
+
141
+ */
142
+ public function info($anymarketordersId)
143
+ {
144
+ $result = array();
145
+ $anymarketorders = $this->_initAnymarketorders($anymarketordersId);
146
+ $result = $this->_getApiData($anymarketorders);
147
+ return $result;
148
+ }
149
+
150
+ /**
151
+ * get data for api
152
+ *
153
+ * @access protected
154
+ * @param DB1_AnyMarket_Model_Anymarketorders $anymarketorders
155
+ * @return array()
156
+
157
+ */
158
+ protected function _getApiData(DB1_AnyMarket_Model_Anymarketorders $anymarketorders)
159
+ {
160
+ return $anymarketorders->getData();
161
+ }
162
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketorders/Api/V2.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketorders_Api_V2 extends DB1_AnyMarket_Model_Anymarketorders_Api
18
+ {
19
+ /**
20
+ * Anymarket Orders info
21
+ *
22
+ * @access public
23
+ * @param int $anymarketordersId
24
+ * @return object
25
+
26
+ */
27
+ public function info($anymarketordersId)
28
+ {
29
+ $result = parent::info($anymarketordersId);
30
+ $result = Mage::helper('api')->wsiArrayPacker($result);
31
+ return $result;
32
+ }
33
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketproducts.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Anymarketproducts extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'db1_anymarket_anymarketproducts';
31
+ const CACHE_TAG = 'db1_anymarket_anymarketproducts';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'db1_anymarket_anymarketproducts';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'anymarketproducts';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+ *
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('db1_anymarket/anymarketproducts');
58
+ }
59
+
60
+ /**
61
+ * before save anymarket products
62
+ *
63
+ * @access protected
64
+ * @return DB1_AnyMarket_Model_Anymarketproducts
65
+ *
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * save anymarket products relation
80
+ *
81
+ * @access public
82
+ * @return DB1_AnyMarket_Model_Anymarketproducts
83
+ *
84
+ */
85
+ protected function _afterSave()
86
+ {
87
+ return parent::_afterSave();
88
+ }
89
+
90
+ /**
91
+ * get default values
92
+ *
93
+ * @access public
94
+ * @return array
95
+ *
96
+ */
97
+ public function getDefaultValues()
98
+ {
99
+ $values = array();
100
+ $values['status'] = 1;
101
+ return $values;
102
+ }
103
+
104
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketproducts_Api extends Mage_Api_Model_Resource_Abstract
18
+ {
19
+
20
+
21
+ /**
22
+ * init anymarket products
23
+ *
24
+ * @access protected
25
+ * @param $anymarketproductsId
26
+ * @return DB1_AnyMarket_Model_Anymarketproducts
27
+
28
+ */
29
+ protected function _initAnymarketproducts($anymarketproductsId)
30
+ {
31
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->load($anymarketproductsId);
32
+ if (!$anymarketproducts->getId()) {
33
+ $this->_fault('anymarketproducts_not_exists');
34
+ }
35
+ return $anymarketproducts;
36
+ }
37
+
38
+ /**
39
+ * get anymarket products
40
+ *
41
+ * @access public
42
+ * @param mixed $filters
43
+ * @return array
44
+ *
45
+ */
46
+ public function items($filters = null)
47
+ {
48
+ $collection = Mage::getModel('db1_anymarket/anymarketproducts')->getCollection();
49
+ $apiHelper = Mage::helper('api');
50
+ $filters = $apiHelper->parseFilters($filters);
51
+ try {
52
+ foreach ($filters as $field => $value) {
53
+ $collection->addFieldToFilter($field, $value);
54
+ }
55
+ } catch (Mage_Core_Exception $e) {
56
+ $this->_fault('filters_invalid', $e->getMessage());
57
+ }
58
+ $result = array();
59
+ foreach ($collection as $anymarketproducts) {
60
+ $result[] = $this->_getApiData($anymarketproducts);
61
+ }
62
+ return $result;
63
+ }
64
+
65
+ /**
66
+ * Add anymarket products
67
+ *
68
+ * @access public
69
+ * @param array $data
70
+ * @return array
71
+ *
72
+ */
73
+ public function add($data)
74
+ {
75
+ try {
76
+ if (is_null($data)) {
77
+ throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
78
+ }
79
+ $data = (array)$data;
80
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')
81
+ ->setData((array)$data)
82
+ ->save();
83
+ } catch (Mage_Core_Exception $e) {
84
+ $this->_fault('data_invalid', $e->getMessage());
85
+ } catch (Exception $e) {
86
+ $this->_fault('data_invalid', $e->getMessage());
87
+ }
88
+ return $anymarketproducts->getId();
89
+ }
90
+
91
+ /**
92
+ * Change existing anymarket products information
93
+ *
94
+ * @access public
95
+ * @param int $anymarketproductsId
96
+ * @param array $data
97
+ * @return bool
98
+ *
99
+ */
100
+ public function update($anymarketproductsId, $data)
101
+ {
102
+ $anymarketproducts = $this->_initAnymarketproducts($anymarketproductsId);
103
+ try {
104
+ $data = (array)$data;
105
+ $anymarketproducts->addData($data);
106
+ $anymarketproducts->save();
107
+ }
108
+ catch (Mage_Core_Exception $e) {
109
+ $this->_fault('save_error', $e->getMessage());
110
+ }
111
+
112
+ return true;
113
+ }
114
+
115
+ /**
116
+ * remove anymarket products
117
+ *
118
+ * @access public
119
+ * @param int $anymarketproductsId
120
+ * @return bool
121
+ *
122
+ */
123
+ public function remove($anymarketproductsId)
124
+ {
125
+ $anymarketproducts = $this->_initAnymarketproducts($anymarketproductsId);
126
+ try {
127
+ $anymarketproducts->delete();
128
+ } catch (Mage_Core_Exception $e) {
129
+ $this->_fault('remove_error', $e->getMessage());
130
+ }
131
+ return true;
132
+ }
133
+
134
+ /**
135
+ * get info
136
+ *
137
+ * @access public
138
+ * @param int $anymarketproductsId
139
+ * @return array
140
+ *
141
+ */
142
+ public function info($anymarketproductsId)
143
+ {
144
+ $result = array();
145
+ $anymarketproducts = $this->_initAnymarketproducts($anymarketproductsId);
146
+ $result = $this->_getApiData($anymarketproducts);
147
+ return $result;
148
+ }
149
+
150
+ /**
151
+ * get data for api
152
+ *
153
+ * @access protected
154
+ * @param DB1_AnyMarket_Model_Anymarketproducts $anymarketproducts
155
+ * @return array()
156
+ *
157
+ */
158
+ protected function _getApiData(DB1_AnyMarket_Model_Anymarketproducts $anymarketproducts)
159
+ {
160
+ return $anymarketproducts->getData();
161
+ }
162
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketproducts/Api/V2.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketproducts_Api_V2 extends DB1_AnyMarket_Model_Anymarketproducts_Api
18
+ {
19
+ /**
20
+ * Anymarket Products info
21
+ *
22
+ * @access public
23
+ * @param int $anymarketproductsId
24
+ * @return object
25
+ *
26
+ */
27
+ public function info($anymarketproductsId)
28
+ {
29
+ $result = parent::info($anymarketproductsId);
30
+ $result = Mage::helper('api')->wsiArrayPacker($result);
31
+ return $result;
32
+ }
33
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketqueue.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Model_Anymarketqueue extends Mage_Core_Model_Abstract
24
+ {
25
+ /**
26
+ * Entity code.
27
+ * Can be used as part of method name for entity processing
28
+ */
29
+ const ENTITY = 'db1_anymarket_anymarketqueue';
30
+ const CACHE_TAG = 'db1_anymarket_anymarketqueue';
31
+
32
+ /**
33
+ * Prefix of model events names
34
+ *
35
+ * @var string
36
+ */
37
+ protected $_eventPrefix = 'db1_anymarket_anymarketqueue';
38
+
39
+ /**
40
+ * Parameter name in event
41
+ *
42
+ * @var string
43
+ */
44
+ protected $_eventObject = 'anymarketqueue';
45
+
46
+ /**
47
+ * constructor
48
+ *
49
+ * @access public
50
+ * @return void
51
+
52
+ */
53
+ public function _construct()
54
+ {
55
+ parent::_construct();
56
+ $this->_init('db1_anymarket/anymarketqueue');
57
+ }
58
+
59
+ /**
60
+ * before save anymarket queue
61
+ *
62
+ * @access protected
63
+ * @return DB1_AnyMarket_Model_Anymarketqueue
64
+
65
+ */
66
+ protected function _beforeSave()
67
+ {
68
+ parent::_beforeSave();
69
+ $now = Mage::getSingleton('core/date')->gmtDate();
70
+ if ($this->isObjectNew()) {
71
+ $this->setCreatedAt($now);
72
+ }
73
+ $this->setUpdatedAt($now);
74
+ return $this;
75
+ }
76
+
77
+ /**
78
+ * save anymarket queue relation
79
+ *
80
+ * @access public
81
+ * @return DB1_AnyMarket_Model_Anymarketqueue
82
+
83
+ */
84
+ protected function _afterSave()
85
+ {
86
+ return parent::_afterSave();
87
+ }
88
+
89
+ /**
90
+ * get default values
91
+ *
92
+ * @access public
93
+ * @return array
94
+
95
+ */
96
+ public function getDefaultValues()
97
+ {
98
+ $values = array();
99
+ $values['status'] = 1;
100
+ return $values;
101
+ }
102
+
103
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketqueue_Api extends Mage_Api_Model_Resource_Abstract
18
+ {
19
+
20
+
21
+ /**
22
+ * init anymarket queue
23
+ *
24
+ * @access protected
25
+ * @param $anymarketqueueId
26
+ * @return DB1_AnyMarket_Model_Anymarketqueue
27
+ "
28
+ */
29
+ protected function _initAnymarketqueue($anymarketqueueId)
30
+ {
31
+ $anymarketqueue = Mage::getModel('db1_anymarket/anymarketqueue')->load($anymarketqueueId);
32
+ if (!$anymarketqueue->getId()) {
33
+ $this->_fault('anymarketqueue_not_exists');
34
+ }
35
+ return $anymarketqueue;
36
+ }
37
+
38
+ /**
39
+ * get anymarket queues
40
+ *
41
+ * @access public
42
+ * @param mixed $filters
43
+ * @return array
44
+
45
+ */
46
+ public function items($filters = null)
47
+ {
48
+ $collection = Mage::getModel('db1_anymarket/anymarketqueue')->getCollection();
49
+ $apiHelper = Mage::helper('api');
50
+ $filters = $apiHelper->parseFilters($filters);
51
+ try {
52
+ foreach ($filters as $field => $value) {
53
+ $collection->addFieldToFilter($field, $value);
54
+ }
55
+ } catch (Mage_Core_Exception $e) {
56
+ $this->_fault('filters_invalid', $e->getMessage());
57
+ }
58
+ $result = array();
59
+ foreach ($collection as $anymarketqueue) {
60
+ $result[] = $this->_getApiData($anymarketqueue);
61
+ }
62
+ return $result;
63
+ }
64
+
65
+ /**
66
+ * Add anymarket queue
67
+ *
68
+ * @access public
69
+ * @param array $data
70
+ * @return array
71
+
72
+ */
73
+ public function add($data)
74
+ {
75
+ try {
76
+ if (is_null($data)) {
77
+ throw new Exception(Mage::helper('db1_anymarket')->__("Data cannot be null"));
78
+ }
79
+ $data = (array)$data;
80
+ $anymarketqueue = Mage::getModel('db1_anymarket/anymarketqueue')
81
+ ->setData((array)$data)
82
+ ->save();
83
+ } catch (Mage_Core_Exception $e) {
84
+ $this->_fault('data_invalid', $e->getMessage());
85
+ } catch (Exception $e) {
86
+ $this->_fault('data_invalid', $e->getMessage());
87
+ }
88
+ return $anymarketqueue->getId();
89
+ }
90
+
91
+ /**
92
+ * Change existing anymarket queue information
93
+ *
94
+ * @access public
95
+ * @param int $anymarketqueueId
96
+ * @param array $data
97
+ * @return bool
98
+
99
+ */
100
+ public function update($anymarketqueueId, $data)
101
+ {
102
+ $anymarketqueue = $this->_initAnymarketqueue($anymarketqueueId);
103
+ try {
104
+ $data = (array)$data;
105
+ $anymarketqueue->addData($data);
106
+ $anymarketqueue->save();
107
+ }
108
+ catch (Mage_Core_Exception $e) {
109
+ $this->_fault('save_error', $e->getMessage());
110
+ }
111
+
112
+ return true;
113
+ }
114
+
115
+ /**
116
+ * remove anymarket queue
117
+ *
118
+ * @access public
119
+ * @param int $anymarketqueueId
120
+ * @return bool
121
+
122
+ */
123
+ public function remove($anymarketqueueId)
124
+ {
125
+ $anymarketqueue = $this->_initAnymarketqueue($anymarketqueueId);
126
+ try {
127
+ $anymarketqueue->delete();
128
+ } catch (Mage_Core_Exception $e) {
129
+ $this->_fault('remove_error', $e->getMessage());
130
+ }
131
+ return true;
132
+ }
133
+
134
+ /**
135
+ * get info
136
+ *
137
+ * @access public
138
+ * @param int $anymarketqueueId
139
+ * @return array
140
+
141
+ */
142
+ public function info($anymarketqueueId)
143
+ {
144
+ $result = array();
145
+ $anymarketqueue = $this->_initAnymarketqueue($anymarketqueueId);
146
+ $result = $this->_getApiData($anymarketqueue);
147
+ return $result;
148
+ }
149
+
150
+ /**
151
+ * get data for api
152
+ *
153
+ * @access protected
154
+ * @param DB1_AnyMarket_Model_Anymarketqueue $anymarketqueue
155
+ * @return array()
156
+
157
+ */
158
+ protected function _getApiData(DB1_AnyMarket_Model_Anymarketqueue $anymarketqueue)
159
+ {
160
+ return $anymarketqueue->getData();
161
+ }
162
+ }
app/code/community/DB1/AnyMarket/Model/Anymarketqueue/Api/V2.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class DB1_AnyMarket_Model_Anymarketqueue_Api_V2 extends DB1_AnyMarket_Model_Anymarketqueue_Api
18
+ {
19
+ /**
20
+ * Anymarket Queue info
21
+ *
22
+ * @access public
23
+ * @param int $anymarketqueueId
24
+ * @return object
25
+
26
+ */
27
+ public function info($anymarketqueueId)
28
+ {
29
+ $result = parent::info($anymarketqueueId);
30
+ $result = Mage::helper('api')->wsiArrayPacker($result);
31
+ return $result;
32
+ }
33
+ }
app/code/community/DB1/AnyMarket/Model/Cron.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DB1_AnyMarket_Model_Cron{
3
+
4
+ public function sincOrders(){
5
+ Mage::getSingleton('core/session')->setImportOrdersVariable('false');
6
+
7
+ $allStores = Mage::helper('db1_anymarket')->getAllStores();
8
+ foreach ($allStores as $store) {
9
+ $storeID = $store['store_id'];
10
+ Mage::app()->setCurrentStore($storeID);
11
+
12
+ $arrayofOrders = array();
13
+ $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', $storeID);
14
+ if($ConfigOrder == 1){
15
+ Mage::helper('db1_anymarket/order')->getFeedOrdersFromAnyMarket();
16
+ }else{
17
+ $orders = Mage::getModel('sales/order')->getCollection();
18
+ foreach($orders as $order) {
19
+ Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($order);
20
+ }
21
+ }
22
+
23
+ }
24
+ Mage::getSingleton('core/session')->setImportOrdersVariable('true');
25
+
26
+ }
27
+
28
+ public function sincProducts(){
29
+ $allStores = Mage::helper('db1_anymarket')->getAllStores();
30
+ foreach ($allStores as $store) {
31
+ $storeID = $store['store_id'];
32
+ Mage::app()->setCurrentStore($storeID);
33
+
34
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
35
+ if($typeSincProd == 1){
36
+ Mage::helper('db1_anymarket/product')->getFeedProdsFromAnyMarket();
37
+ }else{
38
+ $products = Mage::getModel('catalog/product')->getCollection();
39
+ foreach($products as $product) {
40
+
41
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->load($product->getId(), 'nmp_id');
42
+ if($anymarketproducts->getData('nmp_id') != null){
43
+ if( strtolower($anymarketproducts->getData('nmp_status_int')) != 'integrado'){
44
+
45
+ $ProdLoaded = Mage::getModel('catalog/product')->load( $product->getId() );
46
+ if( ($ProdLoaded->getStatus() == 1) && ($ProdLoaded->getData('integra_anymarket') == 1) ){
47
+ Mage::helper('db1_anymarket/product')->sendProductToAnyMarket( $product->getId() );
48
+
49
+ $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', Mage::app()->getStore()->getId()));
50
+ $ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
51
+
52
+ Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($product->getId(), $ProdStock->getQty(), $ProdLoaded->getData($filter));
53
+ }
54
+ }
55
+ }
56
+
57
+ }
58
+ }
59
+ }
60
+ }
61
+
62
+ public function executeQueue(){
63
+ Mage::helper('db1_anymarket/queue')->processQueue();
64
+ }
65
+
66
+ }
app/code/community/DB1/AnyMarket/Model/Observer.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Model_Observer {
4
+
5
+ public function sendProdAnyMarket($observer) {
6
+ $ExportProdSession = Mage::getSingleton('core/session')->getImportProdsVariable();
7
+ if( $ExportProdSession != 'false' ) {
8
+ $productOld = $observer->getEvent()->getProduct();
9
+ $storeID = $productOld->getStoreId();
10
+ if($storeID == null){
11
+ $storeID = 0;
12
+ }
13
+
14
+ $product = Mage::getModel('catalog/product')->setStoreId($storeID)->load($productOld->getId());
15
+ if( $product->getData('integra_anymarket') == 1 ){
16
+ $sincronize = false;
17
+ $parentIds = null;
18
+ if($product->getTypeID() == "configurable"){
19
+ if($product->getStatus() == 1){ //se nao esta com o status enabled
20
+ Mage::getModel('catalog/product_type_configurable')->getProduct($product)->unsetData('_cache_instance_products');
21
+ $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
22
+
23
+ if(count($childProducts) > 0){
24
+ $sincronize = true;
25
+ }
26
+ }
27
+ }else{
28
+ if($product->getStatus() == 1){ //se nao esta com o status enabled
29
+ if($product->getVisibility() == 1){ //nao exibido individualmente
30
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild( $product->getId() );
31
+
32
+ if ($parentIds) {
33
+ $sincronize = true;
34
+ }else if( $product->getTypeID() != 'simple'){
35
+ $sincronize = true;
36
+ $parentIds = 0;
37
+ }
38
+ }else{
39
+ $sincronize = true;
40
+ $parentIds = 0;
41
+ }
42
+ }
43
+
44
+ }
45
+
46
+ if($sincronize == true){
47
+ Mage::app()->setCurrentStore($storeID);
48
+
49
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
50
+ $sendProd = false;
51
+ if( ($typeSincProd == 0) && (!$parentIds) ){
52
+ $sendProd = Mage::helper('db1_anymarket/product')->sendProductToAnyMarket( $product->getId());
53
+ }
54
+
55
+ if($sendProd){
56
+ $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', $storeID));
57
+ if ($product->getData($filter) != $productOld->getOrigData($filter)){
58
+ if( $typeSincProd == 0 ){
59
+ Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($product->getId(), null, $product->getData($filter));
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ }
68
+
69
+ public function updateOrderAnyMarketObs($observer){
70
+ $ImportOrderSession = Mage::getSingleton('core/session')->getImportOrdersVariable();
71
+
72
+ $OrderID = $observer->getEvent()->getOrder()->getIncrementId();
73
+ if(Mage::registry('order_save_observer_executed_'.$OrderID )){
74
+ return $this;
75
+ }
76
+
77
+ Mage::register('order_save_observer_executed_'.$OrderID, true);
78
+ Mage::app()->setCurrentStore( $observer->getEvent()->getOrder()->getStoreId() );
79
+ Mage::helper('db1_anymarket/order')->updateOrderAnyMarket( $observer->getEvent()->getOrder() );
80
+ }
81
+
82
+ public function removeProdAnyMarketControl($observer){
83
+ $product = $observer->getEvent()->getProduct();
84
+
85
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->getCollection()
86
+ ->addFieldToFilter('nmp_sku', $product->getSku());
87
+
88
+ foreach( $anymarketproducts as $item ){
89
+ $item->delete();
90
+ }
91
+ }
92
+
93
+ public function catalogInventorySave($observer){
94
+ $ImportOrderSession = Mage::getSingleton('core/session')->getImportOrdersVariable();
95
+ if( $ImportOrderSession != 'false' ) {
96
+ $event = $observer->getEvent();
97
+ $_item = $event->getItem();
98
+
99
+ $storeID = $_item->getData('store_id');
100
+ if($storeID == null){
101
+ $storeID = 0;
102
+ }
103
+
104
+ Mage::app()->setCurrentStore($storeID);
105
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
106
+ if($typeSincProd == 0){
107
+ if ((int)$_item->getData('qty') != (int)$_item->getOrigData('qty')) {
108
+ Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($_item->getProductId(), $_item->getQty(), null);
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ public function subtractQuoteInventory($observer){
115
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', Mage::app()->getStore()->getId());
116
+ if($typeSincProd == 0){
117
+ $quote = $observer->getEvent()->getQuote();
118
+ foreach ($quote->getAllItems() as $item) {
119
+ $itemSold = $item->getTotalQty();
120
+ $qty = $item->getProduct()->getStockItem()->getQty();
121
+ $qtyNow = $qty-$itemSold;
122
+
123
+ Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($item->getProductId(), $qtyNow, null);
124
+ }
125
+ }
126
+ }
127
+
128
+ public function revertQuoteInventory($observer){
129
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', Mage::app()->getStore()->getId());
130
+ if($typeSincProd == 0){
131
+ $quote = $observer->getEvent()->getQuote();
132
+ foreach ($quote->getAllItems() as $item) {
133
+ $qty = $item->getProduct()->getStockItem()->getQty();
134
+ $itemRevert = ($item->getTotalQty());
135
+ $qtyNow = $qty+$itemRevert;
136
+
137
+ Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($item->getProductId(), $qtyNow, null);
138
+ }
139
+ }
140
+ }
141
+
142
+ public function cancelOrderItem($observer){
143
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', Mage::app()->getStore()->getId());
144
+ if($typeSincProd == 0){
145
+ $item = $observer->getEvent()->getItem();
146
+ $storeID = $item->getStoreId();
147
+ Mage::app()->setCurrentStore($storeID);
148
+
149
+ $qty = $item->getQtyOrdered() - max($item->getQtyShipped(), $item->getQtyInvoiced()) - $item->getQtyCanceled();
150
+
151
+ Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($item->getProductId(), $item->getProduct()->getStockItem()->getQty(), null);
152
+ }
153
+ }
154
+
155
+ public function refundOrderInventory($observer){
156
+ $creditmemo = $observer->getEvent()->getCreditmemo();
157
+
158
+ $storeID = $creditmemo->getStoreId();
159
+ if($storeID == null){
160
+ $storeID = 0;
161
+ }
162
+ Mage::app()->setCurrentStore($storeID);
163
+
164
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
165
+ if($typeSincProd == 0){
166
+ foreach ($creditmemo->getAllItems() as $item) {
167
+ if($item->getData('back_to_stock') == 1){
168
+ $ProdLoaded = Mage::getModel('catalog/product')->setStoreId($storeID)->load($item->getProductId());
169
+ $stockQty = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($ProdLoaded)->getQty();
170
+
171
+ Mage::helper('db1_anymarket/product')->updatePriceStockAnyMarket($item->getProductId(), $stockQty+(int)$item->getQty(), null);
172
+ }
173
+ }
174
+ }
175
+ }
176
+
177
+ }
178
+ ?>
app/code/community/DB1/AnyMarket/Model/PaymentMethod.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DB1_AnyMarket_Model_Paymentmethod extends Mage_Payment_Model_Method_Abstract {
3
+ protected $_code = 'db1_anymarket';
4
+ protected $_isInitializeNeeded = true;
5
+ protected $_canUseInternal = true;
6
+ protected $_canUseForMultishipping = false;
7
+ protected $_apiToken = null;
8
+
9
+ public function assignData($data)
10
+ {
11
+ $info = $this->getInfoInstance();
12
+
13
+ if ($data->getCustomFieldOne())
14
+ {
15
+ $info->setCustomFieldOne($data->getCustomFieldOne());
16
+ }
17
+
18
+ if ($data->getCustomFieldTwo())
19
+ {
20
+ $info->setCustomFieldTwo($data->getCustomFieldTwo());
21
+ }
22
+
23
+ return $this;
24
+ }
25
+
26
+ public function validate()
27
+ {
28
+ parent::validate();
29
+ $info = $this->getInfoInstance();
30
+
31
+ return $this;
32
+ }
33
+
34
+ public function getOrderPlaceRedirectUrl()
35
+ {
36
+ return Mage::getUrl('db1_anymarket/payment/redirect', array('_secure' => false));
37
+ }
38
+ }
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Attributes resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketattributes extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('db1_anymarket/anymarketattributes', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * Get store ids to which specified item is assigned
40
+ *
41
+ * @access public
42
+ * @param int $anymarketattributesId
43
+ * @return array
44
+
45
+ */
46
+ public function lookupStoreIds($anymarketattributesId)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getTable('db1_anymarket/anymarketattributes_store'), 'store_id')
51
+ ->where('anymarketattributes_id = ?', (int)$anymarketattributesId);
52
+ return $adapter->fetchCol($select);
53
+ }
54
+
55
+ /**
56
+ * Perform operations after object load
57
+ *
58
+ * @access public
59
+ * @param Mage_Core_Model_Abstract $object
60
+ * @return DB1_AnyMarket_Model_Resource_Anymarketattributes
61
+
62
+ */
63
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
64
+ {
65
+ if ($object->getId()) {
66
+ $stores = $this->lookupStoreIds($object->getId());
67
+ $object->setData('store_id', $stores);
68
+ }
69
+ return parent::_afterLoad($object);
70
+ }
71
+
72
+ /**
73
+ * Retrieve select object for load object data
74
+ *
75
+ * @param string $field
76
+ * @param mixed $value
77
+ * @param DB1_AnyMarket_Model_Anymarketattributes $object
78
+ * @return Zend_Db_Select
79
+ */
80
+ protected function _getLoadSelect($field, $value, $object)
81
+ {
82
+ $select = parent::_getLoadSelect($field, $value, $object);
83
+ if ($object->getStoreId()) {
84
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
85
+ $select->join(
86
+ array('anymarket_anymarketattributes_store' => $this->getTable('db1_anymarket/anymarketattributes_store')),
87
+ $this->getMainTable() . '.entity_id = anymarket_anymarketattributes_store.anymarketattributes_id',
88
+ array()
89
+ )
90
+ ->where('anymarket_anymarketattributes_store.store_id IN (?)', $storeIds)
91
+ ->order('anymarket_anymarketattributes_store.store_id DESC')
92
+ ->limit(1);
93
+ }
94
+ return $select;
95
+ }
96
+
97
+ /**
98
+ * Assign anymarket attributes to store views
99
+ *
100
+ * @access protected
101
+ * @param Mage_Core_Model_Abstract $object
102
+ * @return DB1_AnyMarket_Model_Resource_Anymarketattributes
103
+
104
+ */
105
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
106
+ {
107
+ $oldStores = $this->lookupStoreIds($object->getId());
108
+ $newStores = (array)$object->getStores();
109
+ if (empty($newStores)) {
110
+ $newStores = (array)$object->getStoreId();
111
+ }
112
+ $table = $this->getTable('db1_anymarket/anymarketattributes_store');
113
+ $insert = array_diff($newStores, $oldStores);
114
+ $delete = array_diff($oldStores, $newStores);
115
+ if ($delete) {
116
+ $where = array(
117
+ 'anymarketattributes_id = ?' => (int) $object->getId(),
118
+ 'store_id IN (?)' => $delete
119
+ );
120
+ $this->_getWriteAdapter()->delete($table, $where);
121
+ }
122
+ if ($insert) {
123
+ $data = array();
124
+ foreach ($insert as $storeId) {
125
+ $data[] = array(
126
+ 'anymarketattributes_id' => (int) $object->getId(),
127
+ 'store_id' => (int) $storeId
128
+ );
129
+ }
130
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
131
+ }
132
+ return parent::_afterSave($object);
133
+ }}
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketattributes/Collection.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 25
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Attributes collection resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketattributes_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('db1_anymarket/anymarketattributes');
39
+ $this->_map['fields']['store'] = 'store_table.store_id';
40
+ }
41
+
42
+ /**
43
+ * Add filter by store
44
+ *
45
+ * @access public
46
+ * @param int|Mage_Core_Model_Store $store
47
+ * @param bool $withAdmin
48
+ * @return DB1_AnyMarket_Model_Resource_Anymarketattributes_Collection
49
+
50
+ */
51
+ public function addStoreFilter($store, $withAdmin = true)
52
+ {
53
+ if (!isset($this->_joinedFields['store'])) {
54
+ if ($store instanceof Mage_Core_Model_Store) {
55
+ $store = array($store->getId());
56
+ }
57
+ if (!is_array($store)) {
58
+ $store = array($store);
59
+ }
60
+ if ($withAdmin) {
61
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
62
+ }
63
+ $this->addFilter('store', array('in' => $store), 'public');
64
+ $this->_joinedFields['store'] = true;
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Join store relation table if there is store filter
71
+ *
72
+ * @access protected
73
+ * @return DB1_AnyMarket_Model_Resource_Anymarketattributes_Collection
74
+
75
+ */
76
+ protected function _renderFiltersBefore()
77
+ {
78
+ if ($this->getFilter('store')) {
79
+ $this->getSelect()->join(
80
+ array('store_table' => $this->getTable('db1_anymarket/anymarketattributes_store')),
81
+ 'main_table.entity_id = store_table.anymarketattributes_id',
82
+ array()
83
+ )
84
+ ->group('main_table.entity_id');
85
+ /*
86
+ * Allow analytic functions usage because of one field grouping
87
+ */
88
+ $this->_useAnalyticFunction = true;
89
+ }
90
+ return parent::_renderFiltersBefore();
91
+ }
92
+
93
+ /**
94
+ * get anymarket attributes as array
95
+ *
96
+ * @access protected
97
+ * @param string $valueField
98
+ * @param string $labelField
99
+ * @param array $additional
100
+ * @return array
101
+
102
+ */
103
+ protected function _toOptionArray($valueField='entity_id', $labelField='nma_desc', $additional=array())
104
+ {
105
+ return parent::_toOptionArray($valueField, $labelField, $additional);
106
+ }
107
+
108
+ /**
109
+ * get options hash
110
+ *
111
+ * @access protected
112
+ * @param string $valueField
113
+ * @param string $labelField
114
+ * @return array
115
+
116
+ */
117
+ protected function _toOptionHash($valueField='entity_id', $labelField='nma_desc')
118
+ {
119
+ return parent::_toOptionHash($valueField, $labelField);
120
+ }
121
+
122
+ /**
123
+ * Get SQL for get record count.
124
+ * Extra GROUP BY strip added.
125
+ *
126
+ * @access public
127
+ * @return Varien_Db_Select
128
+
129
+ */
130
+ public function getSelectCountSql()
131
+ {
132
+ $countSelect = parent::getSelectCountSql();
133
+ $countSelect->reset(Zend_Db_Select::GROUP);
134
+ return $countSelect;
135
+ }
136
+ }
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketcategories extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('db1_anymarket/anymarketcategories', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * Get store ids to which specified item is assigned
40
+ *
41
+ * @access public
42
+ * @param int $anymarketcategoriesId
43
+ * @return array
44
+
45
+ */
46
+ public function lookupStoreIds($anymarketcategoriesId)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getTable('db1_anymarket/anymarketcategories_store'), 'store_id')
51
+ ->where('anymarketcategories_id = ?', (int)$anymarketcategoriesId);
52
+ return $adapter->fetchCol($select);
53
+ }
54
+
55
+ /**
56
+ * Perform operations after object load
57
+ *
58
+ * @access public
59
+ * @param Mage_Core_Model_Abstract $object
60
+ * @return DB1_AnyMarket_Model_Resource_Anymarketcategories
61
+
62
+ */
63
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
64
+ {
65
+ if ($object->getId()) {
66
+ $stores = $this->lookupStoreIds($object->getId());
67
+ $object->setData('store_id', $stores);
68
+ }
69
+ return parent::_afterLoad($object);
70
+ }
71
+
72
+ /**
73
+ * Retrieve select object for load object data
74
+ *
75
+ * @param string $field
76
+ * @param mixed $value
77
+ * @param DB1_AnyMarket_Model_Anymarketcategories $object
78
+ * @return Zend_Db_Select
79
+ */
80
+ protected function _getLoadSelect($field, $value, $object)
81
+ {
82
+ $select = parent::_getLoadSelect($field, $value, $object);
83
+ if ($object->getStoreId()) {
84
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
85
+ $select->join(
86
+ array('anymarket_anymarketcategories_store' => $this->getTable('db1_anymarket/anymarketcategories_store')),
87
+ $this->getMainTable() . '.entity_id = anymarket_anymarketcategories_store.anymarketcategories_id',
88
+ array()
89
+ )
90
+ ->where('anymarket_anymarketcategories_store.store_id IN (?)', $storeIds)
91
+ ->order('anymarket_anymarketcategories_store.store_id DESC')
92
+ ->limit(1);
93
+ }
94
+ return $select;
95
+ }
96
+
97
+ /**
98
+ * Assign anymarket categories to store views
99
+ *
100
+ * @access protected
101
+ * @param Mage_Core_Model_Abstract $object
102
+ * @return DB1_AnyMarket_Model_Resource_Anymarketcategories
103
+
104
+ */
105
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
106
+ {
107
+ $oldStores = $this->lookupStoreIds($object->getId());
108
+ $newStores = (array)$object->getStores();
109
+ if (empty($newStores)) {
110
+ $newStores = (array)$object->getStoreId();
111
+ }
112
+ $table = $this->getTable('db1_anymarket/anymarketcategories_store');
113
+ $insert = array_diff($newStores, $oldStores);
114
+ $delete = array_diff($oldStores, $newStores);
115
+ if ($delete) {
116
+ $where = array(
117
+ 'anymarketcategories_id = ?' => (int) $object->getId(),
118
+ 'store_id IN (?)' => $delete
119
+ );
120
+ $this->_getWriteAdapter()->delete($table, $where);
121
+ }
122
+ if ($insert) {
123
+ $data = array();
124
+ foreach ($insert as $storeId) {
125
+ $data[] = array(
126
+ 'anymarketcategories_id' => (int) $object->getId(),
127
+ 'store_id' => (int) $storeId
128
+ );
129
+ }
130
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
131
+ }
132
+ return parent::_afterSave($object);
133
+ }}
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketcategories/Collection.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories collection resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketcategories_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('db1_anymarket/anymarketcategories');
39
+ $this->_map['fields']['store'] = 'store_table.store_id';
40
+ }
41
+
42
+ /**
43
+ * Add filter by store
44
+ *
45
+ * @access public
46
+ * @param int|Mage_Core_Model_Store $store
47
+ * @param bool $withAdmin
48
+ * @return DB1_AnyMarket_Model_Resource_Anymarketcategories_Collection
49
+
50
+ */
51
+ public function addStoreFilter($store, $withAdmin = true)
52
+ {
53
+ if (!isset($this->_joinedFields['store'])) {
54
+ if ($store instanceof Mage_Core_Model_Store) {
55
+ $store = array($store->getId());
56
+ }
57
+ if (!is_array($store)) {
58
+ $store = array($store);
59
+ }
60
+ if ($withAdmin) {
61
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
62
+ }
63
+ $this->addFilter('store', array('in' => $store), 'public');
64
+ $this->_joinedFields['store'] = true;
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Join store relation table if there is store filter
71
+ *
72
+ * @access protected
73
+ * @return DB1_AnyMarket_Model_Resource_Anymarketcategories_Collection
74
+
75
+ */
76
+ protected function _renderFiltersBefore()
77
+ {
78
+ if ($this->getFilter('store')) {
79
+ $this->getSelect()->join(
80
+ array('store_table' => $this->getTable('db1_anymarket/anymarketcategories_store')),
81
+ 'main_table.entity_id = store_table.anymarketcategories_id',
82
+ array()
83
+ )
84
+ ->group('main_table.entity_id');
85
+ /*
86
+ * Allow analytic functions usage because of one field grouping
87
+ */
88
+ $this->_useAnalyticFunction = true;
89
+ }
90
+ return parent::_renderFiltersBefore();
91
+ }
92
+
93
+ /**
94
+ * get anymarket categories as array
95
+ *
96
+ * @access protected
97
+ * @param string $valueField
98
+ * @param string $labelField
99
+ * @param array $additional
100
+ * @return array
101
+
102
+ */
103
+ protected function _toOptionArray($valueField='entity_id', $labelField='nmc_cat_desc', $additional=array())
104
+ {
105
+ return parent::_toOptionArray($valueField, $labelField, $additional);
106
+ }
107
+
108
+ /**
109
+ * get options hash
110
+ *
111
+ * @access protected
112
+ * @param string $valueField
113
+ * @param string $labelField
114
+ * @return array
115
+
116
+ */
117
+ protected function _toOptionHash($valueField='entity_id', $labelField='nmc_cat_desc')
118
+ {
119
+ return parent::_toOptionHash($valueField, $labelField);
120
+ }
121
+
122
+ /**
123
+ * Get SQL for get record count.
124
+ * Extra GROUP BY strip added.
125
+ *
126
+ * @access public
127
+ * @return Varien_Db_Select
128
+
129
+ */
130
+ public function getSelectCountSql()
131
+ {
132
+ $countSelect = parent::getSelectCountSql();
133
+ $countSelect->reset(Zend_Db_Select::GROUP);
134
+ return $countSelect;
135
+ }
136
+ }
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketlog extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ *
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('db1_anymarket/anymarketlog', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * Get store ids to which specified item is assigned
40
+ *
41
+ * @access public
42
+ * @param int $anymarketlogId
43
+ * @return array
44
+ *
45
+ */
46
+ public function lookupStoreIds($anymarketlogId)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getTable('db1_anymarket/anymarketlog_store'), 'store_id')
51
+ ->where('anymarketlog_id = ?', (int)$anymarketlogId);
52
+ return $adapter->fetchCol($select);
53
+ }
54
+
55
+ /**
56
+ * Perform operations after object load
57
+ *
58
+ * @access public
59
+ * @param Mage_Core_Model_Abstract $object
60
+ * @return DB1_AnyMarket_Model_Resource_Anymarketlog
61
+ *
62
+ */
63
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
64
+ {
65
+ if ($object->getId()) {
66
+ $stores = $this->lookupStoreIds($object->getId());
67
+ $object->setData('store_id', $stores);
68
+ }
69
+ return parent::_afterLoad($object);
70
+ }
71
+
72
+ /**
73
+ * Retrieve select object for load object data
74
+ *
75
+ * @param string $field
76
+ * @param mixed $value
77
+ * @param DB1_AnyMarket_Model_Anymarketlog $object
78
+ * @return Zend_Db_Select
79
+ */
80
+ protected function _getLoadSelect($field, $value, $object)
81
+ {
82
+ $select = parent::_getLoadSelect($field, $value, $object);
83
+ if ($object->getStoreId()) {
84
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
85
+ $select->join(
86
+ array('anymarket_anymarketlog_store' => $this->getTable('db1_anymarket/anymarketlog_store')),
87
+ $this->getMainTable() . '.entity_id = anymarket_anymarketlog_store.anymarketlog_id',
88
+ array()
89
+ )
90
+ ->where('anymarket_anymarketlog_store.store_id IN (?)', $storeIds)
91
+ ->order('anymarket_anymarketlog_store.store_id DESC')
92
+ ->limit(1);
93
+ }
94
+ return $select;
95
+ }
96
+
97
+ /**
98
+ * Assign anymarket log to store views
99
+ *
100
+ * @access protected
101
+ * @param Mage_Core_Model_Abstract $object
102
+ * @return DB1_AnyMarket_Model_Resource_Anymarketlog
103
+ *
104
+ */
105
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
106
+ {
107
+ $oldStores = $this->lookupStoreIds($object->getId());
108
+ $newStores = (array)$object->getStores();
109
+ if (empty($newStores)) {
110
+ $newStores = (array)$object->getStoreId();
111
+ }
112
+ $table = $this->getTable('db1_anymarket/anymarketlog_store');
113
+ $insert = array_diff($newStores, $oldStores);
114
+ $delete = array_diff($oldStores, $newStores);
115
+ if ($delete) {
116
+ $where = array(
117
+ 'anymarketlog_id = ?' => (int) $object->getId(),
118
+ 'store_id IN (?)' => $delete
119
+ );
120
+ $this->_getWriteAdapter()->delete($table, $where);
121
+ }
122
+ if ($insert) {
123
+ $data = array();
124
+ foreach ($insert as $storeId) {
125
+ $data[] = array(
126
+ 'anymarketlog_id' => (int) $object->getId(),
127
+ 'store_id' => (int) $storeId
128
+ );
129
+ }
130
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
131
+ }
132
+ return parent::_afterSave($object);
133
+ }}
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketlog/Collection.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log collection resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketlog_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ *
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('db1_anymarket/anymarketlog');
39
+ $this->_map['fields']['store'] = 'store_table.store_id';
40
+ }
41
+
42
+ /**
43
+ * Add filter by store
44
+ *
45
+ * @access public
46
+ * @param int|Mage_Core_Model_Store $store
47
+ * @param bool $withAdmin
48
+ * @return DB1_AnyMarket_Model_Resource_Anymarketlog_Collection
49
+ *
50
+ */
51
+ public function addStoreFilter($store, $withAdmin = true)
52
+ {
53
+ if (!isset($this->_joinedFields['store'])) {
54
+ if ($store instanceof Mage_Core_Model_Store) {
55
+ $store = array($store->getId());
56
+ }
57
+ if (!is_array($store)) {
58
+ $store = array($store);
59
+ }
60
+ if ($withAdmin) {
61
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
62
+ }
63
+ $this->addFilter('store', array('in' => $store), 'public');
64
+ $this->_joinedFields['store'] = true;
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Join store relation table if there is store filter
71
+ *
72
+ * @access protected
73
+ * @return DB1_AnyMarket_Model_Resource_Anymarketlog_Collection
74
+ *
75
+ */
76
+ protected function _renderFiltersBefore()
77
+ {
78
+ if ($this->getFilter('store')) {
79
+ $this->getSelect()->join(
80
+ array('store_table' => $this->getTable('db1_anymarket/anymarketlog_store')),
81
+ 'main_table.entity_id = store_table.anymarketlog_id',
82
+ array()
83
+ )
84
+ ->group('main_table.entity_id');
85
+ /*
86
+ * Allow analytic functions usage because of one field grouping
87
+ */
88
+ $this->_useAnalyticFunction = true;
89
+ }
90
+ return parent::_renderFiltersBefore();
91
+ }
92
+
93
+ /**
94
+ * get anymarket log as array
95
+ *
96
+ * @access protected
97
+ * @param string $valueField
98
+ * @param string $labelField
99
+ * @param array $additional
100
+ * @return array
101
+ *
102
+ */
103
+ protected function _toOptionArray($valueField='entity_id', $labelField='log_desc', $additional=array())
104
+ {
105
+ return parent::_toOptionArray($valueField, $labelField, $additional);
106
+ }
107
+
108
+ /**
109
+ * get options hash
110
+ *
111
+ * @access protected
112
+ * @param string $valueField
113
+ * @param string $labelField
114
+ * @return array
115
+ *
116
+ */
117
+ protected function _toOptionHash($valueField='entity_id', $labelField='log_desc')
118
+ {
119
+ return parent::_toOptionHash($valueField, $labelField);
120
+ }
121
+
122
+ /**
123
+ * Get SQL for get record count.
124
+ * Extra GROUP BY strip added.
125
+ *
126
+ * @access public
127
+ * @return Varien_Db_Select
128
+ *
129
+ */
130
+ public function getSelectCountSql()
131
+ {
132
+ $countSelect = parent::getSelectCountSql();
133
+ $countSelect->reset(Zend_Db_Select::GROUP);
134
+ return $countSelect;
135
+ }
136
+ }
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketorders extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('db1_anymarket/anymarketorders', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * Get store ids to which specified item is assigned
40
+ *
41
+ * @access public
42
+ * @param int $anymarketordersId
43
+ * @return array
44
+
45
+ */
46
+ public function lookupStoreIds($anymarketordersId)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getTable('db1_anymarket/anymarketorders_store'), 'store_id')
51
+ ->where('anymarketorders_id = ?', (int)$anymarketordersId);
52
+ return $adapter->fetchCol($select);
53
+ }
54
+
55
+ /**
56
+ * Perform operations after object load
57
+ *
58
+ * @access public
59
+ * @param Mage_Core_Model_Abstract $object
60
+ * @return DB1_AnyMarket_Model_Resource_Anymarketorders
61
+
62
+ */
63
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
64
+ {
65
+ if ($object->getId()) {
66
+ $stores = $this->lookupStoreIds($object->getId());
67
+ $object->setData('store_id', $stores);
68
+ }
69
+ return parent::_afterLoad($object);
70
+ }
71
+
72
+ /**
73
+ * Retrieve select object for load object data
74
+ *
75
+ * @param string $field
76
+ * @param mixed $value
77
+ * @param DB1_AnyMarket_Model_Anymarketorders $object
78
+ * @return Zend_Db_Select
79
+ */
80
+ protected function _getLoadSelect($field, $value, $object)
81
+ {
82
+ $select = parent::_getLoadSelect($field, $value, $object);
83
+ if ($object->getStoreId()) {
84
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
85
+ $select->join(
86
+ array('anymarket_anymarketorders_store' => $this->getTable('db1_anymarket/anymarketorders_store')),
87
+ $this->getMainTable() . '.entity_id = anymarket_anymarketorders_store.anymarketorders_id',
88
+ array()
89
+ )
90
+ ->where('anymarket_anymarketorders_store.store_id IN (?)', $storeIds)
91
+ ->order('anymarket_anymarketorders_store.store_id DESC')
92
+ ->limit(1);
93
+ }
94
+ return $select;
95
+ }
96
+
97
+ /**
98
+ * Assign anymarket orders to store views
99
+ *
100
+ * @access protected
101
+ * @param Mage_Core_Model_Abstract $object
102
+ * @return DB1_AnyMarket_Model_Resource_Anymarketorders
103
+
104
+ */
105
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
106
+ {
107
+ $oldStores = $this->lookupStoreIds($object->getId());
108
+ $newStores = (array)$object->getStores();
109
+ if (empty($newStores)) {
110
+ $newStores = (array)$object->getStoreId();
111
+ }
112
+ $table = $this->getTable('db1_anymarket/anymarketorders_store');
113
+ $insert = array_diff($newStores, $oldStores);
114
+ $delete = array_diff($oldStores, $newStores);
115
+ if ($delete) {
116
+ $where = array(
117
+ 'anymarketorders_id = ?' => (int) $object->getId(),
118
+ 'store_id IN (?)' => $delete
119
+ );
120
+ $this->_getWriteAdapter()->delete($table, $where);
121
+ }
122
+ if ($insert) {
123
+ $data = array();
124
+ foreach ($insert as $storeId) {
125
+ $data[] = array(
126
+ 'anymarketorders_id' => (int) $object->getId(),
127
+ 'store_id' => (int) $storeId
128
+ );
129
+ }
130
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
131
+ }
132
+ return parent::_afterSave($object);
133
+ }}
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketorders/Collection.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders collection resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketorders_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('db1_anymarket/anymarketorders');
39
+ $this->_map['fields']['store'] = 'store_table.store_id';
40
+ }
41
+
42
+ /**
43
+ * Add filter by store
44
+ *
45
+ * @access public
46
+ * @param int|Mage_Core_Model_Store $store
47
+ * @param bool $withAdmin
48
+ * @return DB1_AnyMarket_Model_Resource_Anymarketorders_Collection
49
+
50
+ */
51
+ public function addStoreFilter($store, $withAdmin = true)
52
+ {
53
+ if (!isset($this->_joinedFields['store'])) {
54
+ if ($store instanceof Mage_Core_Model_Store) {
55
+ $store = array($store->getId());
56
+ }
57
+ if (!is_array($store)) {
58
+ $store = array($store);
59
+ }
60
+ if ($withAdmin) {
61
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
62
+ }
63
+ $this->addFilter('store', array('in' => $store), 'public');
64
+ $this->_joinedFields['store'] = true;
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Join store relation table if there is store filter
71
+ *
72
+ * @access protected
73
+ * @return DB1_AnyMarket_Model_Resource_Anymarketorders_Collection
74
+
75
+ */
76
+ protected function _renderFiltersBefore()
77
+ {
78
+ if ($this->getFilter('store')) {
79
+ $this->getSelect()->join(
80
+ array('store_table' => $this->getTable('db1_anymarket/anymarketorders_store')),
81
+ 'main_table.entity_id = store_table.anymarketorders_id',
82
+ array()
83
+ )
84
+ ->group('main_table.entity_id');
85
+ /*
86
+ * Allow analytic functions usage because of one field grouping
87
+ */
88
+ $this->_useAnalyticFunction = true;
89
+ }
90
+ return parent::_renderFiltersBefore();
91
+ }
92
+
93
+ /**
94
+ * get anymarket orders as array
95
+ *
96
+ * @access protected
97
+ * @param string $valueField
98
+ * @param string $labelField
99
+ * @param array $additional
100
+ * @return array
101
+
102
+ */
103
+ protected function _toOptionArray($valueField='entity_id', $labelField='nmo_id_order', $additional=array())
104
+ {
105
+ return parent::_toOptionArray($valueField, $labelField, $additional);
106
+ }
107
+
108
+ /**
109
+ * get options hash
110
+ *
111
+ * @access protected
112
+ * @param string $valueField
113
+ * @param string $labelField
114
+ * @return array
115
+
116
+ */
117
+ protected function _toOptionHash($valueField='entity_id', $labelField='nmo_id_order')
118
+ {
119
+ return parent::_toOptionHash($valueField, $labelField);
120
+ }
121
+
122
+ /**
123
+ * Get SQL for get record count.
124
+ * Extra GROUP BY strip added.
125
+ *
126
+ * @access public
127
+ * @return Varien_Db_Select
128
+
129
+ */
130
+ public function getSelectCountSql()
131
+ {
132
+ $countSelect = parent::getSelectCountSql();
133
+ $countSelect->reset(Zend_Db_Select::GROUP);
134
+ return $countSelect;
135
+ }
136
+ }
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketproducts extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ *
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('db1_anymarket/anymarketproducts', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * Get store ids to which specified item is assigned
40
+ *
41
+ * @access public
42
+ * @param int $anymarketproductsId
43
+ * @return array
44
+ *
45
+ */
46
+ public function lookupStoreIds($anymarketproductsId)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getTable('db1_anymarket/anymarketproducts_store'), 'store_id')
51
+ ->where('anymarketproducts_id = ?', (int)$anymarketproductsId);
52
+ return $adapter->fetchCol($select);
53
+ }
54
+
55
+ /**
56
+ * Perform operations after object load
57
+ *
58
+ * @access public
59
+ * @param Mage_Core_Model_Abstract $object
60
+ * @return DB1_AnyMarket_Model_Resource_Anymarketproducts
61
+ *
62
+ */
63
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
64
+ {
65
+ if ($object->getId()) {
66
+ $stores = $this->lookupStoreIds($object->getId());
67
+ $object->setData('store_id', $stores);
68
+ }
69
+ return parent::_afterLoad($object);
70
+ }
71
+
72
+ /**
73
+ * Retrieve select object for load object data
74
+ *
75
+ * @param string $field
76
+ * @param mixed $value
77
+ * @param DB1_AnyMarket_Model_Anymarketproducts $object
78
+ * @return Zend_Db_Select
79
+ */
80
+ protected function _getLoadSelect($field, $value, $object)
81
+ {
82
+ $select = parent::_getLoadSelect($field, $value, $object);
83
+ if ($object->getStoreId()) {
84
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
85
+ $select->join(
86
+ array('anymarket_anymarketproducts_store' => $this->getTable('db1_anymarket/anymarketproducts_store')),
87
+ $this->getMainTable() . '.entity_id = anymarket_anymarketproducts_store.anymarketproducts_id',
88
+ array()
89
+ )
90
+ ->where('anymarket_anymarketproducts_store.store_id IN (?)', $storeIds)
91
+ ->order('anymarket_anymarketproducts_store.store_id DESC')
92
+ ->limit(1);
93
+ }
94
+ return $select;
95
+ }
96
+
97
+ /**
98
+ * Assign anymarket products to store views
99
+ *
100
+ * @access protected
101
+ * @param Mage_Core_Model_Abstract $object
102
+ * @return DB1_AnyMarket_Model_Resource_Anymarketproducts
103
+ *
104
+ */
105
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
106
+ {
107
+ $oldStores = $this->lookupStoreIds($object->getId());
108
+ $newStores = (array)$object->getStores();
109
+ if (empty($newStores)) {
110
+ $newStores = (array)$object->getStoreId();
111
+ }
112
+ $table = $this->getTable('db1_anymarket/anymarketproducts_store');
113
+ $insert = array_diff($newStores, $oldStores);
114
+ $delete = array_diff($oldStores, $newStores);
115
+ if ($delete) {
116
+ $where = array(
117
+ 'anymarketproducts_id = ?' => (int) $object->getId(),
118
+ 'store_id IN (?)' => $delete
119
+ );
120
+ $this->_getWriteAdapter()->delete($table, $where);
121
+ }
122
+ if ($insert) {
123
+ $data = array();
124
+ foreach ($insert as $storeId) {
125
+ $data[] = array(
126
+ 'anymarketproducts_id' => (int) $object->getId(),
127
+ 'store_id' => (int) $storeId
128
+ );
129
+ }
130
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
131
+ }
132
+ return parent::_afterSave($object);
133
+ }}
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketproducts/Collection.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products collection resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Anymarketproducts_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ *
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('db1_anymarket/anymarketproducts');
39
+ $this->_map['fields']['store'] = 'store_table.store_id';
40
+ }
41
+
42
+ /**
43
+ * Add filter by store
44
+ *
45
+ * @access public
46
+ * @param int|Mage_Core_Model_Store $store
47
+ * @param bool $withAdmin
48
+ * @return DB1_AnyMarket_Model_Resource_Anymarketproducts_Collection
49
+ *
50
+ */
51
+ public function addStoreFilter($store, $withAdmin = true)
52
+ {
53
+ if (!isset($this->_joinedFields['store'])) {
54
+ if ($store instanceof Mage_Core_Model_Store) {
55
+ $store = array($store->getId());
56
+ }
57
+ if (!is_array($store)) {
58
+ $store = array($store);
59
+ }
60
+ if ($withAdmin) {
61
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
62
+ }
63
+ $this->addFilter('store', array('in' => $store), 'public');
64
+ $this->_joinedFields['store'] = true;
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Join store relation table if there is store filter
71
+ *
72
+ * @access protected
73
+ * @return DB1_AnyMarket_Model_Resource_Anymarketproducts_Collection
74
+ *
75
+ */
76
+ protected function _renderFiltersBefore()
77
+ {
78
+ if ($this->getFilter('store')) {
79
+ $this->getSelect()->join(
80
+ array('store_table' => $this->getTable('db1_anymarket/anymarketproducts_store')),
81
+ 'main_table.entity_id = store_table.anymarketproducts_id',
82
+ array()
83
+ )
84
+ ->group('main_table.entity_id');
85
+ /*
86
+ * Allow analytic functions usage because of one field grouping
87
+ */
88
+ $this->_useAnalyticFunction = true;
89
+ }
90
+ return parent::_renderFiltersBefore();
91
+ }
92
+
93
+ /**
94
+ * get anymarket products as array
95
+ *
96
+ * @access protected
97
+ * @param string $valueField
98
+ * @param string $labelField
99
+ * @param array $additional
100
+ * @return array
101
+ *
102
+ */
103
+ protected function _toOptionArray($valueField='entity_id', $labelField='nmp_status_int', $additional=array())
104
+ {
105
+ return parent::_toOptionArray($valueField, $labelField, $additional);
106
+ }
107
+
108
+ /**
109
+ * get options hash
110
+ *
111
+ * @access protected
112
+ * @param string $valueField
113
+ * @param string $labelField
114
+ * @return array
115
+ *
116
+ */
117
+ protected function _toOptionHash($valueField='entity_id', $labelField='nmp_status_int')
118
+ {
119
+ return parent::_toOptionHash($valueField, $labelField);
120
+ }
121
+
122
+ /**
123
+ * Get SQL for get record count.
124
+ * Extra GROUP BY strip added.
125
+ *
126
+ * @access public
127
+ * @return Varien_Db_Select
128
+ *
129
+ */
130
+ public function getSelectCountSql()
131
+ {
132
+ $countSelect = parent::getSelectCountSql();
133
+ $countSelect->reset(Zend_Db_Select::GROUP);
134
+ return $countSelect;
135
+ }
136
+ }
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Model_Resource_Anymarketqueue extends Mage_Core_Model_Resource_Db_Abstract
24
+ {
25
+
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+
31
+ */
32
+ public function _construct()
33
+ {
34
+ $this->_init('db1_anymarket/anymarketqueue', 'entity_id');
35
+ }
36
+
37
+ /**
38
+ * Get store ids to which specified item is assigned
39
+ *
40
+ * @access public
41
+ * @param int $anymarketqueueId
42
+ * @return array
43
+
44
+ */
45
+ public function lookupStoreIds($anymarketqueueId)
46
+ {
47
+ $adapter = $this->_getReadAdapter();
48
+ $select = $adapter->select()
49
+ ->from($this->getTable('db1_anymarket/anymarketqueue_store'), 'store_id')
50
+ ->where('anymarketqueue_id = ?', (int)$anymarketqueueId);
51
+ return $adapter->fetchCol($select);
52
+ }
53
+
54
+ /**
55
+ * Perform operations after object load
56
+ *
57
+ * @access public
58
+ * @param Mage_Core_Model_Abstract $object
59
+ * @return DB1_AnyMarket_Model_Resource_Anymarketqueue
60
+
61
+ */
62
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
63
+ {
64
+ if ($object->getId()) {
65
+ $stores = $this->lookupStoreIds($object->getId());
66
+ $object->setData('store_id', $stores);
67
+ }
68
+ return parent::_afterLoad($object);
69
+ }
70
+
71
+ /**
72
+ * Retrieve select object for load object data
73
+ *
74
+ * @param string $field
75
+ * @param mixed $value
76
+ * @param DB1_AnyMarket_Model_Anymarketqueue $object
77
+ * @return Zend_Db_Select
78
+ */
79
+ protected function _getLoadSelect($field, $value, $object)
80
+ {
81
+ $select = parent::_getLoadSelect($field, $value, $object);
82
+ if ($object->getStoreId()) {
83
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
84
+ $select->join(
85
+ array('anymarket_anymarketqueue_store' => $this->getTable('db1_anymarket/anymarketqueue_store')),
86
+ $this->getMainTable() . '.entity_id = anymarket_anymarketqueue_store.anymarketqueue_id',
87
+ array()
88
+ )
89
+ ->where('anymarket_anymarketqueue_store.store_id IN (?)', $storeIds)
90
+ ->order('anymarket_anymarketqueue_store.store_id DESC')
91
+ ->limit(1);
92
+ }
93
+ return $select;
94
+ }
95
+
96
+ /**
97
+ * Assign anymarket queue to store views
98
+ *
99
+ * @access protected
100
+ * @param Mage_Core_Model_Abstract $object
101
+ * @return DB1_AnyMarket_Model_Resource_Anymarketqueue
102
+
103
+ */
104
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
105
+ {
106
+ $oldStores = $this->lookupStoreIds($object->getId());
107
+ $newStores = (array)$object->getStores();
108
+ if (empty($newStores)) {
109
+ $newStores = (array)$object->getStoreId();
110
+ }
111
+ $table = $this->getTable('db1_anymarket/anymarketqueue_store');
112
+ $insert = array_diff($newStores, $oldStores);
113
+ $delete = array_diff($oldStores, $newStores);
114
+ if ($delete) {
115
+ $where = array(
116
+ 'anymarketqueue_id = ?' => (int) $object->getId(),
117
+ 'store_id IN (?)' => $delete
118
+ );
119
+ $this->_getWriteAdapter()->delete($table, $where);
120
+ }
121
+ if ($insert) {
122
+ $data = array();
123
+ foreach ($insert as $storeId) {
124
+ $data[] = array(
125
+ 'anymarketqueue_id' => (int) $object->getId(),
126
+ 'store_id' => (int) $storeId
127
+ );
128
+ }
129
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
130
+ }
131
+ return parent::_afterSave($object);
132
+ }}
app/code/community/DB1/AnyMarket/Model/Resource/Anymarketqueue/Collection.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue collection resource model
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Model_Resource_Anymarketqueue_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
24
+ {
25
+ protected $_joinedFields = array();
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ * @return void
32
+
33
+ */
34
+ protected function _construct()
35
+ {
36
+ parent::_construct();
37
+ $this->_init('db1_anymarket/anymarketqueue');
38
+ $this->_map['fields']['store'] = 'store_table.store_id';
39
+ }
40
+
41
+ /**
42
+ * Add filter by store
43
+ *
44
+ * @access public
45
+ * @param int|Mage_Core_Model_Store $store
46
+ * @param bool $withAdmin
47
+ * @return DB1_AnyMarket_Model_Resource_Anymarketqueue_Collection
48
+
49
+ */
50
+ public function addStoreFilter($store, $withAdmin = true)
51
+ {
52
+ if (!isset($this->_joinedFields['store'])) {
53
+ if ($store instanceof Mage_Core_Model_Store) {
54
+ $store = array($store->getId());
55
+ }
56
+ if (!is_array($store)) {
57
+ $store = array($store);
58
+ }
59
+ if ($withAdmin) {
60
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
61
+ }
62
+ $this->addFilter('store', array('in' => $store), 'public');
63
+ $this->_joinedFields['store'] = true;
64
+ }
65
+ return $this;
66
+ }
67
+
68
+ /**
69
+ * Join store relation table if there is store filter
70
+ *
71
+ * @access protected
72
+ * @return DB1_AnyMarket_Model_Resource_Anymarketqueue_Collection
73
+
74
+ */
75
+ protected function _renderFiltersBefore()
76
+ {
77
+ if ($this->getFilter('store')) {
78
+ $this->getSelect()->join(
79
+ array('store_table' => $this->getTable('db1_anymarket/anymarketqueue_store')),
80
+ 'main_table.entity_id = store_table.anymarketqueue_id',
81
+ array()
82
+ )
83
+ ->group('main_table.entity_id');
84
+ /*
85
+ * Allow analytic functions usage because of one field grouping
86
+ */
87
+ $this->_useAnalyticFunction = true;
88
+ }
89
+ return parent::_renderFiltersBefore();
90
+ }
91
+
92
+ /**
93
+ * get anymarket queues as array
94
+ *
95
+ * @access protected
96
+ * @param string $valueField
97
+ * @param string $labelField
98
+ * @param array $additional
99
+ * @return array
100
+
101
+ */
102
+ protected function _toOptionArray($valueField='entity_id', $labelField='nmq_id', $additional=array())
103
+ {
104
+ return parent::_toOptionArray($valueField, $labelField, $additional);
105
+ }
106
+
107
+ /**
108
+ * get options hash
109
+ *
110
+ * @access protected
111
+ * @param string $valueField
112
+ * @param string $labelField
113
+ * @return array
114
+
115
+ */
116
+ protected function _toOptionHash($valueField='entity_id', $labelField='nmq_id')
117
+ {
118
+ return parent::_toOptionHash($valueField, $labelField);
119
+ }
120
+
121
+ /**
122
+ * Get SQL for get record count.
123
+ * Extra GROUP BY strip added.
124
+ *
125
+ * @access public
126
+ * @return Varien_Db_Select
127
+
128
+ */
129
+ public function getSelectCountSql()
130
+ {
131
+ $countSelect = parent::getSelectCountSql();
132
+ $countSelect->reset(Zend_Db_Select::GROUP);
133
+ return $countSelect;
134
+ }
135
+ }
app/code/community/DB1/AnyMarket/Model/Resource/Setup.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket setup
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
25
+ {
26
+ }
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Group/Values.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Model_System_Config_Source_Attributes_Customer_Group_Values
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $customerGroup = Mage::getModel('customer/group')->getCollection();
8
+ $retornArray = array();
9
+ foreach ($customerGroup as $group) {
10
+ $retornArray[] = array( 'value' => $group->getData('customer_group_id'), 'label' => $group->getData('customer_group_code') );
11
+ }
12
+
13
+ return $retornArray;
14
+ }
15
+ }
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Customer/Values.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Model_System_Config_Source_Attributes_Customer_Values
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $attributes = Mage::getModel('customer/customer')->getAttributes();
8
+ $retornArray = array();
9
+ foreach ($attributes as $attribute) {
10
+ if($attribute->getStoreLabel() != ''){
11
+ $retornArray[] = array( 'value' => $attribute->getData('attribute_code'), 'label' => $attribute->getStoreLabel() );
12
+ }
13
+ }
14
+
15
+ return $retornArray;
16
+ }
17
+ }
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Attributes/Product/Values.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Model_System_Config_Source_Attributes_Product_Values
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $productAttrs = Mage::getResourceModel('catalog/product_attribute_collection');
8
+ $retornArray = array();
9
+ foreach ($productAttrs as $productAttr) {
10
+ if($productAttr->getFrontendLabel() != null){
11
+ $attrCheck = Mage::getModel('db1_anymarket/anymarketattributes')->load($productAttr->getAttributeCode(), 'nma_id_attr');
12
+
13
+ if($attrCheck->getData('nma_id_attr') == null){
14
+ $retornArray[] = array( 'value' => $productAttr->getAttributeCode(), 'label' => $productAttr->getFrontendLabel() );
15
+ }
16
+ }
17
+ }
18
+
19
+ return $retornArray;
20
+ }
21
+ }
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Categories/Values.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class DB1_AnyMarket_Model_System_Config_Source_Categories_Values extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
3
+ {
4
+ protected $retornArray = array();
5
+ protected $descComp;
6
+
7
+ private function getChildCat($IDRoot, $DescCateg){
8
+ $categCh = Mage::getModel('db1_anymarket/anymarketcategories')->getCollection()
9
+ ->addFilter('nmc_cat_root_id', $IDRoot);
10
+
11
+ $ctrlCat = '';
12
+ if(sizeof($categCh) >1){
13
+ $ctrlCat = $DescCateg;
14
+ }
15
+
16
+ foreach ($categCh as $catCh) {
17
+ if($ctrlCat == ''){
18
+ $DescCateg = $DescCateg.'\\'.$catCh->getData('nmc_cat_desc');
19
+ }else{
20
+ $DescCateg = $ctrlCat.'\\'.$catCh->getData('nmc_cat_desc');
21
+ }
22
+ $IDRoot = $catCh->getData('nmc_cat_id');
23
+
24
+ $returnCateg = $this->getChildCat($IDRoot, $DescCateg);
25
+ $hChild = $returnCateg["return"];
26
+ $IDRoot = $returnCateg["root"];
27
+ }
28
+
29
+ if($IDRoot != ''){
30
+ array_push($this->retornArray, array( 'value' => $IDRoot, 'label' => $DescCateg ) );
31
+ }
32
+
33
+ return array("return" => false, "root" => "", "desc" => "");
34
+ }
35
+
36
+ public function getAllOptions()
37
+ {
38
+ if (!Mage::app()->isSingleStoreMode()){
39
+ $store = Mage::app()->getRequest()->getParam('store');
40
+ $categories = Mage::getModel('db1_anymarket/anymarketcategories')->getCollection()
41
+ ->addFilter('nmc_cat_root_id','000')
42
+ ->addStoreFilter($store)
43
+ ->setOrder('nmc_cat_desc', 'ASC');
44
+ }else{
45
+ $categories = Mage::getModel('db1_anymarket/anymarketcategories')->getCollection()
46
+ ->addFilter('nmc_cat_root_id','000')
47
+ ->setOrder('nmc_cat_desc', 'ASC');
48
+ }
49
+
50
+ array_push($this->retornArray, array( 'value' => null, 'label' => ' ' ) );
51
+ foreach($categories as $category) {
52
+ $hChild = true;
53
+ $IDRoot = $category->getData('nmc_cat_id');
54
+ $DescCateg = $category->getData('nmc_cat_desc');
55
+ $this->descComp = $DescCateg;
56
+ while ( $hChild ) {
57
+ $returnCateg = $this->getChildCat($IDRoot, $DescCateg);
58
+ $hChild = $returnCateg["return"];
59
+ $IDRoot = $returnCateg["root"];
60
+ $DescCateg = $returnCateg["desc"];
61
+ }
62
+
63
+ }
64
+
65
+ return $this->retornArray;
66
+ }
67
+ }
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Massunit/Values.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Model_System_Config_Source_Massunit_Values
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $retornArray = array();
8
+ $retornArray[] = array( 'label' => Mage::helper('db1_anymarket')->__('Quilogramas'), 'value' => '0' );
9
+ $retornArray[] = array( 'label' => Mage::helper('db1_anymarket')->__('Gramas'), 'value' => '1' );
10
+
11
+ return $retornArray;
12
+ }
13
+ }
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Orders/Values.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Model_System_Config_Source_Orders_Values
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $retornArray = array();
8
+ // $retornArray[] = array( 'label' => 'Qualquer Status', 'value' => 'ANY' );
9
+ $retornArray[] = array( 'label' => 'Concluido (CONCLUDED)', 'value' => 'CONCLUDED' );
10
+ $retornArray[] = array( 'label' => 'Pendente (PENDING)', 'value' => 'PENDING' );
11
+ $retornArray[] = array( 'label' => 'Faturado (INVOICED)', 'value' => 'INVOICED' );
12
+ $retornArray[] = array( 'label' => 'Enviado (PAID_WAITING_DELIVERY)', 'value' => 'PAID_WAITING_DELIVERY' );
13
+ $retornArray[] = array( 'label' => 'Pago (PAID_WAITING_SHIP)', 'value' => 'PAID_WAITING_SHIP' );
14
+ $retornArray[] = array( 'label' => 'Cancelado (CANCELED)', 'value' => 'CANCELED' );
15
+
16
+ return $retornArray;
17
+ }
18
+ }
app/code/community/DB1/AnyMarket/Model/System/Config/Source/Typesync/Order/Values.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DB1_AnyMarket_Model_System_Config_Source_TypeSync_Order_Values
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $retornArray[] = array( 'value' => 0, 'label' => 'Magento to AnyMarket');
8
+ $retornArray[] = array( 'value' => 1, 'label' => 'AnyMarket to Magento');
9
+
10
+ return $retornArray;
11
+ }
12
+ }
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketattributesController.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Attributes admin controller
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketattributesController extends DB1_AnyMarket_Controller_Adminhtml_AnyMarket
25
+ {
26
+ /**
27
+ * init the anymarket attributes
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Model_Anymarketattributes
31
+ */
32
+ protected function _initAnymarketattributes()
33
+ {
34
+ $anymarketattributesId = (int) $this->getRequest()->getParam('id');
35
+ $anymarketattributes = Mage::getModel('db1_anymarket/anymarketattributes');
36
+ if ($anymarketattributesId) {
37
+ $anymarketattributes->load($anymarketattributesId);
38
+ }
39
+ Mage::register('current_anymarketattributes', $anymarketattributes);
40
+ return $anymarketattributes;
41
+ }
42
+
43
+ /**
44
+ * default action
45
+ *
46
+ * @access public
47
+ * @return void
48
+
49
+ */
50
+ public function indexAction()
51
+ {
52
+ $this->loadLayout();
53
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
54
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Attributes'));
55
+ $this->renderLayout();
56
+ }
57
+
58
+ /**
59
+ * grid action
60
+ *
61
+ * @access public
62
+ * @return void
63
+
64
+ */
65
+ public function gridAction()
66
+ {
67
+ $this->loadLayout()->renderLayout();
68
+ }
69
+
70
+ /**
71
+ * edit anymarket attributes - action
72
+ *
73
+ * @access public
74
+ * @return void
75
+
76
+ */
77
+ public function editAction()
78
+ {
79
+ $anymarketattributesId = $this->getRequest()->getParam('id');
80
+ $anymarketattributes = $this->_initAnymarketattributes();
81
+ if ($anymarketattributesId && !$anymarketattributes->getId()) {
82
+ $this->_getSession()->addError(
83
+ Mage::helper('db1_anymarket')->__('This anymarket attributes no longer exists.')
84
+ );
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ }
88
+ $data = Mage::getSingleton('adminhtml/session')->getAnymarketattributesData(true);
89
+ if (!empty($data)) {
90
+ $anymarketattributes->setData($data);
91
+ }
92
+ Mage::register('anymarketattributes_data', $anymarketattributes);
93
+ $this->loadLayout();
94
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
95
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Attributes'));
96
+ if ($anymarketattributes->getId()) {
97
+ $this->_title($anymarketattributes->getNmaDesc());
98
+ } else {
99
+ $this->_title(Mage::helper('db1_anymarket')->__('Add anymarket attributes'));
100
+ }
101
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
102
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
103
+ }
104
+ $this->renderLayout();
105
+ }
106
+
107
+ /**
108
+ * new anymarket attributes action
109
+ *
110
+ * @access public
111
+ * @return void
112
+
113
+ */
114
+ public function newAction()
115
+ {
116
+ $this->_forward('edit');
117
+ }
118
+
119
+ /**
120
+ * save anymarket attributes - action
121
+ *
122
+ * @access public
123
+ * @return void
124
+
125
+ */
126
+ public function saveAction()
127
+ {
128
+ if ($data = $this->getRequest()->getPost('anymarketattributes')) {
129
+ try {
130
+ $anymarketattributes = $this->_initAnymarketattributes();
131
+ $anymarketattributes->addData($data);
132
+ $anymarketattributes->save();
133
+ Mage::getSingleton('adminhtml/session')->addSuccess(
134
+ Mage::helper('db1_anymarket')->__('Anymarket Attributes was successfully saved')
135
+ );
136
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
137
+ if ($this->getRequest()->getParam('back')) {
138
+ $this->_redirect('*/*/edit', array('id' => $anymarketattributes->getId()));
139
+ return;
140
+ }
141
+ $this->_redirect('*/*/');
142
+ return;
143
+ } catch (Mage_Core_Exception $e) {
144
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
145
+ Mage::getSingleton('adminhtml/session')->setAnymarketattributesData($data);
146
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
147
+ return;
148
+ } catch (Exception $e) {
149
+ Mage::logException($e);
150
+ Mage::getSingleton('adminhtml/session')->addError(
151
+ Mage::helper('db1_anymarket')->__('There was a problem saving the anymarket attributes.')
152
+ );
153
+ Mage::getSingleton('adminhtml/session')->setAnymarketattributesData($data);
154
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
155
+ return;
156
+ }
157
+ }
158
+ Mage::getSingleton('adminhtml/session')->addError(
159
+ Mage::helper('db1_anymarket')->__('Unable to find anymarket attributes to save.')
160
+ );
161
+ $this->_redirect('*/*/');
162
+ }
163
+
164
+ /**
165
+ * delete anymarket attributes - action
166
+ *
167
+ * @access public
168
+ * @return void
169
+
170
+ */
171
+ public function deleteAction()
172
+ {
173
+ if ( $this->getRequest()->getParam('id') > 0) {
174
+ try {
175
+ $anymarketattributes = Mage::getModel('db1_anymarket/anymarketattributes');
176
+ $anymarketattributes->setId($this->getRequest()->getParam('id'))->delete();
177
+ Mage::getSingleton('adminhtml/session')->addSuccess(
178
+ Mage::helper('db1_anymarket')->__('Anymarket Attributes was successfully deleted.')
179
+ );
180
+ $this->_redirect('*/*/');
181
+ return;
182
+ } catch (Mage_Core_Exception $e) {
183
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
184
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
185
+ } catch (Exception $e) {
186
+ Mage::getSingleton('adminhtml/session')->addError(
187
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket attributes.')
188
+ );
189
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
190
+ Mage::logException($e);
191
+ return;
192
+ }
193
+ }
194
+ Mage::getSingleton('adminhtml/session')->addError(
195
+ Mage::helper('db1_anymarket')->__('Could not find anymarket attributes to delete.')
196
+ );
197
+ $this->_redirect('*/*/');
198
+ }
199
+
200
+ /**
201
+ * mass delete anymarket attributes - action
202
+ *
203
+ * @access public
204
+ * @return void
205
+
206
+ */
207
+ public function massDeleteAction()
208
+ {
209
+ $anymarketattributesIds = $this->getRequest()->getParam('anymarketattributes');
210
+ if (!is_array($anymarketattributesIds)) {
211
+ Mage::getSingleton('adminhtml/session')->addError(
212
+ Mage::helper('db1_anymarket')->__('Please select anymarket attributes to delete.')
213
+ );
214
+ } else {
215
+ try {
216
+ foreach ($anymarketattributesIds as $anymarketattributesId) {
217
+ $anymarketattributes = Mage::getModel('db1_anymarket/anymarketattributes');
218
+ $anymarketattributes->setId($anymarketattributesId)->delete();
219
+ }
220
+ Mage::getSingleton('adminhtml/session')->addSuccess(
221
+ Mage::helper('db1_anymarket')->__('Total of %d anymarket attributes were successfully deleted.', count($anymarketattributesIds))
222
+ );
223
+ } catch (Mage_Core_Exception $e) {
224
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
225
+ } catch (Exception $e) {
226
+ Mage::getSingleton('adminhtml/session')->addError(
227
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket attributes.')
228
+ );
229
+ Mage::logException($e);
230
+ }
231
+ }
232
+ $this->_redirect('*/*/index');
233
+ }
234
+
235
+ /**
236
+ * mass status change - action
237
+ *
238
+ * @access public
239
+ * @return void
240
+
241
+ */
242
+ public function massStatusAction()
243
+ {
244
+ $anymarketattributesIds = $this->getRequest()->getParam('anymarketattributes');
245
+ if (!is_array($anymarketattributesIds)) {
246
+ Mage::getSingleton('adminhtml/session')->addError(
247
+ Mage::helper('db1_anymarket')->__('Please select anymarket attributes.')
248
+ );
249
+ } else {
250
+ try {
251
+ foreach ($anymarketattributesIds as $anymarketattributesId) {
252
+ $anymarketattributes = Mage::getSingleton('db1_anymarket/anymarketattributes')->load($anymarketattributesId)
253
+ ->setStatus($this->getRequest()->getParam('status'))
254
+ ->setIsMassupdate(true)
255
+ ->save();
256
+ }
257
+ $this->_getSession()->addSuccess(
258
+ $this->__('Total of %d anymarket attributes were successfully updated.', count($anymarketattributesIds))
259
+ );
260
+ } catch (Mage_Core_Exception $e) {
261
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
262
+ } catch (Exception $e) {
263
+ Mage::getSingleton('adminhtml/session')->addError(
264
+ Mage::helper('db1_anymarket')->__('There was an error updating anymarket attributes.')
265
+ );
266
+ Mage::logException($e);
267
+ }
268
+ }
269
+ $this->_redirect('*/*/index');
270
+ }
271
+
272
+ /**
273
+ * export as csv - action
274
+ *
275
+ * @access public
276
+ * @return void
277
+
278
+ */
279
+ public function exportCsvAction()
280
+ {
281
+ $fileName = 'anymarketattributes.csv';
282
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketattributes_grid')
283
+ ->getCsv();
284
+ $this->_prepareDownloadResponse($fileName, $content);
285
+ }
286
+
287
+ /**
288
+ * export as MsExcel - action
289
+ *
290
+ * @access public
291
+ * @return void
292
+
293
+ */
294
+ public function exportExcelAction()
295
+ {
296
+ $fileName = 'anymarketattributes.xls';
297
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketattributes_grid')
298
+ ->getExcelFile();
299
+ $this->_prepareDownloadResponse($fileName, $content);
300
+ }
301
+
302
+ /**
303
+ * export as xml - action
304
+ *
305
+ * @access public
306
+ * @return void
307
+
308
+ */
309
+ public function exportXmlAction()
310
+ {
311
+ $fileName = 'anymarketattributes.xml';
312
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketattributes_grid')
313
+ ->getXml();
314
+ $this->_prepareDownloadResponse($fileName, $content);
315
+ }
316
+
317
+ /**
318
+ * Check if admin has permissions to visit related pages
319
+ *
320
+ * @access protected
321
+ * @return boolean
322
+
323
+ */
324
+ protected function _isAllowed()
325
+ {
326
+ return Mage::getSingleton('admin/session')->isAllowed('system/db1_anymarket/anymarketattributes');
327
+ }
328
+ }
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketcategoriesController.php ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Categories admin controller
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketcategoriesController extends DB1_AnyMarket_Controller_Adminhtml_AnyMarket
25
+ {
26
+ /**
27
+ * init the anymarket categories
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Model_Anymarketcategories
31
+ */
32
+ protected function _initAnymarketcategories()
33
+ {
34
+ $anymarketcategoriesId = (int) $this->getRequest()->getParam('id');
35
+ $anymarketcategories = Mage::getModel('db1_anymarket/anymarketcategories');
36
+ if ($anymarketcategoriesId) {
37
+ $anymarketcategories->load($anymarketcategoriesId);
38
+ }
39
+ Mage::register('current_anymarketcategories', $anymarketcategories);
40
+ return $anymarketcategories;
41
+ }
42
+
43
+ /**
44
+ * default action
45
+ *
46
+ * @access public
47
+ * @return void
48
+
49
+ */
50
+ public function indexAction()
51
+ {
52
+ $this->loadLayout();
53
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
54
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Categories'));
55
+
56
+ $this->renderLayout();
57
+ }
58
+
59
+
60
+ /**
61
+ * import Orders action
62
+ *
63
+ * @access public
64
+ * @return void
65
+
66
+ */
67
+ public function sincCategsAction()
68
+ {
69
+ $storeID = Mage::getSingleton('core/session')->getStoreCategVariable();
70
+ Mage::app()->setCurrentStore($storeID);
71
+ Mage::helper('db1_anymarket/category')->getCategories();
72
+
73
+ Mage::getSingleton('adminhtml/session')->addSuccess(
74
+ Mage::helper('db1_anymarket')->__('Successfully synchronized categories.')
75
+ );
76
+ $this->_redirect('*/*/');
77
+
78
+ }
79
+
80
+ /**
81
+ * grid action
82
+ *
83
+ * @access public
84
+ * @return void
85
+
86
+ */
87
+ public function gridAction()
88
+ {
89
+ $this->loadLayout()->renderLayout();
90
+ }
91
+
92
+ /**
93
+ * edit anymarket categories - action
94
+ *
95
+ * @access public
96
+ * @return void
97
+
98
+ */
99
+ public function editAction()
100
+ {
101
+ $anymarketcategoriesId = $this->getRequest()->getParam('id');
102
+ $anymarketcategories = $this->_initAnymarketcategories();
103
+ if ($anymarketcategoriesId && !$anymarketcategories->getId()) {
104
+ $this->_getSession()->addError(
105
+ Mage::helper('db1_anymarket')->__('This anymarket categories no longer exists.')
106
+ );
107
+ $this->_redirect('*/*/');
108
+ return;
109
+ }
110
+ $data = Mage::getSingleton('adminhtml/session')->getAnymarketcategoriesData(true);
111
+ if (!empty($data)) {
112
+ $anymarketcategories->setData($data);
113
+ }
114
+ Mage::register('anymarketcategories_data', $anymarketcategories);
115
+ $this->loadLayout();
116
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
117
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Categories'));
118
+ if ($anymarketcategories->getId()) {
119
+ $this->_title($anymarketcategories->getNmcCatDesc());
120
+ } else {
121
+ $this->_title(Mage::helper('db1_anymarket')->__('Add anymarket categories'));
122
+ }
123
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
124
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
125
+ }
126
+ $this->renderLayout();
127
+ }
128
+
129
+ /**
130
+ * new anymarket categories action
131
+ *
132
+ * @access public
133
+ * @return void
134
+
135
+ */
136
+ public function newAction()
137
+ {
138
+ $this->_forward('edit');
139
+ }
140
+
141
+ /**
142
+ * save anymarket categories - action
143
+ *
144
+ * @access public
145
+ * @return void
146
+
147
+ */
148
+ public function saveAction()
149
+ {
150
+ if ($data = $this->getRequest()->getPost('anymarketcategories')) {
151
+ try {
152
+ $anymarketcategories = $this->_initAnymarketcategories();
153
+ $anymarketcategories->addData($data);
154
+ $anymarketcategories->save();
155
+ Mage::getSingleton('adminhtml/session')->addSuccess(
156
+ Mage::helper('db1_anymarket')->__('Anymarket Categories was successfully saved')
157
+ );
158
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
159
+ if ($this->getRequest()->getParam('back')) {
160
+ $this->_redirect('*/*/edit', array('id' => $anymarketcategories->getId()));
161
+ return;
162
+ }
163
+ $this->_redirect('*/*/');
164
+ return;
165
+ } catch (Mage_Core_Exception $e) {
166
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
167
+ Mage::getSingleton('adminhtml/session')->setAnymarketcategoriesData($data);
168
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
169
+ return;
170
+ } catch (Exception $e) {
171
+ Mage::logException($e);
172
+ Mage::getSingleton('adminhtml/session')->addError(
173
+ Mage::helper('db1_anymarket')->__('There was a problem saving the anymarket categories.')
174
+ );
175
+ Mage::getSingleton('adminhtml/session')->setAnymarketcategoriesData($data);
176
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
177
+ return;
178
+ }
179
+ }
180
+ Mage::getSingleton('adminhtml/session')->addError(
181
+ Mage::helper('db1_anymarket')->__('Unable to find anymarket categories to save.')
182
+ );
183
+ $this->_redirect('*/*/');
184
+ }
185
+
186
+ /**
187
+ * delete anymarket categories - action
188
+ *
189
+ * @access public
190
+ * @return void
191
+
192
+ */
193
+ public function deleteAction()
194
+ {
195
+ if ( $this->getRequest()->getParam('id') > 0) {
196
+ try {
197
+ $anymarketcategories = Mage::getModel('db1_anymarket/anymarketcategories');
198
+ $anymarketcategories->setId($this->getRequest()->getParam('id'))->delete();
199
+ Mage::getSingleton('adminhtml/session')->addSuccess(
200
+ Mage::helper('db1_anymarket')->__('Anymarket Categories was successfully deleted.')
201
+ );
202
+ $this->_redirect('*/*/');
203
+ return;
204
+ } catch (Mage_Core_Exception $e) {
205
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
206
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
207
+ } catch (Exception $e) {
208
+ Mage::getSingleton('adminhtml/session')->addError(
209
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket categories.')
210
+ );
211
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
212
+ Mage::logException($e);
213
+ return;
214
+ }
215
+ }
216
+ Mage::getSingleton('adminhtml/session')->addError(
217
+ Mage::helper('db1_anymarket')->__('Could not find anymarket categories to delete.')
218
+ );
219
+ $this->_redirect('*/*/');
220
+ }
221
+
222
+ /**
223
+ * mass delete anymarket categories - action
224
+ *
225
+ * @access public
226
+ * @return void
227
+
228
+ */
229
+ public function massDeleteAction()
230
+ {
231
+ $anymarketcategoriesIds = $this->getRequest()->getParam('anymarketcategories');
232
+ if (!is_array($anymarketcategoriesIds)) {
233
+ Mage::getSingleton('adminhtml/session')->addError(
234
+ Mage::helper('db1_anymarket')->__('Please select anymarket categories to delete.')
235
+ );
236
+ } else {
237
+ try {
238
+ foreach ($anymarketcategoriesIds as $anymarketcategoriesId) {
239
+ $anymarketcategories = Mage::getModel('db1_anymarket/anymarketcategories');
240
+ $anymarketcategories->setId($anymarketcategoriesId)->delete();
241
+ }
242
+ Mage::getSingleton('adminhtml/session')->addSuccess(
243
+ Mage::helper('db1_anymarket')->__('Total of %d anymarket categories were successfully deleted.', count($anymarketcategoriesIds))
244
+ );
245
+ } catch (Mage_Core_Exception $e) {
246
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
247
+ } catch (Exception $e) {
248
+ Mage::getSingleton('adminhtml/session')->addError(
249
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket categories.')
250
+ );
251
+ Mage::logException($e);
252
+ }
253
+ }
254
+ $this->_redirect('*/*/index');
255
+ }
256
+
257
+ /**
258
+ * mass status change - action
259
+ *
260
+ * @access public
261
+ * @return void
262
+
263
+ */
264
+ public function massStatusAction()
265
+ {
266
+ $anymarketcategoriesIds = $this->getRequest()->getParam('anymarketcategories');
267
+ if (!is_array($anymarketcategoriesIds)) {
268
+ Mage::getSingleton('adminhtml/session')->addError(
269
+ Mage::helper('db1_anymarket')->__('Please select anymarket categories.')
270
+ );
271
+ } else {
272
+ try {
273
+ foreach ($anymarketcategoriesIds as $anymarketcategoriesId) {
274
+ $anymarketcategories = Mage::getSingleton('db1_anymarket/anymarketcategories')->load($anymarketcategoriesId)
275
+ ->setStatus($this->getRequest()->getParam('status'))
276
+ ->setIsMassupdate(true)
277
+ ->save();
278
+ }
279
+ $this->_getSession()->addSuccess(
280
+ $this->__('Total of %d anymarket categories were successfully updated.', count($anymarketcategoriesIds))
281
+ );
282
+ } catch (Mage_Core_Exception $e) {
283
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
284
+ } catch (Exception $e) {
285
+ Mage::getSingleton('adminhtml/session')->addError(
286
+ Mage::helper('db1_anymarket')->__('There was an error updating anymarket categories.')
287
+ );
288
+ Mage::logException($e);
289
+ }
290
+ }
291
+ $this->_redirect('*/*/index');
292
+ }
293
+
294
+ /**
295
+ * export as csv - action
296
+ *
297
+ * @access public
298
+ * @return void
299
+
300
+ */
301
+ public function exportCsvAction()
302
+ {
303
+ $fileName = 'anymarketcategories.csv';
304
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketcategories_grid')
305
+ ->getCsv();
306
+ $this->_prepareDownloadResponse($fileName, $content);
307
+ }
308
+
309
+ /**
310
+ * export as MsExcel - action
311
+ *
312
+ * @access public
313
+ * @return void
314
+
315
+ */
316
+ public function exportExcelAction()
317
+ {
318
+ $fileName = 'anymarketcategories.xls';
319
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketcategories_grid')
320
+ ->getExcelFile();
321
+ $this->_prepareDownloadResponse($fileName, $content);
322
+ }
323
+
324
+ /**
325
+ * export as xml - action
326
+ *
327
+ * @access public
328
+ * @return void
329
+
330
+ */
331
+ public function exportXmlAction()
332
+ {
333
+ $fileName = 'anymarketcategories.xml';
334
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketcategories_grid')
335
+ ->getXml();
336
+ $this->_prepareDownloadResponse($fileName, $content);
337
+ }
338
+
339
+ /**
340
+ * Check if admin has permissions to visit related pages
341
+ *
342
+ * @access protected
343
+ * @return boolean
344
+
345
+ */
346
+ protected function _isAllowed()
347
+ {
348
+ return Mage::getSingleton('admin/session')->isAllowed('system/db1_anymarket/anymarketcategories');
349
+ }
350
+ }
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketlogController.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket Log admin controller
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketlogController extends DB1_AnyMarket_Controller_Adminhtml_AnyMarket
25
+ {
26
+ /**
27
+ * init the anymarket log
28
+ *
29
+ * @access protected
30
+ * @return DB1_AnyMarket_Model_Anymarketlog
31
+ */
32
+ protected function _initAnymarketlog()
33
+ {
34
+ $anymarketlogId = (int) $this->getRequest()->getParam('id');
35
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
36
+ if ($anymarketlogId) {
37
+ $anymarketlog->load($anymarketlogId);
38
+ }
39
+ Mage::register('current_anymarketlog', $anymarketlog);
40
+ return $anymarketlog;
41
+ }
42
+
43
+ /**
44
+ * default action
45
+ *
46
+ * @access public
47
+ * @return void
48
+ *
49
+ */
50
+ public function indexAction()
51
+ {
52
+ $this->loadLayout();
53
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
54
+ ->_title(Mage::helper('db1_anymarket')->__('AnyMarket Log'));
55
+ $this->renderLayout();
56
+ }
57
+
58
+ /**
59
+ * grid action
60
+ *
61
+ * @access public
62
+ * @return void
63
+ *
64
+ */
65
+ public function gridAction()
66
+ {
67
+ $this->loadLayout()->renderLayout();
68
+ }
69
+
70
+ /**
71
+ * edit anymarket log - action
72
+ *
73
+ * @access public
74
+ * @return void
75
+ *
76
+ */
77
+ public function editAction()
78
+ {
79
+ $anymarketlogId = $this->getRequest()->getParam('id');
80
+ $anymarketlog = $this->_initAnymarketlog();
81
+ if ($anymarketlogId && !$anymarketlog->getId()) {
82
+ $this->_getSession()->addError(
83
+ Mage::helper('db1_anymarket')->__('This anymarket log no longer exists.')
84
+ );
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ }
88
+ $data = Mage::getSingleton('adminhtml/session')->getAnymarketlogData(true);
89
+ if (!empty($data)) {
90
+ $anymarketlog->setData($data);
91
+ }
92
+ Mage::register('anymarketlog_data', $anymarketlog);
93
+ $this->loadLayout();
94
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
95
+ ->_title(Mage::helper('db1_anymarket')->__('AnyMarket Log'));
96
+ if ($anymarketlog->getId()) {
97
+ $this->_title($anymarketlog->getLogDesc());
98
+ } else {
99
+ $this->_title(Mage::helper('db1_anymarket')->__('Add anymarket log'));
100
+ }
101
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
102
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
103
+ }
104
+ $this->renderLayout();
105
+ }
106
+
107
+ /**
108
+ * new anymarket log action
109
+ *
110
+ * @access public
111
+ * @return void
112
+ *
113
+ */
114
+ public function newAction()
115
+ {
116
+ $this->_forward('edit');
117
+ }
118
+
119
+ /**
120
+ * save anymarket log - action
121
+ *
122
+ * @access public
123
+ * @return void
124
+ *
125
+ */
126
+ public function saveAction()
127
+ {
128
+ if ($data = $this->getRequest()->getPost('anymarketlog')) {
129
+ try {
130
+ $anymarketlog = $this->_initAnymarketlog();
131
+ $anymarketlog->addData($data);
132
+ $anymarketlog->save();
133
+ Mage::getSingleton('adminhtml/session')->addSuccess(
134
+ Mage::helper('db1_anymarket')->__('AnyMarket Log was successfully saved')
135
+ );
136
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
137
+ if ($this->getRequest()->getParam('back')) {
138
+ $this->_redirect('*/*/edit', array('id' => $anymarketlog->getId()));
139
+ return;
140
+ }
141
+ $this->_redirect('*/*/');
142
+ return;
143
+ } catch (Mage_Core_Exception $e) {
144
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
145
+ Mage::getSingleton('adminhtml/session')->setAnymarketlogData($data);
146
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
147
+ return;
148
+ } catch (Exception $e) {
149
+ Mage::logException($e);
150
+ Mage::getSingleton('adminhtml/session')->addError(
151
+ Mage::helper('db1_anymarket')->__('There was a problem saving the anymarket log.')
152
+ );
153
+ Mage::getSingleton('adminhtml/session')->setAnymarketlogData($data);
154
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
155
+ return;
156
+ }
157
+ }
158
+ Mage::getSingleton('adminhtml/session')->addError(
159
+ Mage::helper('db1_anymarket')->__('Unable to find anymarket log to save.')
160
+ );
161
+ $this->_redirect('*/*/');
162
+ }
163
+
164
+ /**
165
+ * delete anymarket log - action
166
+ *
167
+ * @access public
168
+ * @return void
169
+ *
170
+ */
171
+ public function deleteAction()
172
+ {
173
+ if ( $this->getRequest()->getParam('id') > 0) {
174
+ try {
175
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
176
+ $anymarketlog->setId($this->getRequest()->getParam('id'))->delete();
177
+ Mage::getSingleton('adminhtml/session')->addSuccess(
178
+ Mage::helper('db1_anymarket')->__('AnyMarket Log was successfully deleted.')
179
+ );
180
+ $this->_redirect('*/*/');
181
+ return;
182
+ } catch (Mage_Core_Exception $e) {
183
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
184
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
185
+ } catch (Exception $e) {
186
+ Mage::getSingleton('adminhtml/session')->addError(
187
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket log.')
188
+ );
189
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
190
+ Mage::logException($e);
191
+ return;
192
+ }
193
+ }
194
+ Mage::getSingleton('adminhtml/session')->addError(
195
+ Mage::helper('db1_anymarket')->__('Could not find anymarket log to delete.')
196
+ );
197
+ $this->_redirect('*/*/');
198
+ }
199
+
200
+ /**
201
+ * mass delete anymarket log - action
202
+ *
203
+ * @access public
204
+ * @return void
205
+ *
206
+ */
207
+ public function massDeleteAction()
208
+ {
209
+ $anymarketlogIds = $this->getRequest()->getParam('anymarketlog');
210
+ if (!is_array($anymarketlogIds)) {
211
+ Mage::getSingleton('adminhtml/session')->addError(
212
+ Mage::helper('db1_anymarket')->__('Please select anymarket log to delete.')
213
+ );
214
+ } else {
215
+ try {
216
+ foreach ($anymarketlogIds as $anymarketlogId) {
217
+ $anymarketlog = Mage::getModel('db1_anymarket/anymarketlog');
218
+ $anymarketlog->setId($anymarketlogId)->delete();
219
+ }
220
+ Mage::getSingleton('adminhtml/session')->addSuccess(
221
+ Mage::helper('db1_anymarket')->__('Total of %d anymarket log were successfully deleted.', count($anymarketlogIds))
222
+ );
223
+ } catch (Mage_Core_Exception $e) {
224
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
225
+ } catch (Exception $e) {
226
+ Mage::getSingleton('adminhtml/session')->addError(
227
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket log.')
228
+ );
229
+ Mage::logException($e);
230
+ }
231
+ }
232
+ $this->_redirect('*/*/index');
233
+ }
234
+
235
+ /**
236
+ * mass status change - action
237
+ *
238
+ * @access public
239
+ * @return void
240
+ *
241
+ */
242
+ public function massStatusAction()
243
+ {
244
+ $anymarketlogIds = $this->getRequest()->getParam('anymarketlog');
245
+ if (!is_array($anymarketlogIds)) {
246
+ Mage::getSingleton('adminhtml/session')->addError(
247
+ Mage::helper('db1_anymarket')->__('Please select anymarket log.')
248
+ );
249
+ } else {
250
+ try {
251
+ foreach ($anymarketlogIds as $anymarketlogId) {
252
+ $anymarketlog = Mage::getSingleton('db1_anymarket/anymarketlog')->load($anymarketlogId)
253
+ ->setStatus($this->getRequest()->getParam('status'))
254
+ ->setIsMassupdate(true)
255
+ ->save();
256
+ }
257
+ $this->_getSession()->addSuccess(
258
+ $this->__('Total of %d anymarket log were successfully updated.', count($anymarketlogIds))
259
+ );
260
+ } catch (Mage_Core_Exception $e) {
261
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
262
+ } catch (Exception $e) {
263
+ Mage::getSingleton('adminhtml/session')->addError(
264
+ Mage::helper('db1_anymarket')->__('There was an error updating anymarket log.')
265
+ );
266
+ Mage::logException($e);
267
+ }
268
+ }
269
+ $this->_redirect('*/*/index');
270
+ }
271
+
272
+ /**
273
+ * export as csv - action
274
+ *
275
+ * @access public
276
+ * @return void
277
+ *
278
+ */
279
+ public function exportCsvAction()
280
+ {
281
+ $fileName = 'anymarketlog.csv';
282
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketlog_grid')
283
+ ->getCsv();
284
+ $this->_prepareDownloadResponse($fileName, $content);
285
+ }
286
+
287
+ /**
288
+ * export as MsExcel - action
289
+ *
290
+ * @access public
291
+ * @return void
292
+ *
293
+ */
294
+ public function exportExcelAction()
295
+ {
296
+ $fileName = 'anymarketlog.xls';
297
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketlog_grid')
298
+ ->getExcelFile();
299
+ $this->_prepareDownloadResponse($fileName, $content);
300
+ }
301
+
302
+ /**
303
+ * export as xml - action
304
+ *
305
+ * @access public
306
+ * @return void
307
+ *
308
+ */
309
+ public function exportXmlAction()
310
+ {
311
+ $fileName = 'anymarketlog.xml';
312
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketlog_grid')
313
+ ->getXml();
314
+ $this->_prepareDownloadResponse($fileName, $content);
315
+ }
316
+
317
+ /**
318
+ * Check if admin has permissions to visit related pages
319
+ *
320
+ * @access protected
321
+ * @return boolean
322
+ *
323
+ */
324
+ protected function _isAllowed()
325
+ {
326
+ return Mage::getSingleton('admin/session')->isAllowed('system/db1_anymarket/anymarketlog');
327
+ }
328
+ }
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketordersController.php ADDED
@@ -0,0 +1,457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 25
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Orders admin controller
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketordersController extends DB1_AnyMarket_Controller_Adminhtml_AnyMarket
24
+ {
25
+ /**
26
+ * init the anymarket orders
27
+ *
28
+ * @access protected
29
+ * @return DB1_AnyMarket_Model_Anymarketorders
30
+ */
31
+ protected function _initAnymarketorders()
32
+ {
33
+ $anymarketordersId = (int) $this->getRequest()->getParam('id');
34
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
35
+ if ($anymarketordersId) {
36
+ $anymarketorders->load($anymarketordersId);
37
+ }
38
+ Mage::register('current_anymarketorders', $anymarketorders);
39
+ return $anymarketorders;
40
+ }
41
+
42
+ /**
43
+ * default action
44
+ *
45
+ * @access public
46
+ * @return void
47
+ */
48
+ public function indexAction()
49
+ {
50
+ $this->loadLayout();
51
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
52
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Orders'));
53
+ $this->renderLayout();
54
+ }
55
+
56
+ /**
57
+ * sinc Orders action
58
+ *
59
+ * @access public
60
+ * @return void
61
+ */
62
+ public function sincOrdersAction()
63
+ {
64
+ Mage::getSingleton('core/session')->setImportOrdersVariable('false');
65
+
66
+ $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', Mage::app()->getStore()->getId());
67
+ if($ConfigOrder == 1){
68
+ Mage::helper('db1_anymarket/order')->getOrdersFromAnyMarket();
69
+ }else{
70
+ $orders = Mage::getModel('sales/order')->getCollection();
71
+ foreach($orders as $order) {
72
+ Mage::helper('db1_anymarket/order')->updateOrderAnyMarket($order);
73
+ }
74
+ }
75
+
76
+ Mage::getSingleton('core/session')->setImportOrdersVariable('true');
77
+ Mage::getSingleton('adminhtml/session')->addSuccess(
78
+ Mage::helper('db1_anymarket')->__('Pedidos sincronizados com sucesso.')
79
+ );
80
+ $this->_redirect('*/*/');
81
+ }
82
+
83
+ /**
84
+ * list Orders action
85
+ *
86
+ * @access public
87
+ * @return void
88
+ */
89
+ public function listOrdersAction()
90
+ {
91
+ $storeID = Mage::getSingleton('core/session')->getStoreListOrderVariable();
92
+ Mage::app()->setCurrentStore($storeID);
93
+
94
+ $count = Mage::helper('db1_anymarket/order')->listOrdersFromAnyMarketMagento();
95
+
96
+ Mage::getSingleton('adminhtml/session')->addSuccess(
97
+ Mage::helper('db1_anymarket')->__('Total de %d pedidos listados com sucesso..', $count)
98
+ );
99
+ $this->_redirect('*/*/');
100
+ }
101
+
102
+ /**
103
+ * mass sincronize anymarket Orders - action
104
+ *
105
+ * @access public
106
+ * @return void
107
+ *
108
+ */
109
+ public function sincOrdertoMageAction()
110
+ {
111
+ $anymarketOrdersIds = $this->getRequest()->getParam('anymarketorders');
112
+ if (!is_array($anymarketOrdersIds)) {
113
+ Mage::getSingleton('adminhtml/session')->addError(
114
+ Mage::helper('db1_anymarket')->__('Por favor selecione Orders para sincronizar.')
115
+ );
116
+ } else {
117
+ try {
118
+ $cont = 0;
119
+ Mage::getSingleton('core/session')->setImportOrdersVariable('true');
120
+ $storeID = Mage::getSingleton('core/session')->getStoreListOrderVariable();
121
+ Mage::app()->setCurrentStore($storeID);
122
+
123
+ foreach ($anymarketOrdersIds as $anymarketOrderId) {
124
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
125
+ $anymarketorders->load($anymarketOrderId);
126
+
127
+ if( $anymarketorders->getNmoStatusInt() != "Não integrado (Magento)") {
128
+ $idAnyMarket = $anymarketorders->getNmoIdSeqAnymarket();
129
+ $IDOrderAnyMarket = $anymarketorders->getNmoIdAnymarket();
130
+ $idReg = $anymarketorders->getId();
131
+ $idOrderMage = $anymarketorders->getNmoIdOrder();
132
+
133
+ $anymarketordersDel = Mage::getModel('db1_anymarket/anymarketorders');
134
+ $anymarketordersDel->setId( $idReg )->delete();
135
+ Mage::helper('db1_anymarket/order')->getSpecificOrderFromAnyMarket($idAnyMarket, $IDOrderAnyMarket, $idOrderMage);
136
+
137
+ $cont = $cont+1;
138
+ }
139
+ }
140
+
141
+ Mage::getSingleton('core/session')->setImportOrdersVariable('false');
142
+ Mage::getSingleton('adminhtml/session')->addSuccess(
143
+ Mage::helper('db1_anymarket')->__('Total de %d orders foram sincronizados.', $cont)
144
+ );
145
+ } catch (Mage_Core_Exception $e) {
146
+ Mage::getSingleton('core/session')->setImportProdsVariable('false');
147
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
148
+ } catch (Exception $e) {
149
+ Mage::getSingleton('core/session')->setImportProdsVariable('false');
150
+ Mage::getSingleton('adminhtml/session')->addError(
151
+ Mage::helper('db1_anymarket')->__('Ocorreu um erro ao sincronizar.')
152
+ );
153
+ Mage::logException($e);
154
+ }
155
+ }
156
+ $this->_redirect('*/*/index');
157
+ }
158
+
159
+
160
+ /**
161
+ * mass sincronize anymarket Orders - action
162
+ *
163
+ * @access public
164
+ * @return void
165
+ *
166
+ */
167
+ public function massSincOrderAction()
168
+ {
169
+ $anymarketOrdersIds = $this->getRequest()->getParam('anymarketorders');
170
+ if (!is_array($anymarketOrdersIds)) {
171
+ Mage::getSingleton('adminhtml/session')->addError(
172
+ Mage::helper('db1_anymarket')->__('Por favor selecione Orders para sincronizar.')
173
+ );
174
+ } else {
175
+ $ConfigOrder = Mage::getStoreConfig('anymarket_section/anymarket_integration_order_group/anymarket_type_order_sync_field', Mage::app()->getStore()->getId());
176
+ foreach ($anymarketOrdersIds as $anymarketOrderId) {
177
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
178
+ $anymarketorders->load($anymarketOrderId);
179
+ if($ConfigOrder == 1){ //IMPORT
180
+ if($anymarketorders->getNmoIdAnymarket() != ''){
181
+ Mage::helper('db1_anymarket/queue')->addQueue($anymarketorders->getNmoIdAnymarket(), 'IMP', 'ORDER');
182
+ }
183
+ }else{ //EXPORT
184
+ if($anymarketorders->getNmoIdOrder()){
185
+ Mage::helper('db1_anymarket/queue')->addQueue($anymarketorders->getNmoIdOrder(), 'EXP', 'ORDER');
186
+ }
187
+ }
188
+
189
+ }
190
+ Mage::getSingleton('adminhtml/session')->addSuccess(
191
+ Mage::helper('db1_anymarket')->__('Total %d orders were added to the queue.', count($anymarketOrdersIds))
192
+ );
193
+ }
194
+ $this->_redirect('*/*/index');
195
+ }
196
+
197
+
198
+ /**
199
+ * grid action
200
+ *
201
+ * @access public
202
+ * @return void
203
+ */
204
+ public function gridAction()
205
+ {
206
+ $this->loadLayout()->renderLayout();
207
+ }
208
+
209
+ /**
210
+ * edit anymarket orders - action
211
+ *
212
+ * @access public
213
+ * @return void
214
+ */
215
+ public function editAction()
216
+ {
217
+ $anymarketordersId = $this->getRequest()->getParam('id');
218
+ $anymarketorders = $this->_initAnymarketorders();
219
+ if ($anymarketordersId && !$anymarketorders->getId()) {
220
+ $this->_getSession()->addError(
221
+ Mage::helper('db1_anymarket')->__('This anymarket orders no longer exists.')
222
+ );
223
+ $this->_redirect('*/*/');
224
+ return;
225
+ }
226
+ $data = Mage::getSingleton('adminhtml/session')->getAnymarketordersData(true);
227
+ if (!empty($data)) {
228
+ $anymarketorders->setData($data);
229
+ }
230
+ Mage::register('anymarketorders_data', $anymarketorders);
231
+ $this->loadLayout();
232
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
233
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Orders'));
234
+ if ($anymarketorders->getId()) {
235
+ $this->_title($anymarketorders->getNmoIdOrder());
236
+ } else {
237
+ $this->_title(Mage::helper('db1_anymarket')->__('Add anymarket orders'));
238
+ }
239
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
240
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
241
+ }
242
+ $this->renderLayout();
243
+ }
244
+
245
+ /**
246
+ * new anymarket orders action
247
+ *
248
+ * @access public
249
+ * @return void
250
+ */
251
+ public function newAction()
252
+ {
253
+ $this->_forward('edit');
254
+ }
255
+
256
+ /**
257
+ * save anymarket orders - action
258
+ *
259
+ * @access public
260
+ * @return void
261
+ */
262
+ public function saveAction()
263
+ {
264
+ if ($data = $this->getRequest()->getPost('anymarketorders')) {
265
+ try {
266
+ $anymarketorders = $this->_initAnymarketorders();
267
+ $anymarketorders->addData($data);
268
+ $anymarketorders->save();
269
+ Mage::getSingleton('adminhtml/session')->addSuccess(
270
+ Mage::helper('db1_anymarket')->__('Anymarket Orders was successfully saved')
271
+ );
272
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
273
+ if ($this->getRequest()->getParam('back')) {
274
+ $this->_redirect('*/*/edit', array('id' => $anymarketorders->getId()));
275
+ return;
276
+ }
277
+ $this->_redirect('*/*/');
278
+ return;
279
+ } catch (Mage_Core_Exception $e) {
280
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
281
+ Mage::getSingleton('adminhtml/session')->setAnymarketordersData($data);
282
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
283
+ return;
284
+ } catch (Exception $e) {
285
+ Mage::logException($e);
286
+ Mage::getSingleton('adminhtml/session')->addError(
287
+ Mage::helper('db1_anymarket')->__('There was a problem saving the anymarket orders.')
288
+ );
289
+ Mage::getSingleton('adminhtml/session')->setAnymarketordersData($data);
290
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
291
+ return;
292
+ }
293
+ }
294
+ Mage::getSingleton('adminhtml/session')->addError(
295
+ Mage::helper('db1_anymarket')->__('Unable to find anymarket orders to save.')
296
+ );
297
+ $this->_redirect('*/*/');
298
+ }
299
+
300
+ /**
301
+ * delete anymarket orders - action
302
+ *
303
+ * @access public
304
+ * @return void
305
+ */
306
+ public function deleteAction()
307
+ {
308
+ if ( $this->getRequest()->getParam('id') > 0) {
309
+ try {
310
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
311
+ $anymarketorders->setId($this->getRequest()->getParam('id'))->delete();
312
+ Mage::getSingleton('adminhtml/session')->addSuccess(
313
+ Mage::helper('db1_anymarket')->__('Anymarket Orders was successfully deleted.')
314
+ );
315
+ $this->_redirect('*/*/');
316
+ return;
317
+ } catch (Mage_Core_Exception $e) {
318
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
319
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
320
+ } catch (Exception $e) {
321
+ Mage::getSingleton('adminhtml/session')->addError(
322
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket orders.')
323
+ );
324
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
325
+ Mage::logException($e);
326
+ return;
327
+ }
328
+ }
329
+ Mage::getSingleton('adminhtml/session')->addError(
330
+ Mage::helper('db1_anymarket')->__('Could not find anymarket orders to delete.')
331
+ );
332
+ $this->_redirect('*/*/');
333
+ }
334
+
335
+ /**
336
+ * mass delete anymarket orders - action
337
+ *
338
+ * @access public
339
+ * @return void
340
+ */
341
+ public function massDeleteAction()
342
+ {
343
+ $anymarketordersIds = $this->getRequest()->getParam('anymarketorders');
344
+ if (!is_array($anymarketordersIds)) {
345
+ Mage::getSingleton('adminhtml/session')->addError(
346
+ Mage::helper('db1_anymarket')->__('Please select anymarket orders to delete.')
347
+ );
348
+ } else {
349
+ try {
350
+ foreach ($anymarketordersIds as $anymarketordersId) {
351
+ $anymarketorders = Mage::getModel('db1_anymarket/anymarketorders');
352
+ $anymarketorders->setId($anymarketordersId)->delete();
353
+ }
354
+ Mage::getSingleton('adminhtml/session')->addSuccess(
355
+ Mage::helper('db1_anymarket')->__('Total of %d anymarket orders were successfully deleted.', count($anymarketordersIds))
356
+ );
357
+ } catch (Mage_Core_Exception $e) {
358
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
359
+ } catch (Exception $e) {
360
+ Mage::getSingleton('adminhtml/session')->addError(
361
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket orders.')
362
+ );
363
+ Mage::logException($e);
364
+ }
365
+ }
366
+ $this->_redirect('*/*/index');
367
+ }
368
+
369
+ /**
370
+ * mass status change - action
371
+ *
372
+ * @access public
373
+ * @return void
374
+ */
375
+ public function massStatusAction()
376
+ {
377
+ $anymarketordersIds = $this->getRequest()->getParam('anymarketorders');
378
+ if (!is_array($anymarketordersIds)) {
379
+ Mage::getSingleton('adminhtml/session')->addError(
380
+ Mage::helper('db1_anymarket')->__('Please select anymarket orders.')
381
+ );
382
+ } else {
383
+ try {
384
+ foreach ($anymarketordersIds as $anymarketordersId) {
385
+ $anymarketorders = Mage::getSingleton('db1_anymarket/anymarketorders')->load($anymarketordersId)
386
+ ->setStatus($this->getRequest()->getParam('status'))
387
+ ->setIsMassupdate(true)
388
+ ->save();
389
+ }
390
+ $this->_getSession()->addSuccess(
391
+ $this->__('Total of %d anymarket orders were successfully updated.', count($anymarketordersIds))
392
+ );
393
+ } catch (Mage_Core_Exception $e) {
394
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
395
+ } catch (Exception $e) {
396
+ Mage::getSingleton('adminhtml/session')->addError(
397
+ Mage::helper('db1_anymarket')->__('There was an error updating anymarket orders.')
398
+ );
399
+ Mage::logException($e);
400
+ }
401
+ }
402
+ $this->_redirect('*/*/index');
403
+ }
404
+
405
+ /**
406
+ * export as csv - action
407
+ *
408
+ * @access public
409
+ * @return void
410
+ */
411
+ public function exportCsvAction()
412
+ {
413
+ $fileName = 'anymarketorders.csv';
414
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketorders_grid')
415
+ ->getCsv();
416
+ $this->_prepareDownloadResponse($fileName, $content);
417
+ }
418
+
419
+ /**
420
+ * export as MsExcel - action
421
+ *
422
+ * @access public
423
+ * @return void
424
+ */
425
+ public function exportExcelAction()
426
+ {
427
+ $fileName = 'anymarketorders.xls';
428
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketorders_grid')
429
+ ->getExcelFile();
430
+ $this->_prepareDownloadResponse($fileName, $content);
431
+ }
432
+
433
+ /**
434
+ * export as xml - action
435
+ *
436
+ * @access public
437
+ * @return void
438
+ */
439
+ public function exportXmlAction()
440
+ {
441
+ $fileName = 'anymarketorders.xml';
442
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketorders_grid')
443
+ ->getXml();
444
+ $this->_prepareDownloadResponse($fileName, $content);
445
+ }
446
+
447
+ /**
448
+ * Check if admin has permissions to visit related pages
449
+ *
450
+ * @access protected
451
+ * @return boolean
452
+ */
453
+ protected function _isAllowed()
454
+ {
455
+ return Mage::getSingleton('admin/session')->isAllowed('system/db1_anymarket/anymarketorders');
456
+ }
457
+ }
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketproductsController.php ADDED
@@ -0,0 +1,505 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 25
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Products admin controller
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketproductsController extends DB1_AnyMarket_Controller_Adminhtml_AnyMarket
24
+ {
25
+ /**
26
+ * init the anymarket products
27
+ *
28
+ * @access protected
29
+ * @return DB1_AnyMarket_Model_Anymarketproducts
30
+ */
31
+ protected function _initAnymarketproducts()
32
+ {
33
+ $anymarketproductsId = (int) $this->getRequest()->getParam('id');
34
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
35
+ if ($anymarketproductsId) {
36
+ $anymarketproducts->load($anymarketproductsId);
37
+ }
38
+ Mage::register('current_anymarketproducts', $anymarketproducts);
39
+ return $anymarketproducts;
40
+ }
41
+
42
+ /**
43
+ * default action
44
+ *
45
+ * @access public
46
+ * @return void
47
+ *
48
+ */
49
+ public function indexAction()
50
+ {
51
+ $this->loadLayout();
52
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
53
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Products'));
54
+ $this->renderLayout();
55
+ }
56
+
57
+ /**
58
+ * sinc products action
59
+ *
60
+ * @access public
61
+ * @return void
62
+ */
63
+ public function sincProdsAction()
64
+ {
65
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', Mage::app()->getStore()->getId());
66
+ if($typeSincProd == 1){
67
+ Mage::helper('db1_anymarket/product')->getProdsFromAnyMarket();
68
+ }else{
69
+ $products = Mage::getModel('catalog/product')->getCollection();
70
+ foreach($products as $product) {
71
+
72
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts')->load($product->getId(), 'nmp_id');
73
+ if($anymarketproducts->getData('nmp_id') != null){
74
+ if( strtolower($anymarketproducts->getData('nmp_status_int')) != 'integrado'){
75
+
76
+ $ProdLoaded = Mage::getModel('catalog/product')->load( $product->getId() );
77
+ if( ($ProdLoaded->getStatus() == 1) && ($ProdLoaded->getData('integra_anymarket') == 1) ){
78
+ $amProd = Mage::helper('db1_anymarket/product');
79
+ $amProd->sendProductToAnyMarket( $product->getId() );
80
+
81
+ $filter = strtolower(Mage::getStoreConfig('anymarket_section/anymarket_attribute_group/anymarket_preco_field', Mage::app()->getStore()->getId()));
82
+ $ProdStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
83
+
84
+ $amProd->updatePriceStockAnyMarket($product->getId(), $ProdStock->getQty(), $ProdLoaded->getData($filter));
85
+ }
86
+ }
87
+ }
88
+
89
+ }
90
+ }
91
+
92
+ Mage::getSingleton('adminhtml/session')->addSuccess(
93
+ Mage::helper('db1_anymarket')->__('Produtos sincronizados com sucesso.')
94
+ );
95
+ $this->_redirect('*/*/');
96
+
97
+ }
98
+
99
+ /**
100
+ * list products action
101
+ *
102
+ * @access public
103
+ * @return void
104
+ */
105
+ public function listProdsAction()
106
+ {
107
+ $storeID = Mage::getSingleton('core/session')->getStoreListProdVariable();
108
+ Mage::app()->setCurrentStore($storeID);
109
+ Mage::helper('db1_anymarket/product')->massUpdtProds();
110
+ $this->_redirect('*/*/');
111
+
112
+ }
113
+
114
+ /**
115
+ * grid action
116
+ *
117
+ * @access public
118
+ * @return void
119
+ *
120
+ */
121
+
122
+ public function gridAction()
123
+ {
124
+ $this->loadLayout()->renderLayout();
125
+ }
126
+
127
+ /**
128
+ * edit anymarket products - action
129
+ *
130
+ * @access public
131
+ * @return void
132
+ *
133
+ */
134
+ public function editAction()
135
+ {
136
+ $anymarketproductsId = $this->getRequest()->getParam('id');
137
+ $anymarketproducts = $this->_initAnymarketproducts();
138
+ if ($anymarketproductsId && !$anymarketproducts->getId()) {
139
+ $this->_getSession()->addError(
140
+ Mage::helper('db1_anymarket')->__('This anymarket products no longer exists.')
141
+ );
142
+ $this->_redirect('*/*/');
143
+ return;
144
+ }
145
+ $data = Mage::getSingleton('adminhtml/session')->getAnymarketproductsData(true);
146
+ if (!empty($data)) {
147
+ $anymarketproducts->setData($data);
148
+ }
149
+ Mage::register('anymarketproducts_data', $anymarketproducts);
150
+ $this->loadLayout();
151
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
152
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Products'));
153
+ if ($anymarketproducts->getId()) {
154
+ $this->_title($anymarketproducts->getNmpDescError());
155
+ } else {
156
+ $this->_title(Mage::helper('db1_anymarket')->__('Add anymarket products'));
157
+ }
158
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
159
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
160
+ }
161
+ $this->renderLayout();
162
+ }
163
+
164
+ /**
165
+ * new anymarket products action
166
+ *
167
+ * @access public
168
+ * @return void
169
+ *
170
+ */
171
+ public function newAction()
172
+ {
173
+ $this->_forward('edit');
174
+ }
175
+
176
+ /**
177
+ * save anymarket products - action
178
+ *
179
+ * @access public
180
+ * @return void
181
+ *
182
+ */
183
+ public function saveAction()
184
+ {
185
+ if ($data = $this->getRequest()->getPost('anymarketproducts')) {
186
+ try {
187
+ $anymarketproducts = $this->_initAnymarketproducts();
188
+ $anymarketproducts->addData($data);
189
+ $anymarketproducts->save();
190
+ Mage::getSingleton('adminhtml/session')->addSuccess(
191
+ Mage::helper('db1_anymarket')->__('Anymarket Products was successfully saved')
192
+ );
193
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
194
+ if ($this->getRequest()->getParam('back')) {
195
+ $this->_redirect('*/*/edit', array('id' => $anymarketproducts->getId()));
196
+ return;
197
+ }
198
+ $this->_redirect('*/*/');
199
+ return;
200
+ } catch (Mage_Core_Exception $e) {
201
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
202
+ Mage::getSingleton('adminhtml/session')->setAnymarketproductsData($data);
203
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
204
+ return;
205
+ } catch (Exception $e) {
206
+ Mage::logException($e);
207
+ Mage::getSingleton('adminhtml/session')->addError(
208
+ Mage::helper('db1_anymarket')->__('There was a problem saving the anymarket products.')
209
+ );
210
+ Mage::getSingleton('adminhtml/session')->setAnymarketproductsData($data);
211
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
212
+ return;
213
+ }
214
+ }
215
+ Mage::getSingleton('adminhtml/session')->addError(
216
+ Mage::helper('db1_anymarket')->__('Unable to find anymarket products to save.')
217
+ );
218
+ $this->_redirect('*/*/');
219
+ }
220
+
221
+ /**
222
+ * delete anymarket products - action
223
+ *
224
+ * @access public
225
+ * @return void
226
+ *
227
+ */
228
+ public function deleteAction()
229
+ {
230
+ if ( $this->getRequest()->getParam('id') > 0) {
231
+ try {
232
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
233
+ $anymarketproducts->setId($this->getRequest()->getParam('id'))->delete();
234
+ Mage::getSingleton('adminhtml/session')->addSuccess(
235
+ Mage::helper('db1_anymarket')->__('Anymarket Products was successfully deleted.')
236
+ );
237
+ $this->_redirect('*/*/');
238
+ return;
239
+ } catch (Mage_Core_Exception $e) {
240
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
241
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
242
+ } catch (Exception $e) {
243
+ Mage::getSingleton('adminhtml/session')->addError(
244
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket products.')
245
+ );
246
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
247
+ Mage::logException($e);
248
+ return;
249
+ }
250
+ }
251
+ Mage::getSingleton('adminhtml/session')->addError(
252
+ Mage::helper('db1_anymarket')->__('Could not find anymarket products to delete.')
253
+ );
254
+ $this->_redirect('*/*/');
255
+ }
256
+
257
+ /**
258
+ * mass delete anymarket products - action
259
+ *
260
+ * @access public
261
+ * @return void
262
+ *
263
+ */
264
+ public function massDeleteAction()
265
+ {
266
+ $anymarketproductsIds = $this->getRequest()->getParam('anymarketproducts');
267
+ if (!is_array($anymarketproductsIds)) {
268
+ Mage::getSingleton('adminhtml/session')->addError(
269
+ Mage::helper('db1_anymarket')->__('Please select anymarket products to delete.')
270
+ );
271
+ } else {
272
+ try {
273
+ foreach ($anymarketproductsIds as $anymarketproductsId) {
274
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
275
+ $anymarketproducts->setId($anymarketproductsId)->delete();
276
+ }
277
+ Mage::getSingleton('adminhtml/session')->addSuccess(
278
+ Mage::helper('db1_anymarket')->__('Total of %d anymarket products were successfully deleted.', count($anymarketproductsIds))
279
+ );
280
+ } catch (Mage_Core_Exception $e) {
281
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
282
+ } catch (Exception $e) {
283
+ Mage::getSingleton('adminhtml/session')->addError(
284
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket products.')
285
+ );
286
+ Mage::logException($e);
287
+ }
288
+ }
289
+ $this->_redirect('*/*/index');
290
+ }
291
+
292
+
293
+ /**
294
+ * import anymarket products - action
295
+ *
296
+ * @access public
297
+ * @return void
298
+ *
299
+ */
300
+ public function importProdSincAction()
301
+ {
302
+ $anymarketproductsIds = $this->getRequest()->getParam('anymarketproducts');
303
+ if (!is_array($anymarketproductsIds)) {
304
+ Mage::getSingleton('adminhtml/session')->addError(
305
+ Mage::helper('db1_anymarket')->__('Por favor selecione os produtos para importar.')
306
+ );
307
+ } else {
308
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', Mage::app()->getStore()->getId());
309
+ if($typeSincProd == 1){
310
+ foreach ($anymarketproductsIds as $anymarketproductsId) {
311
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
312
+ $anymarketproducts->load($anymarketproductsId);
313
+ Mage::helper('db1_anymarket/queue')->addQueue($anymarketproducts->getNmpId(), 'IMP', 'PRODUCT');
314
+ }
315
+ Mage::getSingleton('adminhtml/session')->addSuccess(
316
+ Mage::helper('db1_anymarket')->__('Total %d products were added to the queue.', count($anymarketproductsIds))
317
+ );
318
+ }else{
319
+ Mage::getSingleton('adminhtml/session')->addError(
320
+ Mage::helper('db1_anymarket')->__('Integration Products "AnyMarket for Magento" marked as NOT')
321
+ );
322
+ }
323
+ }
324
+ $this->_redirect('*/*/index');
325
+ }
326
+
327
+
328
+ /**
329
+ * export magento products - action
330
+ *
331
+ * @access public
332
+ * @return void
333
+ *
334
+ */
335
+ public function exportProdSincAction()
336
+ {
337
+ $anymarketproductsIds = $this->getRequest()->getParam('anymarketproducts');
338
+ if (!is_array($anymarketproductsIds)) {
339
+ Mage::getSingleton('adminhtml/session')->addError(
340
+ Mage::helper('db1_anymarket')->__('Por favor selecione os produtos para exportar.')
341
+ );
342
+ } else {
343
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', Mage::app()->getStore()->getId());
344
+ if($typeSincProd == 0){
345
+ foreach ($anymarketproductsIds as $anymarketproductsId) {
346
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
347
+ $anymarketproducts->load($anymarketproductsId);
348
+ Mage::helper('db1_anymarket/queue')->addQueue($anymarketproducts->getNmpId(), 'EXP', 'PRODUCT');
349
+ }
350
+ Mage::getSingleton('adminhtml/session')->addSuccess(
351
+ Mage::helper('db1_anymarket')->__('Total %d products were added to the queue.', count($anymarketproductsIds))
352
+ );
353
+ }else{
354
+ Mage::getSingleton('adminhtml/session')->addError(
355
+ Mage::helper('db1_anymarket')->__('Integration Products "Magento for Anymarket" marked as NOT')
356
+ );
357
+ }
358
+ }
359
+ $this->_redirect('*/*/index');
360
+ }
361
+
362
+ /**
363
+ * mass sincronize anymarket products - action
364
+ *
365
+ * @access public
366
+ * @return void
367
+ *
368
+ */
369
+ public function massSincProductAction()
370
+ {
371
+ $anymarketproductsIds = $this->getRequest()->getParam('anymarketproducts');
372
+ if (!is_array($anymarketproductsIds)) {
373
+ Mage::getSingleton('adminhtml/session')->addError(
374
+ Mage::helper('db1_anymarket')->__('Please select the products to synchronize.')
375
+ );
376
+ }else{
377
+ foreach ($anymarketproductsIds as $anymarketproductsId) {
378
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
379
+ $anymarketproducts->load($anymarketproductsId);
380
+
381
+ if(is_array($anymarketproducts->getStoreId())){
382
+ $arrValueStore = array_values($anymarketproducts->getStoreId());
383
+ $storeID = array_shift($arrValueStore);
384
+ }else{
385
+ $storeID = $anymarketproducts->getStoreId();
386
+ }
387
+
388
+ Mage::app()->setCurrentStore($storeID);
389
+ $typeSincProd = Mage::getStoreConfig('anymarket_section/anymarket_integration_prod_group/anymarket_type_prod_sync_field', $storeID);
390
+ if($typeSincProd == 1){
391
+ Mage::helper('db1_anymarket/queue')->addQueue($anymarketproducts->getNmpId(), 'IMP', 'PRODUCT');
392
+ }else{
393
+ Mage::helper('db1_anymarket/queue')->addQueue($anymarketproducts->getNmpId(), 'EXP', 'PRODUCT');
394
+ }
395
+ }
396
+ Mage::getSingleton('adminhtml/session')->addSuccess(
397
+ Mage::helper('db1_anymarket')->__('Total %d products were added to the queue.', count($anymarketproductsIds))
398
+ );
399
+ }
400
+
401
+ $this->_redirect('*/*/index');
402
+ }
403
+
404
+ /**
405
+ * mass status change - action
406
+ *
407
+ * @access public
408
+ * @return void
409
+ *
410
+ */
411
+ public function massStatusAction()
412
+ {
413
+ $anymarketproductsIds = $this->getRequest()->getParam('anymarketproducts');
414
+ if (!is_array($anymarketproductsIds)) {
415
+ Mage::getSingleton('adminhtml/session')->addError(
416
+ Mage::helper('db1_anymarket')->__('Please select anymarket products.')
417
+ );
418
+ } else {
419
+ try {
420
+ foreach ($anymarketproductsIds as $anymarketproductsId) {
421
+ $anymarketproducts = Mage::getModel('db1_anymarket/anymarketproducts');
422
+ $anymarketproducts->load($anymarketproductsId);
423
+
424
+ $anymarketproducts->setStatus('1')->setIsMassupdate(true)->save();
425
+
426
+ $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $anymarketproducts->getNmpSku());
427
+ if($product){
428
+ $productID = $product->getId();
429
+
430
+ $product->setIntegraAnymarket( $this->getRequest()->getParam('status') );
431
+ $product->save();
432
+ }
433
+ }
434
+ $this->_getSession()->addSuccess(
435
+ $this->__('Total of %d anymarket products were successfully updated.', count($anymarketproductsIds))
436
+ );
437
+ } catch (Mage_Core_Exception $e) {
438
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
439
+ } catch (Exception $e) {
440
+ Mage::getSingleton('adminhtml/session')->addError(
441
+ Mage::helper('db1_anymarket')->__('There was an error updating anymarket products.')
442
+ );
443
+ Mage::logException($e);
444
+ }
445
+ }
446
+ $this->_redirect('*/*/index');
447
+ }
448
+
449
+ /**
450
+ * export as csv - action
451
+ *
452
+ * @access public
453
+ * @return void
454
+ *
455
+ */
456
+ public function exportCsvAction()
457
+ {
458
+ $fileName = 'anymarketproducts.csv';
459
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketproducts_grid')
460
+ ->getCsv();
461
+ $this->_prepareDownloadResponse($fileName, $content);
462
+ }
463
+
464
+ /**
465
+ * export as MsExcel - action
466
+ *
467
+ * @access public
468
+ * @return void
469
+ *
470
+ */
471
+ public function exportExcelAction()
472
+ {
473
+ $fileName = 'anymarketproducts.xls';
474
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketproducts_grid')
475
+ ->getExcelFile();
476
+ $this->_prepareDownloadResponse($fileName, $content);
477
+ }
478
+
479
+ /**
480
+ * export as xml - action
481
+ *
482
+ * @access public
483
+ * @return void
484
+ *
485
+ */
486
+ public function exportXmlAction()
487
+ {
488
+ $fileName = 'anymarketproducts.xml';
489
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketproducts_grid')
490
+ ->getXml();
491
+ $this->_prepareDownloadResponse($fileName, $content);
492
+ }
493
+
494
+ /**
495
+ * Check if admin has permissions to visit related pages
496
+ *
497
+ * @access protected
498
+ * @return boolean
499
+ *
500
+ */
501
+ protected function _isAllowed()
502
+ {
503
+ return Mage::getSingleton('admin/session')->isAllowed('system/db1_anymarket/anymarketproducts');
504
+ }
505
+ }
app/code/community/DB1/AnyMarket/controllers/Adminhtml/Anymarket/AnymarketqueueController.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Anymarket Queue admin controller
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+ */
23
+ class DB1_AnyMarket_Adminhtml_Anymarket_AnymarketqueueController extends DB1_AnyMarket_Controller_Adminhtml_AnyMarket
24
+ {
25
+ /**
26
+ * init the anymarket queue
27
+ *
28
+ * @access protected
29
+ * @return DB1_AnyMarket_Model_Anymarketqueue
30
+ */
31
+ protected function _initAnymarketqueue()
32
+ {
33
+ $anymarketqueueId = (int) $this->getRequest()->getParam('id');
34
+ $anymarketqueue = Mage::getModel('db1_anymarket/anymarketqueue');
35
+ if ($anymarketqueueId) {
36
+ $anymarketqueue->load($anymarketqueueId);
37
+ }
38
+ Mage::register('current_anymarketqueue', $anymarketqueue);
39
+ return $anymarketqueue;
40
+ }
41
+
42
+ /**
43
+ * default action
44
+ *
45
+ * @access public
46
+ * @return void
47
+
48
+ */
49
+ public function indexAction()
50
+ {
51
+ $this->loadLayout();
52
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
53
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Queues'));
54
+ $this->renderLayout();
55
+ }
56
+
57
+ /**
58
+ * grid action
59
+ *
60
+ * @access public
61
+ * @return void
62
+
63
+ */
64
+ public function gridAction()
65
+ {
66
+ $this->loadLayout()->renderLayout();
67
+ }
68
+
69
+ /**
70
+ * edit anymarket queue - action
71
+ *
72
+ * @access public
73
+ * @return void
74
+
75
+ */
76
+ public function editAction()
77
+ {
78
+ $anymarketqueueId = $this->getRequest()->getParam('id');
79
+ $anymarketqueue = $this->_initAnymarketqueue();
80
+ if ($anymarketqueueId && !$anymarketqueue->getId()) {
81
+ $this->_getSession()->addError(
82
+ Mage::helper('db1_anymarket')->__('This anymarket queue no longer exists.')
83
+ );
84
+ $this->_redirect('*/*/');
85
+ return;
86
+ }
87
+ $data = Mage::getSingleton('adminhtml/session')->getAnymarketqueueData(true);
88
+ if (!empty($data)) {
89
+ $anymarketqueue->setData($data);
90
+ }
91
+ Mage::register('anymarketqueue_data', $anymarketqueue);
92
+ $this->loadLayout();
93
+ $this->_title(Mage::helper('db1_anymarket')->__('AnyMarket'))
94
+ ->_title(Mage::helper('db1_anymarket')->__('Anymarket Queues'));
95
+ if ($anymarketqueue->getId()) {
96
+ $this->_title($anymarketqueue->getNmqId());
97
+ } else {
98
+ $this->_title(Mage::helper('db1_anymarket')->__('Add anymarket queue'));
99
+ }
100
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
101
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
102
+ }
103
+ $this->renderLayout();
104
+ }
105
+
106
+ /**
107
+ * new anymarket queue action
108
+ *
109
+ * @access public
110
+ * @return void
111
+
112
+ */
113
+ public function newAction()
114
+ {
115
+ $this->_forward('edit');
116
+ }
117
+
118
+ /**
119
+ * save anymarket queue - action
120
+ *
121
+ * @access public
122
+ * @return void
123
+
124
+ */
125
+ public function saveAction()
126
+ {
127
+ if ($data = $this->getRequest()->getPost('anymarketqueue')) {
128
+ try {
129
+ $anymarketqueue = $this->_initAnymarketqueue();
130
+ $anymarketqueue->addData($data);
131
+ $anymarketqueue->save();
132
+ Mage::getSingleton('adminhtml/session')->addSuccess(
133
+ Mage::helper('db1_anymarket')->__('Anymarket Queue was successfully saved')
134
+ );
135
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
136
+ if ($this->getRequest()->getParam('back')) {
137
+ $this->_redirect('*/*/edit', array('id' => $anymarketqueue->getId()));
138
+ return;
139
+ }
140
+ $this->_redirect('*/*/');
141
+ return;
142
+ } catch (Mage_Core_Exception $e) {
143
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
144
+ Mage::getSingleton('adminhtml/session')->setAnymarketqueueData($data);
145
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
146
+ return;
147
+ } catch (Exception $e) {
148
+ Mage::logException($e);
149
+ Mage::getSingleton('adminhtml/session')->addError(
150
+ Mage::helper('db1_anymarket')->__('There was a problem saving the anymarket queue.')
151
+ );
152
+ Mage::getSingleton('adminhtml/session')->setAnymarketqueueData($data);
153
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
154
+ return;
155
+ }
156
+ }
157
+ Mage::getSingleton('adminhtml/session')->addError(
158
+ Mage::helper('db1_anymarket')->__('Unable to find anymarket queue to save.')
159
+ );
160
+ $this->_redirect('*/*/');
161
+ }
162
+
163
+ /**
164
+ * delete anymarket queue - action
165
+ *
166
+ * @access public
167
+ * @return void
168
+
169
+ */
170
+ public function deleteAction()
171
+ {
172
+ if ( $this->getRequest()->getParam('id') > 0) {
173
+ try {
174
+ $anymarketqueue = Mage::getModel('db1_anymarket/anymarketqueue');
175
+ $anymarketqueue->setId($this->getRequest()->getParam('id'))->delete();
176
+ Mage::getSingleton('adminhtml/session')->addSuccess(
177
+ Mage::helper('db1_anymarket')->__('Anymarket Queue was successfully deleted.')
178
+ );
179
+ $this->_redirect('*/*/');
180
+ return;
181
+ } catch (Mage_Core_Exception $e) {
182
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
183
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
184
+ } catch (Exception $e) {
185
+ Mage::getSingleton('adminhtml/session')->addError(
186
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket queue.')
187
+ );
188
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
189
+ Mage::logException($e);
190
+ return;
191
+ }
192
+ }
193
+ Mage::getSingleton('adminhtml/session')->addError(
194
+ Mage::helper('db1_anymarket')->__('Could not find anymarket queue to delete.')
195
+ );
196
+ $this->_redirect('*/*/');
197
+ }
198
+
199
+ /**
200
+ * mass delete anymarket queue - action
201
+ *
202
+ * @access public
203
+ * @return void
204
+
205
+ */
206
+ public function massDeleteAction()
207
+ {
208
+ $anymarketqueueIds = $this->getRequest()->getParam('anymarketqueue');
209
+ if (!is_array($anymarketqueueIds)) {
210
+ Mage::getSingleton('adminhtml/session')->addError(
211
+ Mage::helper('db1_anymarket')->__('Please select anymarket queues to delete.')
212
+ );
213
+ } else {
214
+ try {
215
+ foreach ($anymarketqueueIds as $anymarketqueueId) {
216
+ $anymarketqueue = Mage::getModel('db1_anymarket/anymarketqueue');
217
+ $anymarketqueue->setId($anymarketqueueId)->delete();
218
+ }
219
+ Mage::getSingleton('adminhtml/session')->addSuccess(
220
+ Mage::helper('db1_anymarket')->__('Total of %d anymarket queues were successfully deleted.', count($anymarketqueueIds))
221
+ );
222
+ } catch (Mage_Core_Exception $e) {
223
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
224
+ } catch (Exception $e) {
225
+ Mage::getSingleton('adminhtml/session')->addError(
226
+ Mage::helper('db1_anymarket')->__('There was an error deleting anymarket queues.')
227
+ );
228
+ Mage::logException($e);
229
+ }
230
+ }
231
+ $this->_redirect('*/*/index');
232
+ }
233
+
234
+ /**
235
+ * mass status change - action
236
+ *
237
+ * @access public
238
+ * @return void
239
+
240
+ */
241
+ public function massStatusAction()
242
+ {
243
+ $anymarketqueueIds = $this->getRequest()->getParam('anymarketqueue');
244
+ if (!is_array($anymarketqueueIds)) {
245
+ Mage::getSingleton('adminhtml/session')->addError(
246
+ Mage::helper('db1_anymarket')->__('Please select anymarket queues.')
247
+ );
248
+ } else {
249
+ try {
250
+ foreach ($anymarketqueueIds as $anymarketqueueId) {
251
+ $anymarketqueue = Mage::getSingleton('db1_anymarket/anymarketqueue')->load($anymarketqueueId)
252
+ ->setStatus($this->getRequest()->getParam('status'))
253
+ ->setIsMassupdate(true)
254
+ ->save();
255
+ }
256
+ $this->_getSession()->addSuccess(
257
+ $this->__('Total of %d anymarket queues were successfully updated.', count($anymarketqueueIds))
258
+ );
259
+ } catch (Mage_Core_Exception $e) {
260
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
261
+ } catch (Exception $e) {
262
+ Mage::getSingleton('adminhtml/session')->addError(
263
+ Mage::helper('db1_anymarket')->__('There was an error updating anymarket queues.')
264
+ );
265
+ Mage::logException($e);
266
+ }
267
+ }
268
+ $this->_redirect('*/*/index');
269
+ }
270
+
271
+ /**
272
+ * export as csv - action
273
+ *
274
+ * @access public
275
+ * @return void
276
+
277
+ */
278
+ public function exportCsvAction()
279
+ {
280
+ $fileName = 'anymarketqueue.csv';
281
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketqueue_grid')
282
+ ->getCsv();
283
+ $this->_prepareDownloadResponse($fileName, $content);
284
+ }
285
+
286
+ /**
287
+ * export as MsExcel - action
288
+ *
289
+ * @access public
290
+ * @return void
291
+
292
+ */
293
+ public function exportExcelAction()
294
+ {
295
+ $fileName = 'anymarketqueue.xls';
296
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketqueue_grid')
297
+ ->getExcelFile();
298
+ $this->_prepareDownloadResponse($fileName, $content);
299
+ }
300
+
301
+ /**
302
+ * export as xml - action
303
+ *
304
+ * @access public
305
+ * @return void
306
+
307
+ */
308
+ public function exportXmlAction()
309
+ {
310
+ $fileName = 'anymarketqueue.xml';
311
+ $content = $this->getLayout()->createBlock('db1_anymarket/adminhtml_anymarketqueue_grid')
312
+ ->getXml();
313
+ $this->_prepareDownloadResponse($fileName, $content);
314
+ }
315
+
316
+ /**
317
+ * Check if admin has permissions to visit related pages
318
+ *
319
+ * @access protected
320
+ * @return boolean
321
+
322
+ */
323
+ protected function _isAllowed()
324
+ {
325
+ return Mage::getSingleton('admin/session')->isAllowed('system/db1_anymarket/anymarketqueue');
326
+ }
327
+ }
app/code/community/DB1/AnyMarket/etc/adminhtml.xml ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <db1_anymarket translate="title" module="db1_anymarket">
12
+ <title>AnyMarket</title>
13
+ </db1_anymarket>
14
+
15
+ <anymarket_section translate="title" module="db1_anymarket">
16
+ <title>AnyMarket</title>
17
+ <sort_order>100</sort_order>
18
+ </anymarket_section>
19
+ </children>
20
+ </config>
21
+ </children>
22
+ </system>
23
+ <system>
24
+ <children>
25
+ <db1_anymarket translate="title" module="db1_anymarket">
26
+ <title>AnyMarket</title>
27
+ <children>
28
+ <anymarketlog translate="title" module="db1_anymarket">
29
+ <title>AnyMarket Log</title>
30
+ <sort_order>0</sort_order>
31
+ </anymarketlog>
32
+ <anymarketproducts translate="title" module="db1_anymarket">
33
+ <title>Anymarket Products</title>
34
+ <sort_order>10</sort_order>
35
+ </anymarketproducts>
36
+ <anymarketattributes translate="title" module="db1_anymarket">
37
+ <title>Anymarket Attributes</title>
38
+ <sort_order>20</sort_order>
39
+ </anymarketattributes>
40
+ <anymarketorders translate="title" module="db1_anymarket">
41
+ <title>Anymarket Orders</title>
42
+ <sort_order>30</sort_order>
43
+ </anymarketorders>
44
+ <anymarketcategories translate="title" module="db1_anymarket">
45
+ <title>Anymarket Categories</title>
46
+ <sort_order>40</sort_order>
47
+ </anymarketcategories>
48
+ <anymarketqueue translate="title" module="db1_anymarket">
49
+ <title>Anymarket Queue</title>
50
+ <sort_order>50</sort_order>
51
+ </anymarketqueue>
52
+ </children>
53
+ </db1_anymarket>
54
+ </children>
55
+ </system>
56
+
57
+ </children>
58
+ </admin>
59
+ </resources>
60
+ </acl>
61
+ <menu>
62
+ <system>
63
+ <children>
64
+ <db1_anymarket translate="title" module="db1_anymarket">
65
+ <title>AnyMarket</title>
66
+ <sort_order>0</sort_order>
67
+ <children>
68
+ <anymarketlog translate="title" module="db1_anymarket">
69
+ <title>AnyMarket Log</title>
70
+ <action>adminhtml/anymarket_anymarketlog</action>
71
+ <sort_order>0</sort_order>
72
+ </anymarketlog>
73
+ <anymarketproducts translate="title" module="db1_anymarket">
74
+ <title>Anymarket Products</title>
75
+ <action>adminhtml/anymarket_anymarketproducts</action>
76
+ <sort_order>10</sort_order>
77
+ </anymarketproducts>
78
+ <anymarketattributes translate="title" module="db1_anymarket">
79
+ <title>Anymarket Attributes</title>
80
+ <action>adminhtml/anymarket_anymarketattributes</action>
81
+ <sort_order>20</sort_order>
82
+ </anymarketattributes>
83
+ <anymarketorders translate="title" module="db1_anymarket">
84
+ <title>Anymarket Orders</title>
85
+ <action>adminhtml/anymarket_anymarketorders</action>
86
+ <sort_order>30</sort_order>
87
+ </anymarketorders>
88
+ <anymarketcategories translate="title" module="db1_anymarket">
89
+ <title>Anymarket Categories</title>
90
+ <action>adminhtml/anymarket_anymarketcategories</action>
91
+ <sort_order>40</sort_order>
92
+ </anymarketcategories>
93
+ <anymarketqueue translate="title" module="db1_anymarket">
94
+ <title>Anymarket Queue</title>
95
+ <action>adminhtml/anymarket_anymarketqueue</action>
96
+ <sort_order>50</sort_order>
97
+ </anymarketqueue>
98
+ </children>
99
+ </db1_anymarket>
100
+ </children>
101
+ </system>
102
+
103
+ </menu>
104
+ </config>
app/code/community/DB1/AnyMarket/etc/api.xml ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * DB1_AnyMarket extension
5
+ *
6
+ * @category DB1
7
+ * @package DB1_AnyMarket
8
+ * @copyright Copyright (c) 2015
9
+ * @license http://opensource.org/licenses/mit-license.php MIT License
10
+ */
11
+ -->
12
+ <config>
13
+ <api>
14
+ <resources>
15
+ <anymarket_anymarketlog translate="title" module="db1_anymarket">
16
+ <title>AnyMarket Log API</title>
17
+ <model>db1_anymarket/anymarketlog_api</model>
18
+ <acl>anymarket/anymarketlog</acl>
19
+ <methods>
20
+ <list translate="title" module="db1_anymarket">
21
+ <title>Retrieve list of anymarket log</title>
22
+ <method>items</method>
23
+ <acl>anymarket/anymarketlog/list</acl>
24
+ </list>
25
+ <info translate="title" module="db1_anymarket">
26
+ <title>Retrieve anymarket log info</title>
27
+ <acl>anymarket/anymarketlog/info</acl>
28
+ </info>
29
+ <add translate="title" module="db1_anymarket">
30
+ <title>Add anymarket log</title>
31
+ <acl>anymarket/anymarketlog/add</acl>
32
+ </add>
33
+ <update translate="title" module="db1_anymarket">
34
+ <title>Update anymarket log</title>
35
+ <acl>anymarket/anymarketlog/update</acl>
36
+ </update>
37
+ <remove translate="title" module="db1_anymarket">
38
+ <title>Remove anymarket log</title>
39
+ <acl>anymarket/anymarketlog/remove</acl>
40
+ </remove>
41
+ </methods>
42
+ <faults module="db1_anymarket">
43
+ <anymarketlog_not_exists>
44
+ <code>101</code>
45
+ <message>Requested anymarket log does not exist.</message>
46
+ </anymarketlog_not_exists>
47
+ <invalid_data>
48
+ <code>102</code>
49
+ <message>Provided data is invalid.</message>
50
+ </invalid_data>
51
+ <save_error>
52
+ <code>103</code>
53
+ <message>Error while saving anymarket log. Details in error message.</message>
54
+ </save_error>
55
+ <remove_error>
56
+ <code>104</code>
57
+ <message>Error while removing anymarket log. Details in error message.</message>
58
+ </remove_error>
59
+ </faults>
60
+ </anymarket_anymarketlog>
61
+ <anymarket_anymarketproducts translate="title" module="db1_anymarket">
62
+ <title>Anymarket Products API</title>
63
+ <model>db1_anymarket/anymarketproducts_api</model>
64
+ <acl>anymarket/anymarketproducts</acl>
65
+ <methods>
66
+ <list translate="title" module="db1_anymarket">
67
+ <title>Retrieve list of anymarket products</title>
68
+ <method>items</method>
69
+ <acl>anymarket/anymarketproducts/list</acl>
70
+ </list>
71
+ <info translate="title" module="db1_anymarket">
72
+ <title>Retrieve anymarket products info</title>
73
+ <acl>anymarket/anymarketproducts/info</acl>
74
+ </info>
75
+ <add translate="title" module="db1_anymarket">
76
+ <title>Add anymarket products</title>
77
+ <acl>anymarket/anymarketproducts/add</acl>
78
+ </add>
79
+ <update translate="title" module="db1_anymarket">
80
+ <title>Update anymarket products</title>
81
+ <acl>anymarket/anymarketproducts/update</acl>
82
+ </update>
83
+ <remove translate="title" module="db1_anymarket">
84
+ <title>Remove anymarket products</title>
85
+ <acl>anymarket/anymarketproducts/remove</acl>
86
+ </remove>
87
+ </methods>
88
+ <faults module="db1_anymarket">
89
+ <anymarketproducts_not_exists>
90
+ <code>101</code>
91
+ <message>Requested anymarket products does not exist.</message>
92
+ </anymarketproducts_not_exists>
93
+ <invalid_data>
94
+ <code>102</code>
95
+ <message>Provided data is invalid.</message>
96
+ </invalid_data>
97
+ <save_error>
98
+ <code>103</code>
99
+ <message>Error while saving anymarket products. Details in error message.</message>
100
+ </save_error>
101
+ <remove_error>
102
+ <code>104</code>
103
+ <message>Error while removing anymarket products. Details in error message.</message>
104
+ </remove_error>
105
+ </faults>
106
+ </anymarket_anymarketproducts>
107
+ <anymarket_anymarketattributes translate="title" module="db1_anymarket">
108
+ <title>Anymarket Attributes API</title>
109
+ <model>db1_anymarket/anymarketattributes_api</model>
110
+ <acl>anymarket/anymarketattributes</acl>
111
+ <methods>
112
+ <list translate="title" module="db1_anymarket">
113
+ <title>Retrieve list of anymarket attributes</title>
114
+ <method>items</method>
115
+ <acl>anymarket/anymarketattributes/list</acl>
116
+ </list>
117
+ <info translate="title" module="db1_anymarket">
118
+ <title>Retrieve anymarket attributes info</title>
119
+ <acl>anymarket/anymarketattributes/info</acl>
120
+ </info>
121
+ <add translate="title" module="db1_anymarket">
122
+ <title>Add anymarket attributes</title>
123
+ <acl>anymarket/anymarketattributes/add</acl>
124
+ </add>
125
+ <update translate="title" module="db1_anymarket">
126
+ <title>Update anymarket attributes</title>
127
+ <acl>anymarket/anymarketattributes/update</acl>
128
+ </update>
129
+ <remove translate="title" module="db1_anymarket">
130
+ <title>Remove anymarket attributes</title>
131
+ <acl>anymarket/anymarketattributes/remove</acl>
132
+ </remove>
133
+ </methods>
134
+ <faults module="db1_anymarket">
135
+ <anymarketattributes_not_exists>
136
+ <code>101</code>
137
+ <message>Requested anymarket attributes does not exist.</message>
138
+ </anymarketattributes_not_exists>
139
+ <invalid_data>
140
+ <code>102</code>
141
+ <message>Provided data is invalid.</message>
142
+ </invalid_data>
143
+ <save_error>
144
+ <code>103</code>
145
+ <message>Error while saving anymarket attributes. Details in error message.</message>
146
+ </save_error>
147
+ <remove_error>
148
+ <code>104</code>
149
+ <message>Error while removing anymarket attributes. Details in error message.</message>
150
+ </remove_error>
151
+ </faults>
152
+ </anymarket_anymarketattributes>
153
+ <anymarket_anymarketorders translate="title" module="db1_anymarket">
154
+ <title>Anymarket Orders API</title>
155
+ <model>db1_anymarket/anymarketorders_api</model>
156
+ <acl>anymarket/anymarketorders</acl>
157
+ <methods>
158
+ <list translate="title" module="db1_anymarket">
159
+ <title>Retrieve list of anymarket orders</title>
160
+ <method>items</method>
161
+ <acl>anymarket/anymarketorders/list</acl>
162
+ </list>
163
+ <info translate="title" module="db1_anymarket">
164
+ <title>Retrieve anymarket orders info</title>
165
+ <acl>anymarket/anymarketorders/info</acl>
166
+ </info>
167
+ <add translate="title" module="db1_anymarket">
168
+ <title>Add anymarket orders</title>
169
+ <acl>anymarket/anymarketorders/add</acl>
170
+ </add>
171
+ <update translate="title" module="db1_anymarket">
172
+ <title>Update anymarket orders</title>
173
+ <acl>anymarket/anymarketorders/update</acl>
174
+ </update>
175
+ <remove translate="title" module="db1_anymarket">
176
+ <title>Remove anymarket orders</title>
177
+ <acl>anymarket/anymarketorders/remove</acl>
178
+ </remove>
179
+ </methods>
180
+ <faults module="db1_anymarket">
181
+ <anymarketorders_not_exists>
182
+ <code>101</code>
183
+ <message>Requested anymarket orders does not exist.</message>
184
+ </anymarketorders_not_exists>
185
+ <invalid_data>
186
+ <code>102</code>
187
+ <message>Provided data is invalid.</message>
188
+ </invalid_data>
189
+ <save_error>
190
+ <code>103</code>
191
+ <message>Error while saving anymarket orders. Details in error message.</message>
192
+ </save_error>
193
+ <remove_error>
194
+ <code>104</code>
195
+ <message>Error while removing anymarket orders. Details in error message.</message>
196
+ </remove_error>
197
+ </faults>
198
+ </anymarket_anymarketorders>
199
+ <anymarket_anymarketcategories translate="title" module="db1_anymarket">
200
+ <title>Anymarket Categories API</title>
201
+ <model>db1_anymarket/anymarketcategories_api</model>
202
+ <acl>anymarket/anymarketcategories</acl>
203
+ <methods>
204
+ <list translate="title" module="db1_anymarket">
205
+ <title>Retrieve list of anymarket categories</title>
206
+ <method>items</method>
207
+ <acl>anymarket/anymarketcategories/list</acl>
208
+ </list>
209
+ <info translate="title" module="db1_anymarket">
210
+ <title>Retrieve anymarket categories info</title>
211
+ <acl>anymarket/anymarketcategories/info</acl>
212
+ </info>
213
+ <add translate="title" module="db1_anymarket">
214
+ <title>Add anymarket categories</title>
215
+ <acl>anymarket/anymarketcategories/add</acl>
216
+ </add>
217
+ <update translate="title" module="db1_anymarket">
218
+ <title>Update anymarket categories</title>
219
+ <acl>anymarket/anymarketcategories/update</acl>
220
+ </update>
221
+ <remove translate="title" module="db1_anymarket">
222
+ <title>Remove anymarket categories</title>
223
+ <acl>anymarket/anymarketcategories/remove</acl>
224
+ </remove>
225
+ </methods>
226
+ <faults module="db1_anymarket">
227
+ <anymarketcategories_not_exists>
228
+ <code>101</code>
229
+ <message>Requested anymarket categories does not exist.</message>
230
+ </anymarketcategories_not_exists>
231
+ <invalid_data>
232
+ <code>102</code>
233
+ <message>Provided data is invalid.</message>
234
+ </invalid_data>
235
+ <save_error>
236
+ <code>103</code>
237
+ <message>Error while saving anymarket categories. Details in error message.</message>
238
+ </save_error>
239
+ <remove_error>
240
+ <code>104</code>
241
+ <message>Error while removing anymarket categories. Details in error message.</message>
242
+ </remove_error>
243
+ </faults>
244
+ </anymarket_anymarketcategories>
245
+ <anymarket_anymarketqueue translate="title" module="db1_anymarket">
246
+ <title>Anymarket Queue API</title>
247
+ <model>db1_anymarket/anymarketqueue_api</model>
248
+ <acl>anymarket/anymarketqueue</acl>
249
+ <methods>
250
+ <list translate="title" module="db1_anymarket">
251
+ <title>Retrieve list of anymarket queues</title>
252
+ <method>items</method>
253
+ <acl>anymarket/anymarketqueue/list</acl>
254
+ </list>
255
+ <info translate="title" module="db1_anymarket">
256
+ <title>Retrieve anymarket queue info</title>
257
+ <acl>anymarket/anymarketqueue/info</acl>
258
+ </info>
259
+ <add translate="title" module="db1_anymarket">
260
+ <title>Add anymarket queue</title>
261
+ <acl>anymarket/anymarketqueue/add</acl>
262
+ </add>
263
+ <update translate="title" module="db1_anymarket">
264
+ <title>Update anymarket queue</title>
265
+ <acl>anymarket/anymarketqueue/update</acl>
266
+ </update>
267
+ <remove translate="title" module="db1_anymarket">
268
+ <title>Remove anymarket queue</title>
269
+ <acl>anymarket/anymarketqueue/remove</acl>
270
+ </remove>
271
+ </methods>
272
+ <faults module="db1_anymarket">
273
+ <anymarketqueue_not_exists>
274
+ <code>101</code>
275
+ <message>Requested anymarket queue does not exist.</message>
276
+ </anymarketqueue_not_exists>
277
+ <invalid_data>
278
+ <code>102</code>
279
+ <message>Provided data is invalid.</message>
280
+ </invalid_data>
281
+ <save_error>
282
+ <code>103</code>
283
+ <message>Error while saving anymarket queue. Details in error message.</message>
284
+ </save_error>
285
+ <remove_error>
286
+ <code>104</code>
287
+ <message>Error while removing anymarket queue. Details in error message.</message>
288
+ </remove_error>
289
+ </faults>
290
+ </anymarket_anymarketqueue>
291
+ </resources>
292
+ <resources_alias>
293
+ <anymarketlog>anymarket_anymarketlog</anymarketlog>
294
+ <anymarketproducts>anymarket_anymarketproducts</anymarketproducts>
295
+ <anymarketattributes>anymarket_anymarketattributes</anymarketattributes>
296
+ <anymarketorders>anymarket_anymarketorders</anymarketorders>
297
+ <anymarketcategories>anymarket_anymarketcategories</anymarketcategories>
298
+ <anymarketqueue>anymarket_anymarketqueue</anymarketqueue>
299
+ </resources_alias>
300
+ <v2>
301
+ <resources_function_prefix>
302
+ <anymarketlog>anymarketAnymarketlog</anymarketlog>
303
+ <anymarketproducts>anymarketAnymarketproducts</anymarketproducts>
304
+ <anymarketattributes>anymarketAnymarketattributes</anymarketattributes>
305
+ <anymarketorders>anymarketAnymarketorders</anymarketorders>
306
+ <anymarketcategories>anymarketAnymarketcategories</anymarketcategories>
307
+ <anymarketqueue>anymarketAnymarketqueue</anymarketqueue>
308
+ </resources_function_prefix>
309
+ </v2>
310
+ <acl>
311
+ <resources>
312
+ <db1_anymarket translate="title" module="db1_anymarket">
313
+ <title>AnyMarket</title>
314
+ <anymarketlog translate="title" module="db1_anymarket">
315
+ <title>AnyMarket Log</title>
316
+ <sort_order>0</sort_order>
317
+ <list translate="title" module="db1_anymarket">
318
+ <title>List</title>
319
+ </list>
320
+ <info translate="title" module="db1_anymarket">
321
+ <title>Info</title>
322
+ </info>
323
+ <add translate="title" module="db1_anymarket">
324
+ <title>Add</title>
325
+ </add>
326
+ <update translate="title" module="db1_anymarket">
327
+ <title>Update</title>
328
+ </update>
329
+ <remove translate="title" module="db1_anymarket">
330
+ <title>Remove</title>
331
+ </remove>
332
+ </anymarketlog>
333
+ <anymarketproducts translate="title" module="db1_anymarket">
334
+ <title>Anymarket Products</title>
335
+ <sort_order>10</sort_order>
336
+ <list translate="title" module="db1_anymarket">
337
+ <title>List</title>
338
+ </list>
339
+ <info translate="title" module="db1_anymarket">
340
+ <title>Info</title>
341
+ </info>
342
+ <add translate="title" module="db1_anymarket">
343
+ <title>Add</title>
344
+ </add>
345
+ <update translate="title" module="db1_anymarket">
346
+ <title>Update</title>
347
+ </update>
348
+ <remove translate="title" module="db1_anymarket">
349
+ <title>Remove</title>
350
+ </remove>
351
+ </anymarketproducts>
352
+ <anymarketattributes translate="title" module="db1_anymarket">
353
+ <title>Anymarket Attributes</title>
354
+ <sort_order>20</sort_order>
355
+ <list translate="title" module="db1_anymarket">
356
+ <title>List</title>
357
+ </list>
358
+ <info translate="title" module="db1_anymarket">
359
+ <title>Info</title>
360
+ </info>
361
+ <add translate="title" module="db1_anymarket">
362
+ <title>Add</title>
363
+ </add>
364
+ <update translate="title" module="db1_anymarket">
365
+ <title>Update</title>
366
+ </update>
367
+ <remove translate="title" module="db1_anymarket">
368
+ <title>Remove</title>
369
+ </remove>
370
+ </anymarketattributes>
371
+ <anymarketorders translate="title" module="db1_anymarket">
372
+ <title>Anymarket Orders</title>
373
+ <sort_order>30</sort_order>
374
+ <list translate="title" module="db1_anymarket">
375
+ <title>List</title>
376
+ </list>
377
+ <info translate="title" module="db1_anymarket">
378
+ <title>Info</title>
379
+ </info>
380
+ <add translate="title" module="db1_anymarket">
381
+ <title>Add</title>
382
+ </add>
383
+ <update translate="title" module="db1_anymarket">
384
+ <title>Update</title>
385
+ </update>
386
+ <remove translate="title" module="db1_anymarket">
387
+ <title>Remove</title>
388
+ </remove>
389
+ </anymarketorders>
390
+ <anymarketcategories translate="title" module="db1_anymarket">
391
+ <title>Anymarket Categories</title>
392
+ <sort_order>40</sort_order>
393
+ <list translate="title" module="db1_anymarket">
394
+ <title>List</title>
395
+ </list>
396
+ <info translate="title" module="db1_anymarket">
397
+ <title>Info</title>
398
+ </info>
399
+ <add translate="title" module="db1_anymarket">
400
+ <title>Add</title>
401
+ </add>
402
+ <update translate="title" module="db1_anymarket">
403
+ <title>Update</title>
404
+ </update>
405
+ <remove translate="title" module="db1_anymarket">
406
+ <title>Remove</title>
407
+ </remove>
408
+ </anymarketcategories>
409
+ <anymarketqueue translate="title" module="db1_anymarket">
410
+ <title>Anymarket Queue</title>
411
+ <sort_order>50</sort_order>
412
+ <list translate="title" module="db1_anymarket">
413
+ <title>List</title>
414
+ </list>
415
+ <info translate="title" module="db1_anymarket">
416
+ <title>Info</title>
417
+ </info>
418
+ <add translate="title" module="db1_anymarket">
419
+ <title>Add</title>
420
+ </add>
421
+ <update translate="title" module="db1_anymarket">
422
+ <title>Update</title>
423
+ </update>
424
+ <remove translate="title" module="db1_anymarket">
425
+ <title>Remove</title>
426
+ </remove>
427
+ </anymarketqueue>
428
+ </db1_anymarket>
429
+ </resources>
430
+ </acl>
431
+ </api>
432
+ </config>
app/code/community/DB1/AnyMarket/etc/config.xml ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <DB1_AnyMarket>
5
+ <version>2.3.4</version>
6
+ </DB1_AnyMarket>
7
+ </modules>
8
+ <global>
9
+ <!-- -->
10
+ <fieldsets>
11
+ <sales_convert_quote>
12
+ <payment_description>
13
+ <to_order>*</to_order>
14
+ </payment_description>
15
+ </sales_convert_quote>
16
+
17
+ <sales_convert_order>
18
+ <payment_description>
19
+ <to_quote>*</to_quote>
20
+ </payment_description>
21
+ </sales_convert_order>
22
+ </fieldsets>
23
+ <!-- -->
24
+ <resources>
25
+ <db1_anymarket_setup>
26
+ <setup>
27
+ <module>DB1_AnyMarket</module>
28
+ <class>DB1_AnyMarket_Model_Resource_Setup</class>
29
+ </setup>
30
+ </db1_anymarket_setup>
31
+
32
+ <!-- METODO DE PAGAMENTO -->
33
+ <db1_anymarke_write>
34
+ <connection>
35
+ <use>core_write</use>
36
+ </connection>
37
+ </db1_anymarke_write>
38
+ <db1_anymarke_read>
39
+ <connection>
40
+ <use>core_read</use>
41
+ </connection>
42
+ </db1_anymarke_read>
43
+ <!-- METODO DE PAGAMENTO -->
44
+
45
+ </resources>
46
+ <blocks>
47
+ <db1_anymarket>
48
+ <class>DB1_AnyMarket_Block</class>
49
+ </db1_anymarket>
50
+ </blocks>
51
+ <helpers>
52
+ <db1_anymarket>
53
+ <class>DB1_AnyMarket_Helper</class>
54
+ </db1_anymarket>
55
+ </helpers>
56
+ <models>
57
+ <db1_anymarket>
58
+ <class>DB1_AnyMarket_Model</class>
59
+ <resourceModel>db1_anymarket_resource</resourceModel>
60
+ </db1_anymarket>
61
+ <db1_anymarket_resource>
62
+ <class>DB1_AnyMarket_Model_Resource</class>
63
+ <entities>
64
+ <anymarketlog>
65
+ <table>db1_anymarket_anymarketlog</table>
66
+ </anymarketlog>
67
+ <anymarketproducts>
68
+ <table>db1_anymarket_anymarketproducts</table>
69
+ </anymarketproducts>
70
+ <anymarketattributes>
71
+ <table>db1_anymarket_anymarketattributes</table>
72
+ </anymarketattributes>
73
+ <anymarketorders>
74
+ <table>db1_anymarket_anymarketorders</table>
75
+ </anymarketorders>
76
+ <anymarketcategories>
77
+ <table>db1_anymarket_anymarketcategories</table>
78
+ </anymarketcategories>
79
+ <anymarketqueue>
80
+ <table>db1_anymarket_anymarketqueue</table>
81
+ </anymarketqueue>
82
+ <anymarketlog_store>
83
+ <table>db1_anymarket_anymarketlog_store</table>
84
+ </anymarketlog_store>
85
+ <anymarketproducts_store>
86
+ <table>db1_anymarket_anymarketproducts_store</table>
87
+ </anymarketproducts_store>
88
+ <anymarketattributes_store>
89
+ <table>db1_anymarket_anymarketattributes_store</table>
90
+ </anymarketattributes_store>
91
+ <anymarketorders_store>
92
+ <table>db1_anymarket_anymarketorders_store</table>
93
+ </anymarketorders_store>
94
+ <anymarketcategories_store>
95
+ <table>db1_anymarket_anymarketcategories_store</table>
96
+ </anymarketcategories_store>
97
+ <anymarketqueue_store>
98
+ <table>db1_anymarket_anymarketqueue_store</table>
99
+ </anymarketqueue_store>
100
+ </entities>
101
+ </db1_anymarket_resource>
102
+ </models>
103
+ <events>
104
+ <sales_order_save_commit_after>
105
+ <observers>
106
+ <sales_order_save_commit_after_handler>
107
+ <type>model</type>
108
+ <class>db1_anymarket/observer</class>
109
+ <method>updateOrderAnyMarketObs</method>
110
+ <args></args>
111
+ </sales_order_save_commit_after_handler>
112
+ </observers>
113
+ </sales_order_save_commit_after>
114
+ </events>
115
+
116
+ </global>
117
+ <default>
118
+ <queue_qty>
119
+ <qty>150</qty> <!-- Quantidade itens processo pela queue por vez -->
120
+ </queue_qty>
121
+ <payment>
122
+ <db1_anymarket>
123
+ <active>0</active>
124
+ <model>db1_anymarket/paymentMethod</model>
125
+ <order_status>New</order_status>
126
+ <title>Metodo enviado pelo AnyMarket</title>
127
+ <payment_action>authorize</payment_action>
128
+ <allowspecific>0</allowspecific>
129
+ </db1_anymarket>
130
+ </payment>
131
+
132
+ <anymarket_section>
133
+ <anymarket_general_group>
134
+ <anymarket_EAN_required_field>1</anymarket_EAN_required_field>
135
+ </anymarket_general_group>
136
+
137
+ <anymarket_integration_prod_group>
138
+ <anymarket_type_prod_sync_field>0</anymarket_type_prod_sync_field>
139
+ <anymarket_type_weight_field>0</anymarket_type_weight_field>
140
+ </anymarket_integration_prod_group>
141
+
142
+ <anymarket_integration_order_group>
143
+ <anymarket_type_order_sync_field>1</anymarket_type_order_sync_field>
144
+ </anymarket_integration_order_group>
145
+
146
+ <anymarket_attribute_group>
147
+ <anymarket_doc_type_field>Prefix</anymarket_doc_type_field>
148
+ </anymarket_attribute_group>
149
+ </anymarket_section>
150
+ </default>
151
+ <!-- CRON -->
152
+ <crontab>
153
+ <jobs>
154
+ <db1_anymarket_getorders>
155
+ <schedule><cron_expr>0 0,12 * * *</cron_expr></schedule> <!-- 12 horas -->
156
+ <run><model>db1_anymarket/cron::sincOrders</model></run>
157
+ </db1_anymarket_getorders>
158
+ <db1_anymarket_getprods>
159
+ <schedule><cron_expr>0 * * * *</cron_expr></schedule> <!-- 1 hora -->
160
+ <run><model>db1_anymarket/cron::sincProducts</model></run>
161
+ </db1_anymarket_getprods>
162
+ <db1_anymarket_execqueue>
163
+ <schedule><cron_expr>*/15 * * * *</cron_expr></schedule> <!-- 15 min -->
164
+ <run><model>db1_anymarket/cron::executeQueue</model></run>
165
+ </db1_anymarket_execqueue>
166
+ </jobs>
167
+ </crontab>
168
+ <!-- CRON -->
169
+
170
+ <adminhtml>
171
+
172
+ <!-- Observer INI -->
173
+ <events>
174
+ <!-- PRODUTO -->
175
+ <catalog_product_save_after>
176
+ <observers>
177
+ <db1_anymarket>
178
+ <class>db1_anymarket/observer</class>
179
+ <method>sendProdAnyMarket</method>
180
+ </db1_anymarket>
181
+ </observers>
182
+ </catalog_product_save_after>
183
+
184
+ <catalog_product_delete_after>
185
+ <observers>
186
+ <db1_anymarket>
187
+ <class>db1_anymarket/observer</class>
188
+ <method>removeProdAnyMarketControl</method>
189
+ </db1_anymarket>
190
+ </observers>
191
+ </catalog_product_delete_after>
192
+
193
+ <!-- ORDER -->
194
+ <sales_order_save_after>
195
+ <observers>
196
+ <db1_anymarket>
197
+ <class>db1_anymarket/observer</class>
198
+ <method>updateOrderAnyMarketObs</method>
199
+ </db1_anymarket>
200
+ </observers>
201
+ </sales_order_save_after>
202
+
203
+ <!-- ESTOQUE -->
204
+ <cataloginventory_stock_item_save_commit_after>
205
+ <observers>
206
+ <db1_anymarket>
207
+ <class>db1_anymarket/observer</class>
208
+ <method>catalogInventorySave</method>
209
+ </db1_anymarket>
210
+ </observers>
211
+ </cataloginventory_stock_item_save_commit_after>
212
+
213
+ <sales_model_service_quote_submit_before>
214
+ <observers>
215
+ <db1_anymarket>
216
+ <class>db1_anymarket/observer</class>
217
+ <method>subtractQuoteInventory</method>
218
+ </db1_anymarket>
219
+ </observers>
220
+ </sales_model_service_quote_submit_before>
221
+
222
+ <sales_model_service_quote_submit_failure>
223
+ <observers>
224
+ <db1_anymarket>
225
+ <class>db1_anymarket/observer</class>
226
+ <method>revertQuoteInventory</method>
227
+ </db1_anymarket>
228
+ </observers>
229
+ </sales_model_service_quote_submit_failure>
230
+
231
+ <sales_order_item_cancel>
232
+ <observers>
233
+ <db1_anymarket>
234
+ <class>db1_anymarket/observer</class>
235
+ <method>cancelOrderItem</method>
236
+ </db1_anymarket>
237
+ </observers>
238
+ </sales_order_item_cancel>
239
+
240
+ <sales_order_creditmemo_save_after>
241
+ <observers>
242
+ <db1_anymarket>
243
+ <class>db1_anymarket/observer</class>
244
+ <method>refundOrderInventory</method>
245
+ </db1_anymarket>
246
+ </observers>
247
+ </sales_order_creditmemo_save_after>
248
+ </events>
249
+ <!-- Observer END -->
250
+
251
+ <layout>
252
+ <updates>
253
+ <db1_anymarket>
254
+ <file>db1_anymarket.xml</file>
255
+ </db1_anymarket>
256
+ </updates>
257
+ </layout>
258
+ <translate>
259
+ <modules>
260
+ <db1_anymarket>
261
+ <files>
262
+ <default>DB1_AnyMarket.csv</default>
263
+ </files>
264
+ </db1_anymarket>
265
+ </modules>
266
+ </translate>
267
+ <global_search>
268
+ <anymarketlog>
269
+ <class>db1_anymarket/adminhtml_search_anymarketlog</class>
270
+ <acl>db1_anymarket</acl>
271
+ </anymarketlog>
272
+ <anymarketproducts>
273
+ <class>db1_anymarket/adminhtml_search_anymarketproducts</class>
274
+ <acl>db1_anymarket</acl>
275
+ </anymarketproducts>
276
+ <anymarketattributes>
277
+ <class>db1_anymarket/adminhtml_search_anymarketattributes</class>
278
+ <acl>db1_anymarket</acl>
279
+ </anymarketattributes>
280
+ <anymarketorders>
281
+ <class>db1_anymarket/adminhtml_search_anymarketorders</class>
282
+ <acl>db1_anymarket</acl>
283
+ </anymarketorders>
284
+ <anymarketcategories>
285
+ <class>db1_anymarket/adminhtml_search_anymarketcategories</class>
286
+ <acl>db1_anymarket</acl>
287
+ </anymarketcategories>
288
+ <anymarketqueue>
289
+ <class>db1_anymarket/adminhtml_search_anymarketqueue</class>
290
+ <acl>db1_anymarket</acl>
291
+ </anymarketqueue>
292
+ </global_search>
293
+ </adminhtml>
294
+ <admin>
295
+ <routers>
296
+ <adminhtml>
297
+ <args>
298
+ <modules>
299
+ <DB1_AnyMarket before="Mage_Adminhtml">DB1_AnyMarket_Adminhtml</DB1_AnyMarket>
300
+ </modules>
301
+ </args>
302
+ </adminhtml>
303
+ </routers>
304
+ </admin>
305
+
306
+
307
+ <frontend>
308
+ <routers>
309
+ <categories>
310
+ <use>standard</use>
311
+ <args>
312
+ <module>DB1_AnyMarket</module>
313
+ <frontName>categories</frontName>
314
+ </args>
315
+ </categories>
316
+ </routers>
317
+ </frontend>
318
+
319
+ </config>
app/code/community/DB1/AnyMarket/etc/system.xml ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <tabs>
4
+ <anymarket_tab module="db1_anymarket" translate="label">
5
+ <label>DB1</label>
6
+ <sort_order>100</sort_order>
7
+ </anymarket_tab>
8
+ </tabs>
9
+ <sections>
10
+ <anymarket_section module="db1_anymarket" translate="label">
11
+ <label>AnyMarket</label>
12
+ <sort_order>200</sort_order>
13
+ <show_in_default>1</show_in_default>
14
+ <show_in_website>1</show_in_website>
15
+ <show_in_store>1</show_in_store>
16
+ <tab>anymarket_tab</tab>
17
+ <groups>
18
+ <anymarket_information_group translate="label" module="db1_anymarket">
19
+ <label>Important informations</label>
20
+ <sort_order>0</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <comment>
25
+ <![CDATA[
26
+ <div>
27
+ <h3>v. 2.3.4 Desenvolvido por<br> NovaPC - Tecnologia da Informação.</h3>
28
+ <img src="http://novapc.com.br/images/logo.png" alt="Smiley face" height="200" width="300">
29
+ <br>
30
+ <br>
31
+ Site: <a href="http://www.novapc.com.br/" target="_blank">www.novapc.com.br/</a>
32
+ <br>
33
+ E-mail: novapc@novapc.com.br
34
+ <br>
35
+ Telefone: 14-2104-5600
36
+ <br>
37
+ <b>Acesse o github do projeto: <a target="_blank" href="https://github.com/AnyMarket/magento">https://github.com/AnyMarket/magento</a></b>
38
+ <hr>
39
+ <br>
40
+ </div>
41
+ ]]>
42
+ </comment>
43
+ </anymarket_information_group>
44
+
45
+ <anymarket_general_group translate="label" module="db1_anymarket">
46
+ <label>General</label>
47
+ <sort_order>0</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ <fields>
52
+
53
+ <anymarket_NBM_required_field translate="label comment">
54
+ <label>NBM Required</label>
55
+ <comment>If marked yes, the validation will be done at the time of import.</comment>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ <frontend_type>select</frontend_type>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ </anymarket_NBM_required_field>
62
+
63
+ <anymarket_EAN_required_field translate="label">
64
+ <label>Ignore EAN Invalid</label>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_yesno</source_model>
70
+ </anymarket_EAN_required_field>
71
+
72
+ </fields>
73
+ </anymarket_general_group>
74
+
75
+ <anymarket_integration_prod_group translate="label" module="db1_anymarket">
76
+ <label>Integration (Products)</label>
77
+ <sort_order>2</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ <fields>
82
+ <anymarket_type_prod_sync_field translate="label comment">
83
+ <label>Type Synchronization</label>
84
+ <comment>If checked Magento for Anymarket, products from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's products will be registered in magento.</comment>
85
+ <sort_order>0</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ <frontend_type>select</frontend_type>
90
+ <source_model>db1_anymarket/system_config_source_typesync_order_values</source_model>
91
+ </anymarket_type_prod_sync_field>
92
+ </fields>
93
+
94
+ <fields>
95
+ <anymarket_type_weight_field translate="label comment">
96
+ <label>Mass unit</label>
97
+ <comment>Select will be treated as their weight in shipment to the Anymarket.</comment>
98
+ <sort_order>0</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>db1_anymarket/system_config_source_massunit_values</source_model>
104
+ </anymarket_type_weight_field>
105
+ </fields>
106
+ </anymarket_integration_prod_group>
107
+
108
+ <anymarket_integration_order_group translate="label" module="db1_anymarket">
109
+ <label>Integration (Orders)</label>
110
+ <sort_order>3</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ <fields>
115
+
116
+ <anymarket_type_order_sync_field translate="label tooltip comment">
117
+ <label>Type Synchronization</label>
118
+ <comment>If checked Magento for Anymarket, orders from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's orders will be registered in magento.</comment>
119
+ <sort_order>0</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ <frontend_type>select</frontend_type>
124
+ <source_model>db1_anymarket/system_config_source_typesync_order_values</source_model>
125
+ </anymarket_type_order_sync_field>
126
+
127
+ <anymarket_stauts_order_field translate="label tooltip comment">
128
+ <label>Status Order</label>
129
+ <comment>Status of orders that must be imported.</comment>
130
+ <frontend_type>multiselect</frontend_type>
131
+ <source_model>db1_anymarket/system_config_source_orders_values</source_model>
132
+ <sort_order>1</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ </anymarket_stauts_order_field>
137
+
138
+ <anymarket_status_mg_am_field translate="label comment">
139
+ <label>Status Order (Magento to Anymarket)</label>
140
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
141
+ <frontend_model>db1_anymarket/system_config_source_orders_statusmgam_values</frontend_model>
142
+ <sort_order>2</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ <comment>Add Order Status Magento</comment>
147
+ </anymarket_status_mg_am_field>
148
+
149
+ <anymarket_status_am_mg_field translate="label comment">
150
+ <label>Status Order (Anymarket to Magento)</label>
151
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
152
+ <frontend_model>db1_anymarket/system_config_source_orders_statusammg_values</frontend_model>
153
+ <sort_order>3</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>1</show_in_website>
156
+ <show_in_store>1</show_in_store>
157
+ <comment>Add Order Status Anymarket</comment>
158
+ </anymarket_status_am_mg_field>
159
+
160
+ </fields>
161
+ </anymarket_integration_order_group>
162
+
163
+ <anymarket_acesso_group translate="label comment" module="db1_anymarket">
164
+ <label>Access</label>
165
+ <comment>Configure all the necessary information to allow access to AnyMarket.</comment>
166
+ <sort_order>5</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
+ <fields>
171
+
172
+ <anymarket_host_field translate="label tooltip comment">
173
+ <label>Host</label>
174
+ <comment>URL for access to AnyMarket</comment>
175
+ <tooltip>Contact the DB1 for this information</tooltip>
176
+ <show_in_default>1</show_in_default>
177
+ <show_in_website>1</show_in_website>
178
+ <show_in_store>1</show_in_store>
179
+ <frontend_type>text</frontend_type>
180
+ </anymarket_host_field>
181
+
182
+ <anymarket_token_field translate="label tooltip comment">
183
+ <label>Token</label>
184
+ <comment>Token necessary access to AnyMarket</comment>
185
+ <tooltip>Contact the DB1 for this information</tooltip>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ <show_in_store>1</show_in_store>
189
+ <frontend_type>text</frontend_type>
190
+ </anymarket_token_field>
191
+
192
+ </fields>
193
+ </anymarket_acesso_group>
194
+
195
+ <anymarket_attribute_group translate="label comment" module="db1_anymarket">
196
+ <label>Attributes</label>
197
+ <comment>Configure all the necessary information to manage the attributes.</comment>
198
+ <sort_order>6</sort_order>
199
+ <show_in_default>1</show_in_default>
200
+ <show_in_website>1</show_in_website>
201
+ <show_in_store>1</show_in_store>
202
+ <fields>
203
+ <anymarket_customer_group_field translate="label tooltip comment">
204
+ <label>Customer Group (Customer)</label>
205
+ <comment>Customer group that will be registered when imported from Anymarket.</comment>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <show_in_store>1</show_in_store>
209
+ <frontend_type>select</frontend_type>
210
+ <sort_order>0</sort_order>
211
+ <source_model>db1_anymarket/system_config_source_attributes_customer_group_values</source_model>
212
+ </anymarket_customer_group_field>
213
+
214
+ <anymarket_doc_type_field translate="label tooltip comment">
215
+ <label>Document Type (Customer)</label>
216
+ <comment>Attribute responsible for import orders, usually CPF or RG.</comment>
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
+ <frontend_type>select</frontend_type>
221
+ <sort_order>1</sort_order>
222
+ <source_model>db1_anymarket/system_config_source_attributes_customer_values</source_model>
223
+ </anymarket_doc_type_field>
224
+
225
+ <anymarket_desc_field translate="label tooltip comment">
226
+ <label>Description</label>
227
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
228
+ <frontend_model>db1_anymarket/system_config_source_products_values</frontend_model>
229
+ <sort_order>2</sort_order>
230
+ <show_in_default>1</show_in_default>
231
+ <show_in_website>1</show_in_website>
232
+ <show_in_store>1</show_in_store>
233
+ <comment>Selecione o(s) atributo(s) que devem ser enviado ao Anymarket</comment>
234
+ <tooltip>Se selecionado mais que 1(um), será concatenado todos os campos.</tooltip>
235
+ </anymarket_desc_field>
236
+
237
+ <anymarket_preco_field translate="label tooltip comment">
238
+ <label>Price</label>
239
+ <comment>Attribute that corresponds to the price.</comment>
240
+ <tooltip>Select the attribute that corresponds to the price at AnyMarket</tooltip>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>1</show_in_store>
244
+ <frontend_type>select</frontend_type>
245
+ <sort_order>3</sort_order>
246
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
247
+ </anymarket_preco_field>
248
+
249
+ <anymarket_vol_comp_field translate="label tooltip comment">
250
+ <label>Length_am</label>
251
+ <comment>Attribute corresponding to the length.</comment>
252
+ <tooltip>Select the attribute that corresponds to the length in AnyMarket</tooltip>
253
+ <show_in_default>1</show_in_default>
254
+ <show_in_website>1</show_in_website>
255
+ <show_in_store>1</show_in_store>
256
+ <frontend_type>select</frontend_type>
257
+ <sort_order>4</sort_order>
258
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
259
+ </anymarket_vol_comp_field>
260
+
261
+ <anymarket_vol_alt_field translate="label tooltip comment">
262
+ <label>Height</label>
263
+ <comment>Attribute corresponding to the height.</comment>
264
+ <tooltip>Select the attribute that corresponds to the height AnyMarket</tooltip>
265
+ <show_in_default>1</show_in_default>
266
+ <show_in_website>1</show_in_website>
267
+ <show_in_store>1</show_in_store>
268
+ <frontend_type>select</frontend_type>
269
+ <sort_order>5</sort_order>
270
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
271
+ </anymarket_vol_alt_field>
272
+
273
+ <anymarket_vol_larg_field translate="label tooltip comment">
274
+ <label>Width</label>
275
+ <comment>Attribute corresponding to the Width.</comment>
276
+ <tooltip>Select the attribute that corresponds to the width in AnyMarket</tooltip>
277
+ <show_in_default>1</show_in_default>
278
+ <show_in_website>1</show_in_website>
279
+ <show_in_store>1</show_in_store>
280
+ <frontend_type>select</frontend_type>
281
+ <sort_order>6</sort_order>
282
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
283
+ </anymarket_vol_larg_field>
284
+
285
+ <anymarket_video_url_field translate="label tooltip comment">
286
+ <label>Video Url</label>
287
+ <comment>Attribute corresponding to the Video Url.</comment>
288
+ <tooltip>Select the attribute that corresponds to the video url in AnyMarket</tooltip>
289
+ <show_in_default>1</show_in_default>
290
+ <show_in_website>1</show_in_website>
291
+ <show_in_store>1</show_in_store>
292
+ <frontend_type>select</frontend_type>
293
+ <sort_order>7</sort_order>
294
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
295
+ </anymarket_video_url_field>
296
+
297
+ <anymarket_nbm_field translate="label tooltip comment">
298
+ <label>NBM</label>
299
+ <comment>Attribute corresponding to the NBM.</comment>
300
+ <tooltip>Select the attribute that corresponds to nbm in AnyMarket</tooltip>
301
+ <show_in_default>1</show_in_default>
302
+ <show_in_website>1</show_in_website>
303
+ <show_in_store>1</show_in_store>
304
+ <frontend_type>select</frontend_type>
305
+ <sort_order>8</sort_order>
306
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
307
+ </anymarket_nbm_field>
308
+
309
+ <anymarket_nbm_origin_field translate="label tooltip comment">
310
+ <label>Origem</label>
311
+ <comment>Attribute corresponding to the Origem.</comment>
312
+ <tooltip>Select the attribute that corresponds to the rise in AnyMarket</tooltip>
313
+ <show_in_default>1</show_in_default>
314
+ <show_in_website>1</show_in_website>
315
+ <show_in_store>1</show_in_store>
316
+ <frontend_type>select</frontend_type>
317
+ <sort_order>9</sort_order>
318
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
319
+ </anymarket_nbm_origin_field>
320
+
321
+ <anymarket_ean_field translate="label tooltip comment">
322
+ <label>Bar code</label>
323
+ <comment>Attribute corresponding to the Bar code.</comment>
324
+ <tooltip>Select the attribute that corresponds to the barcode on AnyMarket</tooltip>
325
+ <show_in_default>1</show_in_default>
326
+ <show_in_website>1</show_in_website>
327
+ <show_in_store>1</show_in_store>
328
+ <frontend_type>select</frontend_type>
329
+ <sort_order>10</sort_order>
330
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
331
+ </anymarket_ean_field>
332
+
333
+ <anymarket_warranty_text_field translate="label tooltip comment">
334
+ <label>Warranty</label>
335
+ <comment>Attribute corresponding to the Warranty.</comment>
336
+ <tooltip>Select the attribute that corresponds to the guarantee in AnyMarket</tooltip>
337
+ <show_in_default>1</show_in_default>
338
+ <show_in_website>1</show_in_website>
339
+ <show_in_store>1</show_in_store>
340
+ <frontend_type>select</frontend_type>
341
+ <sort_order>11</sort_order>
342
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
343
+ </anymarket_warranty_text_field>
344
+
345
+ <anymarket_warranty_time_field translate="label tooltip comment">
346
+ <label>Warranty time</label>
347
+ <comment>Attribute corresponding to the Warranty time.</comment>
348
+ <tooltip>Select the attribute that corresponds to the time bars on AnyMarket</tooltip>
349
+ <show_in_default>1</show_in_default>
350
+ <show_in_website>1</show_in_website>
351
+ <show_in_store>1</show_in_store>
352
+ <frontend_type>select</frontend_type>
353
+ <sort_order>12</sort_order>
354
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
355
+ </anymarket_warranty_time_field>
356
+
357
+ <anymarket_brand_field translate="label tooltip comment">
358
+ <label>Brand</label>
359
+ <comment>Attribute corresponding to the Brand.</comment>
360
+ <tooltip>Select the attribute that corresponds to the brand AnyMarket</tooltip>
361
+ <show_in_default>1</show_in_default>
362
+ <show_in_website>1</show_in_website>
363
+ <show_in_store>1</show_in_store>
364
+ <frontend_type>select</frontend_type>
365
+ <sort_order>13</sort_order>
366
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
367
+ </anymarket_brand_field>
368
+
369
+ <anymarket_model_field translate="label tooltip comment">
370
+ <label>Model</label>
371
+ <comment>Attribute corresponding to the Model.</comment>
372
+ <tooltip>Selecione o Atributo que corresponde a model no AnyMarket</tooltip>
373
+ <show_in_default>1</show_in_default>
374
+ <show_in_website>1</show_in_website>
375
+ <show_in_store>1</show_in_store>
376
+ <frontend_type>select</frontend_type>
377
+ <sort_order>14</sort_order>
378
+ <source_model>db1_anymarket/system_config_source_attributes_product_values</source_model>
379
+ </anymarket_model_field>
380
+
381
+ </fields>
382
+ </anymarket_attribute_group>
383
+
384
+ </groups>
385
+ </anymarket_section>
386
+
387
+ <payment>
388
+ <groups>
389
+ <db1_anymarket translate="label" module="db1_anymarket">
390
+ <label>AnyMarket Payment Method</label>
391
+ <sort_order>670</sort_order>
392
+ <show_in_default>1</show_in_default>
393
+ <show_in_website>1</show_in_website>
394
+ <show_in_store>0</show_in_store>
395
+ <fields>
396
+ <active translate="label">
397
+ <label>Enabled</label>
398
+ <frontend_type>select</frontend_type>
399
+ <source_model>adminhtml/system_config_source_yesno</source_model>
400
+ <sort_order>1</sort_order>
401
+ <show_in_default>1</show_in_default>
402
+ <show_in_website>1</show_in_website>
403
+ <show_in_store>0</show_in_store>
404
+ </active>
405
+ <order_status translate="label">
406
+ <label>New order status</label>
407
+ <frontend_type>select</frontend_type>
408
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
409
+ <sort_order>4</sort_order>
410
+ <show_in_default>1</show_in_default>
411
+ <show_in_website>1</show_in_website>
412
+ <show_in_store>0</show_in_store>
413
+ </order_status>
414
+ <title translate="label">
415
+ <label>Title</label>
416
+ <frontend_type>text</frontend_type>
417
+ <sort_order>2</sort_order>
418
+ <show_in_default>1</show_in_default>
419
+ <show_in_website>1</show_in_website>
420
+ <show_in_store>0</show_in_store>
421
+ </title>
422
+ </fields>
423
+ </db1_anymarket>
424
+ </groups>
425
+ </payment>
426
+
427
+ </sections>
428
+ </config>
app/code/community/DB1/AnyMarket/etc/wsdl.xml ADDED
@@ -0,0 +1,889 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
3
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
4
+ name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
5
+ <types>
6
+ <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
7
+ <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
8
+ <complexType name="anymarketAnymarketlogListEntity">
9
+ <all>
10
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
11
+ <element name="log_desc" type="xsd:string" minOccurs="1" />
12
+ <element name="status" type="xsd:string" minOccurs="0" />
13
+
14
+ <element name="created_at" type="xsd:string" minOccurs="1" />
15
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
16
+ </all>
17
+ </complexType>
18
+ <complexType name="anymarketAnymarketlogListEntityArray">
19
+ <complexContent>
20
+ <restriction base="soapenc:Array">
21
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:anymarketAnymarketlogListEntity[]" />
22
+ </restriction>
23
+ </complexContent>
24
+ </complexType>
25
+ <complexType name="anymarketAnymarketlogAddEntity">
26
+ <all>
27
+ <element name="log_desc" type="xsd:string" minOccurs="1" />
28
+ <element name="status" type="xsd:string" minOccurs="0" />
29
+
30
+ </all>
31
+ </complexType>
32
+ <complexType name="anymarketAnymarketlogUpdateEntity">
33
+ <all>
34
+ <element name="log_desc" type="xsd:string" minOccurs="1" />
35
+ <element name="status" type="xsd:string" minOccurs="0" />
36
+
37
+ </all>
38
+ </complexType>
39
+ <complexType name="anymarketAnymarketlogInfoEntity">
40
+ <all>
41
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
42
+ <element name="log_desc" type="xsd:string" minOccurs="1" />
43
+ <element name="status" type="xsd:string" minOccurs="0" />
44
+
45
+ <element name="created_at" type="xsd:string" minOccurs="1" />
46
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
47
+ </all>
48
+ </complexType>
49
+ <complexType name="anymarketAnymarketproductsListEntity">
50
+ <all>
51
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
52
+ <element name="nmp_sku" type="xsd:string" minOccurs="1" />
53
+ <element name="nmp_name" type="xsd:string" minOccurs="1" />
54
+ <element name="nmp_desc_error" type="xsd:string" minOccurs="1" />
55
+ <element name="nmp_status_int" type="xsd:string" minOccurs="1" />
56
+ <element name="status" type="xsd:string" minOccurs="0" />
57
+
58
+ <element name="created_at" type="xsd:string" minOccurs="1" />
59
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
60
+ </all>
61
+ </complexType>
62
+ <complexType name="anymarketAnymarketproductsListEntityArray">
63
+ <complexContent>
64
+ <restriction base="soapenc:Array">
65
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:anymarketAnymarketproductsListEntity[]" />
66
+ </restriction>
67
+ </complexContent>
68
+ </complexType>
69
+ <complexType name="anymarketAnymarketproductsAddEntity">
70
+ <all>
71
+ <element name="nmp_sku" type="xsd:string" minOccurs="1" />
72
+ <element name="nmp_name" type="xsd:string" minOccurs="1" />
73
+ <element name="nmp_desc_error" type="xsd:string" minOccurs="1" />
74
+ <element name="nmp_status_int" type="xsd:string" minOccurs="1" />
75
+ <element name="status" type="xsd:string" minOccurs="0" />
76
+
77
+ </all>
78
+ </complexType>
79
+ <complexType name="anymarketAnymarketproductsUpdateEntity">
80
+ <all>
81
+ <element name="nmp_sku" type="xsd:string" minOccurs="1" />
82
+ <element name="nmp_name" type="xsd:string" minOccurs="1" />
83
+ <element name="nmp_desc_error" type="xsd:string" minOccurs="1" />
84
+ <element name="nmp_status_int" type="xsd:string" minOccurs="1" />
85
+ <element name="status" type="xsd:string" minOccurs="0" />
86
+
87
+ </all>
88
+ </complexType>
89
+ <complexType name="anymarketAnymarketproductsInfoEntity">
90
+ <all>
91
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
92
+ <element name="nmp_sku" type="xsd:string" minOccurs="1" />
93
+ <element name="nmp_name" type="xsd:string" minOccurs="1" />
94
+ <element name="nmp_desc_error" type="xsd:string" minOccurs="1" />
95
+ <element name="nmp_status_int" type="xsd:string" minOccurs="1" />
96
+ <element name="status" type="xsd:string" minOccurs="0" />
97
+
98
+ <element name="created_at" type="xsd:string" minOccurs="1" />
99
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
100
+ </all>
101
+ </complexType>
102
+ <complexType name="anymarketAnymarketattributesListEntity">
103
+ <all>
104
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
105
+ <element name="nma_id_attr" type="xsd:string" minOccurs="1" />
106
+ <element name="nma_desc" type="xsd:string" minOccurs="1" />
107
+ <element name="status" type="xsd:string" minOccurs="0" />
108
+
109
+ <element name="created_at" type="xsd:string" minOccurs="1" />
110
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
111
+ </all>
112
+ </complexType>
113
+ <complexType name="anymarketAnymarketattributesListEntityArray">
114
+ <complexContent>
115
+ <restriction base="soapenc:Array">
116
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:anymarketAnymarketattributesListEntity[]" />
117
+ </restriction>
118
+ </complexContent>
119
+ </complexType>
120
+ <complexType name="anymarketAnymarketattributesAddEntity">
121
+ <all>
122
+ <element name="nma_id_attr" type="xsd:string" minOccurs="1" />
123
+ <element name="nma_desc" type="xsd:string" minOccurs="1" />
124
+ <element name="status" type="xsd:string" minOccurs="0" />
125
+
126
+ </all>
127
+ </complexType>
128
+ <complexType name="anymarketAnymarketattributesUpdateEntity">
129
+ <all>
130
+ <element name="nma_id_attr" type="xsd:string" minOccurs="1" />
131
+ <element name="nma_desc" type="xsd:string" minOccurs="1" />
132
+ <element name="status" type="xsd:string" minOccurs="0" />
133
+
134
+ </all>
135
+ </complexType>
136
+ <complexType name="anymarketAnymarketattributesInfoEntity">
137
+ <all>
138
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
139
+ <element name="nma_id_attr" type="xsd:string" minOccurs="1" />
140
+ <element name="nma_desc" type="xsd:string" minOccurs="1" />
141
+ <element name="status" type="xsd:string" minOccurs="0" />
142
+
143
+ <element name="created_at" type="xsd:string" minOccurs="1" />
144
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
145
+ </all>
146
+ </complexType>
147
+ <complexType name="anymarketAnymarketordersListEntity">
148
+ <all>
149
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
150
+ <element name="nmo_id_anymarket" type="xsd:string" minOccurs="1" />
151
+ <element name="nmo_id_order" type="xsd:string" minOccurs="1" />
152
+ <element name="status" type="xsd:string" minOccurs="0" />
153
+
154
+ <element name="created_at" type="xsd:string" minOccurs="1" />
155
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
156
+ </all>
157
+ </complexType>
158
+ <complexType name="anymarketAnymarketordersListEntityArray">
159
+ <complexContent>
160
+ <restriction base="soapenc:Array">
161
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:anymarketAnymarketordersListEntity[]" />
162
+ </restriction>
163
+ </complexContent>
164
+ </complexType>
165
+ <complexType name="anymarketAnymarketordersAddEntity">
166
+ <all>
167
+ <element name="nmo_id_anymarket" type="xsd:string" minOccurs="1" />
168
+ <element name="nmo_id_order" type="xsd:string" minOccurs="1" />
169
+ <element name="status" type="xsd:string" minOccurs="0" />
170
+
171
+ </all>
172
+ </complexType>
173
+ <complexType name="anymarketAnymarketordersUpdateEntity">
174
+ <all>
175
+ <element name="nmo_id_anymarket" type="xsd:string" minOccurs="1" />
176
+ <element name="nmo_id_order" type="xsd:string" minOccurs="1" />
177
+ <element name="status" type="xsd:string" minOccurs="0" />
178
+
179
+ </all>
180
+ </complexType>
181
+ <complexType name="anymarketAnymarketordersInfoEntity">
182
+ <all>
183
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
184
+ <element name="nmo_id_anymarket" type="xsd:string" minOccurs="1" />
185
+ <element name="nmo_id_order" type="xsd:string" minOccurs="1" />
186
+ <element name="status" type="xsd:string" minOccurs="0" />
187
+
188
+ <element name="created_at" type="xsd:string" minOccurs="1" />
189
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
190
+ </all>
191
+ </complexType>
192
+ <complexType name="anymarketAnymarketcategoriesListEntity">
193
+ <all>
194
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
195
+ <element name="nmc_cat_id" type="xsd:string" minOccurs="1" />
196
+ <element name="nmc_cat_root_id" type="xsd:string" minOccurs="1" />
197
+ <element name="nmc_cat_desc" type="xsd:string" minOccurs="1" />
198
+ <element name="status" type="xsd:string" minOccurs="0" />
199
+
200
+ <element name="created_at" type="xsd:string" minOccurs="1" />
201
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
202
+ </all>
203
+ </complexType>
204
+ <complexType name="anymarketAnymarketcategoriesListEntityArray">
205
+ <complexContent>
206
+ <restriction base="soapenc:Array">
207
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:anymarketAnymarketcategoriesListEntity[]" />
208
+ </restriction>
209
+ </complexContent>
210
+ </complexType>
211
+ <complexType name="anymarketAnymarketcategoriesAddEntity">
212
+ <all>
213
+ <element name="nmc_cat_id" type="xsd:string" minOccurs="1" />
214
+ <element name="nmc_cat_root_id" type="xsd:string" minOccurs="1" />
215
+ <element name="nmc_cat_desc" type="xsd:string" minOccurs="1" />
216
+ <element name="status" type="xsd:string" minOccurs="0" />
217
+
218
+ </all>
219
+ </complexType>
220
+ <complexType name="anymarketAnymarketcategoriesUpdateEntity">
221
+ <all>
222
+ <element name="nmc_cat_id" type="xsd:string" minOccurs="1" />
223
+ <element name="nmc_cat_root_id" type="xsd:string" minOccurs="1" />
224
+ <element name="nmc_cat_desc" type="xsd:string" minOccurs="1" />
225
+ <element name="status" type="xsd:string" minOccurs="0" />
226
+
227
+ </all>
228
+ </complexType>
229
+ <complexType name="anymarketAnymarketcategoriesInfoEntity">
230
+ <all>
231
+ <element name="entity_id" type="xsd:string" minOccurs="1" />
232
+ <element name="nmc_cat_id" type="xsd:string" minOccurs="1" />
233
+ <element name="nmc_cat_root_id" type="xsd:string" minOccurs="1" />
234
+ <element name="nmc_cat_desc" type="xsd:string" minOccurs="1" />
235
+ <element name="status" type="xsd:string" minOccurs="0" />
236
+
237
+ <element name="created_at" type="xsd:string" minOccurs="1" />
238
+ <element name="updated_at" type="xsd:string" minOccurs="1" />
239
+ </all>
240
+ </complexType>
241
+ </schema>
242
+ </types>
243
+ <message name="anymarketAnymarketlogListRequest">
244
+ <part name="sessionId" type="xsd:string" />
245
+ <part name="filters" type="typens:filters"/>
246
+ </message>
247
+ <message name="anymarketAnymarketlogListResponse">
248
+ <part name="result" type="typens:anymarketAnymarketlogListEntityArray" />
249
+ </message>
250
+ <message name="anymarketAnymarketlogInfoRequest">
251
+ <part name="sessionId" type="xsd:string" />
252
+ <part name="anymarketlogId" type="xsd:string" />
253
+ </message>
254
+ <message name="anymarketAnymarketlogInfoResponse">
255
+ <part name="result" type="typens:anymarketAnymarketlogInfoEntity" />
256
+ </message>
257
+ <message name="anymarketAnymarketlogAddRequest">
258
+ <part name="sessionId" type="xsd:string" />
259
+ <part name="data" type="typens:anymarketAnymarketlogAddEntity" />
260
+ </message>
261
+ <message name="anymarketAnymarketlogAddResponse">
262
+ <part name="result" type="xsd:int"/>
263
+ </message>
264
+ <message name="anymarketAnymarketlogUpdateRequest">
265
+ <part name="sessionId" type="xsd:string" />
266
+ <part name="anymarketlogId" type="xsd:string" />
267
+ <part name="data" type="typens:anymarketAnymarketlogUpdateEntity" />
268
+ </message>
269
+ <message name="anymarketAnymarketlogUpdateResponse">
270
+ <part name="result" type="xsd:boolean" />
271
+ </message>
272
+ <message name="anymarketAnymarketlogRemoveRequest">
273
+ <part name="sessionId" type="xsd:string" />
274
+ <part name="anymarketlogId" type="xsd:string" />
275
+ </message>
276
+ <message name="anymarketAnymarketlogRemoveResponse">
277
+ <part name="result" type="xsd:boolean" />
278
+ </message>
279
+ <message name="anymarketAnymarketproductsListRequest">
280
+ <part name="sessionId" type="xsd:string" />
281
+ <part name="filters" type="typens:filters"/>
282
+ </message>
283
+ <message name="anymarketAnymarketproductsListResponse">
284
+ <part name="result" type="typens:anymarketAnymarketproductsListEntityArray" />
285
+ </message>
286
+ <message name="anymarketAnymarketproductsInfoRequest">
287
+ <part name="sessionId" type="xsd:string" />
288
+ <part name="anymarketproductsId" type="xsd:string" />
289
+ </message>
290
+ <message name="anymarketAnymarketproductsInfoResponse">
291
+ <part name="result" type="typens:anymarketAnymarketproductsInfoEntity" />
292
+ </message>
293
+ <message name="anymarketAnymarketproductsAddRequest">
294
+ <part name="sessionId" type="xsd:string" />
295
+ <part name="data" type="typens:anymarketAnymarketproductsAddEntity" />
296
+ </message>
297
+ <message name="anymarketAnymarketproductsAddResponse">
298
+ <part name="result" type="xsd:int"/>
299
+ </message>
300
+ <message name="anymarketAnymarketproductsUpdateRequest">
301
+ <part name="sessionId" type="xsd:string" />
302
+ <part name="anymarketproductsId" type="xsd:string" />
303
+ <part name="data" type="typens:anymarketAnymarketproductsUpdateEntity" />
304
+ </message>
305
+ <message name="anymarketAnymarketproductsUpdateResponse">
306
+ <part name="result" type="xsd:boolean" />
307
+ </message>
308
+ <message name="anymarketAnymarketproductsRemoveRequest">
309
+ <part name="sessionId" type="xsd:string" />
310
+ <part name="anymarketproductsId" type="xsd:string" />
311
+ </message>
312
+ <message name="anymarketAnymarketproductsRemoveResponse">
313
+ <part name="result" type="xsd:boolean" />
314
+ </message>
315
+ <message name="anymarketAnymarketattributesListRequest">
316
+ <part name="sessionId" type="xsd:string" />
317
+ <part name="filters" type="typens:filters"/>
318
+ </message>
319
+ <message name="anymarketAnymarketattributesListResponse">
320
+ <part name="result" type="typens:anymarketAnymarketattributesListEntityArray" />
321
+ </message>
322
+ <message name="anymarketAnymarketattributesInfoRequest">
323
+ <part name="sessionId" type="xsd:string" />
324
+ <part name="anymarketattributesId" type="xsd:string" />
325
+ </message>
326
+ <message name="anymarketAnymarketattributesInfoResponse">
327
+ <part name="result" type="typens:anymarketAnymarketattributesInfoEntity" />
328
+ </message>
329
+ <message name="anymarketAnymarketattributesAddRequest">
330
+ <part name="sessionId" type="xsd:string" />
331
+ <part name="data" type="typens:anymarketAnymarketattributesAddEntity" />
332
+ </message>
333
+ <message name="anymarketAnymarketattributesAddResponse">
334
+ <part name="result" type="xsd:int"/>
335
+ </message>
336
+ <message name="anymarketAnymarketattributesUpdateRequest">
337
+ <part name="sessionId" type="xsd:string" />
338
+ <part name="anymarketattributesId" type="xsd:string" />
339
+ <part name="data" type="typens:anymarketAnymarketattributesUpdateEntity" />
340
+ </message>
341
+ <message name="anymarketAnymarketattributesUpdateResponse">
342
+ <part name="result" type="xsd:boolean" />
343
+ </message>
344
+ <message name="anymarketAnymarketattributesRemoveRequest">
345
+ <part name="sessionId" type="xsd:string" />
346
+ <part name="anymarketattributesId" type="xsd:string" />
347
+ </message>
348
+ <message name="anymarketAnymarketattributesRemoveResponse">
349
+ <part name="result" type="xsd:boolean" />
350
+ </message>
351
+ <message name="anymarketAnymarketordersListRequest">
352
+ <part name="sessionId" type="xsd:string" />
353
+ <part name="filters" type="typens:filters"/>
354
+ </message>
355
+ <message name="anymarketAnymarketordersListResponse">
356
+ <part name="result" type="typens:anymarketAnymarketordersListEntityArray" />
357
+ </message>
358
+ <message name="anymarketAnymarketordersInfoRequest">
359
+ <part name="sessionId" type="xsd:string" />
360
+ <part name="anymarketordersId" type="xsd:string" />
361
+ </message>
362
+ <message name="anymarketAnymarketordersInfoResponse">
363
+ <part name="result" type="typens:anymarketAnymarketordersInfoEntity" />
364
+ </message>
365
+ <message name="anymarketAnymarketordersAddRequest">
366
+ <part name="sessionId" type="xsd:string" />
367
+ <part name="data" type="typens:anymarketAnymarketordersAddEntity" />
368
+ </message>
369
+ <message name="anymarketAnymarketordersAddResponse">
370
+ <part name="result" type="xsd:int"/>
371
+ </message>
372
+ <message name="anymarketAnymarketordersUpdateRequest">
373
+ <part name="sessionId" type="xsd:string" />
374
+ <part name="anymarketordersId" type="xsd:string" />
375
+ <part name="data" type="typens:anymarketAnymarketordersUpdateEntity" />
376
+ </message>
377
+ <message name="anymarketAnymarketordersUpdateResponse">
378
+ <part name="result" type="xsd:boolean" />
379
+ </message>
380
+ <message name="anymarketAnymarketordersRemoveRequest">
381
+ <part name="sessionId" type="xsd:string" />
382
+ <part name="anymarketordersId" type="xsd:string" />
383
+ </message>
384
+ <message name="anymarketAnymarketordersRemoveResponse">
385
+ <part name="result" type="xsd:boolean" />
386
+ </message>
387
+ <message name="anymarketAnymarketcategoriesListRequest">
388
+ <part name="sessionId" type="xsd:string" />
389
+ <part name="filters" type="typens:filters"/>
390
+ </message>
391
+ <message name="anymarketAnymarketcategoriesListResponse">
392
+ <part name="result" type="typens:anymarketAnymarketcategoriesListEntityArray" />
393
+ </message>
394
+ <message name="anymarketAnymarketcategoriesInfoRequest">
395
+ <part name="sessionId" type="xsd:string" />
396
+ <part name="anymarketcategoriesId" type="xsd:string" />
397
+ </message>
398
+ <message name="anymarketAnymarketcategoriesInfoResponse">
399
+ <part name="result" type="typens:anymarketAnymarketcategoriesInfoEntity" />
400
+ </message>
401
+ <message name="anymarketAnymarketcategoriesAddRequest">
402
+ <part name="sessionId" type="xsd:string" />
403
+ <part name="data" type="typens:anymarketAnymarketcategoriesAddEntity" />
404
+ </message>
405
+ <message name="anymarketAnymarketcategoriesAddResponse">
406
+ <part name="result" type="xsd:int"/>
407
+ </message>
408
+ <message name="anymarketAnymarketcategoriesUpdateRequest">
409
+ <part name="sessionId" type="xsd:string" />
410
+ <part name="anymarketcategoriesId" type="xsd:string" />
411
+ <part name="data" type="typens:anymarketAnymarketcategoriesUpdateEntity" />
412
+ </message>
413
+ <message name="anymarketAnymarketcategoriesUpdateResponse">
414
+ <part name="result" type="xsd:boolean" />
415
+ </message>
416
+ <message name="anymarketAnymarketcategoriesRemoveRequest">
417
+ <part name="sessionId" type="xsd:string" />
418
+ <part name="anymarketcategoriesId" type="xsd:string" />
419
+ </message>
420
+ <message name="anymarketAnymarketcategoriesRemoveResponse">
421
+ <part name="result" type="xsd:boolean" />
422
+ </message>
423
+ <message name="anymarketAnymarketqueueListRequest">
424
+ <part name="sessionId" type="xsd:string" />
425
+ <part name="filters" type="typens:filters"/>
426
+ </message>
427
+ <message name="anymarketAnymarketqueueListResponse">
428
+ <part name="result" type="typens:anymarketAnymarketqueueListEntityArray" />
429
+ </message>
430
+ <message name="anymarketAnymarketqueueInfoRequest">
431
+ <part name="sessionId" type="xsd:string" />
432
+ <part name="anymarketqueueId" type="xsd:string" />
433
+ </message>
434
+ <message name="anymarketAnymarketqueueInfoResponse">
435
+ <part name="result" type="typens:anymarketAnymarketqueueInfoEntity" />
436
+ </message>
437
+ <message name="anymarketAnymarketqueueAddRequest">
438
+ <part name="sessionId" type="xsd:string" />
439
+ <part name="data" type="typens:anymarketAnymarketqueueAddEntity" />
440
+ </message>
441
+ <message name="anymarketAnymarketqueueAddResponse">
442
+ <part name="result" type="xsd:int"/>
443
+ </message>
444
+ <message name="anymarketAnymarketqueueUpdateRequest">
445
+ <part name="sessionId" type="xsd:string" />
446
+ <part name="anymarketqueueId" type="xsd:string" />
447
+ <part name="data" type="typens:anymarketAnymarketqueueUpdateEntity" />
448
+ </message>
449
+ <message name="anymarketAnymarketqueueUpdateResponse">
450
+ <part name="result" type="xsd:boolean" />
451
+ </message>
452
+ <message name="anymarketAnymarketqueueRemoveRequest">
453
+ <part name="sessionId" type="xsd:string" />
454
+ <part name="anymarketqueueId" type="xsd:string" />
455
+ </message>
456
+ <message name="anymarketAnymarketqueueRemoveResponse">
457
+ <part name="result" type="xsd:boolean" />
458
+ </message>
459
+ <portType name="{{var wsdl.handler}}PortType">
460
+ <operation name="anymarketAnymarketlogList">
461
+ <documentation>Retrieve list of anymarket log</documentation>
462
+ <input message="typens:anymarketAnymarketlogListRequest" />
463
+ <output message="typens:anymarketAnymarketlogListResponse" />
464
+ </operation>
465
+ <operation name="anymarketAnymarketlogInfo">
466
+ <documentation>Retrieve anymarket log info</documentation>
467
+ <input message="typens:anymarketAnymarketlogInfoRequest" />
468
+ <output message="typens:anymarketAnymarketlogInfoResponse" />
469
+ </operation>
470
+ <operation name="anymarketAnymarketlogAdd">
471
+ <documentation>Add anymarket log</documentation>
472
+ <input message="typens:anymarketAnymarketlogAddRequest" />
473
+ <output message="typens:anymarketAnymarketlogAddResponse" />
474
+ </operation>
475
+ <operation name="anymarketAnymarketlogUpdate">
476
+ <documentation>Update anymarket log</documentation>
477
+ <input message="typens:anymarketAnymarketlogUpdateRequest" />
478
+ <output message="typens:anymarketAnymarketlogUpdateResponse" />
479
+ </operation>
480
+ <operation name="anymarketAnymarketlogRemove">
481
+ <documentation>Remove anymarket log</documentation>
482
+ <input message="typens:anymarketAnymarketlogRemoveRequest" />
483
+ <output message="typens:anymarketAnymarketlogRemoveResponse" />
484
+ </operation>
485
+ <operation name="anymarketAnymarketproductsList">
486
+ <documentation>Retrieve list of anymarket products</documentation>
487
+ <input message="typens:anymarketAnymarketproductsListRequest" />
488
+ <output message="typens:anymarketAnymarketproductsListResponse" />
489
+ </operation>
490
+ <operation name="anymarketAnymarketproductsInfo">
491
+ <documentation>Retrieve anymarket products info</documentation>
492
+ <input message="typens:anymarketAnymarketproductsInfoRequest" />
493
+ <output message="typens:anymarketAnymarketproductsInfoResponse" />
494
+ </operation>
495
+ <operation name="anymarketAnymarketproductsAdd">
496
+ <documentation>Add anymarket products</documentation>
497
+ <input message="typens:anymarketAnymarketproductsAddRequest" />
498
+ <output message="typens:anymarketAnymarketproductsAddResponse" />
499
+ </operation>
500
+ <operation name="anymarketAnymarketproductsUpdate">
501
+ <documentation>Update anymarket products</documentation>
502
+ <input message="typens:anymarketAnymarketproductsUpdateRequest" />
503
+ <output message="typens:anymarketAnymarketproductsUpdateResponse" />
504
+ </operation>
505
+ <operation name="anymarketAnymarketproductsRemove">
506
+ <documentation>Remove anymarket products</documentation>
507
+ <input message="typens:anymarketAnymarketproductsRemoveRequest" />
508
+ <output message="typens:anymarketAnymarketproductsRemoveResponse" />
509
+ </operation>
510
+ <operation name="anymarketAnymarketattributesList">
511
+ <documentation>Retrieve list of anymarket attributes</documentation>
512
+ <input message="typens:anymarketAnymarketattributesListRequest" />
513
+ <output message="typens:anymarketAnymarketattributesListResponse" />
514
+ </operation>
515
+ <operation name="anymarketAnymarketattributesInfo">
516
+ <documentation>Retrieve anymarket attributes info</documentation>
517
+ <input message="typens:anymarketAnymarketattributesInfoRequest" />
518
+ <output message="typens:anymarketAnymarketattributesInfoResponse" />
519
+ </operation>
520
+ <operation name="anymarketAnymarketattributesAdd">
521
+ <documentation>Add anymarket attributes</documentation>
522
+ <input message="typens:anymarketAnymarketattributesAddRequest" />
523
+ <output message="typens:anymarketAnymarketattributesAddResponse" />
524
+ </operation>
525
+ <operation name="anymarketAnymarketattributesUpdate">
526
+ <documentation>Update anymarket attributes</documentation>
527
+ <input message="typens:anymarketAnymarketattributesUpdateRequest" />
528
+ <output message="typens:anymarketAnymarketattributesUpdateResponse" />
529
+ </operation>
530
+ <operation name="anymarketAnymarketattributesRemove">
531
+ <documentation>Remove anymarket attributes</documentation>
532
+ <input message="typens:anymarketAnymarketattributesRemoveRequest" />
533
+ <output message="typens:anymarketAnymarketattributesRemoveResponse" />
534
+ </operation>
535
+ <operation name="anymarketAnymarketordersList">
536
+ <documentation>Retrieve list of anymarket orders</documentation>
537
+ <input message="typens:anymarketAnymarketordersListRequest" />
538
+ <output message="typens:anymarketAnymarketordersListResponse" />
539
+ </operation>
540
+ <operation name="anymarketAnymarketordersInfo">
541
+ <documentation>Retrieve anymarket orders info</documentation>
542
+ <input message="typens:anymarketAnymarketordersInfoRequest" />
543
+ <output message="typens:anymarketAnymarketordersInfoResponse" />
544
+ </operation>
545
+ <operation name="anymarketAnymarketordersAdd">
546
+ <documentation>Add anymarket orders</documentation>
547
+ <input message="typens:anymarketAnymarketordersAddRequest" />
548
+ <output message="typens:anymarketAnymarketordersAddResponse" />
549
+ </operation>
550
+ <operation name="anymarketAnymarketordersUpdate">
551
+ <documentation>Update anymarket orders</documentation>
552
+ <input message="typens:anymarketAnymarketordersUpdateRequest" />
553
+ <output message="typens:anymarketAnymarketordersUpdateResponse" />
554
+ </operation>
555
+ <operation name="anymarketAnymarketordersRemove">
556
+ <documentation>Remove anymarket orders</documentation>
557
+ <input message="typens:anymarketAnymarketordersRemoveRequest" />
558
+ <output message="typens:anymarketAnymarketordersRemoveResponse" />
559
+ </operation>
560
+ <operation name="anymarketAnymarketcategoriesList">
561
+ <documentation>Retrieve list of anymarket categories</documentation>
562
+ <input message="typens:anymarketAnymarketcategoriesListRequest" />
563
+ <output message="typens:anymarketAnymarketcategoriesListResponse" />
564
+ </operation>
565
+ <operation name="anymarketAnymarketcategoriesInfo">
566
+ <documentation>Retrieve anymarket categories info</documentation>
567
+ <input message="typens:anymarketAnymarketcategoriesInfoRequest" />
568
+ <output message="typens:anymarketAnymarketcategoriesInfoResponse" />
569
+ </operation>
570
+ <operation name="anymarketAnymarketcategoriesAdd">
571
+ <documentation>Add anymarket categories</documentation>
572
+ <input message="typens:anymarketAnymarketcategoriesAddRequest" />
573
+ <output message="typens:anymarketAnymarketcategoriesAddResponse" />
574
+ </operation>
575
+ <operation name="anymarketAnymarketcategoriesUpdate">
576
+ <documentation>Update anymarket categories</documentation>
577
+ <input message="typens:anymarketAnymarketcategoriesUpdateRequest" />
578
+ <output message="typens:anymarketAnymarketcategoriesUpdateResponse" />
579
+ </operation>
580
+ <operation name="anymarketAnymarketcategoriesRemove">
581
+ <documentation>Remove anymarket categories</documentation>
582
+ <input message="typens:anymarketAnymarketcategoriesRemoveRequest" />
583
+ <output message="typens:anymarketAnymarketcategoriesRemoveResponse" />
584
+ </operation>
585
+ <operation name="anymarketAnymarketqueueList">
586
+ <documentation>Retrieve list of anymarket queue</documentation>
587
+ <input message="typens:anymarketAnymarketqueueListRequest" />
588
+ <output message="typens:anymarketAnymarketqueueListResponse" />
589
+ </operation>
590
+ <operation name="anymarketAnymarketqueueInfo">
591
+ <documentation>Retrieve anymarket queue info</documentation>
592
+ <input message="typens:anymarketAnymarketqueueInfoRequest" />
593
+ <output message="typens:anymarketAnymarketqueueInfoResponse" />
594
+ </operation>
595
+ <operation name="anymarketAnymarketqueueAdd">
596
+ <documentation>Add anymarket queue</documentation>
597
+ <input message="typens:anymarketAnymarketqueueAddRequest" />
598
+ <output message="typens:anymarketAnymarketqueueAddResponse" />
599
+ </operation>
600
+ <operation name="anymarketAnymarketqueueUpdate">
601
+ <documentation>Update anymarket queue</documentation>
602
+ <input message="typens:anymarketAnymarketqueueUpdateRequest" />
603
+ <output message="typens:anymarketAnymarketqueueUpdateResponse" />
604
+ </operation>
605
+ <operation name="anymarketAnymarketqueueRemove">
606
+ <documentation>Remove anymarket queue</documentation>
607
+ <input message="typens:anymarketAnymarketqueueRemoveRequest" />
608
+ <output message="typens:anymarketAnymarketqueueRemoveResponse" />
609
+ </operation>
610
+ </portType>
611
+ <binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
612
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
613
+ <operation name="anymarketAnymarketlogList">
614
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
615
+ <input>
616
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
617
+ </input>
618
+ <output>
619
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
620
+ </output>
621
+ </operation>
622
+ <operation name="anymarketAnymarketlogInfo">
623
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
624
+ <input>
625
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
626
+ </input>
627
+ <output>
628
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
629
+ </output>
630
+ </operation>
631
+ <operation name="anymarketAnymarketlogAdd">
632
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
633
+ <input>
634
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
635
+ </input>
636
+ <output>
637
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
638
+ </output>
639
+ </operation>
640
+ <operation name="anymarketAnymarketlogUpdate">
641
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
642
+ <input>
643
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
644
+ </input>
645
+ <output>
646
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
647
+ </output>
648
+ </operation>
649
+ <operation name="anymarketAnymarketlogRemove">
650
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
651
+ <input>
652
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
653
+ </input>
654
+ <output>
655
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
656
+ </output>
657
+ </operation>
658
+ <operation name="anymarketAnymarketproductsList">
659
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
660
+ <input>
661
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
662
+ </input>
663
+ <output>
664
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
665
+ </output>
666
+ </operation>
667
+ <operation name="anymarketAnymarketproductsInfo">
668
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
669
+ <input>
670
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
671
+ </input>
672
+ <output>
673
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
674
+ </output>
675
+ </operation>
676
+ <operation name="anymarketAnymarketproductsAdd">
677
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
678
+ <input>
679
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
680
+ </input>
681
+ <output>
682
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
683
+ </output>
684
+ </operation>
685
+ <operation name="anymarketAnymarketproductsUpdate">
686
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
687
+ <input>
688
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
689
+ </input>
690
+ <output>
691
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
692
+ </output>
693
+ </operation>
694
+ <operation name="anymarketAnymarketproductsRemove">
695
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
696
+ <input>
697
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
698
+ </input>
699
+ <output>
700
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
701
+ </output>
702
+ </operation>
703
+ <operation name="anymarketAnymarketattributesList">
704
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
705
+ <input>
706
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
707
+ </input>
708
+ <output>
709
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
710
+ </output>
711
+ </operation>
712
+ <operation name="anymarketAnymarketattributesInfo">
713
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
714
+ <input>
715
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
716
+ </input>
717
+ <output>
718
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
719
+ </output>
720
+ </operation>
721
+ <operation name="anymarketAnymarketattributesAdd">
722
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
723
+ <input>
724
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
725
+ </input>
726
+ <output>
727
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
728
+ </output>
729
+ </operation>
730
+ <operation name="anymarketAnymarketattributesUpdate">
731
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
732
+ <input>
733
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
734
+ </input>
735
+ <output>
736
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
737
+ </output>
738
+ </operation>
739
+ <operation name="anymarketAnymarketattributesRemove">
740
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
741
+ <input>
742
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
743
+ </input>
744
+ <output>
745
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
746
+ </output>
747
+ </operation>
748
+ <operation name="anymarketAnymarketordersList">
749
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
750
+ <input>
751
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
752
+ </input>
753
+ <output>
754
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
755
+ </output>
756
+ </operation>
757
+ <operation name="anymarketAnymarketordersInfo">
758
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
759
+ <input>
760
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
761
+ </input>
762
+ <output>
763
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
764
+ </output>
765
+ </operation>
766
+ <operation name="anymarketAnymarketordersAdd">
767
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
768
+ <input>
769
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
770
+ </input>
771
+ <output>
772
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
773
+ </output>
774
+ </operation>
775
+ <operation name="anymarketAnymarketordersUpdate">
776
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
777
+ <input>
778
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
779
+ </input>
780
+ <output>
781
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
782
+ </output>
783
+ </operation>
784
+ <operation name="anymarketAnymarketordersRemove">
785
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
786
+ <input>
787
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
788
+ </input>
789
+ <output>
790
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
791
+ </output>
792
+ </operation>
793
+ <operation name="anymarketAnymarketcategoriesList">
794
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
795
+ <input>
796
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
797
+ </input>
798
+ <output>
799
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
800
+ </output>
801
+ </operation>
802
+ <operation name="anymarketAnymarketcategoriesInfo">
803
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
804
+ <input>
805
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
806
+ </input>
807
+ <output>
808
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
809
+ </output>
810
+ </operation>
811
+ <operation name="anymarketAnymarketcategoriesAdd">
812
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
813
+ <input>
814
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
815
+ </input>
816
+ <output>
817
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
818
+ </output>
819
+ </operation>
820
+ <operation name="anymarketAnymarketcategoriesUpdate">
821
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
822
+ <input>
823
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
824
+ </input>
825
+ <output>
826
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
827
+ </output>
828
+ </operation>
829
+ <operation name="anymarketAnymarketcategoriesRemove">
830
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
831
+ <input>
832
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
833
+ </input>
834
+ <output>
835
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
836
+ </output>
837
+ </operation>
838
+ <operation name="anymarketAnymarketqueueList">
839
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
840
+ <input>
841
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
842
+ </input>
843
+ <output>
844
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
845
+ </output>
846
+ </operation>
847
+ <operation name="anymarketAnymarketqueueInfo">
848
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
849
+ <input>
850
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
851
+ </input>
852
+ <output>
853
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
854
+ </output>
855
+ </operation>
856
+ <operation name="anymarketAnymarketqueueAdd">
857
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
858
+ <input>
859
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
860
+ </input>
861
+ <output>
862
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
863
+ </output>
864
+ </operation>
865
+ <operation name="anymarketAnymarketqueueUpdate">
866
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
867
+ <input>
868
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
869
+ </input>
870
+ <output>
871
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
872
+ </output>
873
+ </operation>
874
+ <operation name="anymarketAnymarketqueueRemove">
875
+ <soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
876
+ <input>
877
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
878
+ </input>
879
+ <output>
880
+ <soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
881
+ </output>
882
+ </operation>
883
+ </binding>
884
+ <service name="{{var wsdl.name}}Service">
885
+ <port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
886
+ <soap:address location="{{var wsdl.url}}" />
887
+ </port>
888
+ </service>
889
+ </definitions>
app/code/community/DB1/AnyMarket/etc/wsi.xml ADDED
@@ -0,0 +1,1357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
3
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
5
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
6
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
7
+ name="{{var wsdl.name}}"
8
+ targetNamespace="urn:{{var wsdl.name}}">
9
+ <wsdl:types>
10
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
11
+ <xsd:complexType name="anymarketAnymarketlogEntityArray">
12
+ <xsd:sequence>
13
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:anymarketAnymarketlogEntity" />
14
+ </xsd:sequence>
15
+ </xsd:complexType>
16
+ <xsd:complexType name="anymarketAnymarketlogEntity">
17
+ <xsd:sequence>
18
+ <xsd:element name="entity_id" type="xsd:string" />
19
+ <xsd:element name="log_desc" type="xsd:string" />
20
+ <xsd:element name="status" type="xsd:string" />
21
+
22
+ <xsd:element name="created_at" type="xsd:string" />
23
+ <xsd:element name="updated_at" type="xsd:string" />
24
+ </xsd:sequence>
25
+ </xsd:complexType>
26
+ <xsd:complexType name="anymarketAnymarketlogAddEntity">
27
+ <xsd:sequence>
28
+ <xsd:element name="log_desc" type="xsd:string" />
29
+ <xsd:element name="status" type="xsd:string" />
30
+
31
+ </xsd:sequence>
32
+ </xsd:complexType>
33
+ <xsd:complexType name="anymarketAnymarketlogUpdateEntity">
34
+ <xsd:sequence>
35
+ <xsd:element name="log_desc" type="xsd:string" />
36
+ <xsd:element name="status" type="xsd:string" />
37
+
38
+ </xsd:sequence>
39
+ </xsd:complexType>
40
+ <xsd:complexType name="anymarketAnymarketlogInfoEntity">
41
+ <xsd:sequence>
42
+ <xsd:element name="entity_id" type="xsd:string" />
43
+ <xsd:element name="log_desc" type="xsd:string" />
44
+ <xsd:element name="status" type="xsd:string" />
45
+
46
+ <xsd:element name="created_at" type="xsd:string" />
47
+ <xsd:element name="updated_at" type="xsd:string" />
48
+ </xsd:sequence>
49
+ </xsd:complexType>
50
+
51
+ <xsd:element name="anymarketAnymarketlogListRequestParam">
52
+ <xsd:complexType>
53
+ <xsd:sequence>
54
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
55
+ <xsd:element minOccurs="0" maxOccurs="1" name="filters" type="typens:filters" />
56
+ </xsd:sequence>
57
+ </xsd:complexType>
58
+ </xsd:element>
59
+ <xsd:element name="anymarketAnymarketlogListResponseParam">
60
+ <xsd:complexType>
61
+ <xsd:sequence>
62
+ <xsd:element minOccurs="0" maxOccurs="1" name="result" type="typens:anymarketAnymarketlogEntityArray" />
63
+ </xsd:sequence>
64
+ </xsd:complexType>
65
+ </xsd:element>
66
+ <xsd:element name="anymarketAnymarketlogInfoRequestParam">
67
+ <xsd:complexType>
68
+ <xsd:sequence>
69
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
70
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketlogId" type="xsd:string" />
71
+ </xsd:sequence>
72
+ </xsd:complexType>
73
+ </xsd:element>
74
+ <xsd:element name="anymarketAnymarketlogInfoResponseParam">
75
+ <xsd:complexType>
76
+ <xsd:sequence>
77
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:anymarketAnymarketlogInfoEntity" />
78
+ </xsd:sequence>
79
+ </xsd:complexType>
80
+ </xsd:element>
81
+ <xsd:element name="anymarketAnymarketlogAddRequestParam">
82
+ <xsd:complexType>
83
+ <xsd:sequence>
84
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
85
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketlogAddEntity" />
86
+ </xsd:sequence>
87
+ </xsd:complexType>
88
+ </xsd:element>
89
+ <xsd:element name="anymarketAnymarketlogAddResponseParam">
90
+ <xsd:complexType>
91
+ <xsd:sequence>
92
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:int" />
93
+ </xsd:sequence>
94
+ </xsd:complexType>
95
+ </xsd:element>
96
+ <xsd:element name="anymarketAnymarketlogUpdateRequestParam">
97
+ <xsd:complexType>
98
+ <xsd:sequence>
99
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
100
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketlogId" type="xsd:string" />
101
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketlogUpdateEntity" />
102
+ </xsd:sequence>
103
+ </xsd:complexType>
104
+ </xsd:element>
105
+ <xsd:element name="anymarketAnymarketlogUpdateResponseParam">
106
+ <xsd:complexType>
107
+ <xsd:sequence>
108
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
109
+ </xsd:sequence>
110
+ </xsd:complexType>
111
+ </xsd:element>
112
+ <xsd:element name="anymarketAnymarketlogRemoveRequestParam">
113
+ <xsd:complexType>
114
+ <xsd:sequence>
115
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
116
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketlogId" type="xsd:string" />
117
+ </xsd:sequence>
118
+ </xsd:complexType>
119
+ </xsd:element>
120
+ <xsd:element name="anymarketAnymarketlogRemoveResponseParam">
121
+ <xsd:complexType>
122
+ <xsd:sequence>
123
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
124
+ </xsd:sequence>
125
+ </xsd:complexType>
126
+ </xsd:element>
127
+ <xsd:complexType name="anymarketAnymarketproductsEntityArray">
128
+ <xsd:sequence>
129
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:anymarketAnymarketproductsEntity" />
130
+ </xsd:sequence>
131
+ </xsd:complexType>
132
+ <xsd:complexType name="anymarketAnymarketproductsEntity">
133
+ <xsd:sequence>
134
+ <xsd:element name="entity_id" type="xsd:string" />
135
+ <xsd:element name="nmp_sku" type="xsd:string" />
136
+ <xsd:element name="nmp_name" type="xsd:string" />
137
+ <xsd:element name="nmp_desc_error" type="xsd:string" />
138
+ <xsd:element name="nmp_status_int" type="xsd:string" />
139
+ <xsd:element name="status" type="xsd:string" />
140
+
141
+ <xsd:element name="created_at" type="xsd:string" />
142
+ <xsd:element name="updated_at" type="xsd:string" />
143
+ </xsd:sequence>
144
+ </xsd:complexType>
145
+ <xsd:complexType name="anymarketAnymarketproductsAddEntity">
146
+ <xsd:sequence>
147
+ <xsd:element name="nmp_sku" type="xsd:string" />
148
+ <xsd:element name="nmp_name" type="xsd:string" />
149
+ <xsd:element name="nmp_desc_error" type="xsd:string" />
150
+ <xsd:element name="nmp_status_int" type="xsd:string" />
151
+ <xsd:element name="status" type="xsd:string" />
152
+
153
+ </xsd:sequence>
154
+ </xsd:complexType>
155
+ <xsd:complexType name="anymarketAnymarketproductsUpdateEntity">
156
+ <xsd:sequence>
157
+ <xsd:element name="nmp_sku" type="xsd:string" />
158
+ <xsd:element name="nmp_name" type="xsd:string" />
159
+ <xsd:element name="nmp_desc_error" type="xsd:string" />
160
+ <xsd:element name="nmp_status_int" type="xsd:string" />
161
+ <xsd:element name="status" type="xsd:string" />
162
+
163
+ </xsd:sequence>
164
+ </xsd:complexType>
165
+ <xsd:complexType name="anymarketAnymarketproductsInfoEntity">
166
+ <xsd:sequence>
167
+ <xsd:element name="entity_id" type="xsd:string" />
168
+ <xsd:element name="nmp_sku" type="xsd:string" />
169
+ <xsd:element name="nmp_name" type="xsd:string" />
170
+ <xsd:element name="nmp_desc_error" type="xsd:string" />
171
+ <xsd:element name="nmp_status_int" type="xsd:string" />
172
+ <xsd:element name="status" type="xsd:string" />
173
+
174
+ <xsd:element name="created_at" type="xsd:string" />
175
+ <xsd:element name="updated_at" type="xsd:string" />
176
+ </xsd:sequence>
177
+ </xsd:complexType>
178
+
179
+ <xsd:element name="anymarketAnymarketproductsListRequestParam">
180
+ <xsd:complexType>
181
+ <xsd:sequence>
182
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
183
+ <xsd:element minOccurs="0" maxOccurs="1" name="filters" type="typens:filters" />
184
+ </xsd:sequence>
185
+ </xsd:complexType>
186
+ </xsd:element>
187
+ <xsd:element name="anymarketAnymarketproductsListResponseParam">
188
+ <xsd:complexType>
189
+ <xsd:sequence>
190
+ <xsd:element minOccurs="0" maxOccurs="1" name="result" type="typens:anymarketAnymarketproductsEntityArray" />
191
+ </xsd:sequence>
192
+ </xsd:complexType>
193
+ </xsd:element>
194
+ <xsd:element name="anymarketAnymarketproductsInfoRequestParam">
195
+ <xsd:complexType>
196
+ <xsd:sequence>
197
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
198
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketproductsId" type="xsd:string" />
199
+ </xsd:sequence>
200
+ </xsd:complexType>
201
+ </xsd:element>
202
+ <xsd:element name="anymarketAnymarketproductsInfoResponseParam">
203
+ <xsd:complexType>
204
+ <xsd:sequence>
205
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:anymarketAnymarketproductsInfoEntity" />
206
+ </xsd:sequence>
207
+ </xsd:complexType>
208
+ </xsd:element>
209
+ <xsd:element name="anymarketAnymarketproductsAddRequestParam">
210
+ <xsd:complexType>
211
+ <xsd:sequence>
212
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
213
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketproductsAddEntity" />
214
+ </xsd:sequence>
215
+ </xsd:complexType>
216
+ </xsd:element>
217
+ <xsd:element name="anymarketAnymarketproductsAddResponseParam">
218
+ <xsd:complexType>
219
+ <xsd:sequence>
220
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:int" />
221
+ </xsd:sequence>
222
+ </xsd:complexType>
223
+ </xsd:element>
224
+ <xsd:element name="anymarketAnymarketproductsUpdateRequestParam">
225
+ <xsd:complexType>
226
+ <xsd:sequence>
227
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
228
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketproductsId" type="xsd:string" />
229
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketproductsUpdateEntity" />
230
+ </xsd:sequence>
231
+ </xsd:complexType>
232
+ </xsd:element>
233
+ <xsd:element name="anymarketAnymarketproductsUpdateResponseParam">
234
+ <xsd:complexType>
235
+ <xsd:sequence>
236
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
237
+ </xsd:sequence>
238
+ </xsd:complexType>
239
+ </xsd:element>
240
+ <xsd:element name="anymarketAnymarketproductsRemoveRequestParam">
241
+ <xsd:complexType>
242
+ <xsd:sequence>
243
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
244
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketproductsId" type="xsd:string" />
245
+ </xsd:sequence>
246
+ </xsd:complexType>
247
+ </xsd:element>
248
+ <xsd:element name="anymarketAnymarketproductsRemoveResponseParam">
249
+ <xsd:complexType>
250
+ <xsd:sequence>
251
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
252
+ </xsd:sequence>
253
+ </xsd:complexType>
254
+ </xsd:element>
255
+ <xsd:complexType name="anymarketAnymarketattributesEntityArray">
256
+ <xsd:sequence>
257
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:anymarketAnymarketattributesEntity" />
258
+ </xsd:sequence>
259
+ </xsd:complexType>
260
+ <xsd:complexType name="anymarketAnymarketattributesEntity">
261
+ <xsd:sequence>
262
+ <xsd:element name="entity_id" type="xsd:string" />
263
+ <xsd:element name="nma_id_attr" type="xsd:string" />
264
+ <xsd:element name="nma_desc" type="xsd:string" />
265
+ <xsd:element name="status" type="xsd:string" />
266
+
267
+ <xsd:element name="created_at" type="xsd:string" />
268
+ <xsd:element name="updated_at" type="xsd:string" />
269
+ </xsd:sequence>
270
+ </xsd:complexType>
271
+ <xsd:complexType name="anymarketAnymarketattributesAddEntity">
272
+ <xsd:sequence>
273
+ <xsd:element name="nma_id_attr" type="xsd:string" />
274
+ <xsd:element name="nma_desc" type="xsd:string" />
275
+ <xsd:element name="status" type="xsd:string" />
276
+
277
+ </xsd:sequence>
278
+ </xsd:complexType>
279
+ <xsd:complexType name="anymarketAnymarketattributesUpdateEntity">
280
+ <xsd:sequence>
281
+ <xsd:element name="nma_id_attr" type="xsd:string" />
282
+ <xsd:element name="nma_desc" type="xsd:string" />
283
+ <xsd:element name="status" type="xsd:string" />
284
+
285
+ </xsd:sequence>
286
+ </xsd:complexType>
287
+ <xsd:complexType name="anymarketAnymarketattributesInfoEntity">
288
+ <xsd:sequence>
289
+ <xsd:element name="entity_id" type="xsd:string" />
290
+ <xsd:element name="nma_id_attr" type="xsd:string" />
291
+ <xsd:element name="nma_desc" type="xsd:string" />
292
+ <xsd:element name="status" type="xsd:string" />
293
+
294
+ <xsd:element name="created_at" type="xsd:string" />
295
+ <xsd:element name="updated_at" type="xsd:string" />
296
+ </xsd:sequence>
297
+ </xsd:complexType>
298
+
299
+ <xsd:element name="anymarketAnymarketattributesListRequestParam">
300
+ <xsd:complexType>
301
+ <xsd:sequence>
302
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
303
+ <xsd:element minOccurs="0" maxOccurs="1" name="filters" type="typens:filters" />
304
+ </xsd:sequence>
305
+ </xsd:complexType>
306
+ </xsd:element>
307
+ <xsd:element name="anymarketAnymarketattributesListResponseParam">
308
+ <xsd:complexType>
309
+ <xsd:sequence>
310
+ <xsd:element minOccurs="0" maxOccurs="1" name="result" type="typens:anymarketAnymarketattributesEntityArray" />
311
+ </xsd:sequence>
312
+ </xsd:complexType>
313
+ </xsd:element>
314
+ <xsd:element name="anymarketAnymarketattributesInfoRequestParam">
315
+ <xsd:complexType>
316
+ <xsd:sequence>
317
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
318
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketattributesId" type="xsd:string" />
319
+ </xsd:sequence>
320
+ </xsd:complexType>
321
+ </xsd:element>
322
+ <xsd:element name="anymarketAnymarketattributesInfoResponseParam">
323
+ <xsd:complexType>
324
+ <xsd:sequence>
325
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:anymarketAnymarketattributesInfoEntity" />
326
+ </xsd:sequence>
327
+ </xsd:complexType>
328
+ </xsd:element>
329
+ <xsd:element name="anymarketAnymarketattributesAddRequestParam">
330
+ <xsd:complexType>
331
+ <xsd:sequence>
332
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
333
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketattributesAddEntity" />
334
+ </xsd:sequence>
335
+ </xsd:complexType>
336
+ </xsd:element>
337
+ <xsd:element name="anymarketAnymarketattributesAddResponseParam">
338
+ <xsd:complexType>
339
+ <xsd:sequence>
340
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:int" />
341
+ </xsd:sequence>
342
+ </xsd:complexType>
343
+ </xsd:element>
344
+ <xsd:element name="anymarketAnymarketattributesUpdateRequestParam">
345
+ <xsd:complexType>
346
+ <xsd:sequence>
347
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
348
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketattributesId" type="xsd:string" />
349
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketattributesUpdateEntity" />
350
+ </xsd:sequence>
351
+ </xsd:complexType>
352
+ </xsd:element>
353
+ <xsd:element name="anymarketAnymarketattributesUpdateResponseParam">
354
+ <xsd:complexType>
355
+ <xsd:sequence>
356
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
357
+ </xsd:sequence>
358
+ </xsd:complexType>
359
+ </xsd:element>
360
+ <xsd:element name="anymarketAnymarketattributesRemoveRequestParam">
361
+ <xsd:complexType>
362
+ <xsd:sequence>
363
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
364
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketattributesId" type="xsd:string" />
365
+ </xsd:sequence>
366
+ </xsd:complexType>
367
+ </xsd:element>
368
+ <xsd:element name="anymarketAnymarketattributesRemoveResponseParam">
369
+ <xsd:complexType>
370
+ <xsd:sequence>
371
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
372
+ </xsd:sequence>
373
+ </xsd:complexType>
374
+ </xsd:element>
375
+ <xsd:complexType name="anymarketAnymarketordersEntityArray">
376
+ <xsd:sequence>
377
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:anymarketAnymarketordersEntity" />
378
+ </xsd:sequence>
379
+ </xsd:complexType>
380
+ <xsd:complexType name="anymarketAnymarketordersEntity">
381
+ <xsd:sequence>
382
+ <xsd:element name="entity_id" type="xsd:string" />
383
+ <xsd:element name="nmo_id_anymarket" type="xsd:string" />
384
+ <xsd:element name="nmo_id_order" type="xsd:string" />
385
+ <xsd:element name="status" type="xsd:string" />
386
+
387
+ <xsd:element name="created_at" type="xsd:string" />
388
+ <xsd:element name="updated_at" type="xsd:string" />
389
+ </xsd:sequence>
390
+ </xsd:complexType>
391
+ <xsd:complexType name="anymarketAnymarketordersAddEntity">
392
+ <xsd:sequence>
393
+ <xsd:element name="nmo_id_anymarket" type="xsd:string" />
394
+ <xsd:element name="nmo_id_order" type="xsd:string" />
395
+ <xsd:element name="status" type="xsd:string" />
396
+
397
+ </xsd:sequence>
398
+ </xsd:complexType>
399
+ <xsd:complexType name="anymarketAnymarketordersUpdateEntity">
400
+ <xsd:sequence>
401
+ <xsd:element name="nmo_id_anymarket" type="xsd:string" />
402
+ <xsd:element name="nmo_id_order" type="xsd:string" />
403
+ <xsd:element name="status" type="xsd:string" />
404
+
405
+ </xsd:sequence>
406
+ </xsd:complexType>
407
+ <xsd:complexType name="anymarketAnymarketordersInfoEntity">
408
+ <xsd:sequence>
409
+ <xsd:element name="entity_id" type="xsd:string" />
410
+ <xsd:element name="nmo_id_anymarket" type="xsd:string" />
411
+ <xsd:element name="nmo_id_order" type="xsd:string" />
412
+ <xsd:element name="status" type="xsd:string" />
413
+
414
+ <xsd:element name="created_at" type="xsd:string" />
415
+ <xsd:element name="updated_at" type="xsd:string" />
416
+ </xsd:sequence>
417
+ </xsd:complexType>
418
+
419
+ <xsd:element name="anymarketAnymarketordersListRequestParam">
420
+ <xsd:complexType>
421
+ <xsd:sequence>
422
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
423
+ <xsd:element minOccurs="0" maxOccurs="1" name="filters" type="typens:filters" />
424
+ </xsd:sequence>
425
+ </xsd:complexType>
426
+ </xsd:element>
427
+ <xsd:element name="anymarketAnymarketordersListResponseParam">
428
+ <xsd:complexType>
429
+ <xsd:sequence>
430
+ <xsd:element minOccurs="0" maxOccurs="1" name="result" type="typens:anymarketAnymarketordersEntityArray" />
431
+ </xsd:sequence>
432
+ </xsd:complexType>
433
+ </xsd:element>
434
+ <xsd:element name="anymarketAnymarketordersInfoRequestParam">
435
+ <xsd:complexType>
436
+ <xsd:sequence>
437
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
438
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketordersId" type="xsd:string" />
439
+ </xsd:sequence>
440
+ </xsd:complexType>
441
+ </xsd:element>
442
+ <xsd:element name="anymarketAnymarketordersInfoResponseParam">
443
+ <xsd:complexType>
444
+ <xsd:sequence>
445
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:anymarketAnymarketordersInfoEntity" />
446
+ </xsd:sequence>
447
+ </xsd:complexType>
448
+ </xsd:element>
449
+ <xsd:element name="anymarketAnymarketordersAddRequestParam">
450
+ <xsd:complexType>
451
+ <xsd:sequence>
452
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
453
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketordersAddEntity" />
454
+ </xsd:sequence>
455
+ </xsd:complexType>
456
+ </xsd:element>
457
+ <xsd:element name="anymarketAnymarketordersAddResponseParam">
458
+ <xsd:complexType>
459
+ <xsd:sequence>
460
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:int" />
461
+ </xsd:sequence>
462
+ </xsd:complexType>
463
+ </xsd:element>
464
+ <xsd:element name="anymarketAnymarketordersUpdateRequestParam">
465
+ <xsd:complexType>
466
+ <xsd:sequence>
467
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
468
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketordersId" type="xsd:string" />
469
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketordersUpdateEntity" />
470
+ </xsd:sequence>
471
+ </xsd:complexType>
472
+ </xsd:element>
473
+ <xsd:element name="anymarketAnymarketordersUpdateResponseParam">
474
+ <xsd:complexType>
475
+ <xsd:sequence>
476
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
477
+ </xsd:sequence>
478
+ </xsd:complexType>
479
+ </xsd:element>
480
+ <xsd:element name="anymarketAnymarketordersRemoveRequestParam">
481
+ <xsd:complexType>
482
+ <xsd:sequence>
483
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
484
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketordersId" type="xsd:string" />
485
+ </xsd:sequence>
486
+ </xsd:complexType>
487
+ </xsd:element>
488
+ <xsd:element name="anymarketAnymarketordersRemoveResponseParam">
489
+ <xsd:complexType>
490
+ <xsd:sequence>
491
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
492
+ </xsd:sequence>
493
+ </xsd:complexType>
494
+ </xsd:element>
495
+ <xsd:complexType name="anymarketAnymarketcategoriesEntityArray">
496
+ <xsd:sequence>
497
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:anymarketAnymarketcategoriesEntity" />
498
+ </xsd:sequence>
499
+ </xsd:complexType>
500
+ <xsd:complexType name="anymarketAnymarketcategoriesEntity">
501
+ <xsd:sequence>
502
+ <xsd:element name="entity_id" type="xsd:string" />
503
+ <xsd:element name="nmc_cat_id" type="xsd:string" />
504
+ <xsd:element name="nmc_cat_root_id" type="xsd:string" />
505
+ <xsd:element name="nmc_cat_desc" type="xsd:string" />
506
+ <xsd:element name="status" type="xsd:string" />
507
+
508
+ <xsd:element name="created_at" type="xsd:string" />
509
+ <xsd:element name="updated_at" type="xsd:string" />
510
+ </xsd:sequence>
511
+ </xsd:complexType>
512
+ <xsd:complexType name="anymarketAnymarketcategoriesAddEntity">
513
+ <xsd:sequence>
514
+ <xsd:element name="nmc_cat_id" type="xsd:string" />
515
+ <xsd:element name="nmc_cat_root_id" type="xsd:string" />
516
+ <xsd:element name="nmc_cat_desc" type="xsd:string" />
517
+ <xsd:element name="status" type="xsd:string" />
518
+
519
+ </xsd:sequence>
520
+ </xsd:complexType>
521
+ <xsd:complexType name="anymarketAnymarketcategoriesUpdateEntity">
522
+ <xsd:sequence>
523
+ <xsd:element name="nmc_cat_id" type="xsd:string" />
524
+ <xsd:element name="nmc_cat_root_id" type="xsd:string" />
525
+ <xsd:element name="nmc_cat_desc" type="xsd:string" />
526
+ <xsd:element name="status" type="xsd:string" />
527
+
528
+ </xsd:sequence>
529
+ </xsd:complexType>
530
+ <xsd:complexType name="anymarketAnymarketcategoriesInfoEntity">
531
+ <xsd:sequence>
532
+ <xsd:element name="entity_id" type="xsd:string" />
533
+ <xsd:element name="nmc_cat_id" type="xsd:string" />
534
+ <xsd:element name="nmc_cat_root_id" type="xsd:string" />
535
+ <xsd:element name="nmc_cat_desc" type="xsd:string" />
536
+ <xsd:element name="status" type="xsd:string" />
537
+
538
+ <xsd:element name="created_at" type="xsd:string" />
539
+ <xsd:element name="updated_at" type="xsd:string" />
540
+ </xsd:sequence>
541
+ </xsd:complexType>
542
+
543
+ <xsd:element name="anymarketAnymarketcategoriesListRequestParam">
544
+ <xsd:complexType>
545
+ <xsd:sequence>
546
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
547
+ <xsd:element minOccurs="0" maxOccurs="1" name="filters" type="typens:filters" />
548
+ </xsd:sequence>
549
+ </xsd:complexType>
550
+ </xsd:element>
551
+ <xsd:element name="anymarketAnymarketcategoriesListResponseParam">
552
+ <xsd:complexType>
553
+ <xsd:sequence>
554
+ <xsd:element minOccurs="0" maxOccurs="1" name="result" type="typens:anymarketAnymarketcategoriesEntityArray" />
555
+ </xsd:sequence>
556
+ </xsd:complexType>
557
+ </xsd:element>
558
+ <xsd:element name="anymarketAnymarketcategoriesInfoRequestParam">
559
+ <xsd:complexType>
560
+ <xsd:sequence>
561
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
562
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketcategoriesId" type="xsd:string" />
563
+ </xsd:sequence>
564
+ </xsd:complexType>
565
+ </xsd:element>
566
+ <xsd:element name="anymarketAnymarketcategoriesInfoResponseParam">
567
+ <xsd:complexType>
568
+ <xsd:sequence>
569
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:anymarketAnymarketcategoriesInfoEntity" />
570
+ </xsd:sequence>
571
+ </xsd:complexType>
572
+ </xsd:element>
573
+ <xsd:element name="anymarketAnymarketcategoriesAddRequestParam">
574
+ <xsd:complexType>
575
+ <xsd:sequence>
576
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
577
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketcategoriesAddEntity" />
578
+ </xsd:sequence>
579
+ </xsd:complexType>
580
+ </xsd:element>
581
+ <xsd:element name="anymarketAnymarketcategoriesAddResponseParam">
582
+ <xsd:complexType>
583
+ <xsd:sequence>
584
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:int" />
585
+ </xsd:sequence>
586
+ </xsd:complexType>
587
+ </xsd:element>
588
+ <xsd:element name="anymarketAnymarketcategoriesUpdateRequestParam">
589
+ <xsd:complexType>
590
+ <xsd:sequence>
591
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
592
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketcategoriesId" type="xsd:string" />
593
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketcategoriesUpdateEntity" />
594
+ </xsd:sequence>
595
+ </xsd:complexType>
596
+ </xsd:element>
597
+ <xsd:element name="anymarketAnymarketcategoriesUpdateResponseParam">
598
+ <xsd:complexType>
599
+ <xsd:sequence>
600
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
601
+ </xsd:sequence>
602
+ </xsd:complexType>
603
+ </xsd:element>
604
+ <xsd:element name="anymarketAnymarketcategoriesRemoveRequestParam">
605
+ <xsd:complexType>
606
+ <xsd:sequence>
607
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
608
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketcategoriesId" type="xsd:string" />
609
+ </xsd:sequence>
610
+ </xsd:complexType>
611
+ </xsd:element>
612
+ <xsd:element name="anymarketAnymarketcategoriesRemoveResponseParam">
613
+ <xsd:complexType>
614
+ <xsd:sequence>
615
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
616
+ </xsd:sequence>
617
+ </xsd:complexType>
618
+ </xsd:element>
619
+
620
+ <xsd:complexType name="anymarketAnymarketqueueEntityArray">
621
+ <xsd:sequence>
622
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray" type="typens:anymarketAnymarketqueueEntity" />
623
+ </xsd:sequence>
624
+ </xsd:complexType>
625
+ <xsd:complexType name="anymarketAnymarketqueueEntity">
626
+ <xsd:sequence>
627
+ <xsd:element name="entity_id" type="xsd:string" />
628
+ <xsd:element name="nmq_id" type="xsd:string" />
629
+ <xsd:element name="nmq_type" type="xsd:string" />
630
+ <xsd:element name="nmq_table" type="xsd:string" />
631
+ <xsd:element name="status" type="xsd:string" />
632
+
633
+ <xsd:element name="created_at" type="xsd:string" />
634
+ <xsd:element name="updated_at" type="xsd:string" />
635
+ </xsd:sequence>
636
+ </xsd:complexType>
637
+ <xsd:complexType name="anymarketAnymarketqueueAddEntity">
638
+ <xsd:sequence>
639
+ <xsd:element name="nmq_id" type="xsd:string" />
640
+ <xsd:element name="nmq_type" type="xsd:string" />
641
+ <xsd:element name="nmq_table" type="xsd:string" />
642
+ <xsd:element name="status" type="xsd:string" />
643
+
644
+ </xsd:sequence>
645
+ </xsd:complexType>
646
+ <xsd:complexType name="anymarketAnymarketqueueUpdateEntity">
647
+ <xsd:sequence>
648
+ <xsd:element name="nmq_id" type="xsd:string" />
649
+ <xsd:element name="nmq_type" type="xsd:string" />
650
+ <xsd:element name="nmq_table" type="xsd:string" />
651
+ <xsd:element name="status" type="xsd:string" />
652
+
653
+ </xsd:sequence>
654
+ </xsd:complexType>
655
+ <xsd:complexType name="anymarketAnymarketqueueInfoEntity">
656
+ <xsd:sequence>
657
+ <xsd:element name="entity_id" type="xsd:string" />
658
+ <xsd:element name="nmq_id" type="xsd:string" />
659
+ <xsd:element name="nmq_type" type="xsd:string" />
660
+ <xsd:element name="nmq_table" type="xsd:string" />
661
+ <xsd:element name="status" type="xsd:string" />
662
+
663
+ <xsd:element name="created_at" type="xsd:string" />
664
+ <xsd:element name="updated_at" type="xsd:string" />
665
+ </xsd:sequence>
666
+ </xsd:complexType>
667
+
668
+ <xsd:element name="anymarketAnymarketqueueListRequestParam">
669
+ <xsd:complexType>
670
+ <xsd:sequence>
671
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
672
+ <xsd:element minOccurs="0" maxOccurs="1" name="filters" type="typens:filters" />
673
+ </xsd:sequence>
674
+ </xsd:complexType>
675
+ </xsd:element>
676
+ <xsd:element name="anymarketAnymarketqueueListResponseParam">
677
+ <xsd:complexType>
678
+ <xsd:sequence>
679
+ <xsd:element minOccurs="0" maxOccurs="1" name="result" type="typens:anymarketAnymarketqueueEntityArray" />
680
+ </xsd:sequence>
681
+ </xsd:complexType>
682
+ </xsd:element>
683
+ <xsd:element name="anymarketAnymarketqueueInfoRequestParam">
684
+ <xsd:complexType>
685
+ <xsd:sequence>
686
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
687
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketqueueId" type="xsd:string" />
688
+ </xsd:sequence>
689
+ </xsd:complexType>
690
+ </xsd:element>
691
+ <xsd:element name="anymarketAnymarketqueueInfoResponseParam">
692
+ <xsd:complexType>
693
+ <xsd:sequence>
694
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="typens:anymarketAnymarketqueueInfoEntity" />
695
+ </xsd:sequence>
696
+ </xsd:complexType>
697
+ </xsd:element>
698
+ <xsd:element name="anymarketAnymarketqueueAddRequestParam">
699
+ <xsd:complexType>
700
+ <xsd:sequence>
701
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
702
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketqueueAddEntity" />
703
+ </xsd:sequence>
704
+ </xsd:complexType>
705
+ </xsd:element>
706
+ <xsd:element name="anymarketAnymarketqueueAddResponseParam">
707
+ <xsd:complexType>
708
+ <xsd:sequence>
709
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:int" />
710
+ </xsd:sequence>
711
+ </xsd:complexType>
712
+ </xsd:element>
713
+ <xsd:element name="anymarketAnymarketqueueUpdateRequestParam">
714
+ <xsd:complexType>
715
+ <xsd:sequence>
716
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
717
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketqueueId" type="xsd:string" />
718
+ <xsd:element minOccurs="1" maxOccurs="1" name="data" type="typens:anymarketAnymarketqueueUpdateEntity" />
719
+ </xsd:sequence>
720
+ </xsd:complexType>
721
+ </xsd:element>
722
+ <xsd:element name="anymarketAnymarketqueueUpdateResponseParam">
723
+ <xsd:complexType>
724
+ <xsd:sequence>
725
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
726
+ </xsd:sequence>
727
+ </xsd:complexType>
728
+ </xsd:element>
729
+ <xsd:element name="anymarketAnymarketqueueRemoveRequestParam">
730
+ <xsd:complexType>
731
+ <xsd:sequence>
732
+ <xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
733
+ <xsd:element minOccurs="1" maxOccurs="1" name="anymarketqueueId" type="xsd:string" />
734
+ </xsd:sequence>
735
+ </xsd:complexType>
736
+ </xsd:element>
737
+ <xsd:element name="anymarketAnymarketqueueRemoveResponseParam">
738
+ <xsd:complexType>
739
+ <xsd:sequence>
740
+ <xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />
741
+ </xsd:sequence>
742
+ </xsd:complexType>
743
+ </xsd:element>
744
+
745
+ </xsd:schema>
746
+ </wsdl:types>
747
+ <wsdl:message name="anymarketAnymarketlogListRequest">
748
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogListRequestParam" />
749
+ </wsdl:message>
750
+ <wsdl:message name="anymarketAnymarketlogListResponse">
751
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogListResponseParam" />
752
+ </wsdl:message>
753
+ <wsdl:message name="anymarketAnymarketlogInfoRequest">
754
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogInfoRequestParam" />
755
+ </wsdl:message>
756
+ <wsdl:message name="anymarketAnymarketlogInfoResponse">
757
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogInfoResponseParam" />
758
+ </wsdl:message>
759
+ <wsdl:message name="anymarketAnymarketlogAddRequest">
760
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogAddRequestParam" />
761
+ </wsdl:message>
762
+ <wsdl:message name="anymarketAnymarketlogAddResponse">
763
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogAddResponseParam"/>
764
+ </wsdl:message>
765
+ <wsdl:message name="anymarketAnymarketlogUpdateRequest">
766
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogUpdateRequestParam" />
767
+ </wsdl:message>
768
+ <wsdl:message name="anymarketAnymarketlogUpdateResponse">
769
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogUpdateResponseParam"/>
770
+ </wsdl:message>
771
+ <wsdl:message name="anymarketAnymarketlogRemoveRequest">
772
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogRemoveRequestParam" />
773
+ </wsdl:message>
774
+ <wsdl:message name="anymarketAnymarketlogRemoveResponse">
775
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketlogRemoveResponseParam" />
776
+ </wsdl:message>
777
+ <wsdl:message name="anymarketAnymarketproductsListRequest">
778
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsListRequestParam" />
779
+ </wsdl:message>
780
+ <wsdl:message name="anymarketAnymarketproductsListResponse">
781
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsListResponseParam" />
782
+ </wsdl:message>
783
+ <wsdl:message name="anymarketAnymarketproductsInfoRequest">
784
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsInfoRequestParam" />
785
+ </wsdl:message>
786
+ <wsdl:message name="anymarketAnymarketproductsInfoResponse">
787
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsInfoResponseParam" />
788
+ </wsdl:message>
789
+ <wsdl:message name="anymarketAnymarketproductsAddRequest">
790
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsAddRequestParam" />
791
+ </wsdl:message>
792
+ <wsdl:message name="anymarketAnymarketproductsAddResponse">
793
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsAddResponseParam"/>
794
+ </wsdl:message>
795
+ <wsdl:message name="anymarketAnymarketproductsUpdateRequest">
796
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsUpdateRequestParam" />
797
+ </wsdl:message>
798
+ <wsdl:message name="anymarketAnymarketproductsUpdateResponse">
799
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsUpdateResponseParam"/>
800
+ </wsdl:message>
801
+ <wsdl:message name="anymarketAnymarketproductsRemoveRequest">
802
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsRemoveRequestParam" />
803
+ </wsdl:message>
804
+ <wsdl:message name="anymarketAnymarketproductsRemoveResponse">
805
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketproductsRemoveResponseParam" />
806
+ </wsdl:message>
807
+ <wsdl:message name="anymarketAnymarketattributesListRequest">
808
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesListRequestParam" />
809
+ </wsdl:message>
810
+ <wsdl:message name="anymarketAnymarketattributesListResponse">
811
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesListResponseParam" />
812
+ </wsdl:message>
813
+ <wsdl:message name="anymarketAnymarketattributesInfoRequest">
814
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesInfoRequestParam" />
815
+ </wsdl:message>
816
+ <wsdl:message name="anymarketAnymarketattributesInfoResponse">
817
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesInfoResponseParam" />
818
+ </wsdl:message>
819
+ <wsdl:message name="anymarketAnymarketattributesAddRequest">
820
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesAddRequestParam" />
821
+ </wsdl:message>
822
+ <wsdl:message name="anymarketAnymarketattributesAddResponse">
823
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesAddResponseParam"/>
824
+ </wsdl:message>
825
+ <wsdl:message name="anymarketAnymarketattributesUpdateRequest">
826
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesUpdateRequestParam" />
827
+ </wsdl:message>
828
+ <wsdl:message name="anymarketAnymarketattributesUpdateResponse">
829
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesUpdateResponseParam"/>
830
+ </wsdl:message>
831
+ <wsdl:message name="anymarketAnymarketattributesRemoveRequest">
832
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesRemoveRequestParam" />
833
+ </wsdl:message>
834
+ <wsdl:message name="anymarketAnymarketattributesRemoveResponse">
835
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketattributesRemoveResponseParam" />
836
+ </wsdl:message>
837
+ <wsdl:message name="anymarketAnymarketordersListRequest">
838
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersListRequestParam" />
839
+ </wsdl:message>
840
+ <wsdl:message name="anymarketAnymarketordersListResponse">
841
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersListResponseParam" />
842
+ </wsdl:message>
843
+ <wsdl:message name="anymarketAnymarketordersInfoRequest">
844
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersInfoRequestParam" />
845
+ </wsdl:message>
846
+ <wsdl:message name="anymarketAnymarketordersInfoResponse">
847
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersInfoResponseParam" />
848
+ </wsdl:message>
849
+ <wsdl:message name="anymarketAnymarketordersAddRequest">
850
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersAddRequestParam" />
851
+ </wsdl:message>
852
+ <wsdl:message name="anymarketAnymarketordersAddResponse">
853
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersAddResponseParam"/>
854
+ </wsdl:message>
855
+ <wsdl:message name="anymarketAnymarketordersUpdateRequest">
856
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersUpdateRequestParam" />
857
+ </wsdl:message>
858
+ <wsdl:message name="anymarketAnymarketordersUpdateResponse">
859
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersUpdateResponseParam"/>
860
+ </wsdl:message>
861
+ <wsdl:message name="anymarketAnymarketordersRemoveRequest">
862
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersRemoveRequestParam" />
863
+ </wsdl:message>
864
+ <wsdl:message name="anymarketAnymarketordersRemoveResponse">
865
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketordersRemoveResponseParam" />
866
+ </wsdl:message>
867
+ <wsdl:message name="anymarketAnymarketcategoriesListRequest">
868
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesListRequestParam" />
869
+ </wsdl:message>
870
+ <wsdl:message name="anymarketAnymarketcategoriesListResponse">
871
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesListResponseParam" />
872
+ </wsdl:message>
873
+ <wsdl:message name="anymarketAnymarketcategoriesInfoRequest">
874
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesInfoRequestParam" />
875
+ </wsdl:message>
876
+ <wsdl:message name="anymarketAnymarketcategoriesInfoResponse">
877
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesInfoResponseParam" />
878
+ </wsdl:message>
879
+ <wsdl:message name="anymarketAnymarketcategoriesAddRequest">
880
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesAddRequestParam" />
881
+ </wsdl:message>
882
+ <wsdl:message name="anymarketAnymarketcategoriesAddResponse">
883
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesAddResponseParam"/>
884
+ </wsdl:message>
885
+ <wsdl:message name="anymarketAnymarketcategoriesUpdateRequest">
886
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesUpdateRequestParam" />
887
+ </wsdl:message>
888
+ <wsdl:message name="anymarketAnymarketcategoriesUpdateResponse">
889
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesUpdateResponseParam"/>
890
+ </wsdl:message>
891
+ <wsdl:message name="anymarketAnymarketcategoriesRemoveRequest">
892
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesRemoveRequestParam" />
893
+ </wsdl:message>
894
+ <wsdl:message name="anymarketAnymarketcategoriesRemoveResponse">
895
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketcategoriesRemoveResponseParam" />
896
+ </wsdl:message>
897
+ <wsdl:message name="anymarketAnymarketqueueListRequest">
898
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueListRequestParam" />
899
+ </wsdl:message>
900
+ <wsdl:message name="anymarketAnymarketqueueListResponse">
901
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueListResponseParam" />
902
+ </wsdl:message>
903
+ <wsdl:message name="anymarketAnymarketqueueInfoRequest">
904
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueInfoRequestParam" />
905
+ </wsdl:message>
906
+ <wsdl:message name="anymarketAnymarketqueueInfoResponse">
907
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueInfoResponseParam" />
908
+ </wsdl:message>
909
+ <wsdl:message name="anymarketAnymarketqueueAddRequest">
910
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueAddRequestParam" />
911
+ </wsdl:message>
912
+ <wsdl:message name="anymarketAnymarketqueueAddResponse">
913
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueAddResponseParam"/>
914
+ </wsdl:message>
915
+ <wsdl:message name="anymarketAnymarketqueueUpdateRequest">
916
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueUpdateRequestParam" />
917
+ </wsdl:message>
918
+ <wsdl:message name="anymarketAnymarketqueueUpdateResponse">
919
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueUpdateResponseParam"/>
920
+ </wsdl:message>
921
+ <wsdl:message name="anymarketAnymarketqueueRemoveRequest">
922
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueRemoveRequestParam" />
923
+ </wsdl:message>
924
+ <wsdl:message name="anymarketAnymarketqueueRemoveResponse">
925
+ <wsdl:part name="parameters" element="typens:anymarketAnymarketqueueRemoveResponseParam" />
926
+ </wsdl:message>
927
+ <wsdl:portType name="{{var wsdl.handler}}PortType">
928
+ <wsdl:operation name="anymarketAnymarketlogList">
929
+ <wsdl:documentation>Retrieve list of anymarket log</wsdl:documentation>
930
+ <wsdl:input message="typens:anymarketAnymarketlogListRequest" />
931
+ <wsdl:output message="typens:anymarketAnymarketlogListResponse" />
932
+ </wsdl:operation>
933
+ <wsdl:operation name="anymarketAnymarketlogInfo">
934
+ <wsdl:documentation>Retrieve anymarket log info</wsdl:documentation>
935
+ <wsdl:input message="typens:anymarketAnymarketlogInfoRequest" />
936
+ <wsdl:output message="typens:anymarketAnymarketlogInfoResponse" />
937
+ </wsdl:operation>
938
+ <wsdl:operation name="anymarketAnymarketlogAdd">
939
+ <wsdl:documentation>Add anymarket log</wsdl:documentation>
940
+ <wsdl:input message="typens:anymarketAnymarketlogAddRequest" />
941
+ <wsdl:output message="typens:anymarketAnymarketlogAddResponse" />
942
+ </wsdl:operation>
943
+ <wsdl:operation name="anymarketAnymarketlogUpdate">
944
+ <wsdl:documentation>Update anymarket log</wsdl:documentation>
945
+ <wsdl:input message="typens:anymarketAnymarketlogUpdateRequest" />
946
+ <wsdl:output message="typens:anymarketAnymarketlogUpdateResponse" />
947
+ </wsdl:operation>
948
+ <wsdl:operation name="anymarketAnymarketlogRemove">
949
+ <wsdl:documentation>Remove anymarket log</wsdl:documentation>
950
+ <wsdl:input message="typens:anymarketAnymarketlogRemoveRequest" />
951
+ <wsdl:output message="typens:anymarketAnymarketlogRemoveResponse" />
952
+ </wsdl:operation>
953
+ <wsdl:operation name="anymarketAnymarketproductsList">
954
+ <wsdl:documentation>Retrieve list of anymarket products</wsdl:documentation>
955
+ <wsdl:input message="typens:anymarketAnymarketproductsListRequest" />
956
+ <wsdl:output message="typens:anymarketAnymarketproductsListResponse" />
957
+ </wsdl:operation>
958
+ <wsdl:operation name="anymarketAnymarketproductsInfo">
959
+ <wsdl:documentation>Retrieve anymarket products info</wsdl:documentation>
960
+ <wsdl:input message="typens:anymarketAnymarketproductsInfoRequest" />
961
+ <wsdl:output message="typens:anymarketAnymarketproductsInfoResponse" />
962
+ </wsdl:operation>
963
+ <wsdl:operation name="anymarketAnymarketproductsAdd">
964
+ <wsdl:documentation>Add anymarket products</wsdl:documentation>
965
+ <wsdl:input message="typens:anymarketAnymarketproductsAddRequest" />
966
+ <wsdl:output message="typens:anymarketAnymarketproductsAddResponse" />
967
+ </wsdl:operation>
968
+ <wsdl:operation name="anymarketAnymarketproductsUpdate">
969
+ <wsdl:documentation>Update anymarket products</wsdl:documentation>
970
+ <wsdl:input message="typens:anymarketAnymarketproductsUpdateRequest" />
971
+ <wsdl:output message="typens:anymarketAnymarketproductsUpdateResponse" />
972
+ </wsdl:operation>
973
+ <wsdl:operation name="anymarketAnymarketproductsRemove">
974
+ <wsdl:documentation>Remove anymarket products</wsdl:documentation>
975
+ <wsdl:input message="typens:anymarketAnymarketproductsRemoveRequest" />
976
+ <wsdl:output message="typens:anymarketAnymarketproductsRemoveResponse" />
977
+ </wsdl:operation>
978
+ <wsdl:operation name="anymarketAnymarketattributesList">
979
+ <wsdl:documentation>Retrieve list of anymarket attributes</wsdl:documentation>
980
+ <wsdl:input message="typens:anymarketAnymarketattributesListRequest" />
981
+ <wsdl:output message="typens:anymarketAnymarketattributesListResponse" />
982
+ </wsdl:operation>
983
+ <wsdl:operation name="anymarketAnymarketattributesInfo">
984
+ <wsdl:documentation>Retrieve anymarket attributes info</wsdl:documentation>
985
+ <wsdl:input message="typens:anymarketAnymarketattributesInfoRequest" />
986
+ <wsdl:output message="typens:anymarketAnymarketattributesInfoResponse" />
987
+ </wsdl:operation>
988
+ <wsdl:operation name="anymarketAnymarketattributesAdd">
989
+ <wsdl:documentation>Add anymarket attributes</wsdl:documentation>
990
+ <wsdl:input message="typens:anymarketAnymarketattributesAddRequest" />
991
+ <wsdl:output message="typens:anymarketAnymarketattributesAddResponse" />
992
+ </wsdl:operation>
993
+ <wsdl:operation name="anymarketAnymarketattributesUpdate">
994
+ <wsdl:documentation>Update anymarket attributes</wsdl:documentation>
995
+ <wsdl:input message="typens:anymarketAnymarketattributesUpdateRequest" />
996
+ <wsdl:output message="typens:anymarketAnymarketattributesUpdateResponse" />
997
+ </wsdl:operation>
998
+ <wsdl:operation name="anymarketAnymarketattributesRemove">
999
+ <wsdl:documentation>Remove anymarket attributes</wsdl:documentation>
1000
+ <wsdl:input message="typens:anymarketAnymarketattributesRemoveRequest" />
1001
+ <wsdl:output message="typens:anymarketAnymarketattributesRemoveResponse" />
1002
+ </wsdl:operation>
1003
+ <wsdl:operation name="anymarketAnymarketordersList">
1004
+ <wsdl:documentation>Retrieve list of anymarket orders</wsdl:documentation>
1005
+ <wsdl:input message="typens:anymarketAnymarketordersListRequest" />
1006
+ <wsdl:output message="typens:anymarketAnymarketordersListResponse" />
1007
+ </wsdl:operation>
1008
+ <wsdl:operation name="anymarketAnymarketordersInfo">
1009
+ <wsdl:documentation>Retrieve anymarket orders info</wsdl:documentation>
1010
+ <wsdl:input message="typens:anymarketAnymarketordersInfoRequest" />
1011
+ <wsdl:output message="typens:anymarketAnymarketordersInfoResponse" />
1012
+ </wsdl:operation>
1013
+ <wsdl:operation name="anymarketAnymarketordersAdd">
1014
+ <wsdl:documentation>Add anymarket orders</wsdl:documentation>
1015
+ <wsdl:input message="typens:anymarketAnymarketordersAddRequest" />
1016
+ <wsdl:output message="typens:anymarketAnymarketordersAddResponse" />
1017
+ </wsdl:operation>
1018
+ <wsdl:operation name="anymarketAnymarketordersUpdate">
1019
+ <wsdl:documentation>Update anymarket orders</wsdl:documentation>
1020
+ <wsdl:input message="typens:anymarketAnymarketordersUpdateRequest" />
1021
+ <wsdl:output message="typens:anymarketAnymarketordersUpdateResponse" />
1022
+ </wsdl:operation>
1023
+ <wsdl:operation name="anymarketAnymarketordersRemove">
1024
+ <wsdl:documentation>Remove anymarket orders</wsdl:documentation>
1025
+ <wsdl:input message="typens:anymarketAnymarketordersRemoveRequest" />
1026
+ <wsdl:output message="typens:anymarketAnymarketordersRemoveResponse" />
1027
+ </wsdl:operation>
1028
+ <wsdl:operation name="anymarketAnymarketcategoriesList">
1029
+ <wsdl:documentation>Retrieve list of anymarket categories</wsdl:documentation>
1030
+ <wsdl:input message="typens:anymarketAnymarketcategoriesListRequest" />
1031
+ <wsdl:output message="typens:anymarketAnymarketcategoriesListResponse" />
1032
+ </wsdl:operation>
1033
+ <wsdl:operation name="anymarketAnymarketcategoriesInfo">
1034
+ <wsdl:documentation>Retrieve anymarket categories info</wsdl:documentation>
1035
+ <wsdl:input message="typens:anymarketAnymarketcategoriesInfoRequest" />
1036
+ <wsdl:output message="typens:anymarketAnymarketcategoriesInfoResponse" />
1037
+ </wsdl:operation>
1038
+ <wsdl:operation name="anymarketAnymarketcategoriesAdd">
1039
+ <wsdl:documentation>Add anymarket categories</wsdl:documentation>
1040
+ <wsdl:input message="typens:anymarketAnymarketcategoriesAddRequest" />
1041
+ <wsdl:output message="typens:anymarketAnymarketcategoriesAddResponse" />
1042
+ </wsdl:operation>
1043
+ <wsdl:operation name="anymarketAnymarketcategoriesUpdate">
1044
+ <wsdl:documentation>Update anymarket categories</wsdl:documentation>
1045
+ <wsdl:input message="typens:anymarketAnymarketcategoriesUpdateRequest" />
1046
+ <wsdl:output message="typens:anymarketAnymarketcategoriesUpdateResponse" />
1047
+ </wsdl:operation>
1048
+ <wsdl:operation name="anymarketAnymarketcategoriesRemove">
1049
+ <wsdl:documentation>Remove anymarket categories</wsdl:documentation>
1050
+ <wsdl:input message="typens:anymarketAnymarketcategoriesRemoveRequest" />
1051
+ <wsdl:output message="typens:anymarketAnymarketcategoriesRemoveResponse" />
1052
+ </wsdl:operation>
1053
+ <wsdl:operation name="anymarketAnymarketqueueList">
1054
+ <wsdl:documentation>Retrieve list of anymarket queues</wsdl:documentation>
1055
+ <wsdl:input message="typens:anymarketAnymarketqueueListRequest" />
1056
+ <wsdl:output message="typens:anymarketAnymarketqueueListResponse" />
1057
+ </wsdl:operation>
1058
+ <wsdl:operation name="anymarketAnymarketqueueInfo">
1059
+ <wsdl:documentation>Retrieve anymarket queue info</wsdl:documentation>
1060
+ <wsdl:input message="typens:anymarketAnymarketqueueInfoRequest" />
1061
+ <wsdl:output message="typens:anymarketAnymarketqueueInfoResponse" />
1062
+ </wsdl:operation>
1063
+ <wsdl:operation name="anymarketAnymarketqueueAdd">
1064
+ <wsdl:documentation>Add anymarket queue</wsdl:documentation>
1065
+ <wsdl:input message="typens:anymarketAnymarketqueueAddRequest" />
1066
+ <wsdl:output message="typens:anymarketAnymarketqueueAddResponse" />
1067
+ </wsdl:operation>
1068
+ <wsdl:operation name="anymarketAnymarketqueueUpdate">
1069
+ <wsdl:documentation>Update anymarket queue</wsdl:documentation>
1070
+ <wsdl:input message="typens:anymarketAnymarketqueueUpdateRequest" />
1071
+ <wsdl:output message="typens:anymarketAnymarketqueueUpdateResponse" />
1072
+ </wsdl:operation>
1073
+ <wsdl:operation name="anymarketAnymarketqueueRemove">
1074
+ <wsdl:documentation>Remove anymarket queue</wsdl:documentation>
1075
+ <wsdl:input message="typens:anymarketAnymarketqueueRemoveRequest" />
1076
+ <wsdl:output message="typens:anymarketAnymarketqueueRemoveResponse" />
1077
+ </wsdl:operation>
1078
+ </wsdl:portType>
1079
+ <wsdl:binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
1080
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
1081
+ <wsdl:operation name="anymarketAnymarketlogList">
1082
+ <soap:operation soapAction="" />
1083
+ <wsdl:input>
1084
+ <soap:body use="literal" />
1085
+ </wsdl:input>
1086
+ <wsdl:output>
1087
+ <soap:body use="literal" />
1088
+ </wsdl:output>
1089
+ </wsdl:operation>
1090
+ <wsdl:operation name="anymarketAnymarketlogInfo">
1091
+ <soap:operation soapAction="" />
1092
+ <wsdl:input>
1093
+ <soap:body use="literal" />
1094
+ </wsdl:input>
1095
+ <wsdl:output>
1096
+ <soap:body use="literal" />
1097
+ </wsdl:output>
1098
+ </wsdl:operation>
1099
+ <wsdl:operation name="anymarketAnymarketlogAdd">
1100
+ <soap:operation soapAction="" />
1101
+ <wsdl:input>
1102
+ <soap:body use="literal" />
1103
+ </wsdl:input>
1104
+ <wsdl:output>
1105
+ <soap:body use="literal" />
1106
+ </wsdl:output>
1107
+ </wsdl:operation>
1108
+ <wsdl:operation name="anymarketAnymarketlogUpdate">
1109
+ <soap:operation soapAction="" />
1110
+ <wsdl:input>
1111
+ <soap:body use="literal" />
1112
+ </wsdl:input>
1113
+ <wsdl:output>
1114
+ <soap:body use="literal" />
1115
+ </wsdl:output>
1116
+ </wsdl:operation>
1117
+ <wsdl:operation name="anymarketAnymarketlogRemove">
1118
+ <soap:operation soapAction="" />
1119
+ <wsdl:input>
1120
+ <soap:body use="literal" />
1121
+ </wsdl:input>
1122
+ <wsdl:output>
1123
+ <soap:body use="literal" />
1124
+ </wsdl:output>
1125
+ </wsdl:operation>
1126
+ <wsdl:operation name="anymarketAnymarketproductsList">
1127
+ <soap:operation soapAction="" />
1128
+ <wsdl:input>
1129
+ <soap:body use="literal" />
1130
+ </wsdl:input>
1131
+ <wsdl:output>
1132
+ <soap:body use="literal" />
1133
+ </wsdl:output>
1134
+ </wsdl:operation>
1135
+ <wsdl:operation name="anymarketAnymarketproductsInfo">
1136
+ <soap:operation soapAction="" />
1137
+ <wsdl:input>
1138
+ <soap:body use="literal" />
1139
+ </wsdl:input>
1140
+ <wsdl:output>
1141
+ <soap:body use="literal" />
1142
+ </wsdl:output>
1143
+ </wsdl:operation>
1144
+ <wsdl:operation name="anymarketAnymarketproductsAdd">
1145
+ <soap:operation soapAction="" />
1146
+ <wsdl:input>
1147
+ <soap:body use="literal" />
1148
+ </wsdl:input>
1149
+ <wsdl:output>
1150
+ <soap:body use="literal" />
1151
+ </wsdl:output>
1152
+ </wsdl:operation>
1153
+ <wsdl:operation name="anymarketAnymarketproductsUpdate">
1154
+ <soap:operation soapAction="" />
1155
+ <wsdl:input>
1156
+ <soap:body use="literal" />
1157
+ </wsdl:input>
1158
+ <wsdl:output>
1159
+ <soap:body use="literal" />
1160
+ </wsdl:output>
1161
+ </wsdl:operation>
1162
+ <wsdl:operation name="anymarketAnymarketproductsRemove">
1163
+ <soap:operation soapAction="" />
1164
+ <wsdl:input>
1165
+ <soap:body use="literal" />
1166
+ </wsdl:input>
1167
+ <wsdl:output>
1168
+ <soap:body use="literal" />
1169
+ </wsdl:output>
1170
+ </wsdl:operation>
1171
+ <wsdl:operation name="anymarketAnymarketattributesList">
1172
+ <soap:operation soapAction="" />
1173
+ <wsdl:input>
1174
+ <soap:body use="literal" />
1175
+ </wsdl:input>
1176
+ <wsdl:output>
1177
+ <soap:body use="literal" />
1178
+ </wsdl:output>
1179
+ </wsdl:operation>
1180
+ <wsdl:operation name="anymarketAnymarketattributesInfo">
1181
+ <soap:operation soapAction="" />
1182
+ <wsdl:input>
1183
+ <soap:body use="literal" />
1184
+ </wsdl:input>
1185
+ <wsdl:output>
1186
+ <soap:body use="literal" />
1187
+ </wsdl:output>
1188
+ </wsdl:operation>
1189
+ <wsdl:operation name="anymarketAnymarketattributesAdd">
1190
+ <soap:operation soapAction="" />
1191
+ <wsdl:input>
1192
+ <soap:body use="literal" />
1193
+ </wsdl:input>
1194
+ <wsdl:output>
1195
+ <soap:body use="literal" />
1196
+ </wsdl:output>
1197
+ </wsdl:operation>
1198
+ <wsdl:operation name="anymarketAnymarketattributesUpdate">
1199
+ <soap:operation soapAction="" />
1200
+ <wsdl:input>
1201
+ <soap:body use="literal" />
1202
+ </wsdl:input>
1203
+ <wsdl:output>
1204
+ <soap:body use="literal" />
1205
+ </wsdl:output>
1206
+ </wsdl:operation>
1207
+ <wsdl:operation name="anymarketAnymarketattributesRemove">
1208
+ <soap:operation soapAction="" />
1209
+ <wsdl:input>
1210
+ <soap:body use="literal" />
1211
+ </wsdl:input>
1212
+ <wsdl:output>
1213
+ <soap:body use="literal" />
1214
+ </wsdl:output>
1215
+ </wsdl:operation>
1216
+ <wsdl:operation name="anymarketAnymarketordersList">
1217
+ <soap:operation soapAction="" />
1218
+ <wsdl:input>
1219
+ <soap:body use="literal" />
1220
+ </wsdl:input>
1221
+ <wsdl:output>
1222
+ <soap:body use="literal" />
1223
+ </wsdl:output>
1224
+ </wsdl:operation>
1225
+ <wsdl:operation name="anymarketAnymarketordersInfo">
1226
+ <soap:operation soapAction="" />
1227
+ <wsdl:input>
1228
+ <soap:body use="literal" />
1229
+ </wsdl:input>
1230
+ <wsdl:output>
1231
+ <soap:body use="literal" />
1232
+ </wsdl:output>
1233
+ </wsdl:operation>
1234
+ <wsdl:operation name="anymarketAnymarketordersAdd">
1235
+ <soap:operation soapAction="" />
1236
+ <wsdl:input>
1237
+ <soap:body use="literal" />
1238
+ </wsdl:input>
1239
+ <wsdl:output>
1240
+ <soap:body use="literal" />
1241
+ </wsdl:output>
1242
+ </wsdl:operation>
1243
+ <wsdl:operation name="anymarketAnymarketordersUpdate">
1244
+ <soap:operation soapAction="" />
1245
+ <wsdl:input>
1246
+ <soap:body use="literal" />
1247
+ </wsdl:input>
1248
+ <wsdl:output>
1249
+ <soap:body use="literal" />
1250
+ </wsdl:output>
1251
+ </wsdl:operation>
1252
+ <wsdl:operation name="anymarketAnymarketordersRemove">
1253
+ <soap:operation soapAction="" />
1254
+ <wsdl:input>
1255
+ <soap:body use="literal" />
1256
+ </wsdl:input>
1257
+ <wsdl:output>
1258
+ <soap:body use="literal" />
1259
+ </wsdl:output>
1260
+ </wsdl:operation>
1261
+ <wsdl:operation name="anymarketAnymarketcategoriesList">
1262
+ <soap:operation soapAction="" />
1263
+ <wsdl:input>
1264
+ <soap:body use="literal" />
1265
+ </wsdl:input>
1266
+ <wsdl:output>
1267
+ <soap:body use="literal" />
1268
+ </wsdl:output>
1269
+ </wsdl:operation>
1270
+ <wsdl:operation name="anymarketAnymarketcategoriesInfo">
1271
+ <soap:operation soapAction="" />
1272
+ <wsdl:input>
1273
+ <soap:body use="literal" />
1274
+ </wsdl:input>
1275
+ <wsdl:output>
1276
+ <soap:body use="literal" />
1277
+ </wsdl:output>
1278
+ </wsdl:operation>
1279
+ <wsdl:operation name="anymarketAnymarketcategoriesAdd">
1280
+ <soap:operation soapAction="" />
1281
+ <wsdl:input>
1282
+ <soap:body use="literal" />
1283
+ </wsdl:input>
1284
+ <wsdl:output>
1285
+ <soap:body use="literal" />
1286
+ </wsdl:output>
1287
+ </wsdl:operation>
1288
+ <wsdl:operation name="anymarketAnymarketcategoriesUpdate">
1289
+ <soap:operation soapAction="" />
1290
+ <wsdl:input>
1291
+ <soap:body use="literal" />
1292
+ </wsdl:input>
1293
+ <wsdl:output>
1294
+ <soap:body use="literal" />
1295
+ </wsdl:output>
1296
+ </wsdl:operation>
1297
+ <wsdl:operation name="anymarketAnymarketcategoriesRemove">
1298
+ <soap:operation soapAction="" />
1299
+ <wsdl:input>
1300
+ <soap:body use="literal" />
1301
+ </wsdl:input>
1302
+ <wsdl:output>
1303
+ <soap:body use="literal" />
1304
+ </wsdl:output>
1305
+ </wsdl:operation>
1306
+ <wsdl:operation name="anymarketAnymarketqueueList">
1307
+ <soap:operation soapAction="" />
1308
+ <wsdl:input>
1309
+ <soap:body use="literal" />
1310
+ </wsdl:input>
1311
+ <wsdl:output>
1312
+ <soap:body use="literal" />
1313
+ </wsdl:output>
1314
+ </wsdl:operation>
1315
+ <wsdl:operation name="anymarketAnymarketqueueInfo">
1316
+ <soap:operation soapAction="" />
1317
+ <wsdl:input>
1318
+ <soap:body use="literal" />
1319
+ </wsdl:input>
1320
+ <wsdl:output>
1321
+ <soap:body use="literal" />
1322
+ </wsdl:output>
1323
+ </wsdl:operation>
1324
+ <wsdl:operation name="anymarketAnymarketqueueAdd">
1325
+ <soap:operation soapAction="" />
1326
+ <wsdl:input>
1327
+ <soap:body use="literal" />
1328
+ </wsdl:input>
1329
+ <wsdl:output>
1330
+ <soap:body use="literal" />
1331
+ </wsdl:output>
1332
+ </wsdl:operation>
1333
+ <wsdl:operation name="anymarketAnymarketqueueUpdate">
1334
+ <soap:operation soapAction="" />
1335
+ <wsdl:input>
1336
+ <soap:body use="literal" />
1337
+ </wsdl:input>
1338
+ <wsdl:output>
1339
+ <soap:body use="literal" />
1340
+ </wsdl:output>
1341
+ </wsdl:operation>
1342
+ <wsdl:operation name="anymarketAnymarketqueueRemove">
1343
+ <soap:operation soapAction="" />
1344
+ <wsdl:input>
1345
+ <soap:body use="literal" />
1346
+ </wsdl:input>
1347
+ <wsdl:output>
1348
+ <soap:body use="literal" />
1349
+ </wsdl:output>
1350
+ </wsdl:operation>
1351
+ </wsdl:binding>
1352
+ <wsdl:service name="{{var wsdl.name}}Service">
1353
+ <wsdl:port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
1354
+ <soap:address location="{{var wsdl.url}}" />
1355
+ </wsdl:port>
1356
+ </wsdl:service>
1357
+ </wsdl:definitions>
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,621 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * DB1_AnyMarket extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category DB1
13
+ * @package DB1_AnyMarket
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * AnyMarket module install script
19
+ *
20
+ * @category DB1
21
+ * @package DB1_AnyMarket
22
+
23
+ */
24
+ $this->startSetup();
25
+ $table = $this->getConnection()
26
+ ->newTable($this->getTable('db1_anymarket/anymarketlog'))
27
+ ->addColumn(
28
+ 'entity_id',
29
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
30
+ null,
31
+ array(
32
+ 'identity' => true,
33
+ 'nullable' => false,
34
+ 'primary' => true,
35
+ ),
36
+ 'AnyMarket Log ID'
37
+ )
38
+ ->addColumn(
39
+ 'log_id',
40
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
41
+ array(
42
+ 'nullable' => false,
43
+ ),
44
+ 'Identificação do produto ou pedido'
45
+ )
46
+ ->addColumn(
47
+ 'log_desc',
48
+ Varien_Db_Ddl_Table::TYPE_TEXT, 500,
49
+ array(
50
+ 'nullable' => false,
51
+ ),
52
+ 'Descrição Log'
53
+ )
54
+ ->addColumn(
55
+ 'status',
56
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
57
+ array(),
58
+ 'Enabled'
59
+ )
60
+ ->addColumn(
61
+ 'updated_at',
62
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
63
+ null,
64
+ array(),
65
+ 'AnyMarket Log Modification Time'
66
+ )
67
+ ->addColumn(
68
+ 'created_at',
69
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
70
+ null,
71
+ array(),
72
+ 'AnyMarket Log Creation Time'
73
+ )
74
+ ->setComment('AnyMarket Log Table');
75
+ $this->getConnection()->createTable($table);
76
+ $table = $this->getConnection()
77
+ ->newTable($this->getTable('db1_anymarket/anymarketproducts'))
78
+ ->addColumn(
79
+ 'entity_id',
80
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
81
+ null,
82
+ array(
83
+ 'identity' => true,
84
+ 'nullable' => false,
85
+ 'primary' => true,
86
+ ),
87
+ 'Anymarket Products ID'
88
+ )
89
+ ->addColumn(
90
+ 'nmp_id',
91
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
92
+ array(
93
+ 'nullable' => false,
94
+ ),
95
+ 'ID do produto'
96
+ )
97
+ ->addColumn(
98
+ 'nmp_sku',
99
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
100
+ array(
101
+ 'nullable' => false,
102
+ ),
103
+ 'SKU do produto'
104
+ )
105
+ ->addColumn(
106
+ 'nmp_name',
107
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
108
+ array(
109
+ 'nullable' => false,
110
+ ),
111
+ 'Nome do Produto'
112
+ )
113
+ ->addColumn(
114
+ 'nmp_desc_error',
115
+ Varien_Db_Ddl_Table::TYPE_TEXT, 500,
116
+ array(
117
+ 'nullable' => false,
118
+ ),
119
+ 'Descrição do Erro'
120
+ )
121
+ ->addColumn(
122
+ 'nmp_status_int',
123
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
124
+ array(
125
+ 'nullable' => false,
126
+ ),
127
+ 'Status Integração'
128
+ )
129
+ ->addColumn(
130
+ 'status',
131
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
132
+ array(),
133
+ 'Enabled'
134
+ )
135
+ ->addColumn(
136
+ 'updated_at',
137
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
138
+ null,
139
+ array(),
140
+ 'Anymarket Products Modification Time'
141
+ )
142
+ ->addColumn(
143
+ 'created_at',
144
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
145
+ null,
146
+ array(),
147
+ 'Anymarket Products Creation Time'
148
+ )
149
+ ->setComment('Anymarket Products Table');
150
+ $this->getConnection()->createTable($table);
151
+ $table = $this->getConnection()
152
+ ->newTable($this->getTable('db1_anymarket/anymarketattributes'))
153
+ ->addColumn(
154
+ 'entity_id',
155
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
156
+ null,
157
+ array(
158
+ 'identity' => true,
159
+ 'nullable' => false,
160
+ 'primary' => true,
161
+ ),
162
+ 'Anymarket Attributes ID'
163
+ )
164
+ ->addColumn(
165
+ 'nma_id_attr',
166
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
167
+ array(
168
+ 'nullable' => false,
169
+ ),
170
+ 'Código do Atributo'
171
+ )
172
+ ->addColumn(
173
+ 'nma_desc',
174
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
175
+ array(
176
+ 'nullable' => false,
177
+ ),
178
+ 'Descrição do Atributo'
179
+ )
180
+ ->addColumn(
181
+ 'status',
182
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
183
+ array(),
184
+ 'Enabled'
185
+ )
186
+ ->addColumn(
187
+ 'updated_at',
188
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
189
+ null,
190
+ array(),
191
+ 'Anymarket Attributes Modification Time'
192
+ )
193
+ ->addColumn(
194
+ 'created_at',
195
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
196
+ null,
197
+ array(),
198
+ 'Anymarket Attributes Creation Time'
199
+ )
200
+ ->setComment('Anymarket Attributes Table');
201
+ $this->getConnection()->createTable($table);
202
+ $table = $this->getConnection()
203
+ ->newTable($this->getTable('db1_anymarket/anymarketorders'))
204
+ ->addColumn(
205
+ 'entity_id',
206
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
207
+ null,
208
+ array(
209
+ 'identity' => true,
210
+ 'nullable' => false,
211
+ 'primary' => true,
212
+ ),
213
+ 'Anymarket Orders ID'
214
+ )
215
+ ->addColumn(
216
+ 'nmo_id_anymarket',
217
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
218
+ array(
219
+ 'nullable' => false,
220
+ ),
221
+ 'Código no AnyMarket'
222
+ )
223
+ ->addColumn(
224
+ 'nmo_id_seq_anymarket',
225
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
226
+ array(
227
+ 'nullable' => false,
228
+ ),
229
+ 'Código sequencial no AnyMarket'
230
+ )
231
+ ->addColumn(
232
+ 'nmo_id_order',
233
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
234
+ array(
235
+ 'nullable' => false,
236
+ ),
237
+ 'Código Venda Magento'
238
+ )
239
+ ->addColumn(
240
+ 'nmo_status_int',
241
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
242
+ array(
243
+ 'nullable' => false,
244
+ ),
245
+ 'Status Integração'
246
+ )
247
+ ->addColumn(
248
+ 'nmo_desc_error',
249
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
250
+ array(
251
+ 'nullable' => false,
252
+ ),
253
+ 'Descrição do Erro'
254
+ )
255
+ ->addColumn(
256
+ 'updated_at',
257
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
258
+ null,
259
+ array(),
260
+ 'Anymarket Orders Modification Time'
261
+ )
262
+ ->addColumn(
263
+ 'created_at',
264
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
265
+ null,
266
+ array(),
267
+ 'Anymarket Orders Creation Time'
268
+ )
269
+ ->setComment('Anymarket Orders Table');
270
+ $this->getConnection()->createTable($table);
271
+ $table = $this->getConnection()
272
+ ->newTable($this->getTable('db1_anymarket/anymarketcategories'))
273
+ ->addColumn(
274
+ 'entity_id',
275
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
276
+ null,
277
+ array(
278
+ 'identity' => true,
279
+ 'nullable' => false,
280
+ 'primary' => true,
281
+ ),
282
+ 'Anymarket Categories ID'
283
+ )
284
+ ->addColumn(
285
+ 'nmc_cat_id',
286
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
287
+ array(
288
+ 'nullable' => false,
289
+ ),
290
+ 'Código completo da Categoria'
291
+ )
292
+ ->addColumn(
293
+ 'nmc_cat_root_id',
294
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
295
+ array(
296
+ 'nullable' => false,
297
+ ),
298
+ 'Código da categoria antecessora'
299
+ )
300
+ ->addColumn(
301
+ 'nmc_cat_desc',
302
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
303
+ array(
304
+ 'nullable' => false,
305
+ ),
306
+ 'Decrição da Categoria'
307
+ )
308
+ ->addColumn(
309
+ 'status',
310
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
311
+ array(),
312
+ 'Enabled'
313
+ )
314
+ ->addColumn(
315
+ 'updated_at',
316
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
317
+ null,
318
+ array(),
319
+ 'Anymarket Categories Modification Time'
320
+ )
321
+ ->addColumn(
322
+ 'created_at',
323
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
324
+ null,
325
+ array(),
326
+ 'Anymarket Categories Creation Time'
327
+ )
328
+ ->setComment('Anymarket Categories Table');
329
+ $this->getConnection()->createTable($table);
330
+ $table = $this->getConnection()
331
+ ->newTable($this->getTable('db1_anymarket/anymarketlog_store'))
332
+ ->addColumn(
333
+ 'anymarketlog_id',
334
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
335
+ null,
336
+ array(
337
+ 'nullable' => false,
338
+ 'primary' => true,
339
+ ),
340
+ 'AnyMarket Log ID'
341
+ )
342
+ ->addColumn(
343
+ 'store_id',
344
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
345
+ null,
346
+ array(
347
+ 'unsigned' => true,
348
+ 'nullable' => false,
349
+ 'primary' => true,
350
+ ),
351
+ 'Store ID'
352
+ )
353
+ ->addIndex(
354
+ $this->getIdxName(
355
+ 'db1_anymarket/anymarketlog_store',
356
+ array('store_id')
357
+ ),
358
+ array('store_id')
359
+ )
360
+ ->addForeignKey(
361
+ $this->getFkName(
362
+ 'db1_anymarket/anymarketlog_store',
363
+ 'anymarketlog_id',
364
+ 'db1_anymarket/anymarketlog',
365
+ 'entity_id'
366
+ ),
367
+ 'anymarketlog_id',
368
+ $this->getTable('db1_anymarket/anymarketlog'),
369
+ 'entity_id',
370
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
371
+ Varien_Db_Ddl_Table::ACTION_CASCADE
372
+ )
373
+ ->addForeignKey(
374
+ $this->getFkName(
375
+ 'db1_anymarket/anymarketlog_store',
376
+ 'store_id',
377
+ 'core/store',
378
+ 'store_id'
379
+ ),
380
+ 'store_id',
381
+ $this->getTable('core/store'),
382
+ 'store_id',
383
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
384
+ Varien_Db_Ddl_Table::ACTION_CASCADE
385
+ )
386
+ ->setComment('AnyMarket Log To Store Linkage Table');
387
+ $this->getConnection()->createTable($table);
388
+ $table = $this->getConnection()
389
+ ->newTable($this->getTable('db1_anymarket/anymarketproducts_store'))
390
+ ->addColumn(
391
+ 'anymarketproducts_id',
392
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
393
+ null,
394
+ array(
395
+ 'nullable' => false,
396
+ 'primary' => true,
397
+ ),
398
+ 'Anymarket Products ID'
399
+ )
400
+ ->addColumn(
401
+ 'store_id',
402
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
403
+ null,
404
+ array(
405
+ 'unsigned' => true,
406
+ 'nullable' => false,
407
+ 'primary' => true,
408
+ ),
409
+ 'Store ID'
410
+ )
411
+ ->addIndex(
412
+ $this->getIdxName(
413
+ 'db1_anymarket/anymarketproducts_store',
414
+ array('store_id')
415
+ ),
416
+ array('store_id')
417
+ )
418
+ ->addForeignKey(
419
+ $this->getFkName(
420
+ 'db1_anymarket/anymarketproducts_store',
421
+ 'anymarketproducts_id',
422
+ 'db1_anymarket/anymarketproducts',
423
+ 'entity_id'
424
+ ),
425
+ 'anymarketproducts_id',
426
+ $this->getTable('db1_anymarket/anymarketproducts'),
427
+ 'entity_id',
428
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
429
+ Varien_Db_Ddl_Table::ACTION_CASCADE
430
+ )
431
+ ->addForeignKey(
432
+ $this->getFkName(
433
+ 'db1_anymarket/anymarketproducts_store',
434
+ 'store_id',
435
+ 'core/store',
436
+ 'store_id'
437
+ ),
438
+ 'store_id',
439
+ $this->getTable('core/store'),
440
+ 'store_id',
441
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
442
+ Varien_Db_Ddl_Table::ACTION_CASCADE
443
+ )
444
+ ->setComment('Anymarket Products To Store Linkage Table');
445
+ $this->getConnection()->createTable($table);
446
+ $table = $this->getConnection()
447
+ ->newTable($this->getTable('db1_anymarket/anymarketattributes_store'))
448
+ ->addColumn(
449
+ 'anymarketattributes_id',
450
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
451
+ null,
452
+ array(
453
+ 'nullable' => false,
454
+ 'primary' => true,
455
+ ),
456
+ 'Anymarket Attributes ID'
457
+ )
458
+ ->addColumn(
459
+ 'store_id',
460
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
461
+ null,
462
+ array(
463
+ 'unsigned' => true,
464
+ 'nullable' => false,
465
+ 'primary' => true,
466
+ ),
467
+ 'Store ID'
468
+ )
469
+ ->addIndex(
470
+ $this->getIdxName(
471
+ 'db1_anymarket/anymarketattributes_store',
472
+ array('store_id')
473
+ ),
474
+ array('store_id')
475
+ )
476
+ ->addForeignKey(
477
+ $this->getFkName(
478
+ 'db1_anymarket/anymarketattributes_store',
479
+ 'anymarketattributes_id',
480
+ 'db1_anymarket/anymarketattributes',
481
+ 'entity_id'
482
+ ),
483
+ 'anymarketattributes_id',
484
+ $this->getTable('db1_anymarket/anymarketattributes'),
485
+ 'entity_id',
486
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
487
+ Varien_Db_Ddl_Table::ACTION_CASCADE
488
+ )
489
+ ->addForeignKey(
490
+ $this->getFkName(
491
+ 'db1_anymarket/anymarketattributes_store',
492
+ 'store_id',
493
+ 'core/store',
494
+ 'store_id'
495
+ ),
496
+ 'store_id',
497
+ $this->getTable('core/store'),
498
+ 'store_id',
499
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
500
+ Varien_Db_Ddl_Table::ACTION_CASCADE
501
+ )
502
+ ->setComment('Anymarket Attributes To Store Linkage Table');
503
+ $this->getConnection()->createTable($table);
504
+ $table = $this->getConnection()
505
+ ->newTable($this->getTable('db1_anymarket/anymarketorders_store'))
506
+ ->addColumn(
507
+ 'anymarketorders_id',
508
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
509
+ null,
510
+ array(
511
+ 'nullable' => false,
512
+ 'primary' => true,
513
+ ),
514
+ 'Anymarket Orders ID'
515
+ )
516
+ ->addColumn(
517
+ 'store_id',
518
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
519
+ null,
520
+ array(
521
+ 'unsigned' => true,
522
+ 'nullable' => false,
523
+ 'primary' => true,
524
+ ),
525
+ 'Store ID'
526
+ )
527
+ ->addIndex(
528
+ $this->getIdxName(
529
+ 'db1_anymarket/anymarketorders_store',
530
+ array('store_id')
531
+ ),
532
+ array('store_id')
533
+ )
534
+ ->addForeignKey(
535
+ $this->getFkName(
536
+ 'db1_anymarket/anymarketorders_store',
537
+ 'anymarketorders_id',
538
+ 'db1_anymarket/anymarketorders',
539
+ 'entity_id'
540
+ ),
541
+ 'anymarketorders_id',
542
+ $this->getTable('db1_anymarket/anymarketorders'),
543
+ 'entity_id',
544
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
545
+ Varien_Db_Ddl_Table::ACTION_CASCADE
546
+ )
547
+ ->addForeignKey(
548
+ $this->getFkName(
549
+ 'db1_anymarket/anymarketorders_store',
550
+ 'store_id',
551
+ 'core/store',
552
+ 'store_id'
553
+ ),
554
+ 'store_id',
555
+ $this->getTable('core/store'),
556
+ 'store_id',
557
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
558
+ Varien_Db_Ddl_Table::ACTION_CASCADE
559
+ )
560
+ ->setComment('Anymarket Orders To Store Linkage Table');
561
+ $this->getConnection()->createTable($table);
562
+
563
+ $table = $this->getConnection()
564
+ ->newTable($this->getTable('db1_anymarket/anymarketcategories_store'))
565
+ ->addColumn(
566
+ 'anymarketcategories_id',
567
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
568
+ null,
569
+ array(
570
+ 'nullable' => false,
571
+ 'primary' => true,
572
+ ),
573
+ 'Anymarket Categories ID'
574
+ )
575
+ ->addColumn(
576
+ 'store_id',
577
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
578
+ null,
579
+ array(
580
+ 'unsigned' => true,
581
+ 'nullable' => false,
582
+ 'primary' => true,
583
+ ),
584
+ 'Store ID'
585
+ )
586
+ ->addIndex(
587
+ $this->getIdxName(
588
+ 'db1_anymarket/anymarketcategories_store',
589
+ array('store_id')
590
+ ),
591
+ array('store_id')
592
+ )
593
+ ->addForeignKey(
594
+ $this->getFkName(
595
+ 'db1_anymarket/anymarketcategories_store',
596
+ 'anymarketcategories_id',
597
+ 'db1_anymarket/anymarketcategories',
598
+ 'entity_id'
599
+ ),
600
+ 'anymarketcategories_id',
601
+ $this->getTable('db1_anymarket/anymarketcategories'),
602
+ 'entity_id',
603
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
604
+ Varien_Db_Ddl_Table::ACTION_CASCADE
605
+ )
606
+ ->addForeignKey(
607
+ $this->getFkName(
608
+ 'db1_anymarket/anymarketcategories_store',
609
+ 'store_id',
610
+ 'core/store',
611
+ 'store_id'
612
+ ),
613
+ 'store_id',
614
+ $this->getTable('core/store'),
615
+ 'store_id',
616
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
617
+ Varien_Db_Ddl_Table::ACTION_CASCADE
618
+ )
619
+ ->setComment('Anymarket Categories To Store Linkage Table');
620
+ $this->getConnection()->createTable($table);
621
+ $this->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.0.0-1.1.0.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var $installer Mage_Core_Model_Resource_Setup */
4
+ $installer = $this;
5
+ $installer->startSetup();
6
+
7
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
8
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
9
+
10
+
11
+ // Add new Attribute group
12
+ $groupName = 'AnyMarket';
13
+ $entityTypeId = $setup->getEntityTypeId('catalog_product');
14
+ $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
15
+ $setup->addAttributeGroup($entityTypeId, $attributeSetId, $groupName, 100);
16
+
17
+ //$setup->addAttributeGroup('catalog_product', 'Default', 'AnyMarket', 1000);
18
+
19
+ // Add Integra Anymarket to prduct attribute set
20
+ $codigo = 'integra_anymarket';
21
+ $config = array(
22
+ 'group' => 'AnyMarket',
23
+ 'position' => 0,
24
+ 'required' => 1,
25
+ 'label' => 'Integrar produto com o AnyMarket',
26
+ 'type' => 'int',
27
+ 'input' => 'boolean',
28
+ 'visible' => true,
29
+ 'apply_to' => 'simple,bundle,grouped,configurable',
30
+ 'note' => '',
31
+ 'global' => 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL'
32
+ );
33
+
34
+ $setup->addAttribute('catalog_product', $codigo, $config);
35
+
36
+ // Add id_anymarket to prduct attribute set
37
+ $codigo = 'id_anymarket';
38
+ $config = array(
39
+ 'group' => 'AnyMarket',
40
+ 'position' => 1,
41
+ 'required' => 0,
42
+ 'label' => 'Código Anymarket',
43
+ 'type' => 'int',
44
+ 'input' => 'text',
45
+ 'apply_to' => 'simple,bundle,grouped,configurable',
46
+ 'note' => 'Código referente ao produto no AnyMarket(Não Preencher)'
47
+ );
48
+
49
+ $setup->addAttribute('catalog_product', $codigo, $config);
50
+
51
+ // Add categoria_anymarket to prduct attribute set
52
+ $codigo = 'categoria_anymarket';
53
+ $config = array(
54
+ 'group' => 'AnyMarket',
55
+ 'position' => 2,
56
+ 'required' => 1,
57
+ 'label' => 'Categoria Anymarket',
58
+ 'type' => 'int',
59
+ 'input' => 'text',
60
+ 'apply_to' => 'simple,bundle,grouped,configurable',
61
+ 'note' => '<a style="cursor:pointer" onclick="showDialogCategory();">Selecione uma categoria para subir ao Anymarket</a>'
62
+ );
63
+
64
+ $setup->addAttribute('catalog_product', $codigo, $config);
65
+
66
+ $installer->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.1.0-1.2.0 .php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
6
+ $setup->updateAttribute('catalog_product', 'categoria_anymarket','is_required',0);
7
+
8
+ $installer->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.2.0-1.3.0.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $resource = Mage::getSingleton('core/resource');
6
+
7
+ function getMagentoVersion()
8
+ {
9
+ return substr(str_replace(".", "", Mage::getVersion()), 0, 2);
10
+ }
11
+ function _tableExists($table, $resource)
12
+ {
13
+ if (getMagentoVersion() < 16) {
14
+ return array_search($table, $resource->getConnection('core_write')->listTables());
15
+ }
16
+ return $resource->getConnection('core_write')->isTableExists($table);
17
+ }
18
+
19
+ $sql = '';
20
+ $table = 'db1_anymarket_anymarketattributes01';
21
+ if (_tableExists($table, $resource)) {
22
+ $sql = "ALTER TABLE db1_anymarket_anymarketattributes01 RENAME db1_anymarket_anymarketattributes;";
23
+ $sql .= "ALTER TABLE db1_anymarket_anymarketattributes01_store RENAME db1_anymarket_anymarketattributes_store;";
24
+ $sql .= "SET foreign_key_checks = 0;";
25
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketattributes_store` CHANGE `anymarketattributes01_id` `anymarketattributes_id` int(11) NOT NULL;";
26
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketattributes_store` ADD CONSTRAINT `fk13_anymarketattributes_id` FOREIGN KEY ( `anymarketattributes_id` ) REFERENCES `db1_anymarket_anymarketattributes` ( `entity_id` );";
27
+ }
28
+
29
+ $table = 'db1_anymarket_anymarketcategories01';
30
+ if (_tableExists($table, $resource)) {
31
+ $sql .= "ALTER TABLE db1_anymarket_anymarketcategories01 RENAME db1_anymarket_anymarketcategories;";
32
+ $sql .= "ALTER TABLE db1_anymarket_anymarketcategories01_store RENAME db1_anymarket_anymarketcategories_store;";
33
+ $sql .= "SET foreign_key_checks = 0;";
34
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketcategories_store` CHANGE `anymarketcategories01_id` `anymarketcategories_id` int(11) NOT NULL;";
35
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketcategories_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
36
+ }
37
+
38
+ $table = 'db1_anymarket_anymarketlog01';
39
+ if (_tableExists($table, $resource)) {
40
+ $sql .= "ALTER TABLE db1_anymarket_anymarketlog01 RENAME db1_anymarket_anymarketlog;";
41
+ $sql .= "ALTER TABLE db1_anymarket_anymarketlog01_store RENAME db1_anymarket_anymarketlog_store;";
42
+ $sql .= "SET foreign_key_checks = 0;";
43
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketlog_store` CHANGE `anymarketlog01_id` `anymarketlog_id` int(11) NOT NULL;";
44
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketlog_store` ADD CONSTRAINT `fk13_anymarketlog_id` FOREIGN KEY ( `anymarketlog_id` ) REFERENCES `db1_anymarket_anymarketlog` ( `entity_id` );";
45
+ }
46
+
47
+ $table = 'db1_anymarket_anymarketorders01';
48
+ if (_tableExists($table, $resource)) {
49
+ $sql .= "ALTER TABLE db1_anymarket_anymarketorders01 RENAME db1_anymarket_anymarketorders;";
50
+ $sql .= "ALTER TABLE db1_anymarket_anymarketorders01_store RENAME db1_anymarket_anymarketorders_store;";
51
+ $sql .= "SET foreign_key_checks = 0;";
52
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketorders_store` CHANGE `anymarketorders01_id` `anymarketorders_id` int(11) NOT NULL;";
53
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketorders_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
54
+ }
55
+
56
+ $table = 'db1_anymarket_anymarketproducts01';
57
+ if (_tableExists($table, $resource)) {
58
+ $sql .= "ALTER TABLE db1_anymarket_anymarketproducts01 RENAME db1_anymarket_anymarketproducts;";
59
+ $sql .= "ALTER TABLE db1_anymarket_anymarketproducts01_store RENAME db1_anymarket_anymarketproducts_store;";
60
+ $sql .= "SET foreign_key_checks = 0;";
61
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketproducts_store` CHANGE `anymarketproducts01_id` `anymarketproducts_id` int(11) NOT NULL;";
62
+ $sql .= "ALTER TABLE `db1_anymarket_anymarketproducts_store` ADD CONSTRAINT `fk13_anymarketcategories_id` FOREIGN KEY ( `anymarketcategories_id` ) REFERENCES `db1_anymarket_anymarketcategories` ( `entity_id` );";
63
+ }
64
+
65
+ if ($sql != '') {
66
+ $installer->run($sql);
67
+ }
68
+ $installer->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.3.0-1.4.0.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $connection = $installer->getConnection();
4
+
5
+ $installer->startSetup();
6
+ $installer->getConnection()
7
+ ->addColumn($installer->getTable('db1_anymarket/anymarketlog'),'log_json', array(
8
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
9
+ 'nullable' => false,
10
+ 'length' => 700,
11
+ 'comment' => 'Json'
12
+ ));
13
+
14
+ $installer->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.4.0-1.5.0.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+
4
+ $table = $this->getConnection()
5
+ ->newTable($this->getTable('db1_anymarket/anymarketqueue'))
6
+ ->addColumn(
7
+ 'entity_id',
8
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
9
+ null,
10
+ array(
11
+ 'identity' => true,
12
+ 'nullable' => false,
13
+ 'primary' => true,
14
+ ),
15
+ 'Anymarket Queue ID'
16
+ )
17
+ ->addColumn(
18
+ 'nmq_id',
19
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
20
+ array(
21
+ 'nullable' => false,
22
+ ),
23
+ 'Código do Item que esta aguardando na fila'
24
+ )
25
+ ->addColumn(
26
+ 'nmq_type',
27
+ Varien_Db_Ddl_Table::TYPE_TEXT, 3,
28
+ array(
29
+ 'nullable' => false,
30
+ ),
31
+ 'Tipo de Operação (IMP/EXP)'
32
+ )
33
+ ->addColumn(
34
+ 'nmq_table',
35
+ Varien_Db_Ddl_Table::TYPE_TEXT, 25,
36
+ array(
37
+ 'nullable' => false,
38
+ ),
39
+ 'Tabela originaria do item'
40
+ )
41
+ ->addColumn(
42
+ 'updated_at',
43
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
44
+ null,
45
+ array(),
46
+ 'Anymarket Queue Modification Time'
47
+ )
48
+ ->addColumn(
49
+ 'created_at',
50
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
51
+ null,
52
+ array(),
53
+ 'Anymarket Queue Creation Time'
54
+ )
55
+ ->setComment('Anymarket Queue Table');
56
+ $this->getConnection()->createTable($table);
57
+
58
+ $table = $this->getConnection()
59
+ ->newTable($this->getTable('db1_anymarket/anymarketqueue_store'))
60
+ ->addColumn(
61
+ 'anymarketqueue_id',
62
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
63
+ null,
64
+ array(
65
+ 'nullable' => false,
66
+ 'primary' => true,
67
+ ),
68
+ 'Anymarket Queue ID'
69
+ )
70
+ ->addColumn(
71
+ 'store_id',
72
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
73
+ null,
74
+ array(
75
+ 'unsigned' => true,
76
+ 'nullable' => false,
77
+ 'primary' => true,
78
+ ),
79
+ 'Store ID'
80
+ )
81
+ ->addIndex(
82
+ $this->getIdxName(
83
+ 'db1_anymarket/anymarketqueue_store',
84
+ array('store_id')
85
+ ),
86
+ array('store_id')
87
+ )
88
+ ->addForeignKey(
89
+ $this->getFkName(
90
+ 'db1_anymarket/anymarketqueue_store',
91
+ 'anymarketqueue_id',
92
+ 'db1_anymarket/anymarketqueue',
93
+ 'entity_id'
94
+ ),
95
+ 'anymarketqueue_id',
96
+ $this->getTable('db1_anymarket/anymarketqueue'),
97
+ 'entity_id',
98
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
99
+ Varien_Db_Ddl_Table::ACTION_CASCADE
100
+ )
101
+ ->addForeignKey(
102
+ $this->getFkName(
103
+ 'db1_anymarket/anymarketqueue_store',
104
+ 'store_id',
105
+ 'core/store',
106
+ 'store_id'
107
+ ),
108
+ 'store_id',
109
+ $this->getTable('core/store'),
110
+ 'store_id',
111
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
112
+ Varien_Db_Ddl_Table::ACTION_CASCADE
113
+ )
114
+ ->setComment('Anymarket Queues To Store Linkage Table');
115
+ $this->getConnection()->createTable($table);
116
+
117
+ $this->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.5.0-1.6.0.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = new Mage_Eav_Model_Entity_Setup('core_setup');
4
+ $installer->startSetup();
5
+ $entityTypeId = $installer->getEntityTypeId('catalog_product');
6
+ $idAttributeOldSelect = $installer->getAttribute($entityTypeId, 'categoria_anymarket', 'attribute_id');
7
+ $installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'frontend_input','select');
8
+ $installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'backend_type','varchar');
9
+ $installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'backend_model','eav/entity_attribute_backend_array');
10
+ $installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'source_model','db1_anymarket/system_config_source_categories_values');
11
+
12
+ $installer->updateAttribute($entityTypeId, $idAttributeOldSelect, 'note','Selecione uma categoria para subir ao Anymarket');
13
+ $installer->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.6.0-1.7.0.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $sql = "INSERT IGNORE INTO `catalog_product_entity_varchar` (entity_type_id, attribute_id, store_id, entity_id, value) SELECT pei.entity_type_id, pei.attribute_id, pei.store_id, pei.entity_id, pei.value FROM `catalog_product_entity_int` pei JOIN `eav_attribute` ea ON pei.attribute_id = ea .attribute_id WHERE ea.attribute_code = 'categoria_anymarket';";
6
+ $sql .= "DELETE pei.* FROM `catalog_product_entity_int` pei JOIN `eav_attribute` ea ON pei.attribute_id = ea .attribute_id WHERE ea.attribute_code = 'categoria_anymarket';";
7
+
8
+ $installer->run($sql);
9
+ $installer->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.7.0-1.8.0.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
6
+ $setup->updateAttribute('catalog_product', 'categoria_anymarket', 'note', 'Selecione uma categoria para subir ao Anymarket');
7
+ $setup->updateAttribute('catalog_product', 'categoria_anymarket', 'is_global', 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL');
8
+ $setup->updateAttribute('catalog_product', 'id_anymarket', 'is_global', 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL');
9
+
10
+ $installer->endSetup();
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-1.8.0-2.0.0.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
app/code/community/DB1/AnyMarket/sql/db1_anymarket_setup/mysql4-upgrade-2.0.0-2.1.0.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $sql = "INSERT IGNORE INTO `db1_anymarket_anymarketcategories_store` (`anymarketcategories_id`, `store_id`) SELECT entity_id, 0 FROM `db1_anymarket_anymarketcategories`;";
6
+ $sql .= "INSERT IGNORE INTO `db1_anymarket_anymarketattributes_store` (`anymarketattributes_id`, `store_id`) SELECT entity_id, 0 FROM `db1_anymarket_anymarketattributes`;";
7
+ $sql .= "INSERT IGNORE INTO `db1_anymarket_anymarketqueue_store` (`anymarketqueue_id`, `store_id`) SELECT entity_id, 0 FROM `db1_anymarket_anymarketqueue`;";
8
+ $sql .= "INSERT IGNORE INTO `db1_anymarket_anymarketproducts_store` (`anymarketproducts_id`, `store_id`) SELECT entity_id, 0 FROM `db1_anymarket_anymarketproducts`;";
9
+ $sql .= "INSERT IGNORE INTO `db1_anymarket_anymarketorders_store` (`anymarketorders_id`, `store_id`) SELECT entity_id, 0 FROM `db1_anymarket_anymarketorders`;";
10
+
11
+ $installer->run($sql);
12
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/db1_anymarket.xml ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <catalog_product_view>
4
+ <reference name="head">
5
+ <action method="addItem">
6
+ <type>js</type>
7
+ <name>prototype/window.js</name>
8
+ </action>
9
+ </reference>
10
+ </catalog_product_view>
11
+
12
+ <adminhtml_anymarket_anymarketlog_index>
13
+ <reference name="menu">
14
+ <action method="setActive">
15
+ <menupath>system/db1_anymarket/anymarketlog</menupath>
16
+ </action>
17
+ </reference>
18
+ <reference name="content">
19
+ <block type="db1_anymarket/adminhtml_anymarketlog" name="anymarketlog" />
20
+ </reference>
21
+ </adminhtml_anymarket_anymarketlog_index>
22
+ <adminhtml_anymarket_anymarketlog_grid>
23
+ <block type="core/text_list" name="root" output="toHtml">
24
+ <block type="db1_anymarket/adminhtml_anymarketlog_grid" name="anymarketlog_grid"/>
25
+ </block>
26
+ </adminhtml_anymarket_anymarketlog_grid>
27
+ <!-- Anymarketlog add/edit action -->
28
+ <adminhtml_anymarket_anymarketlog_edit>
29
+ <update handle="editor"/>
30
+ <reference name="menu">
31
+ <action method="setActive">
32
+ <menupath>system/db1_anymarket/anymarketlog</menupath>
33
+ </action>
34
+ </reference>
35
+ <reference name="content">
36
+ <block type="db1_anymarket/adminhtml_anymarketlog_edit" name="anymarketlog_edit"></block>
37
+ </reference>
38
+ <reference name="left">
39
+ <block type="db1_anymarket/adminhtml_anymarketlog_edit_tabs" name="anymarketlog_tabs"></block>
40
+ </reference>
41
+ </adminhtml_anymarket_anymarketlog_edit>
42
+
43
+ <!-- PRODUCTS -->
44
+
45
+ <adminhtml_anymarket_anymarketproducts_index>
46
+ <reference name="menu">
47
+ <action method="setActive">
48
+ <menupath>system/db1_anymarket/anymarketproducts</menupath>
49
+ </action>
50
+ </reference>
51
+ <reference name="content">
52
+ <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
53
+ <action method="setUseConfirm"><params>0</params></action>
54
+ </block>
55
+ <block type="db1_anymarket/adminhtml_anymarketproducts" name="anymarketproducts" />
56
+ </reference>
57
+ </adminhtml_anymarket_anymarketproducts_index>
58
+ <adminhtml_anymarket_anymarketproducts_grid>
59
+ <block type="core/text_list" name="root" output="toHtml">
60
+ <block type="db1_anymarket/adminhtml_anymarketproducts_grid" name="anymarketproducts_grid"/>
61
+ </block>
62
+ </adminhtml_anymarket_anymarketproducts_grid>
63
+ <!-- Anymarketproducts add/edit action -->
64
+ <adminhtml_anymarket_anymarketproducts_edit>
65
+ <update handle="editor"/>
66
+ <reference name="menu">
67
+ <action method="setActive">
68
+ <menupath>system/db1_anymarket/anymarketproducts</menupath>
69
+ </action>
70
+ </reference>
71
+ <reference name="content">
72
+ <block type="db1_anymarket/adminhtml_anymarketproducts_edit" name="anymarketproducts_edit"></block>
73
+ </reference>
74
+ <reference name="left">
75
+ <block type="db1_anymarket/adminhtml_anymarketproducts_edit_tabs" name="anymarketproducts_tabs"></block>
76
+ </reference>
77
+ </adminhtml_anymarket_anymarketproducts_edit>
78
+
79
+ <!-- ATTRIBUTES -->
80
+
81
+ <adminhtml_anymarket_anymarketattributes_index>
82
+ <reference name="menu">
83
+ <action method="setActive">
84
+ <menupath>system/db1_anymarket/anymarketattributes</menupath>
85
+ </action>
86
+ </reference>
87
+ <reference name="content">
88
+ <block type="db1_anymarket/adminhtml_anymarketattributes" name="anymarketattributes" />
89
+
90
+ </reference>
91
+ </adminhtml_anymarket_anymarketattributes_index>
92
+ <adminhtml_anymarket_anymarketattributes_grid>
93
+ <block type="core/text_list" name="root" output="toHtml">
94
+ <block type="db1_anymarket/adminhtml_anymarketattributes_grid" name="anymarketattributes_grid"/>
95
+ </block>
96
+ </adminhtml_anymarket_anymarketattributes_grid>
97
+ <!-- Anymarketattributes add/edit action -->
98
+ <adminhtml_anymarket_anymarketattributes_edit>
99
+ <update handle="editor"/>
100
+ <reference name="menu">
101
+ <action method="setActive">
102
+ <menupath>system/db1_anymarket/anymarketattributes</menupath>
103
+ </action>
104
+ </reference>
105
+ <reference name="content">
106
+ <block type="db1_anymarket/adminhtml_anymarketattributes_edit" name="anymarketattributes_edit"></block>
107
+ </reference>
108
+ <reference name="left">
109
+ <block type="db1_anymarket/adminhtml_anymarketattributes_edit_tabs" name="anymarketattributes_tabs"></block>
110
+ </reference>
111
+ </adminhtml_anymarket_anymarketattributes_edit>
112
+
113
+ <adminhtml_anymarket_anymarketorders_index>
114
+ <reference name="menu">
115
+ <action method="setActive">
116
+ <menupath>system/db1_anymarket/anymarketorders</menupath>
117
+ </action>
118
+ </reference>
119
+ <reference name="content">
120
+ <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
121
+ <action method="setUseConfirm"><params>0</params></action>
122
+ </block>
123
+ <block type="db1_anymarket/adminhtml_anymarketorders" name="anymarketorders" />
124
+ </reference>
125
+ </adminhtml_anymarket_anymarketorders_index>
126
+ <adminhtml_anymarket_anymarketorders_grid>
127
+ <block type="core/text_list" name="root" output="toHtml">
128
+ <block type="db1_anymarket/adminhtml_anymarketorders_grid" name="anymarketorders_grid"/>
129
+ </block>
130
+ </adminhtml_anymarket_anymarketorders_grid>
131
+ <!-- Anymarketorders add/edit action -->
132
+ <adminhtml_anymarket_anymarketorders_edit>
133
+ <update handle="editor"/>
134
+ <reference name="menu">
135
+ <action method="setActive">
136
+ <menupath>system/db1_anymarket/anymarketorders</menupath>
137
+ </action>
138
+ </reference>
139
+ <reference name="content">
140
+ <block type="db1_anymarket/adminhtml_anymarketorders_edit" name="anymarketorders_edit"></block>
141
+ </reference>
142
+ <reference name="left">
143
+ <block type="db1_anymarket/adminhtml_anymarketorders_edit_tabs" name="anymarketorders_tabs"></block>
144
+ </reference>
145
+ </adminhtml_anymarket_anymarketorders_edit>
146
+
147
+ <adminhtml_anymarket_anymarketcategories_index>
148
+ <reference name="menu">
149
+ <action method="setActive">
150
+ <menupath>system/db1_anymarket/anymarketcategories</menupath>
151
+ </action>
152
+ </reference>
153
+ <reference name="content">
154
+ <block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
155
+ <action method="setUseConfirm"><params>0</params></action>
156
+ </block>
157
+ <block type="db1_anymarket/adminhtml_anymarketcategories" name="anymarketcategories" />
158
+ </reference>
159
+ </adminhtml_anymarket_anymarketcategories_index>
160
+ <adminhtml_anymarket_anymarketcategories_grid>
161
+ <block type="core/text_list" name="root" output="toHtml">
162
+ <block type="db1_anymarket/adminhtml_anymarketcategories_grid" name="anymarketcategories_grid"/>
163
+ </block>
164
+ </adminhtml_anymarket_anymarketcategories_grid>
165
+ <!-- Anymarketcategories add/edit action -->
166
+ <adminhtml_anymarket_anymarketcategories_edit>
167
+ <update handle="editor"/>
168
+ <reference name="menu">
169
+ <action method="setActive">
170
+ <menupath>system/db1_anymarket/anymarketcategories</menupath>
171
+ </action>
172
+ </reference>
173
+ <reference name="content">
174
+ <block type="db1_anymarket/adminhtml_anymarketcategories_edit" name="anymarketcategories_edit"></block>
175
+ </reference>
176
+ <reference name="left">
177
+ <block type="db1_anymarket/adminhtml_anymarketcategories_edit_tabs" name="anymarketcategories_tabs"></block>
178
+ </reference>
179
+ </adminhtml_anymarket_anymarketcategories_edit>
180
+
181
+ <adminhtml_anymarket_anymarketcategories_categories>
182
+ <reference name="content">
183
+ <block type="db1_anymarket/adminhtml_anymarketcategories_categories" name="anymarketorders_categories"></block>
184
+ </reference>
185
+ </adminhtml_anymarket_anymarketcategories_categories>
186
+
187
+
188
+ <adminhtml_anymarket_anymarketqueue_index>
189
+ <reference name="menu">
190
+ <action method="setActive">
191
+ <menupath>system/db1_anymarket/anymarketqueue</menupath>
192
+ </action>
193
+ </reference>
194
+ <reference name="content">
195
+ <block type="db1_anymarket/adminhtml_anymarketqueue" name="anymarketqueue" />
196
+
197
+ </reference>
198
+ </adminhtml_anymarket_anymarketqueue_index>
199
+ <adminhtml_anymarket_anymarketqueue_grid>
200
+ <block type="core/text_list" name="root" output="toHtml">
201
+ <block type="db1_anymarket/adminhtml_anymarketqueue_grid" name="anymarketqueue_grid"/>
202
+ </block>
203
+ </adminhtml_anymarket_anymarketqueue_grid>
204
+ <!-- Anymarketqueue add/edit action -->
205
+ <adminhtml_anymarket_anymarketqueue_edit>
206
+ <update handle="editor"/>
207
+ <reference name="menu">
208
+ <action method="setActive">
209
+ <menupath>system/db1_anymarket/anymarketqueue</menupath>
210
+ </action>
211
+ </reference>
212
+ <reference name="content">
213
+ <block type="db1_anymarket/adminhtml_anymarketqueue_edit" name="anymarketqueue_edit"></block>
214
+ </reference>
215
+ <reference name="left">
216
+ <block type="db1_anymarket/adminhtml_anymarketqueue_edit_tabs" name="anymarketqueue_tabs"></block>
217
+ </reference>
218
+ </adminhtml_anymarket_anymarketqueue_edit>
219
+
220
+ </layout>
app/design/adminhtml/default/default/template/db1/anymarket/system/config/form/field/array_dropdown.phtml ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fontis Campaign Monitor Extension
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 and you will be sent a copy immediately.
14
+ *
15
+ * @copyright Copyright (c) 2015 Fontis Pty. Ltd. (http://www.fontis.com.au)
16
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
+ */
18
+ ?>
19
+
20
+ <?php
21
+ $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
22
+
23
+ $_colspan = 2;
24
+ if (!$this->_addAfter) {
25
+ $_colspan -= 1;
26
+ }
27
+ $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
28
+ ?>
29
+
30
+ <div class="grid" id="grid<?php echo $_htmlId; ?>">
31
+ <table cellpadding="0" cellspacing="0" class="border">
32
+ <tbody>
33
+
34
+ <tr class="headings" id="headings<?php echo $_htmlId; ?>">
35
+ <?php foreach ($this->_columns as $columnName => $column): ?>
36
+ <th><?php echo $column['label']; ?></th>
37
+ <?php endforeach; ?>
38
+ <th <?php echo $_colspan; ?>></th>
39
+ </tr>
40
+
41
+ <tr id="addRow<?php echo $_htmlId; ?>">
42
+ <td colspan="<?php echo count($this->_columns); ?>"></td>
43
+ <td <?php echo $_colspan; ?>>
44
+ <button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId; ?>">
45
+ <span><span><span><?php echo $this->_addButtonLabel; ?></span></span></span>
46
+ </button>
47
+ </td>
48
+ </tr>
49
+
50
+ </tbody>
51
+ </table>
52
+ <input type="hidden" name="<?php echo $this->getElement()->getName(); ?>[__empty]" value="" />
53
+ </div>
54
+ <div id="empty<?php echo $_htmlId; ?>">
55
+ <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId; ?>">
56
+ <span><span><span><?php echo $this->_addButtonLabel; ?></span></span></span>
57
+ </button>
58
+ </div>
59
+
60
+ <script type="text/javascript">
61
+ // <!--
62
+ // create row creator
63
+ var arrayRow<?php echo $_htmlId; ?> = {
64
+ // define row prototypeJS template
65
+ template : new Template(
66
+ '<tr id="#{_id}">'
67
+ <?php foreach ($this->_columns as $columnName => $column):?>
68
+ +'<td class="#{_id}-<?php echo $columnName?>">'
69
+ +'<?php echo $this->_renderCellTemplate($columnName); ?>'
70
+ +'</td>'
71
+ <?php endforeach; ?>
72
+ <?php if ($this->_addAfter): ?>
73
+ +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><span><span><?php echo Mage::helper('adminhtml')->__('Add after') ?></span></span></span></button></td>'
74
+ <?php endif; ?>
75
+ +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><span><span><?php echo Mage::helper('adminhtml')->__('Delete') ?></span></span></span></button></td>'
76
+ +'</tr>'
77
+ ),
78
+
79
+ rowsCount : 0,
80
+
81
+ add : function(templateData, insertAfterId)
82
+ {
83
+ // generate default template data
84
+ if ('' == templateData) {
85
+ var d = new Date();
86
+ var templateData = {
87
+ <?php foreach ($this->_columns as $columnName => $column): ?>
88
+ <?php echo $columnName ?> : '',
89
+ <?php endforeach; ?>
90
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
91
+ };
92
+ }
93
+
94
+ if ('' == insertAfterId) {
95
+ // insert before last row
96
+ new Insertion.Before(
97
+ $('addRow<?php echo $_htmlId ?>'),
98
+ this.template.evaluate(templateData)
99
+ );
100
+ } else {
101
+ // insert after specified row
102
+ new Insertion.After(
103
+ $(insertAfterId),
104
+ this.template.evaluate(templateData)
105
+ );
106
+ }
107
+ // set the selected drop-down list item
108
+ <?php foreach ($this->_columns as $columnName => $column): ?>
109
+ var options = $$('td.' + templateData._id + '-' + '<?php echo $columnName; ?>' + ' option')
110
+ for(var index = 0; index < options.length; ++index)
111
+ {
112
+ var option = options[index]
113
+ if(option.getAttribute('value') == templateData.<?php echo $columnName; ?>)
114
+ {
115
+ option.selected = true
116
+ }
117
+ }
118
+ <?php endforeach; ?>
119
+
120
+ <?php if ($this->_addAfter): ?>
121
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
122
+ <?php endif; ?>
123
+
124
+ this.rowsCount += 1;
125
+ },
126
+
127
+ del : function(rowId)
128
+ {
129
+ $(rowId).remove();
130
+ this.rowsCount -= 1;
131
+ if (0 == this.rowsCount) {
132
+ this.showButtonOnly();
133
+ }
134
+ },
135
+
136
+ showButtonOnly : function()
137
+ {
138
+ $('grid<?php echo $_htmlId ?>').hide();
139
+ $('empty<?php echo $_htmlId ?>').show();
140
+ }
141
+ }
142
+
143
+ // bind add action to "Add" button in last row
144
+ Event.observe('addToEndBtn<?php echo $_htmlId; ?>', 'click', arrayRow<?php echo $_htmlId; ?>.add.bind(arrayRow<?php echo $_htmlId; ?>, '', ''));
145
+
146
+ // add existing rows
147
+ <?php
148
+ $_addAfterId = "headings{$_htmlId}";
149
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
150
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
151
+ /*print "%%%%%%%%%%%%%%%";
152
+ print_r($_row->toJson());*/
153
+ $_addAfterId = $_rowId;
154
+ }
155
+ ?>
156
+
157
+ // initialize standalone button
158
+ $('empty<?php echo $_htmlId; ?>').hide();
159
+ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
160
+ $('grid<?php echo $_htmlId; ?>').show();
161
+ $('empty<?php echo $_htmlId; ?>').hide();
162
+ arrayRow<?php echo $_htmlId; ?>.add('', '');
163
+ });
164
+
165
+ // if no rows, hide grid and show button only
166
+ <?php if (!$this->getArrayRows()):?>
167
+ arrayRow<?php echo $_htmlId; ?>.showButtonOnly();
168
+ <?php endif;?>
169
+
170
+ // toggle the grid, if element is disabled (depending on scope)
171
+ <?php if ($this->getElement()->getDisabled()): ?>
172
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId; ?>').parentNode);
173
+ <?php endif;?>
174
+ // -->
175
+ </script>
app/etc/modules/DB1_AnyMarket.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * DB1_AnyMarket extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category DB1
14
+ * @package DB1_AnyMarket
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <DB1_AnyMarket>
22
+ <active>true</active>
23
+ <codePool>community</codePool>
24
+ <depends>
25
+ <Mage_Core />
26
+ <Mage_Payment />
27
+ </depends>
28
+ </DB1_AnyMarket>
29
+ </modules>
30
+ </config>
app/locale/en_US/DB1_AnyMarket.csv ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ","
2
+ "Action","Action"
3
+ "Add AnyMarket Log","Add AnyMarket Log"
4
+ "Add Anymarket Products","Add Anymarket Products"
5
+ "Add anymarket log","Add anymarket log"
6
+ "Add anymarket products","Add anymarket products"
7
+ "Add","Add"
8
+ "Integration status","Integration status"
9
+ "Integration message","Integration message"
10
+ "An error occurred while updating the anymarket log.","An error occurred while updating the anymarket log."
11
+ "updating the anymarket log.","updating the anymarket log."
12
+ "An error occurred while updating the anymarket products.","An error occurred while updating the anymarket products."
13
+ "while updating the anymarket products.","while updating the anymarket products."
14
+ "AnyMarket Log API","AnyMarket Log API"
15
+ "AnyMarket Log was saved","AnyMarket Log was saved"
16
+ "AnyMarket Log was successfully deleted.","AnyMarket Log was successfully deleted."
17
+ "deleted.","deleted."
18
+ "AnyMarket Log was successfully saved","AnyMarket Log was successfully saved"
19
+ "AnyMarket Log","AnyMarket Log"
20
+ "Total %d products were added to the queue.","Total %d products were added to the queue."
21
+ "Total %d orders were added to the queue.","Total %d orders were added to the queue."
22
+ "Integration Products "Magento for Anymarket" marked as NOT","Integration Products "Magento for Anymarket" marked as NOT"
23
+ "Integration Products "AnyMarket for Magento" marked as NOT","Integration Products "AnyMarket for Magento" marked as NOT"
24
+ "Anymarket Products API","Anymarket Products API"
25
+ "Anymarket Products was saved","Anymarket Products was saved"
26
+ "Anymarket Products was successfully deleted.","Anymarket Products was successfully deleted."
27
+ "successfully deleted.","successfully deleted."
28
+ "Anymarket Products was successfully saved","Anymarket Products was successfully saved"
29
+ "successfully saved","successfully saved"
30
+ "Anymarket Products","Anymarket Products"
31
+ "Are you sure you want to sync?","Are you sure you want to sync?"
32
+ "Synchronize","Synchronize"
33
+ "Kilogram","Kilogram"
34
+ "Product with inconsistency:","Product with inconsistency:"
35
+ "Gram","Gram"
36
+ "Document Type (Customer)","Document Type (Customer)"
37
+ "Customer Group (Customer)","Customer Group (Customer)"
38
+ "Customer group that will be registered when imported from Anymarket.","Customer group that will be registered when imported from Anymarket."
39
+ "Product Created","Product Created"
40
+ "Select will be treated as their weight in shipment to the Anymarket.","Select will be treated as their weight in shipment to the Anymarket."
41
+ "Mass unit","Mass unit"
42
+ "Simple product Created","Simple product Created"
43
+ "Error on get feed products ","Error on get feed products "
44
+ "Error on import products from anymarket ","Error on import products from anymarket "
45
+ "Configurable product Created","Configurable product Created"
46
+ "Configurable product Updated","Configurable product Updated"
47
+ "Product Updated","Product Updated"
48
+ "Update Stock and Price","Update Stock and Price"
49
+ "Please select the products to synchronize.","Please select the products to synchronize."
50
+ "Change Status Integration","Change Status Integration"
51
+ "Save Anymarket Categories","Save Anymarket Categories"
52
+ "Delete Anymarket Categories","Delete Anymarket Categories"
53
+ "Are you sure?","Are you sure?"
54
+ "Synchronize Categories","Synchronize Categories"
55
+ "Add Anymarket Categories","Add Anymarket Categories"
56
+ "CSV","CSV"
57
+ "Save Anymarket Queue","Save Anymarket Queue"
58
+ "Add Anymarket Queue","Add Anymarket Queue"
59
+ "Error Message","Error Message"
60
+ "Category description","Category description"
61
+ "Code of predecessor category","Code of predecessor category"
62
+ "Complete code Category","Complete code Category"
63
+ "Anymarket Categories","Anymarket Categories"
64
+ "Are you sure you want to import?","Are you sure you want to import?"
65
+ "Import to Magento","Import to Magento"
66
+ "Exportar to Anymarket","Exportar to Anymarket"
67
+ "Are you sure you want to export?","Are you sure you want to export?"
68
+ "Change status","Change status"
69
+ "Could not find anymarket log to delete.","Could not find anymarket log to delete."
70
+ "Could not find anymarket products to delete.","Could not find anymarket products to delete."
71
+ "products to delete.","products to delete."
72
+ "Created at","Created at"
73
+ "This anymarket attributes no longer exists.","This anymarket attributes no longer exists."
74
+ "existe mais.","existe mais."
75
+ "Log Description","Log Description"
76
+ "Data cannot be null","Data cannot be null"
77
+ "Delete AnyMarket Log","Delete AnyMarket Log"
78
+ "Delete Anymarket Products","Delete Anymarket Products"
79
+ "Delete","Delete"
80
+ "Anymarket Orders","Anymarket Orders"
81
+ "Descrição Log","Descrição Log"
82
+ "Error Description","Error Description"
83
+ "Disabled","Disabled"
84
+ "Code Anymarket","Code Anymarket"
85
+ "Code Order Magento","Code Order Magento"
86
+ "Add Anymarket Orders","Add Anymarket Orders"
87
+ "Save Anymarket Orders","Save Anymarket Orders"
88
+ "Delete Anymarket Orders","Delete Anymarket Orders"
89
+ "Edit AnyMarket Log '%s'","Edit AnyMarket Log '%s'"
90
+ "Edit Anymarket Products '%s'","Edit Anymarket Products '%s'"
91
+ "Edit","Edit"
92
+ "Enabled","Enabled"
93
+ "Anymarket Attributes","Anymarket Attributes"
94
+ "Save Anymarket Attributes","Save Anymarket Attributes"
95
+ "Delete Anymarket Attributes","Delete Anymarket Attributes"
96
+ "Error saving anymarket log","Error saving anymarket log"
97
+ "Error saving anymarket products","Error saving anymarket products"
98
+ "Error while removing anymarket log. Details in error message.","Error while removing anymarket log. Details in error message."
99
+ "removing anymarket log. Details in error message.","removing anymarket log. Details in error message."
100
+ "Error while removing anymarket products. Details in error message.","Error while removing anymarket products. Details in error message."
101
+ "removing anymarket products. Details in error message.","removing anymarket products. Details in error message."
102
+ "Error while saving anymarket log. Details in error message.","Error while saving anymarket log. Details in error message."
103
+ "anymarket log. Details in error message.","anymarket log. Details in error message."
104
+ "Error while saving anymarket products. Details in error message.","Error while saving anymarket products. Details in error message."
105
+ "saving anymarket products. Details in error message.","saving anymarket products. Details in error message."
106
+ "Excel","Excel"
107
+ "Home","Home"
108
+ "Id","Id"
109
+ "Status Order","Status Order"
110
+ "Access","Access"
111
+ "Attribute Description","Attribute Description"
112
+ "Attribute Code","Attribute Code"
113
+ "Add Anymarket Attributes","Add Anymarket Attributes"
114
+ "Info","Info"
115
+ "List","List"
116
+ "No","No"
117
+ "Host","Host"
118
+ "Title","Title"
119
+ "New order status","New order status"
120
+ "Token necessary access to AnyMarket","Token necessary access to AnyMarket"
121
+ "Contact the DB1 for this information","Contact the DB1 for this information"
122
+ "essa informação","essa informação"
123
+ "URL for access to AnyMarket","URL for access to AnyMarket"
124
+ "Configure all the necessary information to allow access to ","Configure all the necessary information to allow access to "
125
+ "Status Order (Magento to Anymarket)","Status Order (Magento to Anymarket)"
126
+ "Status Order (Anymarket to Magento)","Status Order (Anymarket to Magento)"
127
+ "Status of orders that must be imported.","Status of orders that must be imported."
128
+ "If checked Magento for Anymarket, orders from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's orders will be registered in magento.","If checked Magento for Anymarket, orders from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's orders will be registered in magento."
129
+ "If checked Magento for Anymarket, products from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's products will be registered in magento.","If checked Magento for Anymarket, products from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's products will be registered in magento."
130
+ "Type Synchronization","Type Synchronization"
131
+ "AnyMarket Payment Method","AnyMarket Payment Method"
132
+ "Integration (Products)","Integration (Products)"
133
+ "Integration (Orders)","Integration (Orders)"
134
+ "Magento to AnyMarket","Magento to AnyMarket"
135
+ "If marked yes, magento products will be registered in anymarket.","If marked yes, magento products will be registered in anymarket."
136
+ "AnyMarket to Magento","AnyMarket to Magento"
137
+ "If marked yes, anymarket products will be registered in magento.","If marked yes, anymarket products will be registered in magento."
138
+ "Attributes","Attributes"
139
+ "NBM Required","NBM Required"
140
+ "Important informations","Important informations"
141
+ "Ignore EAN Invalid","Ignore EAN Invalid"
142
+ "If marked yes, the validation will be done at the time of import.","If marked yes, the validation will be done at the time of import."
143
+ "Sync Products","Sync Products"
144
+ "Products list","Products list"
145
+ "Sync Orders","Sync Orders"
146
+ "Orders list","Orders list"
147
+ "There was an error updating the products.","There was an error updating the products."
148
+ "produtos.","produtos."
149
+ "Total %d products successfully listed.","Total %d products successfully listed."
150
+ "sucesso.","sucesso."
151
+ "Import Anymarket products marked as not.","Import Anymarket products marked as not."
152
+ "Export products to Anymarket marked as not.","Export products to Anymarket marked as not."
153
+ "Anymarket marcado como não.","Anymarket marcado como não."
154
+ "There was an error updating anymarket categories.","There was an error updating anymarket categories."
155
+ "categorias anymarket.","categorias anymarket."
156
+ "Please select anymarket categories.","Please select anymarket categories."
157
+ "Please select anymarket categories to delete.","Please select anymarket categories to delete."
158
+ "categorias para apagar.","categorias para apagar."
159
+ "Could not find anymarket categories to delete.","Could not find anymarket categories to delete."
160
+ "anymarket categorias a serem excluídos.","anymarket categorias a serem excluídos."
161
+ "There was an error deleting anymarket categories.","There was an error deleting anymarket categories."
162
+ "anymarket categorias.","anymarket categorias."
163
+ "Anymarket Categories was successfully deleted.","Anymarket Categories was successfully deleted."
164
+ "excluído com sucesso.","excluído com sucesso."
165
+ "Anymarket Categories was successfully saved","Anymarket Categories was successfully saved"
166
+ "There was a problem saving the anymarket categories.","There was a problem saving the anymarket categories."
167
+ "salvar as categorias anymarket.","salvar as categorias anymarket."
168
+ "Unable to find anymarket categories to save.","Unable to find anymarket categories to save."
169
+ "anymarket para salvar.","anymarket para salvar."
170
+ "Successfully synchronized categories.","Successfully synchronized categories."
171
+ "Anymarket Attributes was successfully deleted.","Anymarket Attributes was successfully deleted."
172
+ "excluído com sucesso.","excluído com sucesso."
173
+ "Unable to find anymarket attributes to save.","Unable to find anymarket attributes to save."
174
+ "atributos para salvar.","atributos para salvar."
175
+ "There was a problem saving the anymarket attributes.","There was a problem saving the anymarket attributes."
176
+ "salvar os atributos anymarket.","salvar os atributos anymarket."
177
+ "Anymarket Attributes was successfully saved","Anymarket Attributes was successfully saved"
178
+ "Will be integrated","Will be integrated"
179
+ "Product Name","Product Name"
180
+ "Product SKU","Product SKU"
181
+ "None","None"
182
+ "Price","Price"
183
+ "Length_am","Length"
184
+ "Height","Height"
185
+ "Width","Width"
186
+ "Brand","Brand"
187
+ "Add Order Status Magento","Add Order Status Magento"
188
+ "Add Order Status Anymarket","Add Order Status Anymarket"
189
+ "Attribute corresponding to the Width","Attribute corresponding to the Width"
190
+ "Select the attribute that corresponds to the model AnyMarket","Select the attribute that corresponds to the model AnyMarket"
191
+ "Atributo que corresponde a modelo no AnyMarket","Atributo que corresponde a modelo no AnyMarket"
192
+ "Select the attribute that corresponds to the brand AnyMarket","Select the attribute that corresponds to the brand AnyMarket"
193
+ "Atributo que corresponde a marca no AnyMarket","Atributo que corresponde a marca no AnyMarket"
194
+ "Select the attribute that corresponds to the time bars on AnyMarket","Select the attribute that corresponds to the time bars on AnyMarket"
195
+ "Atributo que corresponde ao tempo de barras no AnyMarket","Atributo que corresponde ao tempo de barras no AnyMarket"
196
+ "Select the attribute that corresponds to the guarantee in AnyMarket","Select the attribute that corresponds to the guarantee in AnyMarket"
197
+ "Select the attribute that corresponds to the barcode on AnyMarket","Select the attribute that corresponds to the barcode on AnyMarket"
198
+ "Atributo que corresponde ao código de barras no AnyMarket","Atributo que corresponde ao código de barras no AnyMarket"
199
+ "Select the attribute that corresponds to the rise in AnyMarket","Select the attribute that corresponds to the rise in AnyMarket"
200
+ "Atributo que corresponde ao origem no AnyMarket","Atributo que corresponde ao origem no AnyMarket"
201
+ "Select the attribute that corresponds to nbm in AnyMarket","Select the attribute that corresponds to nbm in AnyMarket"
202
+ "que corresponde ao nbm no AnyMarket","que corresponde ao nbm no AnyMarket"
203
+ "Select the attribute that corresponds to the video url in AnyMarket","Select the attribute that corresponds to the video url in AnyMarket"
204
+ "Atributo que corresponde ao video url no AnyMarket","Atributo que corresponde ao video url no AnyMarket"
205
+ "Attribute corresponding to the Brand","Attribute corresponding to the Brand"
206
+ "Model","Model"
207
+ "Attribute corresponding to the Model.","Attribute corresponding to the Model."
208
+ "Attribute corresponding to the Warranty time.","Attribute corresponding to the Warranty time."
209
+ "Tempo de Garantia.","Tempo de Garantia."
210
+ "Warranty time","Warranty time"
211
+ "Bar code","Bar code"
212
+ "Warranty","Warranty"
213
+ "Attribute corresponding to the Brand.","Attribute corresponding to the Brand."
214
+ "Attribute corresponding to the Width.","Attribute corresponding to the Width."
215
+ "Attribute corresponding to the Warranty.","Attribute corresponding to the Warranty."
216
+ "Attribute corresponding to the Bar code.","Attribute corresponding to the Bar code."
217
+ "Select the attribute that corresponds to the width in AnyMarket","Select the attribute that corresponds to the width in AnyMarket"
218
+ "Atributo que corresponde ao largura no AnyMarket","Atributo que corresponde ao largura no AnyMarket"
219
+ "Attribute corresponding to the Video Url.","Attribute corresponding to the Video Url."
220
+ "URL","URL"
221
+ "There was a problem saving the anymarket queue.","There was a problem saving the anymarket queue."
222
+ "There was an error deleting anymarket queue.","There was an error deleting anymarket queue."
223
+ "There was an error deleting anymarket queues.","There was an error deleting anymarket queues."
224
+ "There was an error updating anymarket queues.","There was an error updating anymarket queues."
225
+ "This anymarket queue no longer exists.","This anymarket queue no longer exists."
226
+ "Total of %d anymarket queues were successfully deleted.","Total of %d anymarket queues were successfully deleted."
227
+ "Total of %d anymarket queues were successfully updated.","Total of %d anymarket queues were successfully updated."
228
+ "Unable to find anymarket queue to save.","Unable to find anymarket queue to save."
229
+ "Update anymarket queue","Update anymarket queue"
230
+ "The anymarket queues has been deleted.","The anymarket queues has been deleted."
231
+ "Retrieve list of anymarket queues","Retrieve list of anymarket queues"
232
+ "Retrieve anymarketqueue info","Retrieve anymarketqueue info"
233
+ "Requested anymarket queue does not exist.","Requested anymarket queue does not exist."
234
+ "Remove anymarket queue","Remove anymarket queue"
235
+ "Please select anymarket queues to delete.","Please select anymarket queues to delete."
236
+ "Please select anymarket queues.","Please select anymarket queues."
237
+ "Error while saving anymarket queue. Details in error message.","Error while saving anymarket queue. Details in error message."
238
+ "Error while removing anymarket queue. Details in error message.","Error while removing anymarket queue. Details in error message."
239
+ "Error saving anymarket queue","Error saving anymarket queue"
240
+ "Could not find anymarket queue to delete.","Could not find anymarket queue to delete."
241
+ "Add anymarket queue","Add anymarket queue"
242
+ "An error occurred while updating the anymarket queues.","An error occurred while updating the anymarket queues."
243
+ "Attribute corresponding to the NBM.","Attribute corresponding to the NBM."
244
+ "Attribute corresponding to the Origem.","Attribute corresponding to the Origem."
245
+ "Attribute corresponding to the height.","Attribute corresponding to the height."
246
+ "Attribute corresponding to the length.","Attribute corresponding to the length."
247
+ "Select the attribute that corresponds to the height AnyMarket","Select the attribute that corresponds to the height AnyMarket"
248
+ "Atributo que corresponde ao altura no AnyMarket","Atributo que corresponde ao altura no AnyMarket"
249
+ "Select the attribute that corresponds to the price at AnyMarket","Select the attribute that corresponds to the price at AnyMarket"
250
+ "Atributo que corresponde ao preço no AnyMarket","Atributo que corresponde ao preço no AnyMarket"
251
+ "Attribute that corresponds to the price.","Attribute that corresponds to the price."
252
+ "Attribute responsible for import orders, usually CPF or RG.","Attribute responsible for import orders, usually CPF or RG."
253
+ "por importar Pedidos","por importar Pedidos"
254
+ "Configure all the necessary information to manage the attributes.","Configure all the necessary information to manage the attributes."
255
+ "Please select anymarket log to delete.","Please select anymarket log to delete."
256
+ "Please select anymarket log.","Please select anymarket log."
257
+ "Please select anymarket products to delete.","Please select anymarket products to delete."
258
+ "to delete.","to delete."
259
+ "Please select anymarket products.","Please select anymarket products."
260
+ "Product does not exist.","Product does not exist."
261
+ "Provided data is invalid.","Provided data is invalid."
262
+ "Remove anymarket log","Remove anymarket log"
263
+ "Remove anymarket products","Remove anymarket products"
264
+ "Remove","Remove"
265
+ "Requested anymarket log does not exist.","Requested anymarket log does not exist."
266
+ "exist.","exist."
267
+ "Requested anymarket products does not exist.","Requested anymarket products does not exist."
268
+ "does not exist.","does not exist."
269
+ "Reset","Reset"
270
+ "Retrieve anymarketlog01 info","Retrieve anymarketlog01 info"
271
+ "Retrieve anymarketproducts01 info","Retrieve anymarketproducts01 info"
272
+ "Retrieve list of anymarket log","Retrieve list of anymarket log"
273
+ "Retrieve list of anymarket products","Retrieve list of anymarket products"
274
+ "Save And Continue Edit","Save And Continue Edit"
275
+ "Save AnyMarket Log","Save AnyMarket Log"
276
+ "Save Anymarket Products","Save Anymarket Products"
277
+ "Status","Status"
278
+ "Store views","Store views"
279
+ "The anymarket log has been deleted.","The anymarket log has been deleted."
280
+ "The anymarket products has been deleted.","The anymarket products has been deleted."
281
+ "deleted.","deleted."
282
+ "There was a problem saving the anymarket log.","There was a problem saving the anymarket log."
283
+ "anymarket log.","anymarket log."
284
+ "There was a problem saving the anymarket products.","There was a problem saving the anymarket products."
285
+ "saving the anymarket products.","saving the anymarket products."
286
+ "There was an error deleting anymarket log.","There was an error deleting anymarket log."
287
+ "anymarket log.","anymarket log."
288
+ "There was an error deleting anymarket products.","There was an error deleting anymarket products."
289
+ "anymarket products.","anymarket products."
290
+ "There was an error updating anymarket log.","There was an error updating anymarket log."
291
+ "anymarket log.","anymarket log."
292
+ "There was an error updating anymarket products.","There was an error updating anymarket products."
293
+ "anymarket products.","anymarket products."
294
+ "This anymarket log no longer exists.","This anymarket log no longer exists."
295
+ "This anymarket products no longer exists.","This anymarket products no longer exists."
296
+ "exists.","exists."
297
+ "Total of %d anymarket log were successfully deleted.","Total of %d anymarket log were successfully deleted."
298
+ "log were successfully deleted.","log were successfully deleted."
299
+ "Total of %d anymarket log were successfully updated.","Total of %d anymarket log were successfully updated."
300
+ "log were successfully updated.","log were successfully updated."
301
+ "Total of %d anymarket products were successfully deleted.","Total of %d anymarket products were successfully deleted."
302
+ "anymarket products were successfully deleted.","anymarket products were successfully deleted."
303
+ "Total of %d anymarket products were successfully updated.","Total of %d anymarket products were successfully updated."
304
+ "anymarket products were successfully updated.","anymarket products were successfully updated."
305
+ "Total of %d record(s) have been deleted.","Total of %d record(s) have been deleted."
306
+ "deleted.","deleted."
307
+ "Total of %d record(s) have been updated.","Total of %d record(s) have been updated."
308
+ "updated.","updated."
309
+ "Unable to find anymarket log to save.","Unable to find anymarket log to save."
310
+ "Unable to find anymarket products to save.","Unable to find anymarket products to save."
311
+ "to save.","to save."
312
+ "Update anymarket log","Update anymarket log"
313
+ "Update anymarket products","Update anymarket products"
314
+ "Update","Update"
315
+ "Updated at","Updated at"
316
+ "WYSIWYG Editor","WYSIWYG Editor"
317
+ "XML","XML"
318
+ "Yes","Yes"
app/locale/pt_BR/DB1_AnyMarket.csv ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "",""
2
+ "Action","Ação"
3
+ "Add AnyMarket Log","Adicionar AnyMarket Log"
4
+ "Add Anymarket Products","Add Anymarket Products"
5
+ "Add anymarket log","Add anymarket log"
6
+ "Add anymarket products","Add anymarket products"
7
+ "Add","Add"
8
+ "Integration status","Status Integração"
9
+ "Integration message","Mensagem de Integração"
10
+ "An error occurred while updating the anymarket log.","An error occurred while updating the anymarket log."
11
+ "An error occurred while updating the anymarket products.","An error occurred while updating the anymarket products."
12
+ "AnyMarket Log API","AnyMarket Log API"
13
+ "AnyMarket Log was saved","AnyMarket Log was saved"
14
+ "AnyMarket Log was successfully deleted.","AnyMarket Log was successfully deleted."
15
+ "AnyMarket Log was successfully saved","AnyMarket Log was successfully saved"
16
+ "AnyMarket Log","AnyMarket Log"
17
+ "Anymarket Products API","Anymarket Products API"
18
+ "Anymarket Products was saved","Anymarket Products was saved"
19
+ "Anymarket Products was successfully deleted.","Anymarket Products was successfully deleted."
20
+ "Anymarket Products was successfully saved","Anymarket Products was successfully saved"
21
+ "Anymarket Products","Produtos Anymarket"
22
+ "Change Status Integration","Mudar Status Integração"
23
+ "Save Anymarket Categories","Salvar Categoria Anymarket"
24
+ "Delete Anymarket Categories","Deletar Categoria Anymarket"
25
+ "Are you sure?","Você tem certeza?"
26
+ "Synchronize Categories","Sincronizar Categorias"
27
+ "Add Anymarket Categories","Adicionar Categoria Anymarket"
28
+ "CSV","CSV"
29
+ "Kilogram","Quilograma"
30
+ "Gram","Grama"
31
+ "Already existing SKU in anymarket","SKU ja existente no Anymarket"
32
+ "Product with inconsistency:","Produto com inconsistência:"
33
+ "Document Type (Customer)","Tipo de Documento (Cliente)"
34
+ "Customer group that will be registered when imported from Anymarket.","Grupo de cliente que irá ser cadastrado quando importado do Anymarket."
35
+ "Select will be treated as their weight in shipment to the Anymarket.","Selecione como sera tratado seu peso no envio para o Anymarket."
36
+ "Synchronize","Sincronizar"
37
+ "Error synchronizing, code anymarket invalid.","Erro ao sincronizar, codigo anymarket inválido."
38
+ "Simple product Created","Produto Simples Criado"
39
+ "Product Created","Produto Criado"
40
+ "Error on get feed products ","Erro ao obter feed de produtos "
41
+ "Error on import products from anymarket ","Erro ao importar produtos do Anymarket "
42
+ "Configurable product Created","Produto configuravel criado"
43
+ "Configurable product Updated","Produto configuravel atualizado"
44
+ "Product Updated","Produto Atualizado"
45
+ "Update Stock and Price","Estoque e Preço Atualizados"
46
+ "Mass unit","Unidade de Massa"
47
+ "Please select the products to synchronize.","Por favor selecione os produtos para sincronizar."
48
+ "Are you sure you want to sync?","Você tem certeza que deseja sincronizar?"
49
+ "Total %d products were added to the queue.","Total %d de produtos foram adicionado na fila."
50
+ "Total %d orders were added to the queue.","Total %d pedidos foram adicionado na fila."
51
+ "Integration Products "Magento for Anymarket" marked as NOT","Integração Produtos "Magento para AnyMarket" marcado como NÃO"
52
+ "Integration Products "AnyMarket for Magento" marked as NOT","Integração Produtos "AnyMarket para Magento" marcado como NÃO"
53
+ "Save Anymarket Queue","Salvar Item"
54
+ "Add Anymarket Queue","Adicionar item a fila"
55
+ "Successfully synchronized categories.","Categorias sincronizadas com sucesso."
56
+ "Error Message","Mensagem de Erro"
57
+ "Category description","Descrição da Categoria"
58
+ "Code of predecessor category","Código da categoria antecessora"
59
+ "Complete code Category","Código completo da Categoria"
60
+ "Anymarket Categories","Categorias Anymarket"
61
+ "Are you sure you want to import?","Você tem certeza que deseja importar?"
62
+ "Import to Magento","Importar para Magento"
63
+ "Exportar to Anymarket","Exportar para Anymarket"
64
+ "Are you sure you want to export?","Você tem certeza que deseja exportar?"
65
+ "Change status","Trocar status"
66
+ "Could not find anymarket log to delete.","Could not find anymarket log to delete."
67
+ "Could not find anymarket products to delete.","Could not find anymarket products to delete."
68
+ "Created at","Criado em"
69
+ "This anymarket attributes no longer exists.","Esse Atributo anymarket não existe mais."
70
+ "Log Description","Descrição Log"
71
+ "Data cannot be null","Data cannot be null"
72
+ "Delete AnyMarket Log","Delete AnyMarket Log"
73
+ "Delete Anymarket Products","Deletar Produto Anymarket"
74
+ "Delete","Delete"
75
+ "Anymarket Orders","Pedidos Anymarket"
76
+ "Descrição Log","Descrição Log"
77
+ "Error Description","Descrição do Erro"
78
+ "Disabled","Desabilitado"
79
+ "Code Anymarket","Código no AnyMarket"
80
+ "Code Order Magento","Código Venda Magento"
81
+ "Add Anymarket Orders","Adicionar Pedido Anymarket"
82
+ "Save Anymarket Orders","Salvar Pedido Anymarket"
83
+ "Delete Anymarket Orders","Deletar Pedido Anymarket"
84
+ "Edit AnyMarket Log '%s'","Edit AnyMarket Log '%s'"
85
+ "Edit Anymarket Products '%s'","Edit Anymarket Products '%s'"
86
+ "Edit","Edit"
87
+ "Enabled","Habilitado"
88
+ "Anymarket Attributes","Atributos Anymarket"
89
+ "Save Anymarket Attributes","Salvar Atributos Anymarket"
90
+ "Delete Anymarket Attributes","Delete Atributos Anymarket"
91
+ "Error saving anymarket log","Error saving anymarket log"
92
+ "Error saving anymarket products","Error saving anymarket products"
93
+ "Error while removing anymarket log. Details in error message.","Error while removing anymarket log. Details in error message."
94
+ "Error while removing anymarket products. Details in error message.","Error while removing anymarket products. Details in error message."
95
+ "Error while saving anymarket log. Details in error message.","Error while saving anymarket log. Details in error message."
96
+ "Error while saving anymarket products. Details in error message.","Error while saving anymarket products. Details in error message."
97
+ "Excel","Excel"
98
+ "Home","Home"
99
+ "Id","Código"
100
+ "Anymarket Queue", "Fila de integração Anymarket"
101
+ "Customer Group (Customer)","Grupo de Cliente (Cliente)"
102
+ "Item code that is waiting in the queue","Código do Item que esta aguardando na fila"
103
+ "Type of Operation","Tipo de Operação"
104
+ "Source table", "Tabela de Origem"
105
+ "Order","Pedido"
106
+ "Product","Produto"
107
+ "Type of Operation (Import/Emport)","Tipo de Operação (Importar/Emportar)"
108
+
109
+ "Add anymarket queue","Adicionar Fila Anymarket"
110
+ "An error occurred while updating the anymarket queue.","Ocorreu um erro ao atualizar a fila anymarket."
111
+ "Could not find anymarket queue to delete.","Não foi possível encontrar o item para apagar."
112
+ "Error saving anymarket queue","Erro ao salvar o item na fila"
113
+ "Error while removing anymarket queue. Details in error message.","Erro ao remover item da fila. Detalhes na mensagem de erro."
114
+ "Error while saving anymarket queue. Details in error message.","Erro ao salvar item na fila. Detalhes na mensagem de erro."
115
+ "Please select anymarket queues to delete.","Por favor selecione um item para deletar."
116
+ "Please select anymarket queues.","Por favor selecione um item."
117
+ "Remove anymarket queue","Remover item da fila"
118
+ "Requested anymarket queue does not exist.","Item Solicitado não existe."
119
+ "Retrieve anymarketqueue info","Recuperar Informação da fila"
120
+ "Retrieve list of anymarket queues","Recuperar lista dos itens na fila"
121
+ "The anymarket queues has been deleted.","Os itens da fila foram apagados."
122
+ "There was a problem saving the anymarket queue.","Houve um problema em salvar um item na fila."
123
+ "There was an error deleting anymarket queue.","Houve um problema em deletar um item na fila."
124
+ "There was an error updating anymarket queues.","Houve um problema em atualizar um item na fila."
125
+ "This anymarket queue no longer exists.","Este item não existe não existe mais."
126
+ "Total of %d anymarket queues were successfully deleted.","Total de %d itens foram apagados com sucesso."
127
+ "Total of %d anymarket queues were successfully updated.","Total de %d itens foram atualizados com sucesso."
128
+ "Unable to find anymarket queue to save.","Não foi possivel localizar o item para salvar."
129
+ "Update anymarket queue","Atualizar item da fila"
130
+ "Status Order","Status Pedido"
131
+ "Access","Acesso"
132
+ "Attribute Description","Descrição do Atributo"
133
+ "Attribute Code","Código do Atributo"
134
+ "Add Anymarket Attributes","Adicionar Atributo Anymarket"
135
+ "Info","Info"
136
+ "List","List"
137
+ "No","Não"
138
+ "Host","Servidor"
139
+ "Title","Titulo"
140
+ "New order status","Status do Pedido Novo"
141
+ "Token necessary access to AnyMarket","Token necessario acesso ao AnyMarket"
142
+ "Contact the DB1 for this information","Entre em contato com a DB1 para obter essa informação"
143
+ "URL for access to AnyMarket","URL para acesso ao AnyMarket"
144
+ "Configure all the necessary information to allow access to AnyMarket.","Configure todas as informações necessarias para liberar o acesso ao AnyMarket."
145
+ "Status Order (Magento to Anymarket)","Status Pedido (Magento para Anymarket)"
146
+ "Status Order (Anymarket to Magento)","Status Pedido (Anymarket para Magento)"
147
+ "Status of orders that must be imported.","Status dos pedidos que devem ser importados."
148
+ "If checked Magento for Anymarket, orders from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's orders will be registered in magento.","Caso marcado Magento para Anymarket, os pedidos do magento serão cadastrados no anymarket. Caso marcado Anymarket para Magento, os pedidos do anymarket serão cadastrados no magento."
149
+ "If checked Magento for Anymarket, products from the magento will be registered in anymarket. If checked Anymarket for Magento, anymarket's products will be registered in magento.","Caso marcado Magento para Anymarket, os produtos do magento serão cadastrados no anymarket. Caso marcado Anymarket para Magento, os produtos do anymarket serão cadastrados no magento."
150
+ "Type Synchronization","Tipo de Sincronização"
151
+ "AnyMarket Payment Method","Metodo de Pagamento AnyMarket"
152
+ "Integration (Products)","Integração (Produtos)"
153
+ "Integration (Orders)","Integração (Pedidos)"
154
+ "Magento to AnyMarket","Magento para AnyMarket"
155
+ "If marked yes, magento products will be registered in anymarket.","Caso marcado como sim, os produtos do magento será cadastrado no anymarket."
156
+ "AnyMarket to Magento","AnyMarket para Magento"
157
+ "If marked yes, anymarket products will be registered in magento.","Caso marcado como sim, os produtos do anymarket será cadastrado no magento."
158
+ "Attributes","Atributos"
159
+ "NBM Required","NBM Requerido"
160
+ "Important informations","Informações Importantes"
161
+ "Ignore EAN Invalid","Ignorar EAN Inválido"
162
+ "If marked yes, the validation will be done at the time of import.","Caso marcado como sim, a validação será feita no momento da importação."
163
+ "Sync Products","Sincronizar Produtos"
164
+ "Products list","Listar Produtos"
165
+ "Sync Orders","Sincronizar Pedidos"
166
+ "Orders list","Listar Pedidos"
167
+ "There was an error updating the products.","Ocorreu um erro ao atualizar os produtos."
168
+ "Total %d products successfully listed.","Total de %d produtos listados com sucesso."
169
+ "Import Anymarket products marked as not.","Importar produtos do Anymarket marcado como não."
170
+ "Export products to Anymarket marked as not.","Exportar produtos para Anymarket marcado como não."
171
+ "There was an error updating anymarket categories.","Houve um erro ao atualizar categorias anymarket."
172
+ "Please select anymarket categories.","Por favor, selecione uma categoria anymarket."
173
+ "Please select anymarket categories to delete.","Por favor, selecione anymarket categorias para apagar."
174
+ "Could not find anymarket categories to delete.","Não foi possível encontrar anymarket categorias a serem excluídos."
175
+ "There was an error deleting anymarket categories.","Houve um erro ao excluir anymarket categorias."
176
+ "Anymarket Categories was successfully deleted.","Categorias Anymarket foi excluído com sucesso."
177
+ "Anymarket Categories was successfully saved","Categorias Anymarket foi salvo com êxito"
178
+ "There was a problem saving the anymarket categories.","Houve um problema em salvar as categorias anymarket."
179
+ "Unable to find anymarket categories to save.","Incapaz de encontrar categorias anymarket para salvar."
180
+ "Successfully synchronized categories.","Categorias sincronizadas com sucesso."
181
+ "Anymarket Attributes was successfully deleted.","Atributo Anymarket foi excluído com sucesso."
182
+ "Unable to find anymarket attributes to save.","Incapaz de encontrar anymarket atributos para salvar."
183
+ "There was a problem saving the anymarket attributes.","Houve um problema em salvar os atributos anymarket."
184
+ "Anymarket Attributes was successfully saved","Atributos Anymarket foi salvo com êxito"
185
+ "Will be integrated","Será Integrado"
186
+ "Product Name","Nome do Produto"
187
+ "Product SKU","SKU do produto"
188
+ "None","None"
189
+ "Price","Preço"
190
+ "Length_am","Profundidade"
191
+ "Height","Altura"
192
+ "Width","Largura"
193
+ "Brand","Marca"
194
+ "Add Order Status Magento","Adicionar Status Pedido Magento"
195
+ "Add Order Status Anymarket","Adicionar Status Pedido Anymarket"
196
+ "Attribute corresponding to the Width","Atributo correspondente à largura"
197
+ "Select the attribute that corresponds to the model AnyMarket","Selecione o Atributo que corresponde a modelo no AnyMarket"
198
+ "Select the attribute that corresponds to the brand AnyMarket","Selecione o Atributo que corresponde a marca no AnyMarket"
199
+ "Select the attribute that corresponds to the time bars on AnyMarket","Selecione o Atributo que corresponde ao tempo de barras no AnyMarket"
200
+ "Select the attribute that corresponds to the guarantee in AnyMarket","Selecione o Atributo que corresponde ao garantia no AnyMarket"
201
+ "Select the attribute that corresponds to the barcode on AnyMarket","Selecione o Atributo que corresponde ao código de barras no AnyMarket"
202
+ "Select the attribute that corresponds to the rise in AnyMarket","Selecione o Atributo que corresponde ao origem no AnyMarket"
203
+ "Select the attribute that corresponds to nbm in AnyMarket","Selecione o Atributo que corresponde ao nbm no AnyMarket"
204
+ "Select the attribute that corresponds to the video url in AnyMarket","Selecione o Atributo que corresponde ao video url no AnyMarket"
205
+ "Attribute corresponding to the Brand","Atributo correspondente a Marca"
206
+ "Model","Modelo"
207
+ "Attribute corresponding to the Model.","Atributo correspondente ao Modelo"
208
+ "Attribute corresponding to the Warranty time.","Atributo correspondente ao Tempo de Garantia."
209
+ "Warranty time","Tempo de Garantia"
210
+ "Bar code","Código de Barras"
211
+ "Warranty","Garantia"
212
+ "Attribute corresponding to the Brand.","Atributo correspondente à Marca."
213
+ "Attribute corresponding to the Width.","Atributo correspondente a largura."
214
+ "Attribute corresponding to the Warranty.","Atributo correspondente a Garantia"
215
+ "Attribute corresponding to the Bar code.","Atributo correspondente ao Código de Barras"
216
+ "Select the attribute that corresponds to the width in AnyMarket","Selecione o Atributo que corresponde ao largura no AnyMarket"
217
+ "Attribute corresponding to the Video Url.","Atributo Correspondente ao Video URL"
218
+ "Attribute corresponding to the NBM.", "Atributo correspondente ao NBM"
219
+ "Attribute corresponding to the Origem.", "Atributo correspondente a Origem"
220
+ "Attribute corresponding to the height.","Atributo que corresponde ao Altura."
221
+ "Attribute corresponding to the length.","Atributo que corresponde a Profundidade."
222
+ "Select the attribute that corresponds to the height AnyMarket","Selecione o Atributo que corresponde ao altura no AnyMarket"
223
+ "Select the attribute that corresponds to the price at AnyMarket","Selecione o Atributo que corresponde ao preço no AnyMarket"
224
+ "Attribute that corresponds to the price.","Atributo que corresponde ao Preço."
225
+ "Attribute responsible for import orders, usually CPF or RG.","Atributo responsavel por importar Pedidos, geralmente CPF ou RG."
226
+ "Configure all the necessary information to manage the attributes.","Configure todas as informações necessarias para gerenciar os atributos."
227
+ "Please select anymarket log to delete.","Please select anymarket log to delete."
228
+ "Please select anymarket log.","Please select anymarket log."
229
+ "Please select anymarket products to delete.","Please select anymarket products to delete."
230
+ "Please select anymarket products.","Please select anymarket products."
231
+ "Product does not exist.","Product does not exist."
232
+ "Provided data is invalid.","Provided data is invalid."
233
+ "Remove anymarket log","Remove anymarket log"
234
+ "Remove anymarket products","Remove anymarket products"
235
+ "Remove","Remove"
236
+ "Requested anymarket log does not exist.","Requested anymarket log does not exist."
237
+ "Requested anymarket products does not exist.","Requested anymarket products does not exist."
238
+ "Reset","Reset"
239
+ "Retrieve anymarketlog01 info","Retrieve anymarketlog01 info"
240
+ "Retrieve anymarketproducts01 info","Retrieve anymarketproducts01 info"
241
+ "Retrieve list of anymarket log","Retrieve list of anymarket log"
242
+ "Retrieve list of anymarket products","Retrieve list of anymarket products"
243
+ "Save And Continue Edit","Salvar e Continuar Editando"
244
+ "Save AnyMarket Log","Salvar AnyMarket Log"
245
+ "Save Anymarket Products","Savar Produto Anymarket"
246
+ "Status","Status"
247
+ "Store views","Loja"
248
+ "The anymarket log has been deleted.","The anymarket log has been deleted."
249
+ "The anymarket products has been deleted.","The anymarket products has been deleted."
250
+ "There was a problem saving the anymarket log.","There was a problem saving the anymarket log."
251
+ "There was a problem saving the anymarket products.","There was a problem saving the anymarket products."
252
+ "There was an error deleting anymarket log.","There was an error deleting anymarket log."
253
+ "There was an error deleting anymarket products.","There was an error deleting anymarket products."
254
+ "There was an error updating anymarket log.","There was an error updating anymarket log."
255
+ "There was an error updating anymarket products.","There was an error updating anymarket products."
256
+ "This anymarket log no longer exists.","This anymarket log no longer exists."
257
+ "This anymarket products no longer exists.","This anymarket products no longer exists."
258
+ "Total of %d anymarket log were successfully deleted.","Total of %d anymarket log were successfully deleted."
259
+ "Total of %d anymarket log were successfully updated.","Total of %d anymarket log were successfully updated."
260
+ "Total of %d anymarket products were successfully deleted.","Total of %d anymarket products were successfully deleted."
261
+ "Total of %d anymarket products were successfully updated.","Total of %d anymarket products were successfully updated."
262
+ "Total of %d record(s) have been deleted.","Total of %d record(s) have been deleted."
263
+ "Total of %d record(s) have been updated.","Total of %d record(s) have been updated."
264
+ "Unable to find anymarket log to save.","Unable to find anymarket log to save."
265
+ "Unable to find anymarket products to save.","Unable to find anymarket products to save."
266
+ "Update anymarket log","Update anymarket log"
267
+ "Update anymarket products","Update anymarket products"
268
+ "Update","Update"
269
+ "Updated at","Atualizado em"
270
+ "WYSIWYG Editor","WYSIWYG Editor"
271
+ "XML","XML"
272
+ "Yes","Sim"
package.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>DB1Anymarket</name>
4
+ <version>2.3.4</version>
5
+ <stability>stable</stability>
6
+ <license>MPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>M&#xF3;dulo de integra&#xE7;&#xE3;o AnyMarket e Magento</summary>
10
+ <description>&lt;b&gt;M&#xF3;dulo de integra&#xE7;&#xE3;o AnyMarket e Magento&lt;/b&gt;&#xD;
11
+ &#xD;
12
+ Com o m&#xF3;dulo de integra&#xE7;&#xE3;o AnyMarket instalado e configurado ser&#xE1; poss&#xED;vel a integra&#xE7;&#xE3;o autom&#xE1;tica de:&#xD;
13
+ &lt;ul&gt;&#xD;
14
+ &lt;li&gt; Produtos &lt;/li&gt;&#xD;
15
+ &lt;li&gt; Pedidos &lt;/li&gt;&#xD;
16
+ &lt;li&gt; Estoque &lt;/li&gt;&#xD;
17
+ &lt;/ul&gt;&#xD;
18
+ &#xD;
19
+ &lt;b&gt;Mais informa&#xE7;&#xF5;es ou parcerias&lt;/b&gt;&#xD;
20
+ &#xD;
21
+ Caso tenha d&#xFA;vidas, estamos &#xE0; disposi&#xE7;&#xE3;o para atend&#xEA;-lo no que for preciso: &lt;a href="http://www.anymarket.com.br/"&gt;http://www.anymarket.com.br/&lt;/a&gt;ou em nosso &lt;a href="http://marketplace.anymarket.com.br/"&gt;blog&lt;/a&gt;.&#xD;
22
+ &#xD;
23
+ &lt;b&gt;Desenvolvedores&lt;/b&gt;&#xD;
24
+ &#xD;
25
+ Caso precise de informa&#xE7;&#xF5;es sobre a API AnyMarket voc&#xEA; encontra clicando em: &amp;lt;a href=&amp;quot;http://developers.anymarket.com.br/&amp;quot;&amp;gt; http://developers.anymarket.com.br/&amp;lt;a&amp;gt;</description>
26
+ <notes>Anymarket product and order Integration.</notes>
27
+ <authors><author><name>AnyMarket</name><user>MAG003172479</user><email>dev@anymarket.com.br</email></author></authors>
28
+ <date>2016-01-18</date>
29
+ <time>17:10:41</time>
30
+ <contents><target name="magecommunity"><dir><dir name="DB1"><dir name="AnyMarket"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Anymarketattributes"><dir name="Edit"><file name="Form.php" hash="9becebdd0584998e91b2216ff59089bc"/><dir name="Tab"><file name="Form.php" hash="3a6d5cfecbb0ff8ad87fb56d06514362"/><file name="Stores.php" hash="c0cbf3b95ee5650946fdbde2a05ded9c"/></dir><file name="Tabs.php" hash="a9ba9f40f0b76ea6b3574253afb7aa80"/></dir><file name="Edit.php" hash="c6599dbb52fe7381428fdbb29a5910b6"/><file name="Grid.php" hash="63577a12b57f1ba5895322601d3d2114"/></dir><file name="Anymarketattributes.php" hash="4e8b72f9adbd87a12063b3afe9641d99"/><dir name="Anymarketcategories"><dir name="Edit"><file name="Form.php" hash="cfdb25b59e4ac8194e4c3d30b5d4a37b"/><dir name="Tab"><file name="Form.php" hash="c71f9436c1429624d138b47d8366ea7b"/><file name="Stores.php" hash="f97847fe6a2b00f1e143c3ea63aeef57"/></dir><file name="Tabs.php" hash="3d2c5ac74c587c772a81f3ba25305998"/></dir><file name="Edit.php" hash="2902fea7dcd6ccfaae533744905eba5c"/><file name="Grid.php" hash="b889b967c26420b990c23b5f8dc98e94"/></dir><file name="Anymarketcategories.php" hash="8c8c3dd93cf90f2698e14fde5c8571fc"/><dir name="Anymarketlog"><dir name="Edit"><file name="Form.php" hash="80cb60cafd466beb3b0867dd79426980"/><dir name="Tab"><file name="Form.php" hash="ce85bdab7b177cafc2d817c8f8f60104"/><file name="Stores.php" hash="f163936ef2dfb5f5e9d46a7de96b5213"/></dir><file name="Tabs.php" hash="84b751b60d1728f5d63da4fb220ba8bd"/></dir><file name="Edit.php" hash="543a05a273295b00e1d94d1c0c5e39a7"/><file name="Grid.php" hash="56df24879e39b1aad098045e008df1ad"/></dir><file name="Anymarketlog.php" hash="cc318d0be858674bf3607465e0e3845e"/><dir name="Anymarketorders"><dir name="Edit"><file name="Form.php" hash="7fc92f95bc0f2d638cd366db87428d08"/><dir name="Tab"><file name="Form.php" hash="4277da04ef0fcaf27f267e6b6524462a"/><file name="Stores.php" hash="622ec40bcd7c1a404ca6487d6bb06ab7"/></dir><file name="Tabs.php" hash="5d63bb89b30f6d47c15745712b4494a3"/></dir><file name="Edit.php" hash="123cb7fcb42f23774ffc0c16cec6a0f3"/><file name="Grid.php" hash="3a86863ef132c4c716911a05d24533ba"/></dir><file name="Anymarketorders.php" hash="2f1beb3cf15ab8c17e3b89e639ebec8b"/><dir name="Anymarketproducts"><dir name="Edit"><file name="Form.php" hash="62017e69687be10c1279593ea992ad8e"/><dir name="Tab"><file name="Form.php" hash="821ba2c9e353c670bb8587747259ef9a"/><file name="Stores.php" hash="09def6cbe69736b4ca3b6191b713ed4b"/></dir><file name="Tabs.php" hash="19ef66317304378556830f57c4d2c3dc"/></dir><file name="Edit.php" hash="6cbf1a84bafd587819f1fdd71fe28541"/><file name="Grid.php" hash="18c0cc5eb1fd1367b111b2b17921d2b4"/></dir><file name="Anymarketproducts.php" hash="42741da5a89b33975fe14d51849f2329"/><dir name="Anymarketqueue"><dir name="Edit"><file name="Form.php" hash="c468829fed3911c7c81c3159b7a47536"/><dir name="Tab"><file name="Form.php" hash="4545d7ce2d85894a079cf5f9ca17ffff"/><file name="Stores.php" hash="81cd6ca99b7d84d5a7cb3291a8600b07"/></dir><file name="Tabs.php" hash="c35d9b10a93b76593c21711f67ba37a9"/></dir><file name="Edit.php" hash="f33cda71713878d47c1c0965bc2cfedc"/><file name="Grid.php" hash="52787a2362c68ff69189f09e8ed92165"/></dir><file name="Anymarketqueue.php" hash="d8cb7fa5e7d09aa8825b089676c59931"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Orders"><dir name="Statusammg"><file name="Values.php" hash="1131ec74ea6943d6567d98d728776a58"/></dir><dir name="Statusmgam"><file name="Values.php" hash="4164aa7f9436c6c0db83ebca1fd6afee"/></dir></dir><dir name="Products"><file name="Values.php" hash="d78d81a0bdda43f87e3f7b41dfb1f7d0"/></dir></dir></dir></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="AnyMarket.php" hash="79340a0ee849bca7c2026b3cdc9b4a6f"/></dir></dir><dir name="Helper"><file name="Category.php" hash="fc69ffc7923ae1f213e1736f7f6c20ac"/><file name="Customergenerator.php" hash="0a8673da23961efec177e718683492ec"/><file name="Data.php" hash="6d73869bcec76f2ea950f9c9c7b50f03"/><file name="Order.php" hash="4fe1aa53331050e7f03c414c0871eaaa"/><file name="Ordergenerator.php" hash="efaede69bc836807d83d5e52685364c9"/><file name="Product.php" hash="cd01242a89f441db5a2de826a4bb93d5"/><file name="Productgenerator.php" hash="e86a7b8051e0e29fbece32ac0dadc4f1"/><file name="Queue.php" hash="97ff8df51a6bce9128978dd6743d5b00"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Search"><file name="Anymarketattributes.php" hash="f84911d046264efff9c78ec4d19614ae"/><file name="Anymarketlog.php" hash="f86d713094fe2f01c9682529410961b2"/><file name="Anymarketorders.php" hash="65830d184e5e5ed07627ba732e4f9117"/><file name="Anymarketproducts.php" hash="96cb096a27e2226e7c180534fc24c009"/><file name="Anymarketqueue.php" hash="49f9df6c71da386a90ac88a154f08549"/></dir></dir><dir name="Anymarketattributes"><dir name="Api"><file name="V2.php" hash="eeb9cdecc973af417e631347be23776b"/></dir><file name="Api.php" hash="5fbe170bbc5e2ad92bdede1c29bbf071"/></dir><file name="Anymarketattributes.php" hash="1211605dc83ff3f74bb78bc322163845"/><dir name="Anymarketcategories"><dir name="Api"><file name="V2.php" hash="2d3f0306b26a566c4c48457aa48a9801"/></dir><file name="Api.php" hash="195139dbec9404c0bf939494af845cd5"/></dir><file name="Anymarketcategories.php" hash="f97c5e1e329b45e53450ad6be6515950"/><dir name="Anymarketlog"><dir name="Api"><file name="V2.php" hash="8aa058db0d2717a9f3534edd1f3b42da"/></dir><file name="Api.php" hash="509273383f57fa9c98e9e5bba1679c5e"/></dir><file name="Anymarketlog.php" hash="475d7bd53d4c2c7fe194b671207b28f5"/><dir name="Anymarketorders"><dir name="Api"><file name="V2.php" hash="e2c39a6ca4d3364d40b4c61647feb661"/></dir><file name="Api.php" hash="c9e8b6450f31e757726fabbabe6370f7"/></dir><file name="Anymarketorders.php" hash="7abc1cf8cb44f7979a9a1f7be7d4e7ed"/><dir name="Anymarketproducts"><dir name="Api"><file name="V2.php" hash="a4ae88bbf3cdd7fa1c9faac96bf4886c"/></dir><file name="Api.php" hash="909722e694b83a0b4bb734e688a7d05b"/></dir><file name="Anymarketproducts.php" hash="464e8c107cc392a41de1791acc269eaf"/><dir name="Anymarketqueue"><dir name="Api"><file name="V2.php" hash="649d0998dd5d3088675ee7dfe9ec443b"/></dir><file name="Api.php" hash="0bc87b172c41b41d8f91ddba19f33b3a"/></dir><file name="Anymarketqueue.php" hash="064e3986267ece133fdc576289ffd8f9"/><file name="Cron.php" hash="9917899c5c034e4c287230c0628b2796"/><file name="Observer.php" hash="a1601b46d9343350b98b80d4393e50e1"/><file name="PaymentMethod.php" hash="9973890ff5a28f1761a124444cf0a44e"/><dir name="Resource"><dir name="Anymarketattributes"><file name="Collection.php" hash="9c563aab2b06c631ed090db3e232f087"/></dir><file name="Anymarketattributes.php" hash="5c3ed21de0ad859f23a8d05267f4fa6e"/><dir name="Anymarketcategories"><file name="Collection.php" hash="0530beb1d8a2739f93b0cec7efcfd78b"/></dir><file name="Anymarketcategories.php" hash="b2d43389e222e7c3c4ab038bedc46c9c"/><dir name="Anymarketlog"><file name="Collection.php" hash="0fcf88dd7f861504a40262e9f2b419e2"/></dir><file name="Anymarketlog.php" hash="0c1acb496d261e089b6dd2fb45211649"/><dir name="Anymarketorders"><file name="Collection.php" hash="801aa72c861fef0607f80b4c104fda51"/></dir><file name="Anymarketorders.php" hash="b45608ac53a931087d4ec324a0cafaaa"/><dir name="Anymarketproducts"><file name="Collection.php" hash="186540287711e9d04fe6b189560eea67"/></dir><file name="Anymarketproducts.php" hash="ce461f36aa6a73345242672c88015ee3"/><dir name="Anymarketqueue"><file name="Collection.php" hash="198f77ea2aff27fb92deed538b7a3b3c"/></dir><file name="Anymarketqueue.php" hash="d8ec537f96d152c93f4c63d1b0961513"/><file name="Setup.php" hash="7e6409ef3e5dc6306947b3ddbf4758c0"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Attributes"><dir name="Customer"><dir name="Group"><file name="Values.php" hash="588a5eee4bcf22faef6392e996af61a7"/></dir><file name="Values.php" hash="270caa808d71d2f8b71da44d3f6e8997"/></dir><dir name="Product"><file name="Values.php" hash="296e89a5beaafbe76574986aaf5fd43a"/></dir></dir><dir name="Categories"><file name="Values.php" hash="e21c3d0e201f09f3e04ba1cf3c3588bd"/></dir><dir name="Massunit"><file name="Values.php" hash="addb07bc1f715c458d843582190473d6"/></dir><dir name="Orders"><file name="Values.php" hash="2e13c3c46ca7f64c49ede47cc1c84291"/></dir><dir name="Typesync"><dir name="Order"><file name="Values.php" hash="74180c795b834cf020ef46d090a773d0"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Anymarket"><file name="AnymarketattributesController.php" hash="38f03073a6f8efba29573705c45f06bf"/><file name="AnymarketcategoriesController.php" hash="0c47a0385864bc1694dc63704f9b20f6"/><file name="AnymarketlogController.php" hash="ee93808e3c083e79f6c2190108876fbf"/><file name="AnymarketordersController.php" hash="25224dc28ebee7cbd66ecda258a450df"/><file name="AnymarketproductsController.php" hash="ac1b40b166d3693b133d4dddc25e39bc"/><file name="AnymarketqueueController.php" hash="abeae65de75f530a643e5a74117310b4"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="182eb648cf3b7673e697e8b781333fec"/><file name="api.xml" hash="5798f67b33efe49c3159890f575ac3d4"/><file name="config.xml" hash="c5222281a8dfb63b865e45c3b2182551"/><file name="system.xml" hash="e68edeb113c1a4014bf8d427d67e8a68"/><file name="wsdl.xml" hash="fc6d109949880adc13e03e6f2d1ec293"/><file name="wsi.xml" hash="6a9f3266672f9190dd8647011d230cae"/></dir><dir name="sql"><dir name="db1_anymarket_setup"><file name="mysql4-install-1.0.0.php" hash="415e3328937938c4a0f77b1669ba9860"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="768765ceef84e65c79348b9c2732ae61"/><file name="mysql4-upgrade-1.1.0-1.2.0 .php" hash="38bf6aade6934ae6ca9ee8c59dc77ed9"/><file name="mysql4-upgrade-1.2.0-1.3.0.php" hash="a6dc9dc55b06e82220a90bf570d688fb"/><file name="mysql4-upgrade-1.3.0-1.4.0.php" hash="47897a25154a7b4aa4b7b2bbe58e215a"/><file name="mysql4-upgrade-1.4.0-1.5.0.php" hash="0dabf4305d20b22ecdfb8fa3988df863"/><file name="mysql4-upgrade-1.5.0-1.6.0.php" hash="d25c633298a94f0dc5b6ebfaf092580e"/><file name="mysql4-upgrade-1.6.0-1.7.0.php" hash="a06848075d6076fe07fba37a9aea7d32"/><file name="mysql4-upgrade-1.7.0-1.8.0.php" hash="a3d2d824b76156fc01fca1a153bf8a65"/><file name="mysql4-upgrade-1.8.0-2.0.0.php" hash="ce407ff5715c837d02b1aba7975bf512"/><file name="mysql4-upgrade-2.0.0-2.1.0.php" hash="0e419a3ae137ba26db49603fe1e787ca"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="db1"><dir><dir name="anymarket"><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_dropdown.phtml" hash="b060a697b75aa898fd932d4d92772b1c"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="db1_anymarket.xml" hash="a15649482f0e0df4d2f64e90c9aa6a72"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="DB1_AnyMarket.xml" hash="dc3f608b7ad2897402badc5a0b6dd5d2"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="DB1_AnyMarket.csv" hash="7c2a638eb9cc488830f0fe76aba3b041"/></dir><dir name="pt_BR"><file name="DB1_AnyMarket.csv" hash="88c941c28cc311fd48a0cdc4f33c2dc9"/></dir></dir></target></contents>
31
+ <compatible/>
32
+ <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
33
+ </package>